# HG changeset patch # User Sadrul Habib Chowdhury # Date 1190196105 0 # Node ID 28493a27849bdfb6f20e2b72f602eaef66e0cc71 # Parent ec75e26e72b36eadcff7dad878339c000a4369ce 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? diff -r ec75e26e72b3 -r 28493a27849b libpurple/blist.c --- a/libpurple/blist.c Wed Sep 19 09:52:54 2007 +0000 +++ b/libpurple/blist.c Wed Sep 19 10:01:45 2007 +0000 @@ -1442,29 +1442,7 @@ void purple_contact_set_alias(PurpleContact *contact, const char *alias) { - PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); - char *old_alias; - - g_return_if_fail(contact != NULL); - - if (!purple_strings_are_different(contact->alias, alias)) - return; - - old_alias = contact->alias; - - if ((alias != NULL) && (*alias != '\0')) - contact->alias = g_strdup(alias); - else - contact->alias = NULL; - - purple_blist_schedule_save(); - - if (ops && ops->update) - ops->update(purplebuddylist, (PurpleBlistNode*)contact); - - purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", - contact, old_alias); - g_free(old_alias); + purple_blist_alias_contact(contact,alias); } const char *purple_contact_get_alias(PurpleContact* contact) diff -r ec75e26e72b3 -r 28493a27849b libpurple/blist.h --- a/libpurple/blist.h Wed Sep 19 09:52:54 2007 +0000 +++ b/libpurple/blist.h Wed Sep 19 10:01:45 2007 +0000 @@ -65,11 +65,11 @@ typedef enum { - PURPLE_BLIST_NODE_FLAG_NO_SAVE = 1 /**< node should not be saved with the buddy list */ + PURPLE_BLIST_NODE_FLAG_NO_SAVE = 1 << 0, /**< node should not be saved with the buddy list */ } PurpleBlistNodeFlags; -#define PURPLE_BLIST_NODE_HAS_FLAG(b, f) ((b)->flags & (f)) +#define PURPLE_BLIST_NODE_HAS_FLAG(b, f) (((PurpleBlistNode*)(b))->flags & (f)) #define PURPLE_BLIST_NODE_SHOULD_SAVE(b) (! PURPLE_BLIST_NODE_HAS_FLAG(b, PURPLE_BLIST_NODE_FLAG_NO_SAVE)) #define PURPLE_BLIST_NODE_NAME(n) ((n)->type == PURPLE_BLIST_CHAT_NODE ? purple_chat_get_name((PurpleChat*)n) : \ @@ -488,6 +488,8 @@ * * @param contact The contact * @param alias The alias to set, or NULL to unset + * + * @deprecated Use purple_blist_alias_contact() instead. */ void purple_contact_set_alias(PurpleContact *contact, const char *alias);