Changes in protocols/msn/msn.c [daae10f:4452e69]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.c
rdaae10f r4452e69 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-20 04Wilmer van der Gaast and others *4 * Copyright 2002-2010 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 25 25 26 26 #include "nogaim.h" 27 #include "soap.h" 27 28 #include "msn.h" 28 29 … … 35 36 static void msn_init( account_t *acc ) 36 37 { 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 ); 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 39 43 set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc ); 40 44 set_add( &acc->set, "switchboard_keepalives", "false", set_eval_bool, acc ); 45 46 acc->flags |= ACC_FLAG_AWAY_MESSAGE | ACC_FLAG_STATUS_MESSAGE; 41 47 } 42 48 … … 68 74 md->ic = ic; 69 75 md->away_state = msn_away_state_list; 76 md->domaintree = g_tree_new( msn_domaintree_cmp ); 70 77 71 78 msn_connections = g_slist_append( msn_connections, ic ); … … 103 110 g_free( md->grouplist[--md->groupcount] ); 104 111 g_free( md->grouplist ); 112 g_free( md->tokens[0] ); 113 g_free( md->tokens[1] ); 114 g_free( md->tokens[2] ); 115 g_free( md->lock_key ); 116 117 g_tree_destroy( md->domaintree ); 118 md->domaintree = NULL; 105 119 106 120 while( md->grpq ) … … 174 188 { 175 189 char buf[1024]; 190 char *uux; 176 191 struct msn_data *md = ic->proto_data; 177 192 … … 182 197 183 198 g_snprintf( buf, sizeof( buf ), "CHG %d %s\r\n", ++md->trId, md->away_state->code ); 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 ); 199 if( !msn_write( ic, buf, strlen( buf ) ) ) 200 return; 201 202 uux = g_markup_printf_escaped( "<Data><PSM>%s</PSM><CurrentMedia></CurrentMedia>" 203 "</Data>", message ? message : "" ); 204 g_snprintf( buf, sizeof( buf ), "UUX %d %zd\r\n%s", ++md->trId, strlen( uux ), uux ); 205 if( !msn_write( ic, buf, strlen( buf ) ) ) 206 return; 190 207 } 191 208 … … 314 331 account_t *acc = set->data; 315 332 struct im_connection *ic = acc->ic; 316 317 /* Allow any name if we're offline. */ 318 if( ic == NULL ) 319 return value; 333 struct msn_data *md = ic->proto_data; 334 char buf[512]; 335 char *fn; 320 336 321 337 if( strlen( value ) > 129 ) … … 325 341 } 326 342 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; 343 msn_soap_addressbook_set_display_name( ic, value ); 344 345 fn = g_malloc( strlen( value ) * 3 + 1 ); 346 strcpy( fn, value ); 347 http_encode( fn ); 348 g_snprintf( buf, sizeof( buf ), "PRP %d MFN %s\r\n", 349 ++md->trId, fn ); 350 g_free( fn ); 351 352 /* Note: We don't actually know if the server accepted the new name, 353 and won't give proper feedback yet if it doesn't. */ 354 return msn_write( ic, buf, strlen( buf ) ) ? value : NULL; 355 } 356 357 static void msn_buddy_data_add( bee_user_t *bu ) 358 { 359 struct msn_data *md = bu->ic->proto_data; 360 bu->data = g_new0( struct msn_buddy_data, 1 ); 361 g_tree_insert( md->domaintree, bu->handle, bu ); 362 } 363 364 static void msn_buddy_data_free( bee_user_t *bu ) 365 { 366 struct msn_data *md = bu->ic->proto_data; 367 g_tree_remove( md->domaintree, bu->handle ); 368 g_free( bu->data ); 331 369 } 332 370 … … 343 381 ret->set_away = msn_set_away; 344 382 ret->get_info = msn_get_info; 345 ret->set_my_name = msn_set_my_name;346 383 ret->add_buddy = msn_add_buddy; 347 384 ret->remove_buddy = msn_remove_buddy; … … 357 394 ret->send_typing = msn_send_typing; 358 395 ret->handle_cmp = g_strcasecmp; 396 ret->buddy_data_add = msn_buddy_data_add; 397 ret->buddy_data_free = msn_buddy_data_free; 398 359 399 //ret->transfer_request = msn_ftp_transfer_request; 360 400
Note: See TracChangeset
for help on using the changeset viewer.