changeset 1255:ceada40bbe20

Update Entity Capabilities (add iq:last)
author Mikael Berthe <mikael@lilotux.net>
date Fri, 22 Jun 2007 20:24:19 +0200
parents 401639413340
children ea679e3598a9
files mcabber/src/jab_iq.c mcabber/src/jabglue.c
diffstat 2 files changed, 28 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/jab_iq.c	Fri Jun 22 19:21:23 2007 +0200
+++ b/mcabber/src/jab_iq.c	Fri Jun 22 20:24:19 2007 +0200
@@ -112,14 +112,15 @@
 const char *entity_version(void)
 {
   static char *ver;
+  const char *PVERSION = PACKAGE_VERSION "+iql";
 
   if (ver)
     return ver;
 
 #ifdef HGCSET
-  ver = g_strdup_printf("%s-%s", PACKAGE_VERSION, HGCSET);
+  ver = g_strdup_printf("%s-%s", PVERSION, HGCSET);
 #else
-  ver = g_strdup(PACKAGE_VERSION);
+  ver = g_strdup(PVERSION);
 #endif
 
   return ver;
@@ -1301,6 +1302,11 @@
     xmlnode_put_attrib(xmlnode_insert_tag(ansquery, "feature"),
                        "var", NS_CHATSTATES);
   }
+  if (!strcasecmp(ext, "iql")) {
+    // I guess it's ok to send this even if it's not compiled in.
+    xmlnode_put_attrib(xmlnode_insert_tag(ansquery, "feature"),
+                       "var", NS_LAST);
+  }
 }
 
 //  disco_info_set_default(ansquery, entitycaps)
@@ -1341,6 +1347,9 @@
                      "var", NS_PING);
   xmlnode_put_attrib(xmlnode_insert_tag(ansquery, "feature"),
                      "var", NS_COMMANDS);
+  if (!entitycaps)
+    xmlnode_put_attrib(xmlnode_insert_tag(ansquery, "feature"),
+                       "var", NS_LAST);
 }
 
 static void handle_iq_disco_info(jconn conn, char *from, const char *id,
--- a/mcabber/src/jabglue.c	Fri Jun 22 19:21:23 2007 +0200
+++ b/mcabber/src/jabglue.c	Fri Jun 22 20:24:19 2007 +0200
@@ -335,15 +335,30 @@
 {
   xmlnode y;
   const char *ver = entity_version();
+  char *exts, *exts2;
+
+  exts = NULL;
 
   y = xmlnode_insert_tag(x, "c");
   xmlnode_put_attrib(y, "xmlns", NS_CAPS);
   xmlnode_put_attrib(y, "node", MCABBER_CAPS_NODE);
   xmlnode_put_attrib(y, "ver", ver);
 #ifdef JEP0085
-  if (!chatstates_disabled)
-    xmlnode_put_attrib(y, "ext", "csn");
+  if (!chatstates_disabled) {
+    exts2 = g_strjoin(" ", "csn", exts, NULL);
+    g_free(exts);
+    exts = exts2;
+  }
 #endif
+  if (!settings_opt_get_int("iq_last_disable")) {
+    exts2 = g_strjoin(" ", "iql", exts, NULL);
+    g_free(exts);
+    exts = exts2;
+  }
+  if (exts) {
+    xmlnode_put_attrib(y, "ext", exts);
+    g_free(exts);
+  }
 }
 
 static void roompresence(gpointer room, void *presencedata)