- Timestamp:
- 2008-07-16T23:22:52Z (17 years ago)
- Branches:
- master
- Children:
- 9b55485
- Parents:
- 9730d72 (diff), 6a78c0e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- protocols
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/Makefile
r9730d72 r6738a67 10 10 11 11 # [SH] Program variables 12 objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o sasl.o xmltree.o12 objects = conference.o io.o iq.o jabber.o jabber_util.o message.o presence.o sasl.o 13 13 14 14 CFLAGS += -Wall -
protocols/jabber/io.c
r9730d72 r6738a67 241 241 } 242 242 243 /* EAGAIN/etc or a successful read. */ 244 return TRUE; 243 if( ssl_pending( jd->ssl ) ) 244 /* OpenSSL empties the TCP buffers completely but may keep some 245 data in its internap buffers. select() won't see that, but 246 ssl_pending() does. */ 247 return jabber_read_callback( data, fd, cond ); 248 else 249 return TRUE; 245 250 } 246 251 … … 521 526 from the server too. */ 522 527 xt_free( jd->xt ); /* In case we're RE-starting. */ 523 jd->xt = xt_new( ic ); 524 jd->xt->handlers = (struct xt_handler_entry*) jabber_handlers; 528 jd->xt = xt_new( jabber_handlers, ic ); 525 529 526 530 if( jd->r_inpa <= 0 ) -
protocols/jabber/jabber.c
r9730d72 r6738a67 33 33 #include "jabber.h" 34 34 #include "md5.h" 35 #include "base64.h"36 35 37 36 GSList *jabber_connections; 38 37 38 /* First enty is the default */ 39 static const int jabber_port_list[] = { 40 5222, 41 5223, 42 5220, 43 5221, 44 5224, 45 5225, 46 5226, 47 5227, 48 5228, 49 5229, 50 80, 51 443, 52 0 53 }; 54 39 55 static void jabber_init( account_t *acc ) 40 56 { 41 57 set_t *s; 42 43 s = set_add( &acc->set, "port", JABBER_PORT_DEFAULT, set_eval_int, acc ); 58 char str[16]; 59 60 g_snprintf( str, sizeof( str ), "%d", jabber_port_list[0] ); 61 s = set_add( &acc->set, "port", str, set_eval_int, acc ); 44 62 s->flags |= ACC_SET_OFFLINE_ONLY; 45 63 … … 72 90 struct ns_srv_reply *srv = NULL; 73 91 char *connect_to, *s; 92 int i; 74 93 75 94 /* For now this is needed in the _connected() handlers if using … … 177 196 imcb_log( ic, "Connecting" ); 178 197 179 if( set_getint( &acc->set, "port" ) < JABBER_PORT_MIN || 180 set_getint( &acc->set, "port" ) > JABBER_PORT_MAX ) 181 { 182 imcb_log( ic, "Incorrect port number, must be in the %d-%d range", 183 JABBER_PORT_MIN, JABBER_PORT_MAX ); 198 for( i = 0; jabber_port_list[i] > 0; i ++ ) 199 if( set_getint( &acc->set, "port" ) == jabber_port_list[i] ) 200 break; 201 202 if( jabber_port_list[i] == 0 ) 203 { 204 imcb_log( ic, "Illegal port number" ); 184 205 imc_logout( ic, FALSE ); 185 206 return; … … 219 240 } 220 241 242 /* This generates an unfinished md5_state_t variable. Every time we generate 243 an ID, we finish the state by adding a sequence number and take the hash. */ 221 244 static void jabber_generate_id_hash( struct jabber_data *jd ) 222 245 { 223 md5_state_t id_hash; 224 md5_byte_t binbuf[16]; 246 md5_byte_t binbuf[4]; 225 247 char *s; 226 248 227 md5_init( & id_hash);228 md5_append( & id_hash, (unsigned char *) jd->username, strlen( jd->username ) );229 md5_append( & id_hash, (unsigned char *) jd->server, strlen( jd->server ) );249 md5_init( &jd->cached_id_prefix ); 250 md5_append( &jd->cached_id_prefix, (unsigned char *) jd->username, strlen( jd->username ) ); 251 md5_append( &jd->cached_id_prefix, (unsigned char *) jd->server, strlen( jd->server ) ); 230 252 s = set_getstr( &jd->ic->acc->set, "resource" ); 231 md5_append( &id_hash, (unsigned char *) s, strlen( s ) ); 232 random_bytes( binbuf, 16 ); 233 md5_append( &id_hash, binbuf, 16 ); 234 md5_finish( &id_hash, binbuf ); 235 236 s = base64_encode( binbuf, 9 ); 237 jd->cached_id_prefix = g_strdup_printf( "%s%s", JABBER_CACHED_ID, s ); 238 g_free( s ); 253 md5_append( &jd->cached_id_prefix, (unsigned char *) s, strlen( s ) ); 254 random_bytes( binbuf, 4 ); 255 md5_append( &jd->cached_id_prefix, binbuf, 4 ); 239 256 } 240 257 -
protocols/jabber/jabber.h
r9730d72 r6738a67 86 86 char *away_message; 87 87 88 char *cached_id_prefix;88 md5_state_t cached_id_prefix; 89 89 GHashTable *node_cache; 90 90 GHashTable *buddies; … … 134 134 135 135 #define JABBER_XMLCONSOLE_HANDLE "xmlconsole" 136 137 #define JABBER_PORT_DEFAULT "5222"138 #define JABBER_PORT_MIN 5220139 #define JABBER_PORT_MAX 5229140 136 141 137 /* Prefixes to use for packet IDs (mainly for IQ packets ATM). Usually the -
protocols/jabber/jabber_util.c
r9730d72 r6738a67 23 23 24 24 #include "jabber.h" 25 #include "md5.h" 26 #include "base64.h" 25 27 26 28 static unsigned int next_id = 1; … … 134 136 struct jabber_data *jd = ic->proto_data; 135 137 struct jabber_cache_entry *entry = g_new0( struct jabber_cache_entry, 1 ); 136 char *id; 137 138 id = g_strdup_printf( "%s%05x", jd->cached_id_prefix, ( next_id++ ) & 0xfffff ); 138 md5_state_t id_hash; 139 md5_byte_t id_sum[16]; 140 char *id, *asc_hash; 141 142 next_id ++; 143 144 id_hash = jd->cached_id_prefix; 145 md5_append( &id_hash, (md5_byte_t*) &next_id, sizeof( next_id ) ); 146 md5_finish( &id_hash, id_sum ); 147 asc_hash = base64_encode( id_sum, 12 ); 148 149 id = g_strdup_printf( "%s%s", JABBER_CACHED_ID, asc_hash ); 139 150 xt_add_attr( node, "id", id ); 140 151 g_free( id ); 152 g_free( asc_hash ); 141 153 142 154 entry->node = node; … … 184 196 185 197 if( ( s = xt_find_attr( node, "id" ) ) == NULL || 186 strncmp( s, jd->cached_id_prefix, strlen( jd->cached_id_prefix) ) != 0 )198 strncmp( s, JABBER_CACHED_ID, strlen( JABBER_CACHED_ID ) ) != 0 ) 187 199 { 188 200 /* Silently ignore it, without an ID (or a non-cache … … 196 208 if( entry == NULL ) 197 209 { 210 /* 211 There's no longer an easy way to see if we generated this 212 one or someone else, and there's a ten-minute timeout anyway, 213 so meh. 214 198 215 imcb_log( ic, "Warning: Received %s-%s packet with unknown/expired ID %s!", 199 216 node->name, xt_find_attr( node, "type" ) ? : "(no type)", s ); 217 */ 200 218 } 201 219 else if( entry->func ) … … 246 264 }; 247 265 248 static void jabber_buddy_ask_yes( gpointer w, struct jabber_buddy_ask_data *bla ) 249 { 266 static void jabber_buddy_ask_yes( void *data ) 267 { 268 struct jabber_buddy_ask_data *bla = data; 269 250 270 presence_send_request( bla->ic, bla->handle, "subscribed" ); 251 271 … … 257 277 } 258 278 259 static void jabber_buddy_ask_no( gpointer w, struct jabber_buddy_ask_data *bla ) 260 { 279 static void jabber_buddy_ask_no( void *data ) 280 { 281 struct jabber_buddy_ask_data *bla = data; 282 261 283 presence_send_request( bla->ic, bla->handle, "subscribed" ); 262 284 … … 286 308 len = strlen( orig ); 287 309 new = g_new( char, len + 1 ); 288 for( i = 0; i < len; i ++ ) 310 311 /* So it turns out the /resource part is case sensitive. Yeah, and 312 it's Unicode but feck Unicode. :-P So stop once we see a slash. */ 313 for( i = 0; i < len && orig[i] != '/' ; i ++ ) 289 314 new[i] = tolower( orig[i] ); 315 for( ; orig[i]; i ++ ) 316 new[i] = orig[i]; 290 317 291 318 new[i] = 0; … … 330 357 { 331 358 /* Check for dupes. */ 332 if( g_strcasecmp( bi->resource, s + 1 ) == 0 )359 if( strcmp( bi->resource, s + 1 ) == 0 ) 333 360 { 334 361 *s = '/'; … … 383 410 if( ( s = strchr( jid, '/' ) ) ) 384 411 { 385 int none_found= 0;412 int bare_exists = 0; 386 413 387 414 *s = 0; … … 406 433 /* See if there's an exact match. */ 407 434 for( ; bud; bud = bud->next ) 408 if( g_strcasecmp( bud->resource, s + 1 ) == 0 )435 if( strcmp( bud->resource, s + 1 ) == 0 ) 409 436 break; 410 437 } 411 438 else 412 439 { 413 /* This hack is there to make sure that O_CREAT will 414 work if there's already another resouce present 415 for this JID, even if it's an unknown buddy. This 416 is done to handle conferences properly. */ 417 none_found = 1; 418 /* TODO(wilmer): Find out what I was thinking when I 419 wrote this??? And then fix it. This makes me sad... */ 420 } 421 422 if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && ( imcb_find_buddy( ic, jid ) || !none_found ) ) 440 /* This variable tells the if down here that the bare 441 JID already exists and we should feel free to add 442 more resources, if the caller asked for that. */ 443 bare_exists = 1; 444 } 445 446 if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && 447 ( !bare_exists || imcb_find_buddy( ic, jid ) ) ) 423 448 { 424 449 *s = '/'; … … 445 470 /* We want an exact match, so in thise case there shouldn't be a /resource. */ 446 471 return NULL; 447 else if( ( bud->resource == NULL || bud->next == NULL ))472 else if( bud->resource == NULL || bud->next == NULL ) 448 473 /* No need for selection if there's only one option. */ 449 474 return bud; … … 521 546 matches), removing it is simple. (And the hash reference 522 547 should be removed too!) */ 523 if( bud->next == NULL && ( ( s == NULL || bud->resource == NULL ) || g_strcasecmp( bud->resource, s + 1 ) == 0 ) ) 548 if( bud->next == NULL && 549 ( ( s == NULL && bud->resource == NULL ) || 550 ( bud->resource && s && strcmp( bud->resource, s + 1 ) == 0 ) ) ) 524 551 { 525 552 g_hash_table_remove( jd->buddies, bud->bare_jid ); … … 544 571 { 545 572 for( bi = bud, prev = NULL; bi; bi = (prev=bi)->next ) 546 if( g_strcasecmp( bi->resource, s + 1 ) == 0 )573 if( strcmp( bi->resource, s + 1 ) == 0 ) 547 574 break; 548 575 -
protocols/jabber/message.c
r9730d72 r6738a67 49 49 { 50 50 GString *fullmsg = g_string_new( "" ); 51 52 for( c = node->children; ( c = xt_find_node( c, "x" ) ); c = c->next ) 53 { 54 char *ns = xt_find_attr( c, "xmlns" ), *room; 55 struct xt_node *inv, *reason; 56 57 if( strcmp( ns, XMLNS_MUC_USER ) == 0 && 58 ( inv = xt_find_node( c->children, "invite" ) ) ) 59 { 60 room = from; 61 from = xt_find_attr( inv, "from" ) ? : from; 62 63 g_string_append_printf( fullmsg, "<< \002BitlBee\002 - Invitation to chatroom %s >>\n", room ); 64 if( ( reason = xt_find_node( inv->children, "reason" ) ) && reason->text_len > 0 ) 65 g_string_append( fullmsg, reason->text ); 66 } 67 } 51 68 52 69 if( ( s = strchr( from, '/' ) ) ) -
protocols/msn/msn.h
r9730d72 r6738a67 29 29 #define GROUPCHAT_SWITCHBOARD_MESSAGE "\r\r\rME WANT TALK TO MANY PEOPLE\r\r\r" 30 30 31 #ifdef DEBUG 31 #ifdef DEBUG_MSN 32 32 #define debug( text... ) imcb_log( ic, text ); 33 33 #else -
protocols/msn/msn_util.c
r9730d72 r6738a67 90 90 }; 91 91 92 static void msn_buddy_ask_yes( gpointer w, struct msn_buddy_ask_data *bla ) 93 { 92 static void msn_buddy_ask_yes( void *data ) 93 { 94 struct msn_buddy_ask_data *bla = data; 95 94 96 msn_buddy_list_add( bla->ic, "AL", bla->handle, bla->realname ); 95 97 … … 102 104 } 103 105 104 static void msn_buddy_ask_no( gpointer w, struct msn_buddy_ask_data *bla ) 105 { 106 static void msn_buddy_ask_no( void *data ) 107 { 108 struct msn_buddy_ask_data *bla = data; 109 106 110 msn_buddy_list_add( bla->ic, "BL", bla->handle, bla->realname ); 107 111 -
protocols/msn/ns.c
r9730d72 r6738a67 34 34 static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts ); 35 35 36 static void msn_auth_got_passport_ id( struct passport_reply *rep);36 static void msn_auth_got_passport_token( struct msn_auth_data *mad ); 37 37 38 38 gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond ) … … 178 178 179 179 debug( "Connecting to a new switchboard with key %s", cmd[5] ); 180 sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW ); 180 181 if( ( sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW ) ) == NULL ) 182 { 183 /* Although this isn't strictly fatal for the NS connection, it's 184 definitely something serious (we ran out of file descriptors?). */ 185 imcb_error( ic, "Could not create new switchboard" ); 186 imc_logout( ic, TRUE ); 187 return( 0 ); 188 } 181 189 182 190 if( md->msgq ) … … 214 222 { 215 223 /* Time for some Passport black magic... */ 216 if( !passport_get_ id( msn_auth_got_passport_id, ic, ic->acc->user, ic->acc->pass, cmd[4] ) )224 if( !passport_get_token( msn_auth_got_passport_token, ic, ic->acc->user, ic->acc->pass, cmd[4] ) ) 217 225 { 218 226 imcb_error( ic, "Error while contacting Passport server" ); … … 270 278 if( num_parts == 5 ) 271 279 { 280 int i, groupcount; 281 282 groupcount = atoi( cmd[4] ); 283 if( groupcount > 0 ) 284 { 285 /* valgrind says this is leaking memory, I'm guessing 286 that this happens during server redirects. */ 287 if( md->grouplist ) 288 { 289 for( i = 0; i < md->groupcount; i ++ ) 290 g_free( md->grouplist[i] ); 291 g_free( md->grouplist ); 292 } 293 294 md->groupcount = groupcount; 295 md->grouplist = g_new0( char *, md->groupcount ); 296 } 297 272 298 md->buddycount = atoi( cmd[3] ); 273 md->groupcount = atoi( cmd[4] );274 if( md->groupcount > 0 )275 md->grouplist = g_new0( char *, md->groupcount );276 277 299 if( !*cmd[3] || md->buddycount == 0 ) 278 300 msn_logged_in( ic ); … … 468 490 debug( "Got a call from %s (session %d). Key = %s", cmd[5], session, cmd[4] ); 469 491 470 sb = msn_sb_create( ic, server, port, cmd[4], session ); 471 sb->who = g_strdup( cmd[5] ); 492 if( ( sb = msn_sb_create( ic, server, port, cmd[4], session ) ) == NULL ) 493 { 494 /* Although this isn't strictly fatal for the NS connection, it's 495 definitely something serious (we ran out of file descriptors?). */ 496 imcb_error( ic, "Could not create new switchboard" ); 497 imc_logout( ic, TRUE ); 498 return( 0 ); 499 } 500 else 501 { 502 sb->who = g_strdup( cmd[5] ); 503 } 472 504 } 473 505 else if( strcmp( cmd[0], "ADD" ) == 0 ) … … 647 679 imcb_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders ); 648 680 } 681 682 g_free( inbox ); 683 g_free( folders ); 649 684 } 650 685 else if( g_strncasecmp( ct, "text/x-msmsgsemailnotification", 30 ) == 0 ) … … 674 709 } 675 710 676 static void msn_auth_got_passport_ id( struct passport_reply *rep)711 static void msn_auth_got_passport_token( struct msn_auth_data *mad ) 677 712 { 678 struct im_connection *ic = rep->data; 679 struct msn_data *md = ic->proto_data; 680 char *key = rep->result; 681 char buf[1024]; 682 683 if( key == NULL ) 684 { 685 imcb_error( ic, "Error during Passport authentication (%s)", 686 rep->error_string ? rep->error_string : "Unknown error" ); 713 struct im_connection *ic = mad->data; 714 struct msn_data *md; 715 716 /* Dead connection? */ 717 if( g_slist_find( msn_connections, ic ) == NULL ) 718 return; 719 720 md = ic->proto_data; 721 if( mad->token ) 722 { 723 char buf[1024]; 724 725 g_snprintf( buf, sizeof( buf ), "USR %d TWN S %s\r\n", ++md->trId, mad->token ); 726 msn_write( ic, buf, strlen( buf ) ); 727 } 728 else 729 { 730 imcb_error( ic, "Error during Passport authentication: %s", mad->error ); 687 731 imc_logout( ic, TRUE ); 688 732 } 689 else690 {691 g_snprintf( buf, sizeof( buf ), "USR %d TWN S %s\r\n", ++md->trId, key );692 msn_write( ic, buf, strlen( buf ) );693 }694 733 } -
protocols/msn/passport.c
r9730d72 r6738a67 1 /* passport.c1 /** passport.c 2 2 * 3 * Functions to login to microsoft passport service for Messenger 4 * Copyright (C) 2004 Wouter Paesen <wouter@blue-gate.be> 5 * Copyright (C) 2004 Wilmer van der Gaast <wilmer@gaast.net> 3 * Functions to login to Microsoft Passport service for Messenger 4 * Copyright (C) 2004-2008 Wilmer van der Gaast <wilmer@gaast.net> 6 5 * 7 6 * This program is free software; you can redistribute it and/or modify … … 24 23 #include "msn.h" 25 24 #include "bitlbee.h" 25 #include "url.h" 26 #include "misc.h" 27 #include "xmltree.h" 26 28 #include <ctype.h> 27 29 #include <errno.h> 28 30 29 #define MSN_BUF_LEN 8192 31 static int passport_get_token_real( struct msn_auth_data *mad ); 32 static void passport_get_token_ready( struct http_request *req ); 30 33 31 static char *prd_cached = NULL; 32 33 static int passport_get_id_real( gpointer func, gpointer data, char *header ); 34 static void passport_get_id_ready( struct http_request *req ); 35 36 static int passport_retrieve_dalogin( gpointer data, gpointer func, char *header ); 37 static void passport_retrieve_dalogin_ready( struct http_request *req ); 38 39 static char *passport_create_header( char *cookie, char *email, char *pwd ); 40 static void destroy_reply( struct passport_reply *rep ); 41 42 int passport_get_id( gpointer func, gpointer data, char *username, char *password, char *cookie ) 34 int passport_get_token( gpointer func, gpointer data, char *username, char *password, char *cookie ) 43 35 { 44 char *header = passport_create_header( cookie, username, password ); 36 struct msn_auth_data *mad = g_new0( struct msn_auth_data, 1 ); 37 int i; 45 38 46 if( prd_cached == NULL ) 47 return passport_retrieve_dalogin( func, data, header ); 48 else 49 return passport_get_id_real( func, data, header ); 39 mad->username = g_strdup( username ); 40 mad->password = g_strdup( password ); 41 mad->cookie = g_strdup( cookie ); 42 43 mad->callback = func; 44 mad->data = data; 45 46 mad->url = g_strdup( SOAP_AUTHENTICATION_URL ); 47 mad->ttl = 3; /* Max. # of redirects. */ 48 49 /* HTTP-escape stuff and s/,/&/ */ 50 http_decode( mad->cookie ); 51 for( i = 0; mad->cookie[i]; i ++ ) 52 if( mad->cookie[i] == ',' ) 53 mad->cookie[i] = '&'; 54 55 /* Microsoft doesn't allow password longer than 16 chars and silently 56 fails authentication if you give the "full version" of your passwd. */ 57 if( strlen( mad->password ) > MAX_PASSPORT_PWLEN ) 58 mad->password[MAX_PASSPORT_PWLEN] = 0; 59 60 return passport_get_token_real( mad ); 50 61 } 51 62 52 static int passport_get_ id_real( gpointer func, gpointer data, char *header)63 static int passport_get_token_real( struct msn_auth_data *mad ) 53 64 { 54 struct passport_reply *rep; 55 char *server, *dummy, *reqs; 65 char *post_payload, *post_request; 56 66 struct http_request *req; 67 url_t url; 57 68 58 rep = g_new0( struct passport_reply, 1 ); 59 rep->data = data; 60 rep->func = func; 61 rep->header = header; 69 url_set( &url, mad->url ); 62 70 63 server = g_strdup( prd_cached ); 64 dummy = strchr( server, '/' ); 71 post_payload = g_markup_printf_escaped( SOAP_AUTHENTICATION_PAYLOAD, 72 mad->username, 73 mad->password, 74 mad->cookie ); 65 75 66 if( dummy == NULL ) 67 { 68 destroy_reply( rep ); 69 return( 0 ); 70 } 76 post_request = g_strdup_printf( SOAP_AUTHENTICATION_REQUEST, 77 url.file, url.host, 78 (int) strlen( post_payload ), 79 post_payload ); 80 81 req = http_dorequest( url.host, url.port, 1, post_request, 82 passport_get_token_ready, mad ); 71 83 72 reqs = g_strdup_printf( "GET %s HTTP/1.0\r\n%s\r\n\r\n", dummy, header ); 84 g_free( post_request ); 85 g_free( post_payload ); 73 86 74 *dummy = 0; 75 req = http_dorequest( server, 443, 1, reqs, passport_get_id_ready, rep ); 76 77 g_free( server ); 78 g_free( reqs ); 79 80 if( req == NULL ) 81 destroy_reply( rep ); 82 83 return( req != NULL ); 87 return req != NULL; 84 88 } 85 89 86 static void passport_get_id_ready( struct http_request *req ) 90 static xt_status passport_xt_extract_token( struct xt_node *node, gpointer data ); 91 static xt_status passport_xt_handle_fault( struct xt_node *node, gpointer data ); 92 93 static const struct xt_handler_entry passport_xt_handlers[] = { 94 { "wsse:BinarySecurityToken", "wst:RequestedSecurityToken", passport_xt_extract_token }, 95 { "S:Fault", "S:Envelope", passport_xt_handle_fault }, 96 { NULL, NULL, NULL } 97 }; 98 99 static void passport_get_token_ready( struct http_request *req ) 87 100 { 88 struct passport_reply *rep = req->data; 101 struct msn_auth_data *mad = req->data; 102 struct xt_parser *parser; 89 103 90 if( !g_slist_find( msn_connections, rep->data ) ) 104 g_free( mad->url ); 105 g_free( mad->error ); 106 mad->url = mad->error = NULL; 107 108 if( req->status_code == 200 ) 91 109 { 92 destroy_reply( rep ); 93 return; 94 } 95 96 if( req->finished && req->reply_headers && req->status_code == 200 ) 97 { 98 char *dummy; 99 100 if( ( dummy = strstr( req->reply_headers, "from-PP='" ) ) ) 101 { 102 char *responseend; 103 104 dummy += strlen( "from-PP='" ); 105 responseend = strchr( dummy, '\'' ); 106 if( responseend ) 107 *responseend = 0; 108 109 rep->result = g_strdup( dummy ); 110 } 111 else 112 { 113 rep->error_string = g_strdup( "Could not parse Passport server response" ); 114 } 110 parser = xt_new( passport_xt_handlers, mad ); 111 xt_feed( parser, req->reply_body, req->body_size ); 112 xt_handle( parser, NULL, -1 ); 113 xt_free( parser ); 115 114 } 116 115 else 117 116 { 118 rep->error_string = g_strdup_printf( "HTTP error: %s",119 req->status_string ? req->status_string : "Unknown error" );117 mad->error = g_strdup_printf( "HTTP error %d (%s)", req->status_code, 118 req->status_string ? req->status_string : "unknown" ); 120 119 } 121 120 122 rep->func( rep ); 123 destroy_reply( rep ); 121 if( mad->error == NULL && mad->token == NULL ) 122 mad->error = g_strdup( "Could not parse Passport server response" ); 123 124 if( mad->url && mad->token == NULL ) 125 { 126 passport_get_token_real( mad ); 127 } 128 else 129 { 130 mad->callback( mad ); 131 132 g_free( mad->url ); 133 g_free( mad->username ); 134 g_free( mad->password ); 135 g_free( mad->cookie ); 136 g_free( mad->token ); 137 g_free( mad->error ); 138 g_free( mad ); 139 } 124 140 } 125 141 126 static char *passport_create_header( char *cookie, char *email, char *pwd)142 static xt_status passport_xt_extract_token( struct xt_node *node, gpointer data ) 127 143 { 128 char *buffer; 129 char *currenttoken; 130 char *email_enc, *pwd_enc; 144 struct msn_auth_data *mad = data; 145 char *s; 131 146 132 currenttoken = strstr( cookie, "lc=" ); 133 if( currenttoken == NULL ) 134 return NULL; 147 if( ( s = xt_find_attr( node, "Id" ) ) && strcmp( s, "PPToken1" ) == 0 ) 148 mad->token = g_memdup( node->text, node->text_len + 1 ); 135 149 136 email_enc = g_new0( char, strlen( email ) * 3 + 1 ); 137 strcpy( email_enc, email ); 138 http_encode( email_enc ); 139 140 pwd_enc = g_new0( char, strlen( pwd ) * 3 + 1 ); 141 strcpy( pwd_enc, pwd ); 142 http_encode( pwd_enc ); 143 144 buffer = g_strdup_printf( "Authorization: Passport1.4 OrgVerb=GET," 145 "OrgURL=http%%3A%%2F%%2Fmessenger%%2Emsn%%2Ecom," 146 "sign-in=%s,pwd=%s,%s", email_enc, pwd_enc, 147 currenttoken ); 148 149 g_free( email_enc ); 150 g_free( pwd_enc ); 151 152 return buffer; 150 return XT_HANDLED; 153 151 } 154 152 155 static int passport_retrieve_dalogin( gpointer func, gpointer data, char *header)153 static xt_status passport_xt_handle_fault( struct xt_node *node, gpointer data ) 156 154 { 157 struct passport_reply *rep = g_new0( struct passport_reply, 1 ); 158 struct http_request *req; 155 struct msn_auth_data *mad = data; 156 struct xt_node *code = xt_find_node( node->children, "faultcode" ); 157 struct xt_node *string = xt_find_node( node->children, "faultstring" ); 158 struct xt_node *redirect = xt_find_node( node->children, "psf:redirectUrl" ); 159 159 160 rep->data = data; 161 rep->func = func; 162 rep->header = header; 160 if( redirect && redirect->text_len && mad->ttl-- > 0 ) 161 mad->url = g_memdup( redirect->text, redirect->text_len + 1 ); 163 162 164 req = http_dorequest_url( "https://nexus.passport.com/rdr/pprdr.asp", passport_retrieve_dalogin_ready, rep ); 163 if( code == NULL || code->text_len == 0 ) 164 mad->error = g_strdup( "Unknown error" ); 165 else 166 mad->error = g_strdup_printf( "%s (%s)", code->text, string && string->text_len ? 167 string->text : "no description available" ); 165 168 166 if( !req ) 167 destroy_reply( rep ); 168 169 return( req != NULL ); 169 return XT_HANDLED; 170 170 } 171 172 static void passport_retrieve_dalogin_ready( struct http_request *req )173 {174 struct passport_reply *rep = req->data;175 char *dalogin;176 char *urlend;177 178 if( !g_slist_find( msn_connections, rep->data ) )179 {180 destroy_reply( rep );181 return;182 }183 184 if( !req->finished || !req->reply_headers || req->status_code != 200 )185 {186 rep->error_string = g_strdup_printf( "HTTP error while fetching DALogin: %s",187 req->status_string ? req->status_string : "Unknown error" );188 goto failure;189 }190 191 dalogin = strstr( req->reply_headers, "DALogin=" );192 193 if( !dalogin )194 {195 rep->error_string = g_strdup( "Parse error while fetching DALogin" );196 goto failure;197 }198 199 dalogin += strlen( "DALogin=" );200 urlend = strchr( dalogin, ',' );201 if( urlend )202 *urlend = 0;203 204 /* strip the http(s):// part from the url */205 urlend = strstr( urlend, "://" );206 if( urlend )207 dalogin = urlend + strlen( "://" );208 209 if( prd_cached == NULL )210 prd_cached = g_strdup( dalogin );211 212 if( passport_get_id_real( rep->func, rep->data, rep->header ) )213 {214 rep->header = NULL;215 destroy_reply( rep );216 return;217 }218 219 failure:220 rep->func( rep );221 destroy_reply( rep );222 }223 224 static void destroy_reply( struct passport_reply *rep )225 {226 g_free( rep->result );227 g_free( rep->header );228 g_free( rep->error_string );229 g_free( rep );230 } -
protocols/msn/passport.h
r9730d72 r6738a67 1 #ifndef __PASSPORT_H__2 #define __PASSPORT_H__3 1 /* passport.h 4 2 * 5 * Functions to login to Microsoft Passport Service for Messenger 6 * Copyright (C) 2004 Wouter Paesen <wouter@blue-gate.be>, 7 * Wilmer van der Gaast <wilmer@gaast.net> 3 * Functions to login to Microsoft Passport service for Messenger 4 * Copyright (C) 2004-2008 Wilmer van der Gaast <wilmer@gaast.net> 8 5 * 9 6 * This program is free software; you can redistribute it and/or modify … … 18 15 * You should have received a copy of the GNU General Public License 19 16 * along with this program; if not, write to the Free Software 20 * 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 18 */ 19 20 /* Thanks to http://msnpiki.msnfanatic.com/index.php/MSNP13:SOAPTweener 21 for the specs! */ 22 23 #ifndef __PASSPORT_H__ 24 #define __PASSPORT_H__ 22 25 23 26 #include <stdio.h> … … 33 36 #include "nogaim.h" 34 37 35 struct passport_reply 38 #define MAX_PASSPORT_PWLEN 16 39 40 struct msn_auth_data 36 41 { 37 void (*func)( struct passport_reply * ); 38 void *data; 39 char *result; 40 char *header; 41 char *error_string; 42 char *url; 43 int ttl; 44 45 char *username; 46 char *password; 47 char *cookie; 48 49 /* The end result, the only thing we'll really be interested in 50 once finished. */ 51 char *token; 52 char *error; /* Yeah, or that... */ 53 54 void (*callback)( struct msn_auth_data *mad ); 55 gpointer data; 42 56 }; 43 57 44 int passport_get_id( gpointer func, gpointer data, char *username, char *password, char *cookie ); 58 #define SOAP_AUTHENTICATION_URL "https://loginnet.passport.com/RST.srf" 59 60 #define SOAP_AUTHENTICATION_REQUEST \ 61 "POST %s HTTP/1.0\r\n" \ 62 "Accept: text/*\r\n" \ 63 "User-Agent: BitlBee " BITLBEE_VERSION "\r\n" \ 64 "Host: %s\r\n" \ 65 "Content-Length: %d\r\n" \ 66 "Cache-Control: no-cache\r\n" \ 67 "\r\n" \ 68 "%s" 69 70 #define SOAP_AUTHENTICATION_PAYLOAD \ 71 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \ 72 "<Envelope xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2002/12/policy\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/03/addressing\" xmlns:wssc=\"http://schemas.xmlsoap.org/ws/2004/04/sc\" xmlns:wst=\"http://schemas.xmlsoap.org/ws/2004/04/trust\">" \ 73 "<Header>" \ 74 "<ps:AuthInfo xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" Id=\"PPAuthInfo\">" \ 75 "<ps:HostingApp>{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}</ps:HostingApp>" \ 76 "<ps:BinaryVersion>4</ps:BinaryVersion>" \ 77 "<ps:UIVersion>1</ps:UIVersion>" \ 78 "<ps:Cookies></ps:Cookies>" \ 79 "<ps:RequestParams>AQAAAAIAAABsYwQAAAAzMDg0</ps:RequestParams>" \ 80 "</ps:AuthInfo>" \ 81 "<wsse:Security>" \ 82 "<wsse:UsernameToken Id=\"user\">" \ 83 "<wsse:Username>%s</wsse:Username>" \ 84 "<wsse:Password>%s</wsse:Password>" \ 85 "</wsse:UsernameToken>" \ 86 "</wsse:Security>" \ 87 "</Header>" \ 88 "<Body>" \ 89 "<ps:RequestMultipleSecurityTokens xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" Id=\"RSTS\">" \ 90 "<wst:RequestSecurityToken Id=\"RST0\">" \ 91 "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \ 92 "<wsp:AppliesTo>" \ 93 "<wsa:EndpointReference>" \ 94 "<wsa:Address>http://Passport.NET/tb</wsa:Address>" \ 95 "</wsa:EndpointReference>" \ 96 "</wsp:AppliesTo>" \ 97 "</wst:RequestSecurityToken>" \ 98 "<wst:RequestSecurityToken Id=\"RST1\">" \ 99 "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \ 100 "<wsp:AppliesTo>" \ 101 "<wsa:EndpointReference>" \ 102 "<wsa:Address>messenger.msn.com</wsa:Address>" \ 103 "</wsa:EndpointReference>" \ 104 "</wsp:AppliesTo>" \ 105 "<wsse:PolicyReference URI=\"?%s\"></wsse:PolicyReference>" \ 106 "</wst:RequestSecurityToken>" \ 107 "</ps:RequestMultipleSecurityTokens>" \ 108 "</Body>" \ 109 "</Envelope>" 110 111 int passport_get_token( gpointer func, gpointer data, char *username, char *password, char *cookie ); 45 112 46 113 #endif /* __PASSPORT_H__ */ -
protocols/nogaim.c
r9730d72 r6738a67 343 343 /* dialogs.c */ 344 344 345 void imcb_ask( struct im_connection *ic, char *msg, void *data, void *doit, void *dont ) 345 void imcb_ask( struct im_connection *ic, char *msg, void *data, 346 query_callback doit, query_callback dont ) 346 347 { 347 348 query_add( ic->irc, ic, msg, doit, dont, data ); … … 495 496 }; 496 497 497 void show_got_added_no( gpointer w, struct show_got_added_data*data )498 { 499 g_free( data->handle );498 void show_got_added_no( void *data ) 499 { 500 g_free( ((struct show_got_added_data*)data)->handle ); 500 501 g_free( data ); 501 502 } 502 503 503 void show_got_added_yes( gpointer w, struct show_got_added_data *data ) 504 { 505 data->ic->acc->prpl->add_buddy( data->ic, data->handle, NULL ); 506 /* imcb_add_buddy( data->ic, NULL, data->handle, data->handle ); */ 507 508 return show_got_added_no( w, data ); 504 void show_got_added_yes( void *data ) 505 { 506 struct show_got_added_data *sga = data; 507 508 sga->ic->acc->prpl->add_buddy( sga->ic, sga->handle, NULL ); 509 /* imcb_add_buddy( sga->ic, NULL, sga->handle, sga->handle ); */ 510 511 return show_got_added_no( data ); 509 512 } 510 513 -
protocols/nogaim.h
r9730d72 r6738a67 42 42 #include "account.h" 43 43 #include "proxy.h" 44 #include "query.h" 44 45 #include "md5.h" 45 46 #define BUF_LEN MSG_LEN47 #define BUF_LONG ( BUF_LEN * 2 )48 #define MSG_LEN 204849 #define BUF_LEN MSG_LEN50 46 51 47 #define BUDDY_ALIAS_MAXLEN 388 /* because MSN names can be 387 characters */ … … 265 261 * - 'doit' or 'dont' will be called depending of the answer of the user. 266 262 */ 267 G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, void *doit, void *dont );263 G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, query_callback doit, query_callback dont ); 268 264 G_MODULE_EXPORT void imcb_ask_add( struct im_connection *ic, char *handle, const char *realname ); 269 265 -
protocols/oscar/oscar.c
r9730d72 r6738a67 60 60 61 61 #define OSCAR_GROUP "Friends" 62 63 #define BUF_LEN 2048 64 #define BUF_LONG ( BUF_LEN * 2 ) 62 65 63 66 /* Don't know if support for UTF8 is really working. For now it's UTF16 here. … … 240 243 }; 241 244 static int msgerrreasonlen = 25; 245 246 /* Hurray, this function is NOT thread-safe \o/ */ 247 static char *normalize(const char *s) 248 { 249 static char buf[BUF_LEN]; 250 char *t, *u; 251 int x = 0; 252 253 g_return_val_if_fail((s != NULL), NULL); 254 255 u = t = g_strdup(s); 256 257 strcpy(t, s); 258 g_strdown(t); 259 260 while (*t && (x < BUF_LEN - 1)) { 261 if (*t != ' ' && *t != '!') { 262 buf[x] = *t; 263 x++; 264 } 265 t++; 266 } 267 buf[x] = '\0'; 268 g_free(u); 269 return buf; 270 } 242 271 243 272 static gboolean oscar_callback(gpointer data, gint source, … … 1002 1031 } 1003 1032 1004 tmp = g_strdup(normalize(ic->acc->user)); 1005 if (!strcmp(tmp, normalize(info->sn))) 1033 if (!aim_sncmp(ic->acc->user, info->sn)) 1006 1034 g_snprintf(ic->displayname, sizeof(ic->displayname), "%s", info->sn); 1007 g_free(tmp); 1008 1009 imcb_buddy_status(ic, info->sn, flags, state_string, NULL); 1010 /* imcb_buddy_times(ic, info->sn, signon, time_idle); */ 1035 1036 tmp = normalize(info->sn); 1037 imcb_buddy_status(ic, tmp, flags, state_string, NULL); 1038 /* imcb_buddy_times(ic, tmp, signon, time_idle); */ 1039 1011 1040 1012 1041 return 1; … … 1022 1051 va_end(ap); 1023 1052 1024 imcb_buddy_status(ic, info->sn, 0, NULL, NULL );1053 imcb_buddy_status(ic, normalize(info->sn), 0, NULL, NULL ); 1025 1054 1026 1055 return 1; … … 1078 1107 1079 1108 strip_linefeed(tmp); 1080 imcb_buddy_msg(ic, userinfo->sn, tmp, flags, 0);1109 imcb_buddy_msg(ic, normalize(userinfo->sn), tmp, flags, 0); 1081 1110 g_free(tmp); 1082 1111 … … 1084 1113 } 1085 1114 1086 void oscar_accept_chat( gpointer w, struct aim_chat_invitation * inv);1087 void oscar_reject_chat( gpointer w, struct aim_chat_invitation * inv);1115 void oscar_accept_chat(void *data); 1116 void oscar_reject_chat(void *data); 1088 1117 1089 1118 static int incomingim_chan2(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch2_args *args) { … … 1119 1148 } 1120 1149 1121 static void gaim_icq_authgrant(gpointer w, struct icq_auth *data) { 1150 static void gaim_icq_authgrant(void *data_) { 1151 struct icq_auth *data = data_; 1122 1152 char *uin, message; 1123 1153 struct oscar_data *od = (struct oscar_data *)data->ic->proto_data; … … 1134 1164 } 1135 1165 1136 static void gaim_icq_authdeny(gpointer w, struct icq_auth *data) { 1166 static void gaim_icq_authdeny(void *data_) { 1167 struct icq_auth *data = data_; 1137 1168 char *uin, *message; 1138 1169 struct oscar_data *od = (struct oscar_data *)data->ic->proto_data; … … 1175 1206 message = g_strdup(args->msg); 1176 1207 strip_linefeed(message); 1177 imcb_buddy_msg(ic, uin, message, 0, 0);1208 imcb_buddy_msg(ic, normalize(uin), message, 0, 0); 1178 1209 g_free(uin); 1179 1210 g_free(message); … … 1194 1225 1195 1226 strip_linefeed(message); 1196 imcb_buddy_msg(ic, uin, message, 0, 0);1227 imcb_buddy_msg(ic, normalize(uin), message, 0, 0); 1197 1228 g_free(uin); 1198 1229 g_free(m); … … 1469 1500 1470 1501 for (i = 0; i < count; i++) 1471 imcb_chat_add_buddy(c->cnv, info[i].sn);1502 imcb_chat_add_buddy(c->cnv, normalize(info[i].sn)); 1472 1503 1473 1504 return 1; … … 1492 1523 1493 1524 for (i = 0; i < count; i++) 1494 imcb_chat_remove_buddy(c->cnv, info[i].sn, NULL);1525 imcb_chat_remove_buddy(c->cnv, normalize(info[i].sn), NULL); 1495 1526 1496 1527 return 1; … … 1543 1574 tmp = g_malloc(BUF_LONG); 1544 1575 g_snprintf(tmp, BUF_LONG, "%s", msg); 1545 imcb_chat_msg(ccon->cnv, info->sn, tmp, 0, 0);1576 imcb_chat_msg(ccon->cnv, normalize(info->sn), tmp, 0, 0); 1546 1577 g_free(tmp); 1547 1578 … … 1756 1787 g_snprintf(sender, sizeof(sender), "%u", msg->sender); 1757 1788 strip_linefeed(dialog_msg); 1758 imcb_buddy_msg(ic, sender, dialog_msg, 0, t);1789 imcb_buddy_msg(ic, normalize(sender), dialog_msg, 0, t); 1759 1790 g_free(dialog_msg); 1760 1791 } break; … … 1777 1808 1778 1809 strip_linefeed(dialog_msg); 1779 imcb_buddy_msg(ic, sender, dialog_msg, 0, t);1810 imcb_buddy_msg(ic, normalize(sender), dialog_msg, 0, t); 1780 1811 g_free(dialog_msg); 1781 1812 g_free(m); … … 2015 2046 struct aim_ssi_item *curitem; 2016 2047 int tmp; 2048 char *nrm; 2017 2049 2018 2050 /* Add from server list to local list */ 2019 2051 tmp = 0; 2020 2052 for (curitem=sess->ssi.items; curitem; curitem=curitem->next) { 2053 nrm = curitem->name ? normalize(curitem->name) : NULL; 2054 2021 2055 switch (curitem->type) { 2022 2056 case 0x0000: /* Buddy */ 2023 if ((curitem->name) && (!imcb_find_buddy(ic, curitem->name))) {2057 if ((curitem->name) && (!imcb_find_buddy(ic, nrm))) { 2024 2058 char *realname = NULL; 2025 2059 … … 2027 2061 realname = aim_gettlv_str(curitem->data, 0x0131, 1); 2028 2062 2029 imcb_add_buddy(ic, curitem->name, NULL);2063 imcb_add_buddy(ic, nrm, NULL); 2030 2064 2031 2065 if (realname) { 2032 imcb_buddy_nick_hint(ic, curitem->name, realname);2033 imcb_rename_buddy(ic, curitem->name, realname);2066 imcb_buddy_nick_hint(ic, nrm, realname); 2067 imcb_rename_buddy(ic, nrm, realname); 2034 2068 g_free(realname); 2035 2069 } … … 2043 2077 if (!list) { 2044 2078 char *name; 2045 name = g_strdup(n ormalize(curitem->name));2079 name = g_strdup(nrm); 2046 2080 ic->permit = g_slist_append(ic->permit, name); 2047 2081 tmp++; … … 2056 2090 if (!list) { 2057 2091 char *name; 2058 name = g_strdup(n ormalize(curitem->name));2092 name = g_strdup(nrm); 2059 2093 ic->deny = g_slist_append(ic->deny, name); 2060 2094 tmp++; … … 2118 2152 if( st == 0x00 ) 2119 2153 { 2120 imcb_add_buddy( sess->aux_data, list, NULL );2154 imcb_add_buddy( sess->aux_data, normalize(list), NULL ); 2121 2155 } 2122 2156 else if( st == 0x0E ) … … 2448 2482 if(type2 == 0x0002) { 2449 2483 /* User is typing */ 2450 imcb_buddy_typing(ic, sn, OPT_TYPING);2484 imcb_buddy_typing(ic, normalize(sn), OPT_TYPING); 2451 2485 } 2452 2486 else if (type2 == 0x0001) { 2453 2487 /* User has typed something, but is not actively typing (stale) */ 2454 imcb_buddy_typing(ic, sn, OPT_THINKING);2488 imcb_buddy_typing(ic, normalize(sn), OPT_THINKING); 2455 2489 } 2456 2490 else { 2457 2491 /* User has stopped typing */ 2458 imcb_buddy_typing(ic, sn, 0);2492 imcb_buddy_typing(ic, normalize(sn), 0); 2459 2493 } 2460 2494 … … 2588 2622 } 2589 2623 2590 void oscar_accept_chat(gpointer w, struct aim_chat_invitation * inv) 2591 { 2624 void oscar_accept_chat(void *data) 2625 { 2626 struct aim_chat_invitation * inv = data; 2627 2592 2628 oscar_chat_join(inv->ic, inv->name, NULL, NULL); 2593 2629 g_free(inv->name); … … 2595 2631 } 2596 2632 2597 void oscar_reject_chat(gpointer w, struct aim_chat_invitation * inv) 2598 { 2633 void oscar_reject_chat(void *data) 2634 { 2635 struct aim_chat_invitation * inv = data; 2636 2599 2637 g_free(inv->name); 2600 2638 g_free(inv); -
protocols/yahoo/libyahoo2.c
r9730d72 r6738a67 69 69 #ifdef __MINGW32__ 70 70 # include <winsock2.h> 71 # define write(a,b,c) send(a,b,c,0)72 # define read(a,b,c) recv(a,b,c,0)73 71 #endif 74 72 … … 381 379 382 380 /* call repeatedly to get the next one */ 383 /*384 381 static struct yahoo_input_data * find_input_by_id(int id) 385 382 { … … 392 389 return NULL; 393 390 } 394 */395 391 396 392 static struct yahoo_input_data * find_input_by_id_and_webcam_user(int id, const char * who) … … 737 733 738 734 memcpy(data + pos, "YMSG", 4); pos += 4; 739 pos += yahoo_put16(data + pos, 0x0 a00);735 pos += yahoo_put16(data + pos, 0x000c); 740 736 pos += yahoo_put16(data + pos, 0x0000); 741 737 pos += yahoo_put16(data + pos, pktlen + extra_pad); … … 797 793 { 798 794 struct yahoo_data *yd = find_conn_by_id(id); 795 799 796 if(!yd) 800 797 return; … … 3166 3163 3167 3164 LOG(("write callback: id=%d fd=%d data=%p", id, fd, data)); 3168 if(!yid || !yid->txqueues )3165 if(!yid || !yid->txqueues || !find_conn_by_id(id)) 3169 3166 return -2; 3170 3167 … … 3351 3348 break; 3352 3349 case 5: 3353 if( cp != "\005")3350 if(strcmp(cp, "5") != 0) 3354 3351 yct->location = cp; 3355 3352 k = 0; … … 3842 3839 } 3843 3840 3844 3845 /* do { 3841 do { 3846 3842 yahoo_input_close(yid); 3847 } while((yid = find_input_by_id(id)));*/ 3848 3843 } while((yid = find_input_by_id(id))); 3849 3844 } 3850 3845 -
protocols/yahoo/yahoo.c
r9730d72 r6738a67 163 163 g_slist_free( yd->buddygroups ); 164 164 165 if( yd->logged_in ) 166 yahoo_logoff( yd->y2_id ); 167 else 168 yahoo_close( yd->y2_id ); 165 yahoo_logoff( yd->y2_id ); 169 166 170 167 g_free( yd ); … … 315 312 struct byahoo_data *yd = (struct byahoo_data *) c->ic->proto_data; 316 313 317 yahoo_conference_invite( yd->y2_id, NULL, c->data, c->title, msg );314 yahoo_conference_invite( yd->y2_id, NULL, c->data, c->title, msg ? msg : "" ); 318 315 } 319 316 … … 454 451 { 455 452 struct byahoo_write_ready_data *d = data; 456 457 if( !byahoo_get_ic_by_id( d->id ) )458 /* WTF doesn't libyahoo clean this up? */459 return FALSE;460 453 461 454 yahoo_write_ready( d->id, d->fd, d->data ); … … 798 791 } 799 792 800 static void byahoo_accept_conf( gpointer w, struct byahoo_conf_invitation *inv ) 801 { 793 static void byahoo_accept_conf( void *data ) 794 { 795 struct byahoo_conf_invitation *inv = data; 796 802 797 yahoo_conference_logon( inv->yid, NULL, inv->members, inv->name ); 803 798 imcb_chat_add_buddy( inv->c, inv->ic->acc->user ); … … 806 801 } 807 802 808 static void byahoo_reject_conf( gpointer w, struct byahoo_conf_invitation *inv ) 809 { 803 static void byahoo_reject_conf( void *data ) 804 { 805 struct byahoo_conf_invitation *inv = data; 806 810 807 yahoo_conference_decline( inv->yid, NULL, inv->members, inv->name, "User rejected groupchat" ); 811 808 imcb_chat_free( inv->c ); -
protocols/yahoo/yahoo_httplib.c
r9730d72 r6738a67 51 51 #ifdef __MINGW32__ 52 52 # include <winsock2.h> 53 # define write(a,b,c) send(a,b,c,0)54 # define read(a,b,c) recv(a,b,c,0)55 53 # define snprintf _snprintf 56 54 #endif
Note: See TracChangeset
for help on using the changeset viewer.