Changeset 69cb623 for protocols/msn
- Timestamp:
- 2006-10-15T09:41:12Z (18 years ago)
- Branches:
- master
- Children:
- 2529faf
- Parents:
- 695e392 (diff), e97827b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- protocols/msn
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/msn.c
r695e392 r69cb623 27 27 #include "msn.h" 28 28 29 static void msn_login( struct aim_user *acct ) 30 { 31 struct gaim_connection *gc = new_gaim_conn( acct ); 29 static char *msn_set_display_name( set_t *set, char *value ); 30 31 static void msn_acc_init( account_t *acc ) 32 { 33 set_t *s; 34 35 s = set_add( &acc->set, "display_name", NULL, msn_set_display_name, acc ); 36 s->flags |= ACC_SET_NOSAVE | ACC_SET_ONLINE_ONLY; 37 } 38 39 static void msn_login( account_t *acc ) 40 { 41 struct gaim_connection *gc = new_gaim_conn( acc ); 32 42 struct msn_data *md = g_new0( struct msn_data, 1 ); 33 43 … … 37 47 md->fd = -1; 38 48 39 if( strchr( acc t->username, '@' ) == NULL )49 if( strchr( acc->user, '@' ) == NULL ) 40 50 { 41 51 hide_login_progress( gc, "Invalid account name" ); … … 212 222 static void msn_set_info( struct gaim_connection *gc, char *info ) 213 223 { 214 char buf[1024], *fn; 215 struct msn_data *md = gc->proto_data; 216 217 if( strlen( info ) > 129 ) 218 { 219 do_error_dialog( gc, "Maximum name length exceeded", "MSN" ); 220 return; 221 } 222 223 fn = msn_http_encode( info ); 224 225 g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, gc->username, fn ); 226 msn_write( gc, buf, strlen( buf ) ); 227 g_free( fn ); 224 msn_set_display_name( set_find( &gc->acc->set, "display_name" ), info ); 228 225 } 229 226 … … 364 361 } 365 362 363 static char *msn_set_display_name( set_t *set, char *value ) 364 { 365 account_t *acc = set->data; 366 struct gaim_connection *gc = acc->gc; 367 struct msn_data *md; 368 char buf[1024], *fn; 369 int i; 370 371 /* Double-check. */ 372 if( gc == NULL ) 373 return NULL; 374 375 md = gc->proto_data; 376 377 if( strlen( value ) > 129 ) 378 { 379 serv_got_crap( gc, "Maximum name length exceeded" ); 380 return NULL; 381 } 382 383 fn = msn_http_encode( value ); 384 385 g_snprintf( buf, sizeof( buf ), "REA %d %s %s\r\n", ++md->trId, gc->username, fn ); 386 msn_write( gc, buf, strlen( buf ) ); 387 g_free( fn ); 388 389 /* Returning NULL would be better, because the server still has to 390 confirm the name change. However, it looks a bit confusing to the 391 user. */ 392 return value; 393 } 394 366 395 void msn_init() 367 396 { 368 397 struct prpl *ret = g_new0(struct prpl, 1); 398 369 399 ret->name = "msn"; 370 400 ret->login = msn_login; 401 ret->acc_init = msn_acc_init; 371 402 ret->close = msn_close; 372 403 ret->send_im = msn_send_im; … … 388 419 ret->rem_deny = msn_rem_deny; 389 420 ret->send_typing = msn_send_typing; 390 ret-> cmp_buddynames= g_strcasecmp;421 ret->handle_cmp = g_strcasecmp; 391 422 392 423 register_protocol(ret); -
protocols/msn/ns.c
r695e392 r69cb623 223 223 else if( num_parts == 7 && strcmp( cmd[2], "OK" ) == 0 ) 224 224 { 225 set_t *s; 226 225 227 http_decode( cmd[4] ); 226 228 227 229 strncpy( gc->displayname, cmd[4], sizeof( gc->displayname ) ); 228 230 gc->displayname[sizeof(gc->displayname)-1] = 0; 231 232 if( ( s = set_find( &gc->acc->set, "display_name" ) ) ) 233 { 234 g_free( s->value ); 235 s->value = g_strdup( cmd[4] ); 236 } 229 237 230 238 set_login_progress( gc, 1, "Authenticated, getting buddy list" ); … … 517 525 if( g_strcasecmp( cmd[3], gc->username ) == 0 ) 518 526 { 527 set_t *s; 528 519 529 http_decode( cmd[4] ); 520 530 strncpy( gc->displayname, cmd[4], sizeof( gc->displayname ) ); 521 531 gc->displayname[sizeof(gc->displayname)-1] = 0; 532 533 if( ( s = set_find( &gc->acc->set, "display_name" ) ) ) 534 { 535 g_free( s->value ); 536 s->value = g_strdup( cmd[4] ); 537 } 522 538 } 523 539 else
Note: See TracChangeset
for help on using the changeset viewer.