disco.c
changeset 26 91987ea19f24
parent 25 05469ec9c2e0
child 27 0539bca09f11
equal deleted inserted replaced
25:05469ec9c2e0 26:91987ea19f24
   592 	return;
   592 	return;
   593 }
   593 }
   594 
   594 
   595 static void disco_hh (guint32 htype, hk_arg_t *args, gpointer ignore)
   595 static void disco_hh (guint32 htype, hk_arg_t *args, gpointer ignore)
   596 {
   596 {
   597 #ifdef HOOK_PRE_DISCONNECT
       
   598 	disco_unregister_handlers ();
   597 	disco_unregister_handlers ();
   599 #else
       
   600 	hk_arg_t *arg;
       
   601 
       
   602 	for (arg = args; arg->name; ++arg)
       
   603 		if (!strcmp (arg->name, "hook")) {
       
   604 			if (!strcmp (arg->value, "hook-pre-disconnect"))
       
   605 				disco_unregister_handlers ();
       
   606 			return;
       
   607 		}
       
   608 #endif
       
   609 
       
   610 	return;
   598 	return;
   611 }
   599 }
   612 
   600 
   613 const gchar *g_module_check_init(GModule *module)
   601 const gchar *g_module_check_init(GModule *module)
   614 {
   602 {
   618 		compl_add_category_word (disco_cid, "info");
   606 		compl_add_category_word (disco_cid, "info");
   619 		compl_add_category_word (disco_cid, "items");
   607 		compl_add_category_word (disco_cid, "items");
   620 	}
   608 	}
   621 
   609 
   622 	// hook handler
   610 	// hook handler
   623 #ifdef HOOK_PRE_DISCONNECT
       
   624 	hk_add_handler (disco_hh, HOOK_PRE_DISCONNECT, NULL);
   611 	hk_add_handler (disco_hh, HOOK_PRE_DISCONNECT, NULL);
   625 #else
       
   626 	hk_add_handler (disco_hh, HOOK_INTERNAL, NULL);
       
   627 #endif
       
   628 
   612 
   629 	// command
   613 	// command
   630 	cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL);
   614 	cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL);
   631 
   615 
   632 	return NULL;
   616 	return NULL;