changeset 22332:3232cc79fa51

This is part of a patch from felipec, also known as shx, that adds purple_serv_got_private_alias for prpls to call after receiving a private alias from the server.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Wed, 27 Feb 2008 00:41:51 +0000
parents 981169c12d12
children 62856d0f2e31
files libpurple/server.c libpurple/server.h
diffstat 2 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/server.c	Tue Feb 26 14:28:52 2008 +0000
+++ b/libpurple/server.c	Wed Feb 27 00:41:51 2008 +0000
@@ -274,6 +274,29 @@
 	}
 }
 
+void
+purple_serv_got_private_alias(PurpleConnection *gc, const char *who, const char *alias)
+{
+	PurpleAccount *account = NULL;
+	GSList *buddies = NULL;
+	PurpleBuddy *b = NULL;
+
+	account = purple_connection_get_account(gc);
+	buddies = purple_find_buddies(account, who);
+
+	while(buddies != NULL) {
+		b = buddies->data;
+
+		buddies = g_slist_delete_link(buddies, buddies);
+
+		if((!b->alias && !alias) || (b->alias && alias && !strcmp(b->alias, alias)))
+			continue;
+
+		purple_blist_alias_buddy(b, alias);
+	}
+}
+
+
 PurpleAttentionType *purple_get_attention_type_from_code(PurpleAccount *account, guint type_code)
 {
 	PurplePlugin *prpl;
--- a/libpurple/server.h	Tue Feb 26 14:28:52 2008 +0000
+++ b/libpurple/server.h	Wed Feb 27 00:41:51 2008 +0000
@@ -98,6 +98,17 @@
 void serv_alias_buddy(PurpleBuddy *);
 void serv_got_alias(PurpleConnection *gc, const char *who, const char *alias);
 
+/**
+ * A protocol plugin should call this when it retrieves a private alias from
+ * the server.  Private aliases are the aliases the user sets, while public
+ * aliases are the aliases or display names that buddies set for themselves.
+ *
+ * @param gc The connection on which the alias was received.
+ * @param who The screen name of the buddy whose alias was received.
+ * @param alias The alias that was received.
+ */
+void purple_serv_got_private_alias(PurpleConnection *gc, const char *who, const char *alias);
+
 
 /**
  * Receive a typing message from a remote user.  Either PURPLE_TYPING