changeset 25706:8dee1fb9d8e9

Print to conversation from jabber_cmd_buzz, this prevents printing two info text lines when sending a buzz through purple_prpl_send_attention Print the alias for the buddy, if known.
author Marcus Lundblad <ml@update.uu.se>
date Fri, 16 Jan 2009 21:25:48 +0000
parents 9d023b5d7daf
children b707ec143eee
files libpurple/protocols/jabber/jabber.c
diffstat 1 files changed, 22 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Tue Jan 13 19:47:02 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Fri Jan 16 21:25:48 2009 +0000
@@ -2470,7 +2470,7 @@
 	if (jabber_resource_has_capability(jbr, XEP_0224_NAMESPACE)) {
 		xmlnode *buzz, *msg = xmlnode_new("message");
 		gchar *to;
-
+		
 		to = g_strdup_printf("%s/%s", username, jbr->name);
 		xmlnode_set_attrib(msg, "to", to);
 		g_free(to);
@@ -2484,11 +2484,6 @@
 		jabber_send(js, msg);
 		xmlnode_free(msg);
 
-		str = g_strdup_printf(_("Buzzing %s..."), username);
-		purple_conversation_write(conv, NULL, str, 
-			PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL));
-		g_free(str);
-		
 		return TRUE;
 	} else {
 		*error = g_strdup_printf(_("Unable to buzz, because the user %s does "
@@ -2515,7 +2510,27 @@
 		who = args[0];
 	}
 	
-	return _jabber_send_buzz(js, who, error)  ? PURPLE_CMD_RET_OK : PURPLE_CMD_RET_FAILED;
+	if (_jabber_send_buzz(js, who, error)) {
+		const gchar *alias;
+		const gchar *str;
+		PurpleBuddy *buddy =
+			purple_find_buddy(purple_connection_get_account(conv->account->gc), 
+				who);
+		
+		if (buddy != NULL)
+			alias = purple_buddy_get_contact_alias(buddy);
+		else
+			alias = who;
+		
+		str = g_strdup_printf(_("Buzzing %s..."), alias);
+		purple_conversation_write(conv, NULL, str, 
+			PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL));
+		g_free(str);
+		
+		return PURPLE_CMD_RET_OK;
+	} else {
+		return PURPLE_CMD_RET_FAILED;
+	}
 }
 
 GList *jabber_attention_types(PurpleAccount *account)