changeset 28663:5b449584fead

jabber: Delayed Delivery namespaces
author Paul Aurich <paul@darkrain42.org>
date Sat, 28 Nov 2009 04:05:17 +0000
parents 5306a71c4eb2
children 931d6906291b
files libpurple/protocols/jabber/message.c libpurple/protocols/jabber/namespaces.h libpurple/protocols/jabber/presence.c
diffstat 3 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/message.c	Sat Nov 28 02:45:45 2009 +0000
+++ b/libpurple/protocols/jabber/message.c	Sat Nov 28 04:05:17 2009 +0000
@@ -742,13 +742,13 @@
 				jm->eventitems = g_list_append(jm->eventitems, items);
 		} else if(!strcmp(child->name, "attention") && !strcmp(xmlns, NS_ATTENTION)) {
 			jm->hasBuzz = TRUE;
-		} else if(!strcmp(child->name, "delay") && !strcmp(xmlns,"urn:xmpp:delay")) {
+		} else if(!strcmp(child->name, "delay") && !strcmp(xmlns, NS_DELAYED_DELIVERY)) {
 			const char *timestamp = xmlnode_get_attrib(child, "stamp");
 			jm->delayed = TRUE;
 			if(timestamp)
 				jm->sent = purple_str_to_time(timestamp, TRUE, NULL, NULL, NULL);
 		} else if(!strcmp(child->name, "x")) {
-			if(!strcmp(xmlns, "jabber:x:delay")) {
+			if(!strcmp(xmlns, NS_DELAYED_DELIVERY_LEGACY)) {
 				const char *timestamp = xmlnode_get_attrib(child, "stamp");
 				jm->delayed = TRUE;
 				if(timestamp)
--- a/libpurple/protocols/jabber/namespaces.h	Sat Nov 28 02:45:45 2009 +0000
+++ b/libpurple/protocols/jabber/namespaces.h	Sat Nov 28 04:05:17 2009 +0000
@@ -69,6 +69,10 @@
 /* XEP-0202 Entity Time */
 #define NS_ENTITY_TIME "urn:xmpp:time"
 
+/* XEP-0203 Delayed Delivery (and legacy delayed delivery) */
+#define NS_DELAYED_DELIVERY "urn:xmpp:delay"
+#define NS_DELAYED_DELIVERY_LEGACY "jabber:x:delay"
+
 /* XEP-0224 Attention */
 #define NS_ATTENTION "urn:xmpp:attention:0"
 
--- a/libpurple/protocols/jabber/presence.c	Sat Nov 28 02:45:45 2009 +0000
+++ b/libpurple/protocols/jabber/presence.c	Sat Nov 28 04:05:17 2009 +0000
@@ -633,7 +633,7 @@
 		} else if(xmlns == NULL) {
 			/* The rest of the cases used to check xmlns individually. */
 			continue;
-		} else if(!strcmp(y->name, "delay") && !strcmp(xmlns, "urn:xmpp:delay")) {
+		} else if(!strcmp(y->name, "delay") && !strcmp(xmlns, NS_DELAYED_DELIVERY)) {
 			/* XXX: compare the time.  jabber:x:delay can happen on presence packets that aren't really and truly delayed */
 			delayed = TRUE;
 			stamp = xmlnode_get_attrib(y, "stamp");
@@ -642,7 +642,7 @@
 		} else if (g_str_equal(y->name, "nick") && g_str_equal(xmlns, "http://jabber.org/protocol/nick")) {
 			nickname = xmlnode_get_data(y);
 		} else if(!strcmp(y->name, "x")) {
-			if(!strcmp(xmlns, "jabber:x:delay")) {
+			if(!strcmp(xmlns, NS_DELAYED_DELIVERY_LEGACY)) {
 				/* XXX: compare the time.  jabber:x:delay can happen on presence packets that aren't really and truly delayed */
 				delayed = TRUE;
 				stamp = xmlnode_get_attrib(y, "stamp");