Merge with an updated copy of isbear repository
authorMikael Berthe <mikael@lilotux.net>
Mon, 07 Mar 2011 19:41:44 +0100
changeset 39 ab9dad1e6d66
parent 38 c398184bb752 (current diff)
parent 34 1a62a570e66b (diff)
child 40 d1826ea1d01f
Merge with an updated copy of isbear repository
config.h.in
disco.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Mon Mar 07 19:41:44 2011 +0100
@@ -0,0 +1,27 @@
+syntax: glob
+
+# ignore generated by libtool files (no more necessary)
+*.a
+*.o
+*.lo
+*.la
+*.so
+*.lai
+*.so.*
+# ignore backup files
+*~
+# ignore docs: they are not important and apiref is generated on the fly
+*.html
+# ignore generated makefile
+Makefile
+# ignore cmake files
+*.cmake
+CMake*
+CPack*
+# ignore generated header
+config.h
+# ignore resulting bundles
+*.deb
+*.tar.bz2
+# ignore build dir
+build
--- a/config.h.in	Sun Apr 11 22:37:12 2010 +0300
+++ b/config.h.in	Mon Mar 07 19:41:44 2011 +0100
@@ -6,7 +6,7 @@
 
 #include <mcabber/config.h>
 
-#if MCABBER_BRANCH_EXPERIMENTAL && MCABBER_API_VERSION >= 27
+#if MCABBER_BRANCH_EXPERIMENTAL && MCABBER_API_VERSION >= 31
 #  define HAVE_CMD_ID
 #endif
 
--- a/disco.c	Sun Apr 11 22:37:12 2010 +0300
+++ b/disco.c	Mon Mar 07 19:41:44 2011 +0100
@@ -1,5 +1,5 @@
 
-/* Copyright 2009 Myhailo Danylenko
+/* Copyright 2009,2010 Myhailo Danylenko
  *
  * Service discovery requests
  *
@@ -49,7 +49,7 @@
 
 static module_info_t info_disco_experimental = {
 	.branch      = "experimental",
-	.api         = 27,
+	.api         = 32,
 	.version     = PROJECT_VERSION,
 	.description = DESCRIPTION,
 	.requires    = NULL,
@@ -70,7 +70,7 @@
 };
 
 module_info_t info_disco = {
-	.branch      = "0.10.0",
+	.branch      = "0.10.1",
 	.api         = 1,
 	.version     = PROJECT_VERSION,
 	.description = DESCRIPTION,
@@ -185,7 +185,7 @@
 						identities = g_slist_append (identities, identity);
 					} else if (!strcasecmp (node->name, "feature"))
 						features = g_slist_insert_sorted (features, (gpointer) lm_message_node_get_attribute (node, "var"), (GCompareFunc) g_strcmp0);
-			
+
 			// call handler
 			cb -> handler (identities, features, cb -> data);
 
@@ -263,7 +263,7 @@
 
 						items = g_slist_append (items, item);
 					}
-			
+
 			// call handler
 			cb -> handler (items, cb -> data);
 
@@ -369,7 +369,7 @@
 
 		{
 			disco_info_reply_handler_t *cb = g_new (disco_info_reply_handler_t, 1);
-			
+
 			lhandler = lm_message_handler_new (disco_info_reply_handler, cb, disco_info_reply_handler_destroy_notify);
 
 			cb -> handler = handler;
@@ -418,7 +418,7 @@
 
 		{
 			disco_items_reply_handler_t *cb       = g_new (disco_items_reply_handler_t, 1);
-			
+
 			lhandler = lm_message_handler_new (disco_items_reply_handler, cb, disco_items_reply_handler_destroy_notify);
 
 			cb -> handler = handler;
@@ -582,7 +582,7 @@
 	if (info != -1) {
 		char *to    = NULL;
 		char *dnode = NULL;
-		
+
 		if (args[0] && args[1]) {
 			char *p = args[1];
 
@@ -600,12 +600,31 @@
 			if (args[2])
 				dnode = to_utf8 (args[2]);
 		}
-			// XXX send to all resources/current resource?
+
+		if (!to) {
+			// Use currently selected item, if possible
+			if (current_buddy) {
+				gpointer bud = BUDDATA(current_buddy);
+				if (bud) {
+					guint type = buddy_gettype (bud);
+					if (type != ROSTER_TYPE_GROUP && type != ROSTER_TYPE_SPECIAL)
+						to = g_strdup (buddy_getjid (bud)); // XXX memleak!
+				}
+			}
+		}
+
+		if (!to) {
+			scr_log_print (LPRINT_NORMAL, "Invalid disco target.");
+			free_arg_lst (args);
+			return;
+		}
+
+		// XXX send to all resources/current resource?
 
 		{
 			disco_handler_t *cb = g_new (disco_handler_t, 1);
 
-			cb -> jid  = to ? to : g_strdup (CURRENT_JID);
+			cb -> jid  = to;
 			cb -> node = dnode;
 
 			if (info)
@@ -683,7 +702,7 @@
 	// completion
 	if (disco_cid)
 		compl_del_category (disco_cid);
-	
+
 	// hook handler
 	hk_del_handler (HOOK_PRE_DISCONNECT, disco_hid);
 
--- a/disco.h	Sun Apr 11 22:37:12 2010 +0300
+++ b/disco.h	Mon Mar 07 19:41:44 2011 +0100
@@ -1,5 +1,5 @@
 
-/* Copyright 2009 Myhailo Danylenko
+/* Copyright 2009,2010 Myhailo Danylenko
  *
  * Service discovery requests
  *