killpresence/killpresence.c
changeset 40 5cd4b42ada91
parent 37 a05815df848c
child 41 4e2be5f94743
--- 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... */