events.c File Reference

#include "modules.h"
#include "language.h"
#include "version.h"

Go to the source code of this file.

Functions

int addCoreEventHandler (EvtMessageHash *msgEvtTable[], EvtMessage *evm)
int addCoreEventHook (EvtHookHash *hookEvtTable[], EvtHook *evh)
int addEventHandler (EvtMessageHash *msgEvtTable[], EvtMessage *evm)
int addEventHook (EvtHookHash *hookEvtTable[], EvtHook *evh)
EvtMessagecreateEventHandler (char *name, int(*func)(char *source, int ac, char **av))
EvtHookcreateEventHook (char *name, int(*func)(int argc, char **argv))
int delEventHandler (EvtMessageHash *msgEvtTable[], EvtMessage *evm, char *mod_name)
int delEventHook (EvtHookHash *hookEvtTable[], EvtHook *evh, char *mod_name)
int destroyEventHandler (EvtMessage *evm)
int destroyEventHook (EvtHook *evh)
int displayEventHook (EvtHook *evh)
int displayEventMessage (EvtMessage *evm)
int displayEvtMessageFromHash (char *name)
int displayHookFromHash (char *name)
void event_message_process (char *eventbuf)
void event_process_hook (const char *name, int argc, char **argv)
void eventprintf (char *fmt,...)
EvtMessagefind_event (const char *name)
EvtHookfind_eventhook (const char *name)
EvtMessagefindEventHandler (EvtMessageHash *msgEvtTable[], const char *name)
EvtHookfindEventHook (EvtHookHash *hookEvtTable[], const char *name)
int moduleAddEventHandler (EvtMessage *evm)
int moduleAddEventHook (EvtHook *evh)
int moduleEventDelHandler (char *name)
int moduleEventDelHook (const char *name)
void send_event (const char *name, int argc,...)

Variables

EvtMessageHashEVENT [MAX_CMD_HASH]
EvtHookHashEVENTHOOKS [MAX_CMD_HASH]
char * mod_current_evtbuffer = NULL


Function Documentation

int addCoreEventHandler ( EvtMessageHash msgEvtTable[],
EvtMessage evm 
)

Add the given message (m) to the MessageHash marking it as a core command

Parameters:
msgTable the MessageHash we want to add to
m the Message we are adding
Returns:
MOD_ERR_OK on a successful add.

Definition at line 368 of file events.c.

References addEventHandler(), EvtMessage_::core, and MOD_ERR_PARAMS.

int addCoreEventHook ( EvtHookHash hookEvtTable[],
EvtHook evh 
)

Add the given message (m) to the MessageHash marking it as a core command

Parameters:
msgTable the MessageHash we want to add to
m the Message we are adding
Returns:
MOD_ERR_OK on a successful add.

Definition at line 475 of file events.c.

References addEventHook(), EvtHook_::core, and MOD_ERR_PARAMS.

int addEventHandler ( EvtMessageHash msgEvtTable[],
EvtMessage evm 
)

Add a message to the MessageHash.

Parameters:
msgTable the MessageHash we want to add a message to
m the Message we want to add
Returns:
MOD_ERR_OK on a successful add.

Definition at line 383 of file events.c.

References alog(), CMD_HASH, debug, EvtMessageHash_::evm, MOD_ERR_OK, MOD_ERR_PARAMS, EvtMessageHash_::name, EvtMessage_::name, EvtMessage_::next, EvtMessageHash_::next, and stricmp().

Referenced by addCoreEventHandler(), and moduleAddEventHandler().

int addEventHook ( EvtHookHash hookEvtTable[],
EvtHook evh 
)

Add a message to the MessageHash.

Parameters:
msgTable the MessageHash we want to add a message to
m the Message we want to add
Returns:
MOD_ERR_OK on a successful add.

Definition at line 429 of file events.c.

References alog(), CMD_HASH, debug, EvtHookHash_::evh, MOD_ERR_OK, MOD_ERR_PARAMS, EvtHookHash_::name, EvtHook_::name, EvtHook_::next, EvtHookHash_::next, and stricmp().

Referenced by addCoreEventHook(), and moduleAddEventHook().

EvtMessage* createEventHandler ( char *  name,
int(*)(char *source, int ac, char **av)  func 
)

Create a new Message struct.

Parameters:
name the name of the message
func a pointer to the function to call when we recive this message
Returns:
a new Message object

Definition at line 273 of file events.c.

References fatal(), EvtMessage_::func, EvtMessage_::mod_name, EvtMessage_::name, EvtMessage_::next, and sstrdup().

Referenced by AnopeInit().

EvtHook* createEventHook ( char *  name,
int(*)(int argc, char **argv)  func 
)

Create a new Message struct.

Parameters:
name the name of the message
func a pointer to the function to call when we recive this message
Returns:
a new Message object

Definition at line 297 of file events.c.

References fatal(), EvtHook_::func, EvtHook_::mod_name, EvtHook_::name, EvtHook_::next, and sstrdup().

Referenced by AnopeInit().

int delEventHandler ( EvtMessageHash msgEvtTable[],
EvtMessage evm,
char *  mod_name 
)

remove the given message from the given message hash, for the given module

Parameters:
msgTable which MessageHash we are removing from
m the Message we want to remove the name of the module we are removing
Returns:
MOD_ERR_OK on success, althing else on fail.

Definition at line 608 of file events.c.

References CMD_HASH, EvtMessageHash_::evm, MOD_ERR_OK, MOD_ERR_PARAMS, EvtMessage_::mod_name, EvtMessageHash_::name, EvtMessage_::name, EvtMessage_::next, EvtMessageHash_::next, and stricmp().

Referenced by moduleEventDelHandler().

int delEventHook ( EvtHookHash hookEvtTable[],
EvtHook evh,
char *  mod_name 
)

remove the given message from the given message hash, for the given module

Parameters:
msgTable which MessageHash we are removing from
m the Message we want to remove the name of the module we are removing
Returns:
MOD_ERR_OK on success, althing else on fail.

Definition at line 681 of file events.c.

References CMD_HASH, EvtHookHash_::evh, MOD_ERR_OK, MOD_ERR_PARAMS, EvtHook_::mod_name, EvtHookHash_::name, EvtHook_::name, EvtHook_::next, EvtHookHash_::next, and stricmp().

Referenced by moduleEventDelHook().

int destroyEventHandler ( EvtMessage evm  ) 

Destory a message, freeing its memory.

Parameters:
m the message to be destroyed
Returns:
MOD_ERR_SUCCESS on success

Definition at line 752 of file events.c.

References EvtMessage_::func, MOD_ERR_OK, MOD_ERR_PARAMS, EvtMessage_::mod_name, EvtMessage_::name, and EvtMessage_::next.

int destroyEventHook ( EvtHook evh  ) 

Destory a message, freeing its memory.

Parameters:
m the message to be destroyed
Returns:
MOD_ERR_SUCCESS on success

Definition at line 773 of file events.c.

References EvtHook_::func, MOD_ERR_OK, MOD_ERR_PARAMS, EvtHook_::mod_name, EvtHook_::name, and EvtHook_::next.

int displayEventHook ( EvtHook evh  ) 

Displays a message list for a given message. Again this is of little use other than debugging.

Parameters:
m the message to display
Returns:
0 is returned and has no meaning

Definition at line 201 of file events.c.

References alog(), EvtHook_::name, and EvtHook_::next.

Referenced by displayHookFromHash().

int displayEventMessage ( EvtMessage evm  ) 

Displays a message list for a given message. Again this is of little use other than debugging.

Parameters:
m the message to display
Returns:
0 is returned and has no meaning

Definition at line 183 of file events.c.

References alog(), EvtMessage_::name, and EvtMessage_::next.

Referenced by displayEvtMessageFromHash().

int displayEvtMessageFromHash ( char *  name  ) 

Display the message call stak. Prints the call stack for a message based on the message name, again useful for debugging and little lese :)

Parameters:
name the name of the message to print info for
Returns:
the return int has no relevence atm :)

Definition at line 244 of file events.c.

References alog(), CMD_HASH, debug, displayEventMessage(), EVENT, EvtMessageHash_::evm, EvtMessageHash_::name, EvtMessageHash_::next, and stricmp().

Referenced by moduleAddEventHandler(), and moduleEventDelHandler().

int displayHookFromHash ( char *  name  ) 

Display the message call stak. Prints the call stack for a message based on the message name, again useful for debugging and little lese :)

Parameters:
name the name of the message to print info for
Returns:
the return int has no relevence atm :)

Definition at line 219 of file events.c.

References alog(), CMD_HASH, debug, displayEventHook(), EVENTHOOKS, EvtHookHash_::evh, EvtHookHash_::name, EvtHookHash_::next, and stricmp().

Referenced by moduleAddEventHook(), and moduleEventDelHook().

void event_message_process ( char *  eventbuf  ) 

Definition at line 83 of file events.c.

References doCleanBuffer(), find_event(), EvtMessage_::func, MOD_CONT, mod_current_module_name, EvtMessage_::mod_name, EvtMessage_::next, split_buf(), and strscpy().

Referenced by eventprintf().

void event_process_hook ( const char *  name,
int  argc,
char **  argv 
)

Definition at line 149 of file events.c.

References find_eventhook(), EvtHook_::func, MOD_CONT, mod_current_evtbuffer, mod_current_module_name, EvtHook_::mod_name, and EvtHook_::next.

Referenced by send_event().

void eventprintf ( char *  fmt,
  ... 
)

Definition at line 66 of file events.c.

References event_message_process(), sstrdup(), and vsnprintf.

Referenced by vsend_cmd().

EvtMessage* find_event ( const char *  name  ) 

Definition at line 23 of file events.c.

References EVENT, and findEventHandler().

Referenced by event_message_process().

EvtHook* find_eventhook ( const char *  name  ) 

Definition at line 30 of file events.c.

References EVENTHOOKS, and findEventHook().

Referenced by event_process_hook().

EvtMessage* findEventHandler ( EvtMessageHash msgEvtTable[],
const char *  name 
)

find a message in the given table. Looks up the message <name> in the MessageHash given

Parameters:
MessageHash the message table to search for this command, will almost always be IRCD
name the name of the command were looking for
Returns:
NULL if we cant find it, or a pointer to the Message if we can

Definition at line 320 of file events.c.

References CMD_HASH, EvtMessageHash_::evm, EvtMessageHash_::name, EvtMessageHash_::next, and stricmp().

Referenced by find_event(), and moduleEventDelHandler().

EvtHook* findEventHook ( EvtHookHash hookEvtTable[],
const char *  name 
)

find a message in the given table. Looks up the message <name> in the MessageHash given

Parameters:
MessageHash the message table to search for this command, will almost always be IRCD
name the name of the command were looking for
Returns:
NULL if we cant find it, or a pointer to the Message if we can

Definition at line 345 of file events.c.

References CMD_HASH, EvtHookHash_::evh, EvtHookHash_::name, EvtHookHash_::next, and stricmp().

Referenced by find_eventhook(), and moduleEventDelHook().

int moduleAddEventHandler ( EvtMessage evm  ) 

Add a module message to the IRCD message hash

Parameters:
m the Message to add
pos the Position to add the message to, e.g. MOD_HEAD, MOD_TAIL, MOD_UNIQUE
Returns:
MOD_ERR_OK on success, althing else on fail.

Definition at line 490 of file events.c.

References addEventHandler(), EvtMessage_::core, debug, displayEvtMessageFromHash(), EVENT, findModule(), mod_current_module, mod_current_module_name, MOD_ERR_PARAMS, MOD_ERR_UNKNOWN, EvtMessage_::mod_name, EvtMessage_::name, Module_::name, and sstrdup().

Referenced by AnopeInit().

int moduleAddEventHook ( EvtHook evh  ) 

Add a module message to the IRCD message hash

Parameters:
m the Message to add
pos the Position to add the message to, e.g. MOD_HEAD, MOD_TAIL, MOD_UNIQUE
Returns:
MOD_ERR_OK on success, althing else on fail.

Definition at line 524 of file events.c.

References addEventHook(), EvtHook_::core, debug, displayHookFromHash(), EVENTHOOKS, findModule(), mod_current_module, mod_current_module_name, MOD_ERR_PARAMS, MOD_ERR_UNKNOWN, EvtHook_::mod_name, EvtHook_::name, Module_::name, and sstrdup().

Referenced by AnopeInit().

int moduleEventDelHandler ( char *  name  ) 

remove the given message from the IRCD message hash

Parameters:
name the name of the message to remove
Returns:
MOD_ERR_OK on success, althing else on fail.

Definition at line 556 of file events.c.

References debug, delEventHandler(), displayEvtMessageFromHash(), EVENT, findEventHandler(), mod_current_module, MOD_ERR_NOEXIST, MOD_ERR_UNKNOWN, EvtMessage_::name, and Module_::name.

int moduleEventDelHook ( const char *  name  ) 

remove the given message from the IRCD message hash

Parameters:
name the name of the message to remove
Returns:
MOD_ERR_OK on success, althing else on fail.

Definition at line 581 of file events.c.

References debug, delEventHook(), displayHookFromHash(), EVENTHOOKS, findEventHook(), mod_current_module, MOD_ERR_NOEXIST, MOD_ERR_UNKNOWN, EvtHook_::name, and Module_::name.

void send_event ( const char *  name,
int  argc,
  ... 
)

Definition at line 37 of file events.c.

References alog(), debug, event_process_hook(), and sstrdup().

Referenced by anope_event_tburst(), anope_event_topic(), backup_databases(), botchanmsgs(), delete_user(), do_access(), do_assign(), do_bot(), do_confirm(), do_defcon(), do_drop(), do_forbid(), do_join(), do_kick(), do_nick(), do_part(), do_register(), do_reload(), do_server(), do_sjoin(), do_squit(), do_suspend(), do_topic(), do_unsuspend(), do_xop(), expire_all(), expire_chans(), expire_nicks(), init_secondary(), resetDefCon(), save_databases(), sighandler(), unassign(), and xop_del().


Variable Documentation

EvtMessageHash* EVENT[MAX_CMD_HASH]

Definition at line 20 of file events.c.

EvtHookHash* EVENTHOOKS[MAX_CMD_HASH]

Definition at line 21 of file events.c.

char* mod_current_evtbuffer = NULL

Definition at line 18 of file events.c.

Referenced by event_process_hook().


Generated on Sun Dec 30 09:26:56 2007 for Anope by  doxygen 1.5.1-20070107