# HG changeset patch # User Myhailo Danylenko # Date 1257086886 -7200 # Node ID 6411dbdd32bec217abbebcd54a4c895875fbb471 # Parent b18eee368baa00934ec3e6f35970aa85c5e0eb77 Fixes of sleepyhead * Actually register hook handler * Find hook name the right way diff -r b18eee368baa -r 6411dbdd32be disco.c --- a/disco.c Sun Nov 01 06:20:33 2009 +0200 +++ b/disco.c Sun Nov 01 16:48:06 2009 +0200 @@ -238,14 +238,14 @@ // release handlers before reconnect static void disco_hh (guint32 hid, hk_arg_t *args, gpointer userdata) { - hk_arg_t *arg = args; + hk_arg_t *arg = args; - for (arg = args; arg->name; arg++) { - if (!strcmp (arg->name, "hook-pre-disconnect")) { - disco_free_handlers (); - return; - } + for (arg = args; arg->name; arg++) { + if (!strcmp (arg->name, "name") && !strcmp (arg->value, "hook-pre-disconnect")) { + disco_free_handlers (); + return; } + } } const gchar *g_module_check_init(GModule *module) @@ -255,13 +255,16 @@ // completion disco_cid = compl_new_category (); if (disco_cid) { - compl_add_category_word (disco_cid, "info"); - compl_add_category_word (disco_cid, "items"); + compl_add_category_word (disco_cid, "info"); + compl_add_category_word (disco_cid, "items"); } // command cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL); + // register hook handler + hk_add_handler (disco_hh, HOOK_INTERNAL, NULL); + return NULL; } @@ -270,12 +273,15 @@ // release handlers disco_free_handlers (); + // remove hook handler + hk_del_handler (disco_hh, NULL); + // command cmd_del ("disco"); // completion if (disco_cid) - compl_del_category (disco_cid); + compl_del_category (disco_cid); } /* vim: se ts=4: */