/soc/2015/koosha/main: 94a535d119e3: Parse 'location' attribute
Koosha Khajehmoogahi <[email protected]>
| Newsgroups | gmane.comp.gnome.gaim.cvs |
|---|---|
| Message-ID | <[email protected]> |
Changeset: 94a535d119e33893f507c89f1472198d6af4e412 Author: Koosha Khajehmoogahi <[email protected]> Date: 2015-08-17 20:51 +0200 Branch: default URL: https://hg.pidgin.im/soc/2015/koosha/main/rev/94a535d119e3 Description: Parse 'location' attribute diffstat: libpurple/protocols/jabber/jabber.c | 1 + libpurple/protocols/jabber/sm.c | 10 ++++++---- libpurple/protocols/jabber/sm.h | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diffs (60 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 @@ -1702,6 +1702,7 @@ void jabber_close(PurpleConnection *gc) js->commands = g_list_delete_link(js->commands, js->commands); } g_hash_table_destroy(js->sm->packets_buffer); + g_free(js->sm->location); g_free(js->sm); g_free(js->server_name); g_free(js->certificate_CN); 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 @@ -37,6 +37,7 @@ JabberSM *jabber_stream_management_init( sm->stanzas_sent = 0; sm->stanzas_recvd = 0; sm->last_acked_stanza = 0; + sm->location = NULL; sm->packets_buffer = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, (GDestroyNotify)purple_xmlnode_free); @@ -58,12 +59,9 @@ void jabber_stream_management_enable(Jab sent_enable_packet = TRUE; } -/* - * TODO: parse the 'location' attribute as well - */ void jabber_stream_management_parse(JabberStream *js, PurpleXmlNode *packet) { - const char *resume, *id, *max; + const char *resume, *id, *max, *location; PurpleAccount *account; gboolean resume_enabled; @@ -86,6 +84,10 @@ void jabber_stream_management_parse(Jabb max = purple_xmlnode_get_attrib(packet, "max"); if (max) purple_account_set_string(account, "sm_max", max); + + location = purple_xmlnode_get_attrib(packet, "location"); + if (location) + js->sm->location = g_strdup(location); } } 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 @@ -29,6 +29,9 @@ struct _JabberSM { guint32 stanzas_sent; guint32 stanzas_recvd; + /* Possible location of an alternative server for reconnecting */ + char *location; + /* Holds the number of the stanzas that have been acked by server */ guint32 last_acked_stanza; _______________________________________________ Commits mailing list [email protected] https://pidgin.im/cgi-bin/mailman/listinfo/commits