lastmsg/lastmsg.c
changeset 40 5cd4b42ada91
parent 37 a05815df848c
--- 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);