Changes in protocols/msn/msn.c [80175a1:daae10f]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.c
r80175a1 rdaae10f 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-20 10Wilmer van der Gaast and others *4 * Copyright 2002-2004 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 25 25 26 26 #include "nogaim.h" 27 #include "soap.h"28 27 #include "msn.h" 29 28 … … 36 35 static void msn_init( account_t *acc ) 37 36 { 38 set_t *s; 39 40 s = set_add( &acc->set, "display_name", NULL, set_eval_display_name, acc ); 41 s->flags |= ACC_SET_NOSAVE | ACC_SET_ONLINE_ONLY; 42 37 set_add( &acc->set, "display_name", NULL, set_eval_display_name, acc ); 38 set_add( &acc->set, "local_display_name", "false", set_eval_bool, acc ); 43 39 set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc ); 44 40 set_add( &acc->set, "switchboard_keepalives", "false", set_eval_bool, acc ); 45 46 acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE;47 41 } 48 42 … … 74 68 md->ic = ic; 75 69 md->away_state = msn_away_state_list; 76 md->domaintree = g_tree_new( msn_domaintree_cmp );77 70 78 71 msn_connections = g_slist_append( msn_connections, ic ); … … 83 76 struct msn_data *md = ic->proto_data; 84 77 GSList *l; 85 int i;86 78 87 79 if( md ) … … 108 100 msn_msgq_purge( ic, &md->msgq ); 109 101 110 for( i = 0; i < sizeof( md->tokens ) / sizeof( md->tokens[0] ); i ++ ) 111 g_free( md->tokens[i] ); 112 g_free( md->lock_key ); 113 114 while( md->groups ) 115 { 116 struct msn_group *mg = md->groups->data; 117 g_free( mg->id ); 118 g_free( mg->name ); 119 g_free( mg ); 120 md->groups = g_slist_remove( md->groups, mg ); 121 } 122 123 g_tree_destroy( md->domaintree ); 124 md->domaintree = NULL; 102 while( md->groupcount > 0 ) 103 g_free( md->grouplist[--md->groupcount] ); 104 g_free( md->grouplist ); 125 105 126 106 while( md->grpq ) … … 194 174 { 195 175 char buf[1024]; 196 char *uux;197 176 struct msn_data *md = ic->proto_data; 198 177 … … 203 182 204 183 g_snprintf( buf, sizeof( buf ), "CHG %d %s\r\n", ++md->trId, md->away_state->code ); 205 if( !msn_write( ic, buf, strlen( buf ) ) ) 206 return; 207 208 uux = g_markup_printf_escaped( "<Data><PSM>%s</PSM><CurrentMedia></CurrentMedia>" 209 "</Data>", message ? message : "" ); 210 g_snprintf( buf, sizeof( buf ), "UUX %d %zd\r\n%s", ++md->trId, strlen( uux ), uux ); 211 if( !msn_write( ic, buf, strlen( buf ) ) ) 212 return; 184 msn_write( ic, buf, strlen( buf ) ); 185 } 186 187 static void msn_set_my_name( struct im_connection *ic, char *info ) 188 { 189 msn_set_display_name( ic, info ); 213 190 } 214 191 … … 223 200 struct bee_user *bu = bee_user_by_handle( ic->bee, ic, who ); 224 201 225 msn_buddy_list_add( ic, MSN_BUDDY_FL, who, who, group );202 msn_buddy_list_add( ic, "FL", who, who, group ); 226 203 if( bu && bu->group ) 227 msn_buddy_list_remove( ic, MSN_BUDDY_FL, who, bu->group->name );204 msn_buddy_list_remove( ic, "FL", who, bu->group->name ); 228 205 } 229 206 230 207 static void msn_remove_buddy( struct im_connection *ic, char *who, char *group ) 231 208 { 232 msn_buddy_list_remove( ic, MSN_BUDDY_FL, who, NULL );209 msn_buddy_list_remove( ic, "FL", who, NULL ); 233 210 } 234 211 … … 295 272 static void msn_add_permit( struct im_connection *ic, char *who ) 296 273 { 297 msn_buddy_list_add( ic, MSN_BUDDY_AL, who, who, NULL );274 msn_buddy_list_add( ic, "AL", who, who, NULL ); 298 275 } 299 276 300 277 static void msn_rem_permit( struct im_connection *ic, char *who ) 301 278 { 302 msn_buddy_list_remove( ic, MSN_BUDDY_AL, who, NULL );279 msn_buddy_list_remove( ic, "AL", who, NULL ); 303 280 } 304 281 … … 307 284 struct msn_switchboard *sb; 308 285 309 msn_buddy_list_add( ic, MSN_BUDDY_BL, who, who, NULL );286 msn_buddy_list_add( ic, "BL", who, who, NULL ); 310 287 311 288 /* If there's still a conversation with this person, close it. */ … … 318 295 static void msn_rem_deny( struct im_connection *ic, char *who ) 319 296 { 320 msn_buddy_list_remove( ic, MSN_BUDDY_BL, who, NULL );297 msn_buddy_list_remove( ic, "BL", who, NULL ); 321 298 } 322 299 … … 337 314 account_t *acc = set->data; 338 315 struct im_connection *ic = acc->ic; 339 struct msn_data *md = ic->proto_data; 316 317 /* Allow any name if we're offline. */ 318 if( ic == NULL ) 319 return value; 340 320 341 321 if( strlen( value ) > 129 ) … … 345 325 } 346 326 347 if( md->flags & MSN_GOT_PROFILE_DN ) 348 imcb_log( ic, "Warning: Persistent name changes for this account have to be done " 349 "in the profile. BitlBee doesn't currently support this." ); 350 351 msn_soap_addressbook_set_display_name( ic, value ); 352 return msn_ns_set_display_name( ic, value ) ? value : NULL; 353 } 354 355 static void msn_buddy_data_add( bee_user_t *bu ) 356 { 357 struct msn_data *md = bu->ic->proto_data; 358 bu->data = g_new0( struct msn_buddy_data, 1 ); 359 g_tree_insert( md->domaintree, bu->handle, bu ); 360 } 361 362 static void msn_buddy_data_free( bee_user_t *bu ) 363 { 364 struct msn_data *md = bu->ic->proto_data; 365 g_tree_remove( md->domaintree, bu->handle ); 366 g_free( bu->data ); 327 /* Returning NULL would be better, because the server still has to 328 confirm the name change. However, it looks a bit confusing to the 329 user. */ 330 return msn_set_display_name( ic, value ) ? value : NULL; 367 331 } 368 332 … … 379 343 ret->set_away = msn_set_away; 380 344 ret->get_info = msn_get_info; 345 ret->set_my_name = msn_set_my_name; 381 346 ret->add_buddy = msn_add_buddy; 382 347 ret->remove_buddy = msn_remove_buddy; … … 392 357 ret->send_typing = msn_send_typing; 393 358 ret->handle_cmp = g_strcasecmp; 394 ret->buddy_data_add = msn_buddy_data_add;395 ret->buddy_data_free = msn_buddy_data_free;396 397 359 //ret->transfer_request = msn_ftp_transfer_request; 398 360
Note: See TracChangeset
for help on using the changeset viewer.