changeset 24846:689cfb82242e

Use purple_prpl_got_attention() for XMPP notifications
author Evan Schoenberg <evan.s@dreskin.net>
date Sun, 28 Dec 2008 00:39:39 +0000
parents 9a371554f686
children 5a435e953bc6 2ce759d9176a 302f13678ea3 8095bbba9832 fb3e9bff199e
files libpurple/protocols/jabber/message.c
diffstat 1 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/message.c	Sat Dec 27 10:04:33 2008 +0000
+++ b/libpurple/protocols/jabber/message.c	Sun Dec 28 00:39:39 2008 +0000
@@ -291,27 +291,28 @@
 	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);
 }