Changes in protocols/msn/msn.c [9bf2481:70ac477]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.c
r9bf2481 r70ac477 31 31 GSList *msn_switchboards; 32 32 33 static char * msn_set_display_name( set_t *set, char *value );33 static char *set_eval_display_name( set_t *set, char *value ); 34 34 35 35 static void msn_init( account_t *acc ) 36 36 { 37 set_t *s; 38 39 s = set_add( &acc->set, "display_name", NULL, msn_set_display_name, acc ); 40 s->flags |= ACC_SET_NOSAVE | ACC_SET_ONLINE_ONLY; 41 42 s = set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc ); 43 44 s = set_add( &acc->set, "switchboard_keepalives", "false", set_eval_bool, acc ); 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 ); 39 set_add( &acc->set, "mail_notifications", "false", set_eval_bool, acc ); 40 set_add( &acc->set, "switchboard_keepalives", "false", set_eval_bool, acc ); 45 41 } 46 42 … … 83 79 if( md ) 84 80 { 81 /** Disabling MSN ft support for now. 82 while( md->filetransfers ) { 83 imcb_file_canceled( md->filetransfers->data, "Closing connection" ); 84 } 85 */ 86 85 87 if( md->fd >= 0 ) 86 88 closesocket( md->fd ); … … 102 104 g_free( md->grouplist ); 103 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 104 115 g_free( md ); 105 116 } … … 120 131 struct msn_switchboard *sb; 121 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 122 141 if( ( sb = msn_sb_by_handle( ic, who ) ) ) 123 142 { … … 169 188 static void msn_set_my_name( struct im_connection *ic, char *info ) 170 189 { 171 msn_set_display_name( set_find( &ic->acc->set, "display_name" ), info );190 msn_set_display_name( ic, info ); 172 191 } 173 192 … … 180 199 static void msn_add_buddy( struct im_connection *ic, char *who, char *group ) 181 200 { 182 msn_buddy_list_add( ic, "FL", who, who );201 msn_buddy_list_add( ic, "FL", who, who, group ); 183 202 } 184 203 … … 221 240 { 222 241 struct msn_switchboard *sb; 242 struct groupchat *c = imcb_chat_new( ic, who ); 223 243 224 244 if( ( sb = msn_sb_by_handle( ic, who ) ) ) … … 238 258 msn_sb_write_msg( ic, m ); 239 259 240 return NULL; 241 } 242 243 return NULL; 260 return c; 261 } 244 262 } 245 263 … … 251 269 static void msn_add_permit( struct im_connection *ic, char *who ) 252 270 { 253 msn_buddy_list_add( ic, "AL", who, who );271 msn_buddy_list_add( ic, "AL", who, who, NULL ); 254 272 } 255 273 … … 263 281 struct msn_switchboard *sb; 264 282 265 msn_buddy_list_add( ic, "BL", who, who );283 msn_buddy_list_add( ic, "BL", who, who, NULL ); 266 284 267 285 /* If there's still a conversation with this person, close it. */ … … 285 303 } 286 304 287 static char * msn_set_display_name( set_t *set, char *value )305 static char *set_eval_display_name( set_t *set, char *value ) 288 306 { 289 307 account_t *acc = set->data; 290 308 struct im_connection *ic = acc->ic; 291 struct msn_data *md; 292 char buf[1024], *fn; 293 294 /* Double-check. */ 309 310 /* Allow any name if we're offline. */ 295 311 if( ic == NULL ) 296 return NULL; 297 298 md = ic->proto_data; 312 return value; 299 313 300 314 if( strlen( value ) > 129 ) … … 303 317 return NULL; 304 318 } 305 306 fn = msn_http_encode( value );307 308 g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, ic->acc->user, fn );309 msn_write( ic, buf, strlen( buf ) );310 g_free( fn );311 319 312 320 /* Returning NULL would be better, because the server still has to 313 321 confirm the name change. However, it looks a bit confusing to the 314 322 user. */ 315 return value;323 return msn_set_display_name( ic, value ) ? value : NULL; 316 324 } 317 325 … … 342 350 ret->send_typing = msn_send_typing; 343 351 ret->handle_cmp = g_strcasecmp; 352 //ret->transfer_request = msn_ftp_transfer_request; 344 353 345 354 register_protocol(ret);
Note: See TracChangeset
for help on using the changeset viewer.