Hi
I just browsed through modules.h and found the list of availeable Hooktypes, pretty easy thing. But:
I noticed that there are several commands to add and work with hooks, so which command for which hooktype??
like, RunHook[1-7], HookAdd[Ex, Void, VoidEx, PChar, PCharEx].
What are they doing exactly? And, for example, what do i have to hook if i want to fetch all join/part/nickchanges?
HOOKTYPE_LOCAL_PART, HOOKTYPE_LOCAL_NICKCHANGE and
HOOKTYPE_LOCAL_JOIN for the hooktypes, but which function to add the hook?
Slap me if this can be found in the documentation
Btw, i'm not trying to code a module with the hooks mentioned above, i'm trying to understand the way of hooks for (possible) further modules
Thanks!
- Fussi
Hooking stuff
RunHook you can pretty much ignore from the modules end of town, that's just actually calling all the modules' functions that are hooked into whatever hook it's running (that sounds confusing, hope you get me).
Check out I think it's.. HookAddEx() to add a hook.
Check out I think it's.. HookAddEx() to add a hook.
-ChatSpike IRC Network [http://www.chatspike.net]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
-Denora Stats [http://denora.nomadirc.net]
-Omerta [http://www.barafranca.com]
Ok, lets say RunHook1 - 9 is just for internal use.
But what about these:
8 differend commands for hooking things, and there is no documentation about it .. I think it has something to do what this hook does exactly. Isnt it?
Like HookAddPChar(*) creates a hook that returns a pointer to a char array. Correct? *confused*
But what about these:
Code: Select all
#define add_Hook(hooktype, func) HookAddMain(NULL, hooktype, func, NULL, NULL)
#define HookAdd(hooktype, func) HookAddMain(NULL, hooktype, func, NULL, NULL)
#define HookAddEx(module, hooktype, func) HookAddMain(module, hooktype, func, NULL, NULL)
#define HookAddVoid(hooktype, func) HookAddMain(NULL, hooktype, NULL, func, NULL)
#define HookAddVoidEx(module, hooktype, func) HookAddMain(module, hooktype, NULL, func, NULL)
#define HookAddPChar(hooktype, func) HookAddMain(NULL, hooktype, NULL, NULL, func)
#define HookAddPCharEx(module, hooktype, func) HookAddMain(module, hooktype, NULL, NULL, func)
#define add_HookX(hooktype, func1, func2, func3) HookAddMain(NULL, hooktype, func1, func2, func3)
Like HookAddPChar(*) creates a hook that returns a pointer to a char array. Correct? *confused*
There are three different kinds of hook functions - those that return nothing (void), those that return int, and those that return char* . The parameter list afaik depends on the hook. The reason you have three different macros for it is because C doesn't have function overloading ;) .
Those functions are basically your way of adding hooks. If you're adding them in a module, it's better to use the *Ex functions so you can pass in your module handle. The best way to figure out which version of HookAdd you should use and what parameters you need is to look for where the hook is run. Or look at other modules that use the hook as well.
Those functions are basically your way of adding hooks. If you're adding them in a module, it's better to use the *Ex functions so you can pass in your module handle. The best way to figure out which version of HookAdd you should use and what parameters you need is to look for where the hook is run. Or look at other modules that use the hook as well.