# HG changeset patch # User Myhailo Danylenko # Date 1269542851 -7200 # Node ID 58001297bb7b413a4a8cd76c0f8ba5cdaa2f3e94 # Parent ff36ae7e2b1eb899f2cdd7cbd258af110b5249ec Update hooks diff -r ff36ae7e2b1e -r 58001297bb7b disco.c --- a/disco.c Sun Mar 14 21:41:32 2010 +0200 +++ b/disco.c Thu Mar 25 20:47:31 2010 +0200 @@ -48,7 +48,7 @@ static module_info_t info_disco_experimental = { .branch = "experimental", - .api = 5, + .api = 10, .version = PROJECT_VERSION, .description = DESCRIPTION, .requires = NULL, @@ -59,7 +59,7 @@ module_info_t info_disco = { .branch = "dev", - .api = 4, + .api = 11, .version = PROJECT_VERSION, .description = DESCRIPTION, .requires = NULL, @@ -97,6 +97,7 @@ // static guint disco_cid = 0; +static guint disco_hid = 0; static GSList *reply_handlers = NULL; // @@ -202,7 +203,7 @@ reason = "undefined"; // XXX: we need to inform user, but do we really need to print this on every possible error? - scr_LogPrint (LPRINT_LOGNORM, "disco: Service info discovery for %s failed: %s - %s", from, type, reason); + scr_log_print (LPRINT_LOGNORM, "disco: Service info discovery for %s failed: %s - %s", from, type, reason); cb -> handler (NULL, NULL, cb -> data); } @@ -280,7 +281,7 @@ reason = "undefined"; // XXX: we need to inform user, but do we really need to print this on every possible error? - scr_LogPrint (LPRINT_LOGNORM, "disco: Service items discovery for %s failed: %s - %s", from, type, reason); + scr_log_print (LPRINT_LOGNORM, "disco: Service items discovery for %s failed: %s - %s", from, type, reason); cb -> handler (NULL, cb -> data); } @@ -363,7 +364,7 @@ if (error) { // XXX destroy handler and return NULL? - scr_LogPrint (LPRINT_DEBUG, "disco: Error sending disco request: %s.", error -> message); + scr_log_print (LPRINT_DEBUG, "disco: Error sending disco request: %s.", error -> message); g_error_free (error); } @@ -412,7 +413,7 @@ if (error) { // XXX destroy handler and return NULL? - scr_LogPrint (LPRINT_DEBUG, "disco: Error sending disco request: %s.", error -> message); + scr_log_print (LPRINT_DEBUG, "disco: Error sending disco request: %s.", error -> message); g_error_free (error); } @@ -493,7 +494,7 @@ { // print to buddy's buffer gchar *bjid = jidtodisp (cb -> jid); - scr_WriteIncomingMessage (bjid, info -> str, 0, HBB_PREFIX_INFO, 0); // NO conversion from utf-8 + scr_write_incoming_message (bjid, info -> str, 0, HBB_PREFIX_INFO, 0); // NO conversion from utf-8 g_free (bjid); } @@ -534,7 +535,7 @@ { // print to buddy's buffer gchar *bjid = jidtodisp (cb -> jid); - scr_WriteIncomingMessage (bjid, info -> str, 0, HBB_PREFIX_INFO, 0); // NO conversion from utf-8 + scr_write_incoming_message (bjid, info -> str, 0, HBB_PREFIX_INFO, 0); // NO conversion from utf-8 g_free (bjid); } @@ -558,7 +559,7 @@ else if (!strcmp (args[0], "items")) info = 0; else - scr_LogPrint (LPRINT_NORMAL, "Unknown subcomand."); + scr_log_print (LPRINT_NORMAL, "Unknown subcomand."); if (info != -1) { char *to = NULL; @@ -623,10 +624,10 @@ return; } -static void disco_hh (guint32 htype, hk_arg_t *args, gpointer ignore) +static guint disco_hh (const gchar *htype, hk_arg_t *args, gpointer ignore) { disco_unregister_handlers (); - return; + return HOOK_HANDLER_RESULT_ALLOW_MORE_HANDLERS; } static void disco_init (void) @@ -639,7 +640,7 @@ } // hook handler - hk_add_handler (disco_hh, HOOK_PRE_DISCONNECT, NULL); + disco_hid = hk_add_handler (disco_hh, HOOK_PRE_DISCONNECT, G_PRIORITY_DEFAULT, NULL); // command cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL); @@ -657,7 +658,7 @@ compl_del_category (disco_cid); // hook handler - hk_del_handler (disco_hh, NULL); + hk_del_handler (HOOK_PRE_DISCONNECT, disco_hid); // unregister handlers disco_unregister_handlers ();