comparison libpurple/blist.c @ 20550:28493a27849b

Looking at purple_contact_set_alias and purple_blist_alias_contact functions in blist.c, the only difference I see is that the latter function notifies any existing conversation with the contact so that it can update its title, while the former doesn't. I can't think of a reason why they should behave differently, or why we should have both of them. I was going to deprecate purple_blist_alias_contact in favour of purple_contact_set_alias, but seeing we do purple_blist_alias_ for buddy and chats, I am deprecating purple_contact_set_alias instead. OK?
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 19 Sep 2007 10:01:45 +0000
parents ec75e26e72b3
children 4c910fcb5b0a
comparison
equal deleted inserted replaced
20549:ec75e26e72b3 20550:28493a27849b
1440 return contact; 1440 return contact;
1441 } 1441 }
1442 1442
1443 void purple_contact_set_alias(PurpleContact *contact, const char *alias) 1443 void purple_contact_set_alias(PurpleContact *contact, const char *alias)
1444 { 1444 {
1445 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); 1445 purple_blist_alias_contact(contact,alias);
1446 char *old_alias;
1447
1448 g_return_if_fail(contact != NULL);
1449
1450 if (!purple_strings_are_different(contact->alias, alias))
1451 return;
1452
1453 old_alias = contact->alias;
1454
1455 if ((alias != NULL) && (*alias != '\0'))
1456 contact->alias = g_strdup(alias);
1457 else
1458 contact->alias = NULL;
1459
1460 purple_blist_schedule_save();
1461
1462 if (ops && ops->update)
1463 ops->update(purplebuddylist, (PurpleBlistNode*)contact);
1464
1465 purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased",
1466 contact, old_alias);
1467 g_free(old_alias);
1468 } 1446 }
1469 1447
1470 const char *purple_contact_get_alias(PurpleContact* contact) 1448 const char *purple_contact_get_alias(PurpleContact* contact)
1471 { 1449 {
1472 g_return_val_if_fail(contact != NULL, NULL); 1450 g_return_val_if_fail(contact != NULL, NULL);