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 (diff)
parent 34 1a62a570e66b (current diff)
child 40 d1826ea1d01f
Merge with an updated copy of isbear repository
config.h.in
disco.c
--- a/config.h.in	Wed Nov 10 11:47:31 2010 +0100
+++ b/config.h.in	Mon Mar 07 19:41:44 2011 +0100
@@ -4,6 +4,12 @@
 
 #cmakedefine HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER
 
+#include <mcabber/config.h>
+
+#if MCABBER_BRANCH_EXPERIMENTAL && MCABBER_API_VERSION >= 31
+#  define HAVE_CMD_ID
+#endif
+
 #define PROJECT_VERSION ( "${PROJECT_VERSION}" )
 
 #endif
--- a/disco.c	Wed Nov 10 11:47:31 2010 +0100
+++ b/disco.c	Mon Mar 07 19:41:44 2011 +0100
@@ -49,7 +49,7 @@
 
 static module_info_t info_disco_experimental = {
 	.branch      = "experimental",
-	.api         = 10,
+	.api         = 32,
 	.version     = PROJECT_VERSION,
 	.description = DESCRIPTION,
 	.requires    = NULL,
@@ -58,9 +58,9 @@
 	.next        = NULL,
 };
 
-module_info_t info_disco = {
+static module_info_t info_disco_dev = {
 	.branch      = "dev",
-	.api         = 16,
+	.api         = 13,
 	.version     = PROJECT_VERSION,
 	.description = DESCRIPTION,
 	.requires    = NULL,
@@ -69,6 +69,17 @@
 	.next        = &info_disco_experimental,
 };
 
+module_info_t info_disco = {
+	.branch      = "0.10.1",
+	.api         = 1,
+	.version     = PROJECT_VERSION,
+	.description = DESCRIPTION,
+	.requires    = NULL,
+	.init        = disco_init,
+	.uninit      = disco_uninit,
+	.next        = &info_disco_dev,
+};
+
 //
 // private types
 //
@@ -97,6 +108,10 @@
 // globals
 //
 
+#ifdef HAVE_CMD_ID
+static gpointer disco_cmid = NULL;
+#endif
+
 static guint   disco_cid      = 0;
 static guint   disco_hid      = 0;
 static GSList *reply_handlers = NULL;
@@ -586,22 +601,22 @@
 				dnode = to_utf8 (args[2]);
 		}
 
-        if (!to) {
-		    // Use currently selected item, if possible
+		if (!to) {
+			// Use currently selected item, if possible
 			if (current_buddy) {
-			    gpointer bud = BUDDATA(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;
+			scr_log_print (LPRINT_NORMAL, "Invalid disco target.");
+			free_arg_lst (args);
+			return;
 		}
 
 		// XXX send to all resources/current resource?
@@ -665,7 +680,11 @@
 	disco_hid = hk_add_handler (disco_hh, HOOK_PRE_DISCONNECT, G_PRIORITY_DEFAULT, NULL);
 
 	// command
+#ifndef HAVE_CMD_ID
 	cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL);
+#else
+	disco_cmid = cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL);
+#endif
 
 	return;
 }
@@ -673,7 +692,12 @@
 static void disco_uninit (void)
 {
 	// command
+#ifndef HAVE_CMD_ID
 	cmd_del ("disco");
+#else
+	if (disco_cmid)
+		cmd_del (disco_cmid);
+#endif
 
 	// completion
 	if (disco_cid)