cpw.malu.xmpp.attention: 6fb9ff94: Print to conversation from jabber_cmd_bu...

malu at pidgin.im malu at pidgin.im
Fri Jan 16 16:31:24 EST 2009


-----------------------------------------------------------------
Revision: 6fb9ff94b6589f04e961cdefd6297169cee214dd
Ancestor: 1bfc50603485b5a062a87845944329ede7756051
Author: malu at pidgin.im
Date: 2009-01-16T21:25:48
Branch: im.pidgin.cpw.malu.xmpp.attention
URL: http://d.pidgin.im/viewmtn/revision/info/6fb9ff94b6589f04e961cdefd6297169cee214dd

Modified files:
        libpurple/protocols/jabber/jabber.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	e74af529b6e672d3606bb3a874e11ad6897751be
+++ libpurple/protocols/jabber/jabber.c	097b6cdbd97a0560ef82988079a17e349ee723b5
@@ -2470,7 +2470,7 @@ static gboolean _jabber_send_buzz(Jabber
 	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 @@ static gboolean _jabber_send_buzz(Jabber
 		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 @@ static PurpleCmdRet jabber_cmd_buzz(Purp
 		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)


More information about the Commits mailing list