changeset 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 51285cbe582d
files libpurple/blist.c libpurple/blist.h
diffstat 2 files changed, 5 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- 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);