diff mcabber/modules/beep/beep.c @ 1986:ad77110343d6

Use a command ID with cmd_add/cmd_del (Myhailo Danylenko) Patch merged from isbear's mcabber-experimental repository.
author Mikael Berthe <mikael@lilotux.net>
date Sun, 27 Mar 2011 18:28:45 +0200
parents c059c5c98de6
children 0cb8ea02e472
line wrap: on
line diff
--- a/mcabber/modules/beep/beep.c	Sun Mar 27 13:35:08 2011 +0200
+++ b/mcabber/modules/beep/beep.c	Sun Mar 27 18:28:45 2011 +0200
@@ -46,8 +46,9 @@
         .next            = NULL,
 };
 
-static guint beep_cid = 0;  /* Command completion category id */
-static guint beep_hid = 0;  /* Hook handler id */
+static guint    beep_cid  = 0;  /* Command completion category id */
+static gpointer beep_cmid = 0;  /* Command id */
+static guint    beep_hid  = 0;  /* Hook handler id */
 
 /* Event handler */
 static guint beep_hh(const gchar *hookname, hk_arg_t *args, gpointer userdata)
@@ -94,7 +95,7 @@
     compl_add_category_word(beep_cid, "disable");
   }
   /* Add command */
-  cmd_add("beep", "", beep_cid, 0, do_beep, NULL);
+  beep_cmid = cmd_add("beep", "", beep_cid, 0, do_beep, NULL);
   /* Add handler
    * We are only interested in incoming message events
    */
@@ -108,7 +109,7 @@
   /* Unregister event handler */
   hk_del_handler(HOOK_POST_MESSAGE_IN, beep_hid);
   /* Unregister command */
-  cmd_del("beep");
+  cmd_del(beep_cmid);
   /* Give back completion handle */
   if (beep_cid)
     compl_del_category(beep_cid);