templatecmd.c
changeset 14 5d8f38cc86ac
parent 11 32564a4369f2
child 16 e7c65942ce5c
--- a/templatecmd.c	Tue May 03 02:30:10 2011 +0300
+++ b/templatecmd.c	Tue May 03 18:36:19 2011 +0300
@@ -25,17 +25,18 @@
 #include <mcabber/utils.h>
 #include <mcabber/logprint.h>
 #include <mcabber/modules.h>
+#include <mcabber/api.h>
 
 #include "config.h"
 
-static void tcmd_init (void);
-static void tcmd_uninit (void);
+void tcmd_init (void);
+void tcmd_uninit (void);
 
 #define DESCRIPTION ( "Templated commands\nProvides command /templatecmd (and any commands, you define with it)" )
 
-static module_info_t info_templatecmd_experimental = {
-	.branch      = "experimental",
-	.api         = 28,
+static module_info_t info_templatecmd_dev = {
+	.branch      = "dev",
+	.api         = 20,
 	.version     = PROJECT_VERSION,
 	.description = DESCRIPTION,
 	.requires    = NULL,
@@ -44,19 +45,8 @@
 	.next        = NULL,
 };
 
-static module_info_t info_templatecmd_dev = {
-	.branch      = "dev",
-	.api         = 13,
-	.version     = PROJECT_VERSION,
-	.description = DESCRIPTION,
-	.requires    = NULL,
-	.init        = tcmd_init,
-	.uninit      = tcmd_uninit,
-	.next        = &info_templatecmd_experimental,
-};
-
 module_info_t info_templatecmd = {
-	.branch      = "0.10.0",
+	.branch      = "0.10.1",
 	.api         = 1,
 	.version     = PROJECT_VERSION,
 	.description = DESCRIPTION,
@@ -68,7 +58,7 @@
 
 typedef struct {
 	gchar    *name;
-#ifdef HAVE_CMD_ID
+#ifdef MCABBER_API_HAVE_CMD_ID
 	gpointer  id;
 #endif
 	gchar    *template;
@@ -76,12 +66,10 @@
 	gboolean  stararg;
 } tcmd_t;
 
-#ifdef HAVE_CMD_ID
+#ifdef MCABBER_API_HAVE_CMD_ID
 static gpointer tcmd_cmid = NULL;
-#ifdef HAVE_CMD_SAFE
 static gboolean tcmd_set_safe = FALSE;
 #endif
-#endif
 
 static GSList *template_commands = NULL;
 
@@ -188,7 +176,7 @@
 
 			if (!*astart) { // delete tcmd
 				if (template_command) {
-#ifndef HAVE_CMD_ID
+#ifndef MCABBER_API_HAVE_CMD_ID
 					cmd_del (template_command -> name);
 #else
 					if (template_command -> id)
@@ -236,7 +224,7 @@
 
 			template_commands = g_slist_append (template_commands, template_command);
 
-#ifndef HAVE_CMD_ID
+#ifndef MCABBER_API_HAVE_CMD_ID
 			cmd_add (template_command -> name, "", 0, 0, (void (*) (char *arg)) tcmd_callback, template_command);
 #else
 			template_command -> id = cmd_add (template_command -> name, "", 0, 0, (void (*) (char *arg)) tcmd_callback, template_command);
@@ -246,36 +234,32 @@
 }
 
 
-static void tcmd_init (void)
+void tcmd_init (void)
 {
-#ifndef HAVE_CMD_ID
+#ifndef MCABBER_API_HAVE_CMD_ID
 	cmd_add ("templatecmd", "", COMPL_CMD, COMPL_CMD, do_templatecmd, NULL);
 #else
 	tcmd_cmid = cmd_add ("templatecmd", "", COMPL_CMD, COMPL_CMD, do_templatecmd, NULL);
-#ifdef HAVE_CMD_SAFE
 	tcmd_set_safe = cmd_set_safe ("templatecmd", TRUE);
 #endif
-#endif
 }
 
-static void tcmd_uninit (void)
+void tcmd_uninit (void)
 {
 	GSList *tel;
 
-#ifndef HAVE_CMD_ID
+#ifndef MCABBER_API_HAVE_CMD_ID
 	cmd_del ("templatecmd");
 #else
 	if (tcmd_cmid)
 		cmd_del (tcmd_cmid);
-#ifdef HAVE_CMD_SAFE
 	if (tcmd_set_safe)
 		cmd_set_safe ("templatecmd", FALSE);
 #endif
-#endif
 
 	for (tel = template_commands; tel; tel = tel -> next) {
 		tcmd_t *template_command = (tcmd_t *) tel -> data;
-#ifndef HAVE_CMD_ID
+#ifndef MCABBER_API_HAVE_CMD_ID
 		cmd_del (template_command -> name);
 #else
 		if (template_command -> id)