--- a/extend-caps Sun Mar 27 22:15:09 2011 +0200
+++ b/extend-caps Wed Apr 27 12:42:38 2011 +0300
@@ -1,6 +1,6 @@
-diff -r 55f6cdca9554 mcabber/mcabber/caps.c
---- a/mcabber/mcabber/caps.c Sun Mar 27 19:15:07 2011 +0200
-+++ b/mcabber/mcabber/caps.c Sun Mar 27 19:15:23 2011 +0200
+diff -r 47cb061121c5 mcabber/mcabber/caps.c
+--- a/mcabber/mcabber/caps.c Wed Apr 27 02:20:40 2011 +0300
++++ b/mcabber/mcabber/caps.c Wed Apr 27 12:40:36 2011 +0300
@@ -22,9 +22,14 @@
#include <glib.h>
@@ -27,12 +27,12 @@
- g_free(c->name);
- g_free(c->type);
+ GSList *iel;
-+ for (iel = c -> identities; iel; iel = iel -> next) {
-+ identity *i = iel -> data;
-+ g_free (i -> name);
-+ g_free (i -> type);
-+ g_free (i -> category);
-+ g_free (i -> lang);
++ for (iel = c->identities; iel; iel = iel->next) {
++ identity *i = iel->data;
++ g_free (i->name);
++ g_free (i->type);
++ g_free (i->category);
++ g_free (i->lang);
+ g_free (i);
+ }
g_hash_table_destroy(c->features);
@@ -55,18 +55,48 @@
- c->category = g_strdup(category);
- c->name = g_strdup(name);
- c->type = g_strdup(type);
-+ i = g_new(identity);
++ identity *i = g_new(identity, 1);
+ i->category = g_strdup(category);
+ i->name = g_strdup(name);
+ i->type = g_strdup(type);
-+ i -> lang = g_strdup (lang);
-+ c -> identities = g_slist_append (c -> identities, i); // XXX sorted
++ i->lang = g_strdup(lang);
++ c->identities = g_slist_insert_sorted (c->identities, i, (GCompareFunc)g_strcmp0);
}
}
-diff -r 55f6cdca9554 mcabber/mcabber/caps.h
---- a/mcabber/mcabber/caps.h Sun Mar 27 19:15:07 2011 +0200
-+++ b/mcabber/mcabber/caps.h Sun Mar 27 19:15:23 2011 +0200
+@@ -137,7 +152,6 @@
+ // Generates the sha1 hash for the special capability "" and returns it
+ const char *caps_generate(void)
+ {
+- char *identity;
+ GList *features;
+ GChecksum *sha1;
+ guint8 digest[20];
+@@ -148,10 +162,17 @@
+
+ g_hash_table_steal(caps_cache, "");
+ sha1 = g_checksum_new(G_CHECKSUM_SHA1);
+- identity = g_strdup_printf("%s/%s//%s<", c->category, c->type,
+- c->name ? c->name : "");
+- g_checksum_update(sha1, (guchar*)identity, -1);
+- g_free(identity);
++ {
++ GSList *iel = c->identities;
++ for (iel = c->identities; iel; iel = iel->next) {
++ identity *i = iel->data;
++ char *i_str = g_strdup_printf("%s/%s/%s/%s<", i->category, i->type,
++ i->lang ? i->lang : "",
++ i->name ? i->name : "");
++ g_checksum_update(sha1, (guchar *)i_str, -1);
++ g_free(i_str);
++ }
++ }
+
+ features = g_hash_table_get_values(c->features);
+ features = g_list_sort(features, _strcmp_sort);
+diff -r 47cb061121c5 mcabber/mcabber/caps.h
+--- a/mcabber/mcabber/caps.h Wed Apr 27 02:20:40 2011 +0300
++++ b/mcabber/mcabber/caps.h Wed Apr 27 12:40:36 2011 +0300
@@ -3,6 +3,19 @@
#include <glib.h>
@@ -87,3 +117,38 @@
void caps_init(void);
void caps_free(void);
void caps_add(char *hash);
+@@ -10,7 +23,8 @@
+ void caps_set_identity(char *hash,
+ const char *category,
+ const char *name,
+- const char *type);
++ const char *type,
++ const char *lang);
+ void caps_add_feature(char *hash, const char *feature);
+ int caps_has_feature(char *hash, char *feature);
+ void caps_foreach_feature(const char *hash, GFunc func, gpointer user_data);
+diff -r 47cb061121c5 mcabber/mcabber/xmpp.c
+--- a/mcabber/mcabber/xmpp.c Wed Apr 27 02:20:40 2011 +0300
++++ b/mcabber/mcabber/xmpp.c Wed Apr 27 12:40:36 2011 +0300
+@@ -1342,7 +1342,8 @@
+ if (info)
+ caps_set_identity(ver, lm_message_node_get_attribute(info, "category"),
+ lm_message_node_get_attribute(info, "name"),
+- lm_message_node_get_attribute(info, "type"));
++ lm_message_node_get_attribute(info, "type"),
++ lm_message_node_get_attribute(info, "lang"));
+ info = lm_message_node_get_child(query, "feature");
+ while (info) {
+ if (!g_strcmp0(info->name, "feature"))
+diff -r 47cb061121c5 mcabber/mcabber/xmpp_helper.c
+--- a/mcabber/mcabber/xmpp_helper.c Wed Apr 27 02:20:40 2011 +0300
++++ b/mcabber/mcabber/xmpp_helper.c Wed Apr 27 12:40:36 2011 +0300
+@@ -222,7 +222,7 @@
+ return ver_notavail;
+
+ caps_add("");
+- caps_set_identity("", "client", PACKAGE_STRING, "pc");
++ caps_set_identity("", "client", PACKAGE_STRING, "pc", NULL);
+ caps_add_feature("", NS_DISCO_INFO);
+ caps_add_feature("", NS_MUC);
+ // advertise ChatStates only if they aren't disabled