changeset 17889:9686d549f084

Switched buzz namespace and tag name to be libpurple-specific and use a more professionally-sounding name ('attention' instead of 'buzz').
author Andreas Monitzer <pidgin@monitzer.com>
date Tue, 03 Jul 2007 11:04:50 +0000
parents cca457b9158b
children 935005186312
files libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/libxmpp.c libpurple/protocols/jabber/message.c
diffstat 3 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Fri Jun 29 21:44:42 2007 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Tue Jul 03 11:04:50 2007 +0000
@@ -2075,7 +2075,7 @@
 		return PURPLE_CMD_RET_FAILED;
 	}
 	for(iter = jbr->caps->features; iter; iter = g_list_next(iter)) {
-		if(!strcmp(iter->data, "http://pidgin.im/xmpp/buzz")) {
+		if(!strcmp(iter->data, "http://pidgin.im/libpurple/xmpp/attention")) {
 			msg = xmlnode_new("message");
 			to = g_strdup_printf("%s/%s", args[0], jbr->name);
 			xmlnode_set_attrib(msg,"to",to);
@@ -2084,8 +2084,8 @@
 			/* avoid offline storage */
 			xmlnode_set_attrib(msg,"type","headline");
 			
-			buzz = xmlnode_new_child(msg,"buzz");
-			xmlnode_set_namespace(buzz,"http://pidgin.im/xmpp/buzz");
+			buzz = xmlnode_new_child(msg,"attention");
+			xmlnode_set_namespace(buzz,"http://pidgin.im/libpurple/xmpp/attention");
 			
 			jabber_send(js,msg);
 			xmlnode_free(msg);
--- a/libpurple/protocols/jabber/libxmpp.c	Fri Jun 29 21:44:42 2007 +0000
+++ b/libpurple/protocols/jabber/libxmpp.c	Tue Jul 03 11:04:50 2007 +0000
@@ -239,7 +239,7 @@
 
 		jabber_add_feature("avatarmeta", AVATARNAMESPACEMETA, jabber_pep_namespace_only_when_pep_enabled_cb);
 		jabber_add_feature("avatardata", AVATARNAMESPACEDATA, jabber_pep_namespace_only_when_pep_enabled_cb);
-		jabber_add_feature("buzz", "http://pidgin.im/xmpp/buzz", NULL);
+		jabber_add_feature("buzz", "http://pidgin.im/libpurple/xmpp/attention", NULL);
 		
 		jabber_pep_register_handler("avatar", AVATARNAMESPACEMETA, jabber_buddy_avatar_update_metadata);
 }
--- a/libpurple/protocols/jabber/message.c	Fri Jun 29 21:44:42 2007 +0000
+++ b/libpurple/protocols/jabber/message.c	Tue Jul 03 11:04:50 2007 +0000
@@ -284,14 +284,19 @@
 	PurpleConversation *c;
 	char *username, *str;
 	
+	/* Delayed buzz MUST NOT be accepted */
+	if(jm->delayed)
+		return;
+	
 	account = purple_connection_get_account(jm->js->gc);
-	c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, jm->from);
 	
 	if ((buddy = purple_find_buddy(account, jm->from)) != NULL)
 		username = g_markup_escape_text(purple_buddy_get_alias(buddy), -1);
 	else
-		username = g_markup_escape_text(jm->from, -1);
-	
+		return; /* Do not accept buzzes from unknown people */
+
+	c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, jm->from);
+
 	str = g_strdup_printf(_("%s just sent you a Buzz!"), username);
 	
 	purple_conversation_write(c, NULL, str, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL));
@@ -384,7 +389,7 @@
 			jm->type = JABBER_MESSAGE_EVENT;
 			for(items = xmlnode_get_child(child,"items"); items; items = items->next)
 				jm->eventitems = g_list_append(jm->eventitems, items);
-		} else if(!strcmp(child->name, "buzz") && !strcmp(xmlns,"http://pidgin.im/xmpp/buzz")) {
+		} else if(!strcmp(child->name, "attention") && !strcmp(xmlns,"http://pidgin.im/libpurple/xmpp/attention")) {
 			jm->hasBuzz = TRUE;
 		} else if(!strcmp(child->name, "error")) {
 			const char *code = xmlnode_get_attrib(child, "code");