modules.c File Reference

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

Go to the source code of this file.

Functions

int addCommand (CommandHash *cmdTable[], Command *c, int pos)
int addCoreCommand (CommandHash *cmdTable[], Command *c)
int addCoreMessage (MessageHash *msgTable[], Message *m)
int addMessage (MessageHash *msgTable[], Message *m, int pos)
int addModule (Module *m)
CommandcreateCommand (const char *name, int(*func)(User *u), int(*has_priv)(User *u), int help_all, int help_reg, int help_oper, int help_admin, int help_root)
MessagecreateMessage (const char *name, int(*func)(char *source, int ac, char **av))
ModulecreateModule (char *filename)
int delCommand (CommandHash *cmdTable[], Command *c, char *mod_name)
int delMessage (MessageHash *msgTable[], Message *m, char *mod_name)
int delModule (Module *m)
int destroyCommand (Command *c)
int destroyMessage (Message *m)
int destroyModule (Module *m)
int displayCommand (Command *c)
int displayCommandFromHash (CommandHash *cmdTable[], char *name)
int displayMessage (Message *m)
int displayMessageFromHash (char *name)
int encryption_module_init (void)
int encryptionModuleLoaded ()
CommandfindCommand (CommandHash *cmdTable[], const char *name)
MessagefindMessage (MessageHash *msgTable[], const char *name)
ModulefindModule (char *name)
void handleModuleOperationQueue (void)
int loadModule (Module *m, User *u)
int moduleAddAdminHelp (Command *c, int(*func)(User *u))
void moduleAddAuthor (const char *author)
int moduleAddCallback (char *name, time_t when, int(*func)(int argc, char *argv[]), int argc, char **argv)
int moduleAddCommand (CommandHash *cmdTable[], Command *c, int pos)
int moduleAddData (ModuleData **md, char *key, char *value)
int moduleAddHelp (Command *c, int(*func)(User *u))
int moduleAddMessage (Message *m, int pos)
int moduleAddOperHelp (Command *c, int(*func)(User *u))
int moduleAddRegHelp (Command *c, int(*func)(User *u))
int moduleAddRootHelp (Command *c, int(*func)(User *u))
void moduleAddVersion (const char *version)
void moduleCallBackDeleteEntry (ModuleCallBack *prev)
ModuleCallBackmoduleCallBackFindEntry (char *mod_name, boolean *found)
void moduleCallBackPrepForUnload (char *mod_name)
void moduleCallBackRun (void)
void moduleCleanStruct (ModuleData **moduleData)
int moduleCopyFile (char *name, char *output)
int moduleDataDebug (ModuleData **md)
void moduleDelAllData (ModuleData **md)
void moduleDelAllDataMod (Module *m)
void moduleDelCallback (char *name)
int moduleDelCommand (CommandHash *cmdTable[], char *name)
void moduleDelData (ModuleData **md, char *key)
void moduleDeleteLanguage (int langNumber)
int moduleDelMessage (char *name)
void moduleDisplayHelp (int service, User *u)
int moduleGetConfigDirective (Directive *d)
char * moduleGetData (ModuleData **md, char *key)
char * ModuleGetErrStr (int status)
char * moduleGetLangString (User *u, int number)
char * moduleGetLastBuffer (void)
void moduleInsertLanguage (int langNumber, int ac, char **av)
boolean moduleMinVersion (int major, int minor, int patch, int build)
void moduleNoticeLang (char *source, User *u, int number,...)
void ModuleRunTimeDirCleanUp (void)
void modules_core_init (int number, char **list)
void modules_delayed_init (void)
void modules_init (void)
void modules_unload_all (boolean fini, boolean unload_proto)
void moduleSetBotHelp (void(*func)(User *u))
void moduleSetChanHelp (void(*func)(User *u))
void moduleSetHelpHelp (void(*func)(User *u))
void moduleSetHostHelp (void(*func)(User *u))
void moduleSetMemoHelp (void(*func)(User *u))
void moduleSetNickHelp (void(*func)(User *u))
void moduleSetOperHelp (void(*func)(User *u))
void moduleSetType (MODType type)
int prepForUnload (Module *m)
int protocol_module_init (void)
int protocolModuleLoaded ()
int queueModuleLoad (char *name, User *u)
void queueModuleOperation (Module *m, ModuleOperation op, User *u)
int queueModuleUnload (char *name, User *u)
int unloadModule (Module *m, User *u)
void updateProtectDetails (char *level_info_protect_word, char *level_info_protectme_word, char *fant_protect_add, char *fant_protect_del, char *level_protect_word, char *protect_set_mode, char *protect_unset_mode)

Variables

CommandHashBOTSERV [MAX_CMD_HASH]
CommandHashCHANSERV [MAX_CMD_HASH]
CommandHashHELPSERV [MAX_CMD_HASH]
CommandHashHOSTSERV [MAX_CMD_HASH]
MessageHashIRCD [MAX_CMD_HASH]
CommandHashMEMOSERV [MAX_CMD_HASH]
char * mod_current_buffer = NULL
Modulemod_current_module
char * mod_current_module_name = NULL
Usermod_current_user
ModuleQueuemod_operation_queue = NULL
ModuleHashMODULE_HASH [MAX_CMD_HASH]
ModuleCallBackmoduleCallBackHead = NULL
CommandHashNICKSERV [MAX_CMD_HASH]
CommandHashOPERSERV [MAX_CMD_HASH]


Function Documentation

int addCommand ( CommandHash cmdTable[],
Command c,
int  pos 
)

Add a command to a command table. only add if were unique, pos = 0; if we want it at the "head" of that command, pos = 1 at the tail, pos = 2

Parameters:
cmdTable the table to add the command to
c the command to add
pos the position in the cmd call stack to add the command
Returns:
MOD_ERR_OK will be returned on success.

Definition at line 1225 of file modules.c.

References alog(), CommandHash_::c, CMD_HASH, debug, mod_current_module_name, MOD_ERR_EXISTS, MOD_ERR_NO_MOD_NAME, MOD_ERR_OK, MOD_ERR_PARAMS, Command_::mod_name, CommandHash_::name, Command_::name, Command_::next, CommandHash_::next, Command_::service, and stricmp().

Referenced by addCoreCommand(), and moduleAddCommand().

int addCoreCommand ( CommandHash cmdTable[],
Command c 
)

Add a CORE command ot the given command hash

Parameters:
cmdTable the command table to add the command to
c the command to add
Returns:
MOD_ERR_OK on success

Definition at line 993 of file modules.c.

References addCommand(), Command_::core, MOD_ERR_PARAMS, and Command_::next.

Referenced by moduleAddOperServCmds().

int addCoreMessage ( MessageHash msgTable[],
Message m 
)

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 1520 of file modules.c.

References addMessage(), Message_::core, and MOD_ERR_PARAMS.

Referenced by moduleAddIRCDMsgs(), and moduleAddMsgs().

int addMessage ( MessageHash msgTable[],
Message m,
int  pos 
)

Add a message to the MessageHash.

Parameters:
msgTable the MessageHash we want to add a message to
m the Message we want to add
pos the position we want to add the message to, E.G. MOD_HEAD, MOD_TAIL, MOD_UNIQUE
Returns:
MOD_ERR_OK on a successful add.

Definition at line 1454 of file modules.c.

References alog(), CMD_HASH, debug, ircd, MessageHash_::m, MOD_ERR_EXISTS, MOD_ERR_OK, MOD_ERR_PARAMS, MessageHash_::name, Message_::name, Message_::next, MessageHash_::next, stricmp(), ircdvars_::tokencaseless, and UseTokens.

Referenced by addCoreMessage(), and moduleAddMessage().

int addModule ( Module m  ) 

Add the module to the list of currently loaded modules.

Parameters:
m the currently loaded module
Returns:
MOD_ERR_OK on success, anything else on fail

Definition at line 377 of file modules.c.

References CMD_HASH, fatal(), ModuleHash_::m, MOD_ERR_EXISTS, MOD_ERR_OK, MODULE_HASH, ModuleHash_::name, Module_::name, ModuleHash_::next, sstrdup(), stricmp(), and Module_::time.

Referenced by loadModule().

Command* createCommand ( const char *  name,
int(*)(User *u)  func,
int(*)(User *u)  has_priv,
int  help_all,
int  help_reg,
int  help_oper,
int  help_admin,
int  help_root 
)

Create a Command struct ready for use in anope.

Parameters:
name the name of the command
func pointer to the function to execute when command is given
has_priv pointer to function to check user priv's
help_all help file index for all users
help_reg help file index for all regustered users
help_oper help file index for all opers
help_admin help file index for all admins
help_root help file indenx for all services roots
Returns:
a "ready to use" Command struct will be returned

Definition at line 905 of file modules.c.

References Command_::admin_help, Command_::all_help, fatal(), Command_::has_priv, Command_::help_param1, Command_::help_param2, Command_::help_param3, Command_::help_param4, Command_::helpmsg_admin, Command_::helpmsg_all, Command_::helpmsg_oper, Command_::helpmsg_reg, Command_::helpmsg_root, Command_::mod_name, Command_::name, Command_::next, Command_::oper_help, Command_::regular_help, Command_::root_help, Command_::routine, Command_::service, and sstrdup().

Referenced by addMessageList(), AnopeInit(), and moduleAddOperServCmds().

Message* createMessage ( const 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 1393 of file modules.c.

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

Referenced by AnopeInit(), moduleAddIRCDMsgs(), and moduleAddMsgs().

Module* createModule ( char *  filename  ) 

Create a new module, setting up the default values as needed.

Parameters:
filename the filename of the new module
Returns:
a newly created module struct

Definition at line 304 of file modules.c.

References ModuleLang_::argc, Module_::author, Module_::botHelp, Module_::chanHelp, fatal(), Module_::handle, Module_::helpHelp, Module_::hostHelp, Module_::lang, Module_::memoHelp, Module_::name, Module_::nickHelp, NUM_LANGS, Module_::operHelp, sstrdup(), THIRD, Module_::type, and Module_::version.

Referenced by encryption_module_init(), modules_core_init(), modules_delayed_init(), modules_init(), protocol_module_init(), and queueModuleLoad().

int delCommand ( CommandHash cmdTable[],
Command c,
char *  mod_name 
)

Remove a command from the command hash.

Parameters:
cmdTable the command table to remove the command from
c the command to remove
mod_name the name of the module who owns the command
Returns:
MOD_ERR_OK will be returned on success

Definition at line 1296 of file modules.c.

References CommandHash_::c, CMD_HASH, MOD_ERR_OK, MOD_ERR_PARAMS, Command_::mod_name, CommandHash_::name, Command_::name, Command_::next, CommandHash_::next, and stricmp().

Referenced by moduleDelCommand().

int delMessage ( MessageHash msgTable[],
Message m,
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 1595 of file modules.c.

References CMD_HASH, MessageHash_::m, MOD_ERR_OK, MOD_ERR_PARAMS, Message_::mod_name, MessageHash_::name, Message_::name, Message_::next, MessageHash_::next, and stricmp().

Referenced by moduleDelMessage().

int delModule ( Module m  ) 

Remove the module from the list of loaded modules.

Parameters:
m module to remove
Returns:
MOD_ERR_OK on success anything else on fail

Definition at line 412 of file modules.c.

References CMD_HASH, destroyModule(), ModuleHash_::m, MOD_ERR_OK, MOD_ERR_PARAMS, MODULE_HASH, ModuleHash_::name, Module_::name, ModuleHash_::next, and stricmp().

Referenced by modules_unload_all(), and unloadModule().

int destroyCommand ( Command c  ) 

Destroy a command struct freeing any memory.

Parameters:
c Command to destroy
Returns:
MOD_ERR_OK on success, anything else on fail

Definition at line 946 of file modules.c.

References Command_::core, Command_::has_priv, Command_::help_param1, Command_::help_param2, Command_::help_param3, Command_::help_param4, Command_::helpmsg_admin, Command_::helpmsg_all, Command_::helpmsg_oper, Command_::helpmsg_reg, Command_::helpmsg_root, MOD_ERR_OK, MOD_ERR_PARAMS, MOD_ERR_UNKNOWN, Command_::mod_name, Command_::name, Command_::next, Command_::routine, and Command_::service.

int destroyMessage ( Message m  ) 

Destory a message, freeing its memory.

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

Definition at line 1664 of file modules.c.

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

int destroyModule ( Module m  ) 

Destory the module. free up all memory used by our module struct.

Parameters:
m the module to free
Returns:
MOD_ERR_OK on success, anything else on fail

Definition at line 340 of file modules.c.

References mod_current_module, MOD_ERR_PARAMS, moduleDeleteLanguage(), Module_::name, and NUM_LANGS.

Referenced by delModule(), encryption_module_init(), handleModuleOperationQueue(), modules_core_init(), modules_delayed_init(), modules_init(), and protocol_module_init().

int displayCommand ( Command c  ) 

Output the command stack into the log files. This will print the call-stack for a given command into the log files, very useful for debugging.

Parameters:
c the command struct to print
Returns:
0 is returned, it has no relevence yet :)

Definition at line 1159 of file modules.c.

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

Referenced by displayCommandFromHash().

int displayCommandFromHash ( CommandHash cmdTable[],
char *  name 
)

Output the command stack into the log files. This will print the call-stack for a given command into the log files, very useful for debugging.

Parameters:
cmdTable the command table to read from
name the name of the command to print
Returns:
0 is returned, it has no relevence yet :)

Definition at line 1133 of file modules.c.

References alog(), CommandHash_::c, CMD_HASH, debug, displayCommand(), CommandHash_::name, CommandHash_::next, and stricmp().

Referenced by moduleAddCommand(), and moduleDelCommand().

int displayMessage ( Message m  ) 

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 1202 of file modules.c.

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

Referenced by displayMessageFromHash().

int displayMessageFromHash ( 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 1177 of file modules.c.

References alog(), CMD_HASH, debug, displayMessage(), IRCD, MessageHash_::m, MessageHash_::name, MessageHash_::next, and stricmp().

Referenced by moduleAddMessage(), and moduleDelMessage().

int encryption_module_init ( void   ) 

Definition at line 153 of file modules.c.

References alog(), createModule(), destroyModule(), EncModule, ENCRYPTION, loadModule(), mod_current_module, mod_current_user, MOD_ERR_OK, ModuleGetErrStr(), moduleSetType(), and Module_::name.

Referenced by init_primary().

int encryptionModuleLoaded (  ) 

Search all loaded modules looking for an encryption module. @ return 1 if one is loaded

Definition at line 487 of file modules.c.

References ENCRYPTION, ModuleHash_::m, MAX_CMD_HASH, MODULE_HASH, ModuleHash_::next, and Module_::type.

Referenced by loadModule().

Command* findCommand ( CommandHash cmdTable[],
const char *  name 
)

Search the command table gieven for a command.

Parameters:
cmdTable the name of the command table to search
name the name of the command to look for
Returns:
returns a pointer to the found command struct, or NULL

Definition at line 1365 of file modules.c.

References CommandHash_::c, CMD_HASH, CommandHash_::name, CommandHash_::next, and stricmp().

Referenced by mod_help_cmd(), mod_run_cmd(), and moduleDelCommand().

Message* findMessage ( MessageHash msgTable[],
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 1417 of file modules.c.

References CMD_HASH, ircd, MessageHash_::m, MessageHash_::name, MessageHash_::next, stricmp(), ircdvars_::tokencaseless, and UseTokens.

Referenced by find_message(), and moduleDelMessage().

Module* findModule ( char *  name  ) 

Search the list of loaded modules for the given name.

Parameters:
name the name of the module to find
Returns:
a pointer to the module found, or NULL

Definition at line 446 of file modules.c.

References CMD_HASH, ModuleHash_::m, MODULE_HASH, ModuleHash_::name, ModuleHash_::next, and stricmp().

Referenced by do_help_cmd(), do_modinfo(), loadModule(), moduleAddCommand(), moduleAddEventHandler(), moduleAddEventHook(), moduleAddMessage(), moduleDeleteLanguage(), moduleGetLangString(), moduleInsertLanguage(), moduleNoticeLang(), modules_core_init(), modules_delayed_init(), modules_init(), moduleSetType(), my_memo_lang(), queueModuleLoad(), and queueModuleUnload().

void handleModuleOperationQueue ( void   ) 

Execute all queued module operations

Definition at line 2764 of file modules.c.

References alog(), destroyModule(), loadModule(), ModuleQueue_::m, mod_current_module, mod_current_user, MOD_ERR_OK, MOD_OP_LOAD, MOD_OP_UNLOAD, mod_operation_queue, ModuleGetErrStr(), Module_::name, ModuleQueue_::next, notice_lang(), ModuleQueue_::op, s_OperServ, ModuleQueue_::u, and unloadModule().

Referenced by process().

int loadModule ( Module m,
User u 
)

Loads a given module.

Parameters:
m the module to load
u the user who loaded it, NULL for auto-load
Returns:
MOD_ERR_OK on success, anything else on fail

Definition at line 571 of file modules.c.

References addModule(), alog(), ano_modclearerr, ano_modclose, ano_moderr, ano_modopen, ano_modsym, anope_cmd_global(), debug, ENCRYPTION, encryptionModuleLoaded(), Module_::filename, findModule(), Module_::handle, mod_current_module_name, MOD_ERR_EXISTS, MOD_ERR_NOLOAD, MOD_ERR_OK, MOD_ERR_PARAMS, MOD_STOP, MODULE_EXT, moduleCopyFile(), Module_::name, user_::nick, notice_lang(), PROTOCOL, protocolModuleLoaded(), s_OperServ, sstrdup(), Module_::type, unloadModule(), and version.

Referenced by encryption_module_init(), handleModuleOperationQueue(), modules_core_init(), modules_delayed_init(), modules_init(), and protocol_module_init().

int moduleAddAdminHelp ( Command c,
int(*)(User *u)  func 
)

Add help for Admins.

Parameters:
c the Command to add help for
func the function to run when this help is asked for

Definition at line 1941 of file modules.c.

References Command_::admin_help, MOD_CONT, and MOD_STOP.

Referenced by AnopeInit().

void moduleAddAuthor ( const char *  author  ) 

Add the modules author info

Parameters:
author the author of the module

Definition at line 1695 of file modules.c.

References Module_::author, mod_current_module, and sstrdup().

Referenced by AnopeInit().

int moduleAddCallback ( char *  name,
time_t  when,
int(*)(int argc, char *argv[])  func,
int  argc,
char **  argv 
)

Adds a timed callback for the current module. This allows modules to request that anope executes one of there functions at a time in the future, without an event to trigger it

Parameters:
name the name of the callback, this is used for refrence mostly, but is needed it you want to delete this particular callback later on
when when should the function be executed, this is a time in the future, seconds since 00:00:00 1970-01-01 UTC
func the function to be executed when the callback is ran, its format MUST be int func(int argc, char **argv);
argc the argument count for the argv paramter
atgv a argument list to be passed to the called function.
Returns:
MOD_ERR_OK on success, anything else on fail.
See also:
moduleDelCallBack

Definition at line 1716 of file modules.c.

References mod_current_module_name, MOD_ERR_MEMORY, moduleCallBackHead, ModuleCallBack_::next, sstrdup(), and ModuleCallBack_::when.

Referenced by addBan(), and AnopeInit().

int moduleAddCommand ( CommandHash cmdTable[],
Command c,
int  pos 
)

Add a module provided command to the given service. e.g. moduleAddCommand(NICKSERV,c,MOD_HEAD);

Parameters:
cmdTable the services to add the command to
c the command to add
pos the position to add to, MOD_HEAD, MOD_TAIL, MOD_UNIQUE
See also:
createCommand
Returns:
MOD_ERR_OK on successfully adding the command

Definition at line 1012 of file modules.c.

References addCommand(), alog(), BOTSERV, CHANSERV, Command_::core, debug, displayCommandFromHash(), findModule(), HELPSERV, HOSTSERV, MEMOSERV, mod_current_module, mod_current_module_name, MOD_ERR_NOSERVICE, MOD_ERR_OK, MOD_ERR_PARAMS, MOD_ERR_UNKNOWN, Command_::mod_name, Command_::name, Module_::name, NICKSERV, OPERSERV, s_BotServ, s_ChanServ, s_HelpServ, s_HostServ, s_MemoServ, s_NickServ, s_OperServ, Command_::service, and sstrdup().

Referenced by addMessageList(), and AnopeInit().

int moduleAddData ( ModuleData **  md,
char *  key,
char *  value 
)

Add module data to a struct. This allows module coders to add data to an existing struct

Parameters:
md The module data for the struct to be used
key The Key for the key/value pair
value The value for the key/value pair, this is what will be stored for you
Returns:
MOD_ERR_OK will be returned on success

Definition at line 2144 of file modules.c.

References alog(), debug, do_backtrace(), ModuleData_::key, mod_current_module_name, MOD_ERR_MEMORY, MOD_ERR_OK, MOD_ERR_PARAMS, moduleDataDebug(), moduleDelData(), ModuleData_::moduleName, ModuleData_::next, sstrdup(), and ModuleData_::value.

Referenced by myAddChanInfo(), and myAddNickInfo().

int moduleAddHelp ( Command c,
int(*)(User *u)  func 
)

Add help for all users

Parameters:
c the Command to add help for
func the function to run when this help is asked for

Definition at line 1983 of file modules.c.

References Command_::all_help, MOD_CONT, and MOD_STOP.

Referenced by AnopeInit().

int moduleAddMessage ( Message m,
int  pos 
)

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 1535 of file modules.c.

References addMessage(), Message_::core, debug, displayMessageFromHash(), findModule(), IRCD, mod_current_module, mod_current_module_name, MOD_ERR_PARAMS, MOD_ERR_UNKNOWN, Message_::mod_name, Message_::name, Module_::name, and sstrdup().

Referenced by AnopeInit().

int moduleAddOperHelp ( Command c,
int(*)(User *u)  func 
)

Add help for opers..

Parameters:
c the Command to add help for
func the function to run when this help is asked for

Definition at line 1955 of file modules.c.

References MOD_CONT, MOD_STOP, and Command_::oper_help.

Referenced by AnopeInit().

int moduleAddRegHelp ( Command c,
int(*)(User *u)  func 
)

Add help for registered users

Parameters:
c the Command to add help for
func the function to run when this help is asked for

Definition at line 1969 of file modules.c.

References MOD_CONT, MOD_STOP, and Command_::regular_help.

Referenced by AnopeInit().

int moduleAddRootHelp ( Command c,
int(*)(User *u)  func 
)

Add help for Root admins.

Parameters:
c the Command to add help for
func the function to run when this help is asked for

Definition at line 1927 of file modules.c.

References MOD_CONT, MOD_STOP, and Command_::root_help.

Referenced by AnopeInit().

void moduleAddVersion ( const char *  version  ) 

Add the modules version info.

Parameters:
version the version of the current module

Definition at line 1684 of file modules.c.

References mod_current_module, sstrdup(), and Module_::version.

Referenced by AnopeInit().

void moduleCallBackDeleteEntry ( ModuleCallBack prev  ) 

Removes a entry from the modules callback list

Parameters:
prev a pointer to the previous entry in the list, NULL for the head

Definition at line 1790 of file modules.c.

References ModuleCallBack_::argc, ModuleCallBack_::argv, ModuleCallBack_::func, moduleCallBackHead, ModuleCallBack_::name, ModuleCallBack_::next, and ModuleCallBack_::owner_name.

Referenced by moduleCallBackPrepForUnload(), moduleCallBackRun(), and moduleDelCallback().

ModuleCallBack* moduleCallBackFindEntry ( char *  mod_name,
boolean found 
)

Search the module callback list for a given module

Parameters:
mod_name the name of the module were looking for
found have we found it?
Returns:
a pointer to the ModuleCallBack struct or NULL - dont forget to check the found paramter!

Definition at line 1820 of file modules.c.

References moduleCallBackHead, and ModuleCallBack_::next.

Referenced by moduleCallBackPrepForUnload().

void moduleCallBackPrepForUnload ( char *  mod_name  ) 

Remove all outstanding module callbacks for the given module. When a module is unloaded, any callbacks it had outstanding must be removed, else when they attempt to execute the func pointer will no longer be valid, and we'll seg.

Parameters:
mod_name the name of the module we are preping for unload

Definition at line 1887 of file modules.c.

References alog(), debug, moduleCallBackDeleteEntry(), and moduleCallBackFindEntry().

Referenced by prepForUnload().

void moduleCallBackRun ( void   ) 

Execute a stored call back

Definition at line 1770 of file modules.c.

References alog(), ModuleCallBack_::argc, ModuleCallBack_::argv, debug, ModuleCallBack_::func, mod_current_module, mod_current_module_name, moduleCallBackDeleteEntry(), moduleCallBackHead, ModuleCallBack_::name, ModuleCallBack_::owner_name, and ModuleCallBack_::when.

Referenced by main().

void moduleCleanStruct ( ModuleData **  moduleData  ) 

Remove any data from any module used in the given struct. Useful for cleaning up when a User leave's the net, a NickCore is deleted, etc...

Parameters:
moduleData the moduleData struct to "clean"

Definition at line 2368 of file modules.c.

References ModuleData_::key, ModuleData_::moduleName, ModuleData_::next, and ModuleData_::value.

Referenced by delete_user(), delmemo(), delnick(), and moduleDelAllDataMod().

int moduleCopyFile ( char *  name,
char *  output 
)