pidgin: f94ddf7f: Use purple_prpl_got_attention() for XMPP...

evands at pidgin.im evands at pidgin.im
Sat Dec 27 19:46:16 EST 2008


-----------------------------------------------------------------
Revision: f94ddf7fa975e3a39a53fccae31b7e73f892fd57
Ancestor: 2874a3cd1fd06178cd187d7a6d4b9199d7b5ec00
Author: evands at pidgin.im
Date: 2008-12-28T00:39:39
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/f94ddf7fa975e3a39a53fccae31b7e73f892fd57

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

ChangeLog: 

Use purple_prpl_got_attention() for XMPP notifications

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/message.c	6294dd8a4e9b85afe7ec739fb8597b88150aafb0
+++ libpurple/protocols/jabber/message.c	74647fb848e91449b49a542c2c8f5568cae1ff33
@@ -291,27 +291,28 @@ static void handle_buzz(JabberMessage *j
 	PurpleAccount *account;
 	PurpleConversation *c;
 	char *username, *str;
-	
+
 	/* Delayed buzz MUST NOT be accepted */
 	if(jm->delayed)
 		return;
-	
+
 	/* Reject buzz when it's not enabled */
 	if(!jm->js->allowBuzz)
 		return;
-	
+
 	account = purple_connection_get_account(jm->js->gc);
-	
-	if ((buddy = purple_find_buddy(account, jm->from)) != NULL)
-		username = g_markup_escape_text(purple_buddy_get_alias(buddy), -1);
-	else
+
+	if ((buddy = purple_find_buddy(account, jm->from)) == NULL)
 		return; /* Do not accept buzzes from unknown people */
 
-	c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, jm->from);
+	c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, jm->from, account);
+	if (c == NULL)
+		c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, jm->from);
 
-	str = g_strdup_printf(_("%s has buzzed you!"), username);
-	
-	purple_conversation_write(c, NULL, str, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL));
+	username = g_markup_escape_text(purple_buddy_get_alias(buddy), -1);
+	/* xmpp only has 1 attention type, so index is 0 */
+	purple_prpl_got_attention(jm->js->gc, username, 0);
+
 	g_free(username);
 	g_free(str);
 }


More information about the Commits mailing list