/soc/2015/koosha/main: e3797065ca3c: Write a draft of <resumed/>...

Koosha Khajehmoogahi koosha at posteo.de
Fri Aug 21 14:46:01 EDT 2015


Changeset: e3797065ca3ced1132b622361af69e75f2198677
Author:	 Koosha Khajehmoogahi <koosha at posteo.de>
Date:	 2015-08-20 20:32 +0200
Branch:	 default
URL: https://hg.pidgin.im/soc/2015/koosha/main/rev/e3797065ca3c

Description:

Write a draft of <resumed/> packets handler

diffstat:

 libpurple/protocols/jabber/jabber.c |   2 ++
 libpurple/protocols/jabber/sm.c     |  19 +++++++++++++++++++
 libpurple/protocols/jabber/sm.h     |   1 +
 3 files changed, 22 insertions(+), 0 deletions(-)

diffs (48 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
@@ -396,6 +396,8 @@ void jabber_process_packet(JabberStream 
 		jabber_stream_management_send_ack(js);
 	} else if (purple_strequal(name, "a") && purple_strequal(xmlns, NS_XMPP_SM)) {
 		jabber_stream_management_recv_ack(js, *packet);
+	} else if (purple_strequal(name, "resumed") && purple_strequal(xmlns, NS_XMPP_SM)) {
+		jabber_stream_management_handle_resume(js, *packet);
 	} else {
 		purple_debug_warning("jabber", "Unknown packet: %s\n", name);
 	}
diff --git a/libpurple/protocols/jabber/sm.c b/libpurple/protocols/jabber/sm.c
--- a/libpurple/protocols/jabber/sm.c
+++ b/libpurple/protocols/jabber/sm.c
@@ -229,3 +229,22 @@ void jabber_stream_management_recv_ack(J
 	h_val = g_ascii_strtoll(h, NULL, 10);
 	remove_old_packets_from_buffer(js, h_val);
 }
+
+void jabber_stream_management_handle_resume(JabberStream *js, PurpleXmlNode *packet)
+{
+	char *h, *previd;
+	guint32 h_val, previd_val;
+
+	h = purple_xmlnode_get_attrib(packet, "h");
+	if (h == NULL)
+		return;
+
+	previd = purple_xmlnode_get_attrib(packet, "previd");
+	if (previd == NULL)
+		return;
+
+	h_val = g_ascii_strtoll(h, NULL, 10);
+	previd_val = g_ascii_strtoll(previd, NULL, 10);
+	/* TODO: write stream management resumption code here */
+}
+
diff --git a/libpurple/protocols/jabber/sm.h b/libpurple/protocols/jabber/sm.h
--- a/libpurple/protocols/jabber/sm.h
+++ b/libpurple/protocols/jabber/sm.h
@@ -50,5 +50,6 @@ void jabber_stream_management_parse(Jabb
 void jabber_stream_management_send_ack(JabberStream *js);
 void jabber_stream_management_recv_ack(JabberStream *js, PurpleXmlNode *packet);
 void jabber_stream_management_send_resume(JabberStream *js);
+void jabber_stream_management_handle_resume(JabberStream *js, PurpleXmlNode *packet);
 
 #endif /* PURPLE_JABBER_SM_H_ */



More information about the Commits mailing list