- Timestamp:
- 2007-04-19T06:03:43Z (18 years ago)
- Branches:
- master
- Children:
- d323394c
- Parents:
- 33dc261
- Location:
- protocols
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/iq.c
r33dc261 rf0cb961 360 360 while( ( c = xt_find_node( c, "item" ) ) ) 361 361 { 362 struct xt_node *group = xt_find_node( node->children, "group" ); 362 363 char *jid = xt_find_attr( c, "jid" ); 363 364 char *name = xt_find_attr( c, "name" ); 364 365 char *sub = xt_find_attr( c, "subscription" ); 365 366 366 if( !jid || !sub ) 367 { 368 /* Maybe warn. But how likely is this to happen in the first place? */ 369 } 370 else if( initial ) 371 { 372 if( ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) ) 373 add_buddy( ic, NULL, jid, name ); 374 } 375 else 376 { 377 /* This is a roster push item. Find out what changed exactly. */ 367 if( jid && sub ) 368 { 378 369 if( ( strcmp( sub, "both" ) == 0 || strcmp( sub, "to" ) == 0 ) ) 379 370 { 380 if( find_buddy( ic, jid ) == NULL ) 381 add_buddy( ic, NULL, jid, name ); 382 else if( name ) 383 serv_buddy_rename( ic, jid, name ); 371 if( initial || imcb_find_buddy( ic, jid ) == NULL ) 372 imcb_add_buddy( ic, jid, ( group && group->text_len ) ? 373 group->text : NULL ); 374 375 imcb_rename_buddy( ic, jid, name ); 384 376 } 385 377 else if( strcmp( sub, "remove" ) == 0 ) -
protocols/jabber/jabber_util.c
r33dc261 rf0cb961 223 223 presence_send_request( bla->ic, bla->handle, "subscribed" ); 224 224 225 if( find_buddy( bla->ic, bla->handle ) == NULL )225 if( imcb_find_buddy( bla->ic, bla->handle ) == NULL ) 226 226 imcb_ask_add( bla->ic, bla->handle, NULL ); 227 227 … … 371 371 } 372 372 373 if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && find_buddy( ic, jid ) )373 if( bud == NULL && ( flags & GET_BUDDY_CREAT ) && imcb_find_buddy( ic, jid ) ) 374 374 { 375 375 *s = '/'; … … 391 391 if( bud == NULL ) 392 392 /* No match. Create it now? */ 393 return ( ( flags & GET_BUDDY_CREAT ) && find_buddy( ic, jid_ ) ) ?393 return ( ( flags & GET_BUDDY_CREAT ) && imcb_find_buddy( ic, jid_ ) ) ? 394 394 jabber_buddy_add( ic, jid_ ) : NULL; 395 395 else if( bud->resource && ( flags & GET_BUDDY_EXACT ) ) -
protocols/msn/msn_util.c
r33dc261 rf0cb961 94 94 msn_buddy_list_add( bla->ic, "AL", bla->handle, bla->realname ); 95 95 96 if( find_buddy( bla->ic, bla->handle ) == NULL )96 if( imcb_find_buddy( bla->ic, bla->handle ) == NULL ) 97 97 imcb_ask_add( bla->ic, bla->handle, NULL ); 98 98 -
protocols/msn/ns.c
r33dc261 rf0cb961 305 305 int num; 306 306 307 if( cmd[4] != NULL && sscanf( cmd[4], "%d", &num ) == 1 )307 if( cmd[4] != NULL && sscanf( cmd[4], "%d", &num ) == 1 && num < md->groupcount ) 308 308 group = md->grouplist[num]; 309 309 310 add_buddy( ic, group, cmd[1], cmd[2] ); 310 imcb_add_buddy( ic, cmd[1], group ); 311 imcb_rename_buddy( ic, cmd[1], cmd[2] ); 311 312 } 312 313 if( list & 2 ) /* AL */ … … 391 392 392 393 http_decode( cmd[4] ); 393 serv_buddy_rename( ic, cmd[3], cmd[4] );394 imcb_rename_buddy( ic, cmd[3], cmd[4] ); 394 395 395 396 st = msn_away_state_by_code( cmd[2] ); … … 420 421 421 422 http_decode( cmd[3] ); 422 serv_buddy_rename( ic, cmd[2], cmd[3] );423 imcb_rename_buddy( ic, cmd[2], cmd[3] ); 423 424 424 425 st = msn_away_state_by_code( cmd[1] ); … … 482 483 imcb_error( ic, "Syntax error" ); 483 484 imc_logout( ic, TRUE ); 484 return( 0 ); 485 } 486 487 /* We got added by someone. If we don't have this person in permit/deny yet, inform the user. */ 485 return 0; 486 } 487 488 /* We got added by someone. If we don't have this 489 person in permit/deny yet, inform the user. */ 488 490 for( l = ic->permit; l; l = l->next ) 489 491 if( g_strcasecmp( l->data, cmd[4] ) == 0 ) 490 return ( 1 );492 return 1; 491 493 492 494 for( l = ic->deny; l; l = l->next ) 493 495 if( g_strcasecmp( l->data, cmd[4] ) == 0 ) 494 return ( 1 );496 return 1; 495 497 496 498 msn_buddy_ask( ic, cmd[4], cmd[5] ); 499 } 500 else if( num_parts >= 6 && strcmp( cmd[2], "FL" ) == 0 ) 501 { 502 http_decode( cmd[5] ); 503 imcb_add_buddy( ic, cmd[4], NULL ); 504 imcb_rename_buddy( ic, cmd[4], cmd[5] ); 497 505 } 498 506 } … … 545 553 /* This is not supposed to happen, but let's handle it anyway... */ 546 554 http_decode( cmd[4] ); 547 serv_buddy_rename( ic, cmd[3], cmd[4] );555 imcb_rename_buddy( ic, cmd[3], cmd[4] ); 548 556 } 549 557 } -
protocols/nogaim.c
r33dc261 rf0cb961 352 352 /* list.c */ 353 353 354 void add_buddy( struct im_connection *ic, char *group, char *handle, char *realname)354 void imcb_add_buddy( struct im_connection *ic, char *handle, char *group ) 355 355 { 356 356 user_t *u; 357 char nick[MAX_NICK_LENGTH+1]; 358 char *s; 357 char nick[MAX_NICK_LENGTH+1], *s; 359 358 irc_t *irc = ic->irc; 360 361 if( set_getbool( &irc->set, "debug" ) && 0 ) /* This message is too useless */362 imcb_log( ic, "Receiving user add from handle: %s", handle );363 359 364 360 if( user_findhandle( ic, handle ) ) … … 369 365 return; 370 366 371 /* Buddy seems to exist already. Let's ignore this request then... */ 367 /* Buddy seems to exist already. Let's ignore this request then... 368 Eventually subsequent calls to this function *should* be possible 369 when a buddy is in multiple groups. But for now BitlBee doesn't 370 even support groups so let's silently ignore this for now. */ 372 371 } 373 372 374 373 memset( nick, 0, MAX_NICK_LENGTH + 1 ); 375 strcpy( nick, nick_get( ic->acc, handle, realname) );374 strcpy( nick, nick_get( ic->acc, handle, NULL ) ); 376 375 377 376 u = user_add( ic->irc, nick ); 378 377 379 if( !realname || !*realname ) realname = nick;380 u->realname = g_strdup( realname );378 // if( !realname || !*realname ) realname = nick; 379 // u->realname = g_strdup( realname ); 381 380 382 381 if( ( s = strchr( handle, '@' ) ) ) … … 387 386 else if( ic->acc->server ) 388 387 { 389 char *colon; 390 391 if( ( colon = strchr( ic->acc->server, ':' ) ) ) 392 u->host = g_strndup( ic->acc->server, 393 colon - ic->acc->server ); 394 else 395 u->host = g_strdup( ic->acc->server ); 396 388 u->host = g_strdup( ic->acc->server ); 397 389 u->user = g_strdup( handle ); 398 390 … … 415 407 } 416 408 417 struct buddy * find_buddy( struct im_connection *ic, char *handle )409 struct buddy *imcb_find_buddy( struct im_connection *ic, char *handle ) 418 410 { 419 411 static struct buddy b[1]; … … 435 427 436 428 437 void serv_buddy_rename( struct im_connection *ic, char *handle, char *realname )429 void imcb_rename_buddy( struct im_connection *ic, char *handle, char *realname ) 438 430 { 439 431 user_t *u = user_findhandle( ic, handle ); 440 432 441 if( !u ) return;433 if( !u || !realname ) return; 442 434 443 435 if( g_strcasecmp( u->realname, realname ) != 0 ) … … 470 462 { 471 463 data->ic->acc->prpl->add_buddy( data->ic, data->handle, NULL ); 472 add_buddy( data->ic, NULL, data->handle, data->handle );464 /* imcb_add_buddy( data->ic, NULL, data->handle, data->handle ); */ 473 465 474 466 return show_got_added_no( w, data ); … … 505 497 if( g_strcasecmp( set_getstr( &ic->irc->set, "handle_unknown" ), "add" ) == 0 ) 506 498 { 507 add_buddy( ic, NULL, (char*) handle, NULL );499 imcb_add_buddy( ic, (char*) handle, NULL ); 508 500 u = user_findhandle( ic, (char*) handle ); 509 501 } … … 609 601 } 610 602 611 add_buddy( ic, NULL, handle, NULL );603 imcb_add_buddy( ic, handle, NULL ); 612 604 u = user_findhandle( ic, handle ); 613 605 u->is_private = private; … … 779 771 if( !u ) 780 772 { 781 add_buddy( b->ic, NULL, handle, NULL );773 imcb_add_buddy( b->ic, handle, NULL ); 782 774 u = user_findhandle( b->ic, handle ); 783 775 } -
protocols/nogaim.h
r33dc261 rf0cb961 201 201 202 202 /* Buddy management */ 203 G_MODULE_EXPORT void add_buddy( struct im_connection *ic, char *group, char *handle, char *realname ); 204 G_MODULE_EXPORT struct buddy *find_buddy( struct im_connection *ic, char *handle ); 205 G_MODULE_EXPORT void serv_buddy_rename( struct im_connection *ic, char *handle, char *realname ); 203 G_MODULE_EXPORT void imcb_add_buddy( struct im_connection *ic, char *handle, char *group ); 204 G_MODULE_EXPORT void imcb_remove_buddy( struct im_connection *ic, char *handle, char *group ); 205 G_MODULE_EXPORT struct buddy *imcb_find_buddy( struct im_connection *ic, char *handle ); 206 G_MODULE_EXPORT void imcb_rename_buddy( struct im_connection *ic, char *handle, char *realname ); 206 207 207 208 /* Buddy activity */ -
protocols/oscar/oscar.c
r33dc261 rf0cb961 1119 1119 aim_ssi_auth_reply(od->sess, od->conn, uin, 1, ""); 1120 1120 // aim_send_im_ch4(od->sess, uin, AIM_ICQMSG_AUTHGRANTED, &message); 1121 if( find_buddy(data->ic, uin) == NULL)1121 if(imcb_find_buddy(data->ic, uin) == NULL) 1122 1122 imcb_ask_add(data->ic, uin, NULL); 1123 1123 … … 1875 1875 struct oscar_data *odata = (struct oscar_data *)g->proto_data; 1876 1876 if (odata->icq) { 1877 struct buddy *budlight = find_buddy(g, who);1877 struct buddy *budlight = imcb_find_buddy(g, who); 1878 1878 if (budlight) 1879 1879 if ((budlight->uc & 0xff80) >> 7) … … 2013 2013 switch (curitem->type) { 2014 2014 case 0x0000: /* Buddy */ 2015 if ((curitem->name) && (! find_buddy(ic, curitem->name))) {2015 if ((curitem->name) && (!imcb_find_buddy(ic, curitem->name))) { 2016 2016 char *realname = NULL; 2017 2017 … … 2019 2019 realname = aim_gettlv_str(curitem->data, 0x0131, 1); 2020 2020 2021 add_buddy(ic, NULL, curitem->name, realname);2021 imcb_add_buddy(ic, curitem->name, NULL); 2022 2022 2023 if (realname) 2024 g_free(realname); 2023 if (realname) { 2024 imcb_rename_buddy(ic, curitem->name, realname); 2025 g_free(realname); 2026 } 2025 2027 } 2026 2028 break; … … 2105 2107 { 2106 2108 st = aimbs_get16( &fr->data ); 2107 if( st == 0x0E ) 2109 if( st == 0x00 ) 2110 { 2111 imcb_add_buddy( sess->aux_data, list, NULL ); 2112 } 2113 else if( st == 0x0E ) 2108 2114 { 2109 2115 imcb_log( sess->aux_data, "Buddy %s can't be added without authorization, requesting authorization", list ); … … 2111 2117 aim_ssi_auth_request( sess, fr->conn, list, "" ); 2112 2118 aim_ssi_addbuddies( sess, fr->conn, OSCAR_GROUP, &list, 1, 1 ); 2119 } 2120 else 2121 { 2122 imcb_error( sess->aux_data, "Error while adding buddy: 0x%04x", st ); 2113 2123 } 2114 2124 list += strlen( list ) + 1; -
protocols/yahoo/libyahoo2.c
r33dc261 rf0cb961 2403 2403 where = "Unknown"; 2404 2404 2405 bud = y_new0(struct yahoo_buddy, 1); 2406 bud->id = strdup(who); 2407 bud->group = strdup(where); 2408 bud->real_name = NULL; 2409 2410 yd->buddies = y_list_append(yd->buddies, bud); 2405 /* status: 0 == Successful, 1 == Error (does not exist), 2 == Already in list */ 2406 if( status == 0 ) { 2407 bud = y_new0(struct yahoo_buddy, 1); 2408 bud->id = strdup(who); 2409 bud->group = strdup(where); 2410 bud->real_name = NULL; 2411 2412 yd->buddies = y_list_append(yd->buddies, bud); 2413 2414 /* Possibly called already, but at least the call above doesn't 2415 seem to happen every time (not anytime I tried). */ 2416 YAHOO_CALLBACK(ext_yahoo_contact_added)(yd->client_id, me, who, NULL); 2417 } 2411 2418 2412 2419 /* YAHOO_CALLBACK(ext_yahoo_status_changed)(yd->client_id, who, status, NULL, (status==YAHOO_STATUS_AVAILABLE?0:1)); */ -
protocols/yahoo/yahoo.c
r33dc261 rf0cb961 532 532 } 533 533 534 add_buddy( ic, b->group, b->id, b->real_name ); 534 imcb_add_buddy( ic, b->id, b->group ); 535 imcb_rename_buddy( ic, b->id, b->real_name ); 536 535 537 bl = bl->next; 536 538 } … … 904 906 void ext_yahoo_contact_added( int id, const char *myid, const char *who, const char *msg ) 905 907 { 908 /* Groups schmoups. If I want to handle groups properly I can get the 909 buddy data from some internal libyahoo2 structure. */ 910 imcb_add_buddy( byahoo_get_ic_by_id( id ), (char*) who, NULL ); 906 911 } 907 912
Note: See TracChangeset
for help on using the changeset viewer.