Ticket #1169: skype-displayname.patch
File skype-displayname.patch, 3.0 KB (added by , at 2014-07-20T11:30:01Z) |
---|
-
protocols/skype/skype.c
old new 93 93 int topic_wait; 94 94 /* These are used by the info command. */ 95 95 char *info_fullname; 96 char *info_displayname; 96 97 char *info_phonehome; 97 98 char *info_phoneoffice; 98 99 char *info_phonemobile; … … 117 118 /* Pending user which has to be added to the next group which is 118 119 * created. */ 119 120 char *pending_user; 120 /* If the info command was used, to determine what to do with FULLNAME result. */ 121 int is_info; 121 /* If the info command was used, to determine what to do with 122 * FULLNAME & DISPLAYNAME result. */ 123 int is_info_fullname; 124 int is_info_displayname; 122 125 }; 123 126 124 127 struct skype_away_state { … … 324 327 for (i = nicks; *i; i++) { 325 328 skype_printf(ic, "GET USER %s ONLINESTATUS\n", *i); 326 329 skype_printf(ic, "GET USER %s FULLNAME\n", *i); 330 skype_printf(ic, "GET USER %s DISPLAYNAME\n", *i); 327 331 } 328 332 g_strfreev(nicks); 329 333 } … … 380 384 imcb_log(ic, "User `%s' changed mood text to `%s'", user, buf); 381 385 } else if (!strncmp(ptr, "FULLNAME ", 9)) { 382 386 char *name = ptr + 9; 383 if (sd->is_info ) {384 sd->is_info = FALSE;387 if (sd->is_info_fullname) { 388 sd->is_info_fullname = FALSE; 385 389 sd->info_fullname = g_strdup(name); 386 390 } else { 387 391 char *buf = g_strdup_printf("%s@skype.com", user); 388 imcb_rename_buddy(ic, buf, name); 389 g_free(buf); 392 if (strlen(name)) { 393 imcb_rename_buddy(ic, buf, name); 394 bee_t *bee = ic->bee; 395 bee_user_t *bu = bee_user_by_handle(bee, ic, buf); 396 if (bu) 397 bee->ui->user_group(bee, bu); 398 g_free(buf); 399 } 400 } 401 } else if (!strncmp(ptr, "DISPLAYNAME ", 12)) { 402 char *name = ptr + 12; 403 if (sd->is_info_displayname) { 404 sd->is_info_displayname = FALSE; 405 sd->info_displayname = g_strdup(name); 406 } else { 407 if (strlen(name)) { 408 char *buf = g_strdup_printf("%s@skype.com", user); 409 imcb_rename_buddy(ic, buf, name); 410 bee_t *bee = ic->bee; 411 bee_user_t *bu = bee_user_by_handle(bee, ic, buf); 412 if (bu) 413 bee->ui->user_group(bee, bu); 414 g_free(buf); 415 } 390 416 } 391 417 } else if (!strncmp(ptr, "PHONE_HOME ", 11)) 392 418 sd->info_phonehome = g_strdup(ptr + 11); … … 435 461 g_free(sd->info_fullname); 436 462 sd->info_fullname = NULL; 437 463 } 464 if (sd->info_displayname) { 465 if (strlen(sd->info_displayname)) 466 g_string_append_printf(st, "Display Name: %s\n", 467 sd->info_displayname); 468 g_free(sd->info_displayname); 469 sd->info_displayname = NULL; 470 } 438 471 if (sd->info_phonehome) { 439 472 if (strlen(sd->info_phonehome)) 440 473 g_string_append_printf(st, "Home Phone: %s\n", … … 1527 1560 ptr = strchr(nick, '@'); 1528 1561 if (ptr) 1529 1562 *ptr = '\0'; 1530 sd->is_info = TRUE; 1563 sd->is_info_fullname = TRUE; 1564 sd->is_info_displayname = TRUE; 1531 1565 skype_printf(ic, "GET USER %s FULLNAME\n", nick); 1566 skype_printf(ic, "GET USER %s DISPLAYNAME\n", nick); 1532 1567 skype_printf(ic, "GET USER %s PHONE_HOME\n", nick); 1533 1568 skype_printf(ic, "GET USER %s PHONE_OFFICE\n", nick); 1534 1569 skype_printf(ic, "GET USER %s PHONE_MOBILE\n", nick);