Sync with current mcabber API
authorMikael Berthe <mikael@lilotux.net>
Sun, 27 Mar 2011 21:05:47 +0200
changeset 40 5cd4b42ada91
parent 39 aa40c940b180
child 41 4e2be5f94743
Sync with current mcabber API
comment/comment.c
extsay-ng/extsay.c
ignore_auth/ignore_auth.c
killpresence/killpresence.c
lastmsg/lastmsg.c
--- a/comment/comment.c	Sat Nov 06 22:25:34 2010 +0100
+++ b/comment/comment.c	Sun Mar 27 21:05:47 2011 +0200
@@ -37,6 +37,10 @@
         .next           = NULL,
 };
 
+#ifdef MCABBER_API_HAVE_CMD_ID
+static gpointer comment_cmdid;
+#endif
+
 static void do_comment(char *args)
 {
   /* This is actually a no-op! */
@@ -46,14 +50,22 @@
 static void comment_init(void)
 {
   /* Add command */
+#ifdef MCABBER_API_HAVE_CMD_ID
+  comment_cmdid = cmd_add("#", "Ignore", 0, 0, do_comment, NULL);
+#else
   cmd_add("#", "Ignore", 0, 0, do_comment, NULL);
+#endif
 }
 
 /* Deinitialization */
 static void comment_uninit(void)
 {
   /* Unregister command */
+#ifdef MCABBER_API_HAVE_CMD_ID
+  cmd_del(comment_cmdid);
+#else
   cmd_del("comment");
+#endif
 }
 
 /* vim: set expandtab cindent cinoptions=>2\:2(0:  For Vim users... */
--- a/extsay-ng/extsay.c	Sat Nov 06 22:25:34 2010 +0100
+++ b/extsay-ng/extsay.c	Sun Mar 27 21:05:47 2011 +0200
@@ -47,6 +47,10 @@
         .next           = NULL,
 };
 
+#ifdef MCABBER_API_HAVE_CMD_ID
+static gpointer extsay_cmdid;
+#endif
+
 
 // Run the external helper script with parameters
 static void screen_run_script(const gchar *args)
@@ -143,13 +147,22 @@
 
 static void extsay_init(void)
 {
+#ifdef MCABBER_API_HAVE_CMD_ID
+  extsay_cmdid = cmd_add("extsay", "Use external editor to write a message",
+                         COMPL_JID, 0, do_extsay, NULL);
+#else
   cmd_add("extsay", "Use external editor to write a message",
           COMPL_JID, 0, do_extsay, NULL);
+#endif
 }
 
 static void extsay_uninit(void)
 {
+#ifdef MCABBER_API_HAVE_CMD_ID
+  cmd_del(extsay_cmdid);
+#else
   cmd_del("extsay");
+#endif
 }
 
 /* vim: set expandtab cindent cinoptions=>2\:2(0:  For Vim users... */
--- a/ignore_auth/ignore_auth.c	Sat Nov 06 22:25:34 2010 +0100
+++ b/ignore_auth/ignore_auth.c	Sun Mar 27 21:05:47 2011 +0200
@@ -40,6 +40,10 @@
         .next            = NULL,
 };
 
+#ifdef MCABBER_API_HAVE_CMD_ID
+static gpointer ignoreauth_cmdid;
+#endif
+
 GSList *regexlist = NULL;
 static guint ignore_auth_hid = 0;  /* Hook handler id */
 
@@ -111,7 +115,11 @@
 static void ignore_auth_init(void)
 {
   /* Add command */
+#ifdef MCABBER_API_HAVE_CMD_ID
+  ignoreauth_cmdid = cmd_add("ignore_auth", "", 0, 0, do_ignore_auth, NULL);
+#else
   cmd_add("ignore_auth", "", 0, 0, do_ignore_auth, NULL);
+#endif
   /* Add handler */
   ignore_auth_hid = hk_add_handler(ignore_hh, HOOK_SUBSCRIPTION,
                                    G_PRIORITY_DEFAULT_IDLE, NULL);
@@ -123,7 +131,11 @@
 {
   GSList *head;
   /* Unregister command */
+#ifdef MCABBER_API_HAVE_CMD_ID
+  cmd_del(ignoreauth_cmdid);
+#else
   cmd_del("ignore_auth");
+#endif
   /* Unregister event handler */
   hk_del_handler(HOOK_SUBSCRIPTION, ignore_auth_hid);
   /* unref every regex */
--- a/killpresence/killpresence.c	Sat Nov 06 22:25:34 2010 +0100
+++ b/killpresence/killpresence.c	Sun Mar 27 21:05:47 2011 +0200
@@ -46,6 +46,10 @@
         .next           = NULL,
 };
 
+#ifdef MCABBER_API_HAVE_CMD_ID
+static gpointer killpresence_cmdid, killchatstates_cmdid;
+#endif
+
 static void do_killpresence(char *args)
 {
   char *jid_utf8, *res;
@@ -141,18 +145,30 @@
 static void killpresence_init(void)
 {
   /* Add command */
+#ifdef MCABBER_API_HAVE_CMD_ID
+  killpresence_cmdid = cmd_add("killpresence", "Ignore presence",
+                               COMPL_JID, 0, do_killpresence, NULL);
+  killchatstates_cmdid = cmd_add("killchatstates", "Reset chatstates",
+                                 COMPL_JID, 0, do_killchatstates, NULL);
+#else
   cmd_add("killpresence", "Ignore presence", COMPL_JID, 0,
           do_killpresence, NULL);
   cmd_add("killchatstates", "Reset chatstates", COMPL_JID, 0,
           do_killchatstates, NULL);
+#endif
 }
 
 /* Uninitialization */
 static void killpresence_uninit(void)
 {
   /* Unregister command */
+#ifdef MCABBER_API_HAVE_CMD_ID
+  cmd_del(killpresence_cmdid);
+  cmd_del(killchatstates_cmdid);
+#else
   cmd_del("killpresence");
   cmd_del("killchatstates");
+#endif
 }
 
 /* vim: set expandtab cindent cinoptions=>2\:2(0 sw=2 ts=2:  For Vim users... */
--- a/lastmsg/lastmsg.c	Sat Nov 06 22:25:34 2010 +0100
+++ b/lastmsg/lastmsg.c	Sun Mar 27 21:05:47 2011 +0200
@@ -43,6 +43,10 @@
         .next           = NULL,
 };
 
+#ifdef MCABBER_API_HAVE_CMD_ID
+static gpointer lastmsg_cmdid;
+#endif
+
 static GSList *lastmsg_list;
 
 static guint last_message_hid, last_status_hid;
@@ -153,7 +157,12 @@
 static void lastmsg_init(void)
 {
   /* Add command */
+#ifdef MCABBER_API_HAVE_CMD_ID
+  lastmsg_cmdid = cmd_add("lastmsg", "Display last missed messages", 0, 0,
+                          do_lastmsg, NULL);
+#else
   cmd_add("lastmsg", "Display last missed messages", 0, 0, do_lastmsg, NULL);
+#endif
 
   /* Add hook handlers */
   last_message_hid = hk_add_handler(last_message_hh, HOOK_POST_MESSAGE_IN,
@@ -168,7 +177,11 @@
   GSList *li;
 
   /* Unregister command */
+#ifdef MCABBER_API_HAVE_CMD_ID
+  cmd_del(lastmsg_cmdid);
+#else
   cmd_del("lastmsg");
+#endif
   /* Unregister handlers */
   hk_del_handler(HOOK_POST_MESSAGE_IN, last_message_hid);
   hk_del_handler(HOOK_MY_STATUS_CHANGE, last_status_hid);