/soc/2015/koosha/main: ab6afae4ec38: Implement a function for se...

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


Changeset: ab6afae4ec38e88426a33e2075bb519d2c6c30a7
Author:	 Koosha Khajehmoogahi <koosha at posteo.de>
Date:	 2015-08-18 01:46 +0200
Branch:	 default
URL: https://hg.pidgin.im/soc/2015/koosha/main/rev/ab6afae4ec38

Description:

Implement a function for sending <resume/> packets

diffstat:

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

diffs (41 lines):

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
@@ -108,6 +108,27 @@ void jabber_stream_management_send_ack(J
 	purple_xmlnode_free(ack);
 }
 
+void jabber_stream_management_send_resume(JabberStream *js)
+{
+	PurpleXmlNode *resume;
+	gchar *h, *previd;
+
+	resume = purple_xmlnode_new("resume");
+	h = g_strdup_printf("%d", js->sm->stanzas_recvd);
+	purple_xmlnode_set_attrib(resume, "h", h);
+	g_free(h);
+
+	previd = purple_account_get_string(purple_connection_get_account(js->gc), "sm_id", NULL);
+	if (previd == NULL)
+		return;
+
+	purple_xmlnode_set_attrib(resume, "previd", previd);
+	g_free(previd);
+
+	purple_xmlnode_set_namespace(resume, NS_XMPP_SM);
+	jabber_send(js, resume);
+	purple_xmlnode_free(resume);
+}
 
 static void send_ack_request(JabberStream *js)
 {
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
@@ -49,5 +49,6 @@ void jabber_stream_management_incr_outbo
 void jabber_stream_management_parse(JabberStream *js, PurpleXmlNode *packet);
 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);
 
 #endif /* PURPLE_JABBER_SM_H_ */



More information about the Commits mailing list