Mercurial > pidgin
changeset 25160:c8b4029d37c5
Whitespace and formatting changes
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 22 Nov 2008 00:42:56 +0000 |
parents | 7155fa3ec052 |
children | 0ccb80ae7262 |
files | libpurple/protocols/jabber/caps.c |
diffstat | 1 files changed, 21 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/caps.c Fri Nov 21 23:44:30 2008 +0000 +++ b/libpurple/protocols/jabber/caps.c Sat Nov 22 00:42:56 2008 +0000 @@ -702,34 +702,36 @@ return info; } -static gint jabber_caps_xdata_field_compare(gconstpointer a, gconstpointer b) { - const JabberDataFormField *ac; - const JabberDataFormField *bc; - - ac = a; - bc = b; - +static gint jabber_caps_xdata_field_compare(gconstpointer a, gconstpointer b) +{ + const JabberDataFormField *ac = a; + const JabberDataFormField *bc = b; + return strcmp(ac->var, bc->var); } -static GList *jabber_caps_xdata_get_fields(const xmlnode *x) { - GList *fields = 0; +static GList* jabber_caps_xdata_get_fields(const xmlnode *x) +{ + GList *fields = NULL; xmlnode *field; - xmlnode *value; - JabberDataFormField *xdatafield; - - if(!x) return 0; - - for(field = xmlnode_get_child(x, "field"); field != 0; field = xmlnode_get_next_twin(field)) { - xdatafield = g_new0(JabberDataFormField, 1); + + if (!x) + return NULL; + + for (field = xmlnode_get_child(x, "field"); field; field = xmlnode_get_next_twin(field)) { + xmlnode *value; + JabberDataFormField *xdatafield = g_new0(JabberDataFormField, 1); xdatafield->var = g_strdup(xmlnode_get_attrib(field, "var")); - for(value = xmlnode_get_child(field, "value"); value != 0; value = xmlnode_get_next_twin(value)) { + + for (value = xmlnode_get_child(field, "value"); value; value = xmlnode_get_next_twin(value)) { gchar *val = xmlnode_get_data(value); xdatafield->values = g_list_append(xdatafield->values, val); } + xdatafield->values = g_list_sort(xdatafield->values, (GCompareFunc)strcmp); fields = g_list_append(fields, xdatafield); - } + } + fields = g_list_sort(fields, jabber_caps_xdata_field_compare); return fields; } @@ -786,7 +788,7 @@ GList *value; JabberDataFormField *field = (JabberDataFormField*)fields->data; - if(strcmp(field->var, "FORM_TYPE")) { + if (strcmp(field->var, "FORM_TYPE")) { /* Append the "var" attribute */ verification = jabber_caps_verification_append(verification, field->var); /* Append <value/> element's cdata */