Additions:
//This file is also available on [[http://wiki.atheme.org/modules:event_hooking Atheme's Wiki]]//
<<NOTE: examples are from my memoserv system
ACHTUNG: I also have written far more C# than Java, so my documentation may use terms that are not from the C world, sorry<< ::c::
<<NOTE: examples are from my memoserv system
ACHTUNG: I also have written far more C# than Java, so my documentation may use terms that are not from the C world, sorry<< ::c::
Deletions:
<<ACHTUNG: I also have written far more C# than Java, so my documentation may use terms that are not from the C world, sorry<< ::c::
Additions:
<<ACHTUNG: I also have written far more C# than Java, so my documentation may use terms that are not from the C world, sorry<< ::c::
Certain functions in Atheme will fire "events" to the rest of the system upon their completion. For example, identify calls
hook_call_event("user_identify", mu); //char* and myuser_t*
on a successful identification. I wanted to consume this hook because I wanted my [[AthemeMemoServ MemoServ]] to notice you of new memos on login. Using this hook as I did below is a far nicer solution than putting code in both userserv and nickserv, because potentially any service for ID that gets built will fire that event.
static void on_user_identify(void *vptr); //ah yes... void pointer hack, kinda like passing Object in java
All hooks pass a myuser_t (as you can see from the second param in hook_call_event above)
hook_add_event("user_identify"); //we want user_identify to know we consume it
hook_add_hook("user_identify", on_user_identify); //we want to consume it with on_user_identify
Certain functions in Atheme will fire "events" to the rest of the system upon their completion. For example, identify calls
hook_call_event("user_identify", mu); //char* and myuser_t*
on a successful identification. I wanted to consume this hook because I wanted my [[AthemeMemoServ MemoServ]] to notice you of new memos on login. Using this hook as I did below is a far nicer solution than putting code in both userserv and nickserv, because potentially any service for ID that gets built will fire that event.
static void on_user_identify(void *vptr); //ah yes... void pointer hack, kinda like passing Object in java
All hooks pass a myuser_t (as you can see from the second param in hook_call_event above)
hook_add_event("user_identify"); //we want user_identify to know we consume it
hook_add_hook("user_identify", on_user_identify); //we want to consume it with on_user_identify
Deletions:
static void on_user_identify(void *vptr);
hook_add_event("user_identify");
hook_add_hook("user_identify", on_user_identify);