Mercurial > pidgin
diff libpurple/protocols/jabber/caps.c @ 30258:7fb775b4465b
jabber: Move (and harden) a function to xdata.c
Oops, I guess the const change on xmlnode_get_attrib wasn't
necessary since I had to cast away the constness so I could use
xmlnode_get_next_twin. Oh well.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 10 Jul 2010 00:59:19 +0000 |
parents | 067ad74c7523 |
children | 116ca888e77d |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/caps.c Sat Jul 10 00:56:11 2010 +0000 +++ b/libpurple/protocols/jabber/caps.c Sat Jul 10 00:59:19 2010 +0000 @@ -29,6 +29,7 @@ #include "iq.h" #include "presence.h" #include "util.h" +#include "xdata.h" #define JABBER_CAPS_FILENAME "xmpp-caps.xml" @@ -732,14 +733,6 @@ } } -static gchar *jabber_caps_get_formtype(const xmlnode *x) { - xmlnode *formtypefield; - formtypefield = xmlnode_get_child(x, "field"); - while (formtypefield && strcmp(xmlnode_get_attrib(formtypefield, "var"), "FORM_TYPE")) formtypefield = xmlnode_get_next_twin(formtypefield); - formtypefield = xmlnode_get_child(formtypefield, "value"); - return xmlnode_get_data(formtypefield);; -} - static gint jabber_xdata_compare(gconstpointer a, gconstpointer b) { @@ -749,8 +742,8 @@ char *bformtype; int result; - aformtype = jabber_caps_get_formtype(aformtypefield); - bformtype = jabber_caps_get_formtype(bformtypefield); + aformtype = jabber_x_data_get_formtype(aformtypefield); + bformtype = jabber_x_data_get_formtype(bformtypefield); result = strcmp(aformtype, bformtype); g_free(aformtype); @@ -902,7 +895,7 @@ /* concat x-data forms to the verification string */ for(node = info->forms; node; node = node->next) { xmlnode *data = (xmlnode *)node->data; - gchar *formtype = jabber_caps_get_formtype(data); + gchar *formtype = jabber_x_data_get_formtype(data); GList *fields = jabber_caps_xdata_get_fields(data); /* append FORM_TYPE's field value to the verification string */