Changeset e5854a8 for protocols/msn
- Timestamp:
- 2010-08-14T14:50:10Z (14 years ago)
- Branches:
- master
- Children:
- 193dc74
- Parents:
- 07874be
- Location:
- protocols/msn
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.h
r07874be re5854a8 203 203 int msn_buddy_list_add( struct im_connection *ic, const char *list, const char *who, const char *realname_, const char *group ); 204 204 int msn_buddy_list_remove( struct im_connection *ic, char *list, const char *who, const char *group ); 205 void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname);205 void msn_buddy_ask( bee_user_t *bu ); 206 206 char *msn_findheader( char *text, char *header, int len ); 207 207 char **msn_linesplit( char *line ); -
protocols/msn/msn_util.c
r07874be re5854a8 172 172 } 173 173 174 void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname ) 175 { 176 struct msn_buddy_ask_data *bla = g_new0( struct msn_buddy_ask_data, 1 ); 174 void msn_buddy_ask( bee_user_t *bu ) 175 { 176 struct msn_buddy_ask_data *bla; 177 struct msn_buddy_data *bd = bu->data; 177 178 char buf[1024]; 178 179 179 bla->ic = ic; 180 bla->handle = g_strdup( handle ); 181 bla->realname = g_strdup( realname ); 180 if( ( bd->flags & 30 ) != 8 && ( bd->flags & 30 ) != 16 ) 181 return; 182 183 bla = g_new0( struct msn_buddy_ask_data, 1 ); 184 bla->ic = bu->ic; 185 bla->handle = g_strdup( bu->handle ); 186 bla->realname = g_strdup( bu->fullname ); 182 187 183 188 g_snprintf( buf, sizeof( buf ), 184 189 "The user %s (%s) wants to add you to his/her buddy list.", 185 handle, realname );186 imcb_ask( ic, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no );190 bu->handle, bu->fullname ); 191 imcb_ask( bu->ic, buf, bla, msn_buddy_ask_yes, msn_buddy_ask_no ); 187 192 } 188 193 -
protocols/msn/ns.c
r07874be re5854a8 279 279 msn_write( ic, buf, strlen( buf ) ); 280 280 } 281 else if( num_parts >= 3 ) 282 { 283 md->handler->msglen = atoi( cmd[2] ); 284 } 281 285 } 282 286 else if( strcmp( cmd[0], "PRP" ) == 0 ) … … 412 416 } 413 417 } 414 else if( strcmp( cmd[0], "ADD" ) == 0 )415 {416 if( num_parts >= 6 && strcmp( cmd[2], "RL" ) == 0 )417 {418 GSList *l;419 420 http_decode( cmd[5] );421 422 if( strchr( cmd[4], '@' ) == NULL )423 {424 imcb_error( ic, "Syntax error" );425 imc_logout( ic, TRUE );426 return 0;427 }428 429 /* We got added by someone. If we don't have this430 person in permit/deny yet, inform the user. */431 for( l = ic->permit; l; l = l->next )432 if( g_strcasecmp( l->data, cmd[4] ) == 0 )433 return 1;434 435 for( l = ic->deny; l; l = l->next )436 if( g_strcasecmp( l->data, cmd[4] ) == 0 )437 return 1;438 439 msn_buddy_ask( ic, cmd[4], cmd[5] );440 }441 else if( num_parts >= 6 && strcmp( cmd[2], "FL" ) == 0 )442 {443 const char *group = NULL;444 int num;445 446 if( cmd[6] != NULL && sscanf( cmd[6], "%d", &num ) == 1 && num < md->groupcount )447 group = md->grouplist[num];448 449 http_decode( cmd[5] );450 imcb_add_buddy( ic, cmd[4], group );451 imcb_rename_buddy( ic, cmd[4], cmd[5] );452 }453 }454 418 else if( strcmp( cmd[0], "OUT" ) == 0 ) 455 419 { … … 486 450 } 487 451 } 452 #if 0 488 453 else if( strcmp( cmd[0], "ADG" ) == 0 ) 489 454 { … … 530 495 } 531 496 } 497 #endif 532 498 else if( strcmp( cmd[0], "GCF" ) == 0 ) 533 499 { … … 538 504 else if( strcmp( cmd[0], "UBX" ) == 0 ) 539 505 { 540 /* Status message. Parser coming soon.*/506 /* Status message. */ 541 507 if( num_parts >= 4 ) 542 508 md->handler->msglen = atoi( cmd[3] ); … … 544 510 else if( strcmp( cmd[0], "NOT" ) == 0 ) 545 511 { 546 /* Some kind of notification, not sure if it still exists547 but we have to skip the payload or stuff breaks. */548 if( num_parts >= 3)549 md->handler->msglen = atoi( cmd[ 2] );512 /* Some kind of notification, poorly documented but 513 apparently used to announce address book changes. */ 514 if( num_parts >= 2 ) 515 md->handler->msglen = atoi( cmd[1] ); 550 516 } 551 517 else if( isdigit( cmd[0][0] ) ) … … 670 636 imcb_buddy_status_msg( ic, cmd[1], psm_text ); 671 637 xt_free_node( psm ); 638 } 639 else if( strcmp( cmd[0], "ADL" ) == 0 ) 640 { 641 struct xt_node *adl, *d, *c; 642 643 if( !( adl = xt_from_string( msg ) ) ) 644 return 1; 645 646 for( d = adl->children; d; d = d->next ) 647 { 648 char *dn; 649 if( strcmp( d->name, "d" ) != 0 || 650 ( dn = xt_find_attr( d, "n" ) ) == NULL ) 651 continue; 652 for( c = d->children; c; c = c->next ) 653 { 654 bee_user_t *bu; 655 struct msn_buddy_data *bd; 656 char *cn, *handle, *f, *l; 657 int flags; 658 659 if( strcmp( c->name, "c" ) != 0 || 660 ( l = xt_find_attr( c, "l" ) ) == NULL || 661 ( cn = xt_find_attr( c, "n" ) ) == NULL ) 662 continue; 663 664 handle = g_strdup_printf( "%s@%s", cn, dn ); 665 if( !( ( bu = bee_user_by_handle( ic->bee, ic, handle ) ) || 666 ( bu = bee_user_new( ic->bee, ic, handle, 0 ) ) ) ) 667 { 668 g_free( handle ); 669 continue; 670 } 671 g_free( handle ); 672 bd = bu->data; 673 674 if( ( f = xt_find_attr( c, "f" ) ) ) 675 { 676 http_decode( f ); 677 imcb_rename_buddy( ic, bu->handle, f ); 678 } 679 680 flags = atoi( l ) & 15; 681 if( bd->flags != flags ) 682 { 683 bd->flags = flags; 684 msn_buddy_ask( bu ); 685 } 686 } 687 } 672 688 } 673 689 … … 718 734 char l[4]; 719 735 736 if( ( bd->flags & 7 ) == 0 ) 737 return FALSE; 738 720 739 strcpy( handle, bu->handle ); 721 740 if( ( domain = strchr( handle, '@' ) ) == NULL ) /* WTF */ -
protocols/msn/soap.c
r07874be re5854a8 477 477 bd->flags |= MSN_BUDDY_BL; 478 478 else if( strcmp( role, "Reverse" ) == 0 ) 479 { 479 480 bd->flags |= MSN_BUDDY_RL; 481 msn_buddy_ask( bu ); 482 } 480 483 else if( strcmp( role, "Pending" ) == 0 ) 484 { 481 485 bd->flags |= MSN_BUDDY_PL; 486 msn_buddy_ask( bu ); 487 } 488 489 printf( "%s %d\n", handle, bd->flags ); 482 490 483 491 return XT_HANDLED;
Note: See TracChangeset
for help on using the changeset viewer.