/soc/2015/koosha/main: 18f9bdd43fda: XEP-0198 (Stream Management...

Koosha Khajehmoogahi koosha at posteo.de
Mon Aug 10 10:17:34 EDT 2015


Changeset: 18f9bdd43fdad59895058b40179d96bf41be28d4
Author:	 Koosha Khajehmoogahi <koosha at posteo.de>
Date:	 2015-08-07 20:36 +0200
Branch:	 default
URL: https://hg.pidgin.im/soc/2015/koosha/main/rev/18f9bdd43fda

Description:

XEP-0198 (Stream Management): check that server supports SM

diffstat:

 libpurple/protocols/jabber/jabber.c     |  10 +++++++---
 libpurple/protocols/jabber/jabber.h     |   3 ++-
 libpurple/protocols/jabber/namespaces.h |   1 +
 3 files changed, 10 insertions(+), 4 deletions(-)

diffs (53 lines):

diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c
--- a/libpurple/protocols/jabber/jabber.c
+++ b/libpurple/protocols/jabber/jabber.c
@@ -292,6 +292,10 @@ void jabber_stream_features_parse(Jabber
 		return;
 	}
 
+	/* XEP-0198: Stream Management */
+	if (purple_xmlnode_get_child_with_namespace(packet, "sm", NS_XMPP_SM))
+		js->server_caps |= JABBER_CAP_SM;
+
 	if(js->registration) {
 		jabber_register_start(js);
 	} else if(purple_xmlnode_get_child(packet, "mechanisms")) {
@@ -352,11 +356,11 @@ void jabber_process_packet(JabberStream 
 	name = (*packet)->name;
 	xmlns = purple_xmlnode_get_namespace(*packet);
 
-	if(!strcmp((*packet)->name, "iq")) {
+	if (purple_strequal(name, "iq")) {
 		jabber_iq_parse(js, *packet);
-	} else if(!strcmp((*packet)->name, "presence")) {
+	} else if (purple_strequal(name, "presence")) {
 		jabber_presence_parse(js, *packet);
-	} else if(!strcmp((*packet)->name, "message")) {
+	} else if (purple_strequal(name, "message")) {
 		jabber_message_parse(js, *packet);
 	} else if (purple_strequal(xmlns, NS_XMPP_STREAMS)) {
 		if (g_str_equal(name, "features"))
diff --git a/libpurple/protocols/jabber/jabber.h b/libpurple/protocols/jabber/jabber.h
--- a/libpurple/protocols/jabber/jabber.h
+++ b/libpurple/protocols/jabber/jabber.h
@@ -52,7 +52,8 @@ typedef enum {
 	JABBER_CAP_FACEBOOK       = 1 << 16,
 	JABBER_MSG_DELIVERY       = 1 << 17,
 	JABBER_MSG_REPLACE        = 1 << 18,
-	JABBER_CAP_CARBONS 	  = 1 << 19,
+	JABBER_CAP_CARBONS        = 1 << 19,
+	JABBER_CAP_SM             = 1 << 20,
 	JABBER_CAP_RETRIEVED      = 1 << 31
 } JabberCapabilities;
 
diff --git a/libpurple/protocols/jabber/namespaces.h b/libpurple/protocols/jabber/namespaces.h
--- a/libpurple/protocols/jabber/namespaces.h
+++ b/libpurple/protocols/jabber/namespaces.h
@@ -31,6 +31,7 @@
 #define NS_XMPP_STANZAS "urn:ietf:params:xml:ns:xmpp-stanzas"
 #define NS_XMPP_STREAMS "http://etherx.jabber.org/streams"
 #define NS_XMPP_TLS "urn:ietf:params:xml:ns:xmpp-tls"
+#define NS_XMPP_SM "urn:xmpp:sm:3"
 
 /* XEP-0012 Last Activity (and XEP-0256 Last Activity in Presence) */
 #define NS_LAST_ACTIVITY "jabber:iq:last"



More information about the Commits mailing list