Changeset 70ac477
- Timestamp:
- 2010-06-11T11:34:39Z (15 years ago)
- Branches:
- master
- Children:
- 1c8e5f7
- Parents:
- 5266354
- Location:
- protocols/msn
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.c
r5266354 r70ac477 104 104 g_free( md->grouplist ); 105 105 106 while( md->grpq ) 107 { 108 struct msn_groupadd *ga = md->grpq->data; 109 g_free( ga->group ); 110 g_free( ga->who ); 111 g_free( ga ); 112 md->grpq = g_slist_remove( md->grpq, ga ); 113 } 114 106 115 g_free( md ); 107 116 } … … 122 131 struct msn_switchboard *sb; 123 132 133 #ifdef DEBUG 134 if( strcmp( who, "raw" ) == 0 ) 135 { 136 msn_write( ic, message, strlen( message ) ); 137 msn_write( ic, "\r\n", 2 ); 138 } 139 else 140 #endif 124 141 if( ( sb = msn_sb_by_handle( ic, who ) ) ) 125 142 { -
protocols/msn/msn.h
r5266354 r70ac477 70 70 int trId; 71 71 72 GSList *msgq ;72 GSList *msgq, *grpq; 73 73 GSList *switchboards; 74 74 int sb_failures; … … 119 119 char *who; 120 120 char *text; 121 }; 122 123 struct msn_groupadd 124 { 125 char *who; 126 char *group; 121 127 }; 122 128 -
protocols/msn/msn_util.c
r5266354 r70ac477 55 55 struct msn_data *md = ic->proto_data; 56 56 char buf[1024], *realname, groupid[8]; 57 58 realname = msn_http_encode( realname_ );59 57 60 58 *groupid = '\0'; … … 68 66 break; 69 67 } 70 } 71 68 69 if( *groupid == '\0' ) 70 { 71 /* Have to create this group, it doesn't exist yet. */ 72 struct msn_groupadd *ga; 73 GSList *l; 74 75 for( l = md->grpq; l; l = l->next ) 76 { 77 ga = l->data; 78 if( g_strcasecmp( ga->group, group ) == 0 ) 79 break; 80 } 81 82 ga = g_new0( struct msn_groupadd, 1 ); 83 ga->who = g_strdup( who ); 84 ga->group = g_strdup( group ); 85 md->grpq = g_slist_prepend( md->grpq, ga ); 86 87 if( l == NULL ) 88 { 89 char *groupname = msn_http_encode( group ); 90 g_snprintf( buf, sizeof( buf ), "ADG %d %s %d\r\n", ++md->trId, groupname, 0 ); 91 g_free( groupname ); 92 return msn_write( ic, buf, strlen( buf ) ); 93 } 94 else 95 { 96 /* This can happen if the user's doing lots of adds to a 97 new group at once; we're still waiting for the server 98 to confirm group creation. */ 99 return 1; 100 } 101 } 102 } 103 104 realname = msn_http_encode( realname_ ); 72 105 g_snprintf( buf, sizeof( buf ), "ADD %d %s %s %s%s\r\n", ++md->trId, list, who, realname, groupid ); 73 if( msn_write( ic, buf, strlen( buf ) ) )74 {75 g_free( realname );76 77 return( 1 );78 }79 80 106 g_free( realname ); 81 107 82 return ( 0);108 return msn_write( ic, buf, strlen( buf ) ); 83 109 } 84 110 -
protocols/msn/ns.c
r5266354 r70ac477 612 612 } 613 613 } 614 else if( strcmp( cmd[0], "ADG" ) == 0 ) 615 { 616 char *group = g_strdup( cmd[3] ); 617 int groupnum, i; 618 GSList *l, *next; 619 620 http_decode( group ); 621 if( sscanf( cmd[4], "%d", &groupnum ) == 1 ) 622 { 623 if( groupnum >= md->groupcount ) 624 { 625 md->grouplist = g_renew( char *, md->grouplist, groupnum + 1 ); 626 for( i = md->groupcount; i <= groupnum; i ++ ) 627 md->grouplist[i] = NULL; 628 md->groupcount = groupnum + 1; 629 } 630 g_free( md->grouplist[groupnum] ); 631 md->grouplist[groupnum] = group; 632 } 633 else 634 { 635 /* Shouldn't happen, but if it does, give up on the group. */ 636 g_free( group ); 637 imcb_error( ic, "Syntax error" ); 638 imc_logout( ic, TRUE ); 639 return 0; 640 } 641 642 for( l = md->grpq; l; l = next ) 643 { 644 struct msn_groupadd *ga = l->data; 645 next = l->next; 646 if( g_strcasecmp( ga->group, group ) == 0 ) 647 { 648 if( !msn_buddy_list_add( ic, "FL", ga->who, ga->who, group ) ) 649 return 0; 650 651 g_free( ga->group ); 652 g_free( ga->who ); 653 g_free( ga ); 654 md->grpq = g_slist_remove( md->grpq, ga ); 655 } 656 } 657 } 614 658 else if( isdigit( cmd[0][0] ) ) 615 659 {
Note: See TracChangeset
for help on using the changeset viewer.