#include "modules.h"#include "language.h"#include "version.h"
Go to the source code of this file.
Functions | |
| int | displayCommand (Command *c) |
| int | displayCommandFromHash (CommandHash *cmdTable[], char *name) |
| int | displayMessageFromHash (char *name) |
| int | displayMessage (Message *m) |
| char * | ModuleGetErrStr (int status) |
| void | modules_init (void) |
| void | modules_core_init (int number, char **list) |
| int | encryption_module_init (void) |
| int | protocol_module_init (void) |
| void | modules_delayed_init (void) |
| void | modules_unload_all (boolean fini, boolean unload_proto) |
| Module * | createModule (char *filename) |
| int | destroyModule (Module *m) |
| int | addModule (Module *m) |
| int | delModule (Module *m) |
| Module * | findModule (char *name) |
| int | protocolModuleLoaded () |
| int | encryptionModuleLoaded () |
| int | moduleCopyFile (char *name, char *output) |
| int | loadModule (Module *m, User *u) |
| int | unloadModule (Module *m, User *u) |
| void | moduleSetType (MODType type) |
| int | prepForUnload (Module *m) |
| Command * | createCommand (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) |
| int | destroyCommand (Command *c) |
| int | addCoreCommand (CommandHash *cmdTable[], Command *c) |
| int | moduleAddCommand (CommandHash *cmdTable[], Command *c, int pos) |
| int | moduleDelCommand (CommandHash *cmdTable[], char *name) |
| int | addCommand (CommandHash *cmdTable[], Command *c, int pos) |
| int | delCommand (CommandHash *cmdTable[], Command *c, char *mod_name) |
| Command * | findCommand (CommandHash *cmdTable[], const char *name) |
| Message * | createMessage (const char *name, int(*func)(char *source, int ac, char **av)) |
| Message * | findMessage (MessageHash *msgTable[], const char *name) |
| int | addMessage (MessageHash *msgTable[], Message *m, int pos) |
| int | addCoreMessage (MessageHash *msgTable[], Message *m) |
| int | moduleAddMessage (Message *m, int pos) |
| int | moduleDelMessage (char *name) |
| int | delMessage (MessageHash *msgTable[], Message *m, char *mod_name) |
| int | destroyMessage (Message *m) |
| void | moduleAddVersion (const char *version) |
| void | moduleAddAuthor (const char *author) |
| int | moduleAddCallback (char *name, time_t when, int(*func)(int argc, char *argv[]), int argc, char **argv) |
| void | moduleCallBackRun (void) |
| void | moduleCallBackDeleteEntry (ModuleCallBack *prev) |
| ModuleCallBack * | moduleCallBackFindEntry (char *mod_name, boolean *found) |
| void | moduleDelCallback (char *name) |
| void | moduleCallBackPrepForUnload (char *mod_name) |
| char * | moduleGetLastBuffer (void) |
| int | moduleAddRootHelp (Command *c, int(*func)(User *u)) |
| int | moduleAddAdminHelp (Command *c, int(*func)(User *u)) |
| int | moduleAddOperHelp (Command *c, int(*func)(User *u)) |
| int | moduleAddRegHelp (Command *c, int(*func)(User *u)) |
| int | moduleAddHelp (Command *c, int(*func)(User *u)) |
| void | moduleSetNickHelp (void(*func)(User *u)) |
| void | moduleSetChanHelp (void(*func)(User *u)) |
| void | moduleSetMemoHelp (void(*func)(User *u)) |
| void | moduleSetBotHelp (void(*func)(User *u)) |
| void | moduleSetOperHelp (void(*func)(User *u)) |
| void | moduleSetHostHelp (void(*func)(User *u)) |
| void | moduleSetHelpHelp (void(*func)(User *u)) |
| void | moduleDisplayHelp (int service, User *u) |
| int | moduleDataDebug (ModuleData **md) |
| int | moduleAddData (ModuleData **md, char *key, char *value) |
| char * | moduleGetData (ModuleData **md, char *key) |
| void | moduleDelData (ModuleData **md, char *key) |
| void | moduleDelAllData (ModuleData **md) |
| void | moduleDelAllDataMod (Module *m) |
| void | moduleCleanStruct (ModuleData **moduleData) |
| boolean | moduleMinVersion (int major, int minor, int patch, int build) |
| 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) |
| int | moduleGetConfigDirective (Directive *d) |
| void | moduleInsertLanguage (int langNumber, int ac, char **av) |
| void | moduleNoticeLang (char *source, User *u, int number,...) |
| char * | moduleGetLangString (User *u, int number) |
| void | moduleDeleteLanguage (int langNumber) |
| void | queueModuleOperation (Module *m, ModuleOperation op, User *u) |
| int | queueModuleLoad (char *name, User *u) |
| int | queueModuleUnload (char *name, User *u) |
| void | handleModuleOperationQueue (void) |
| void | ModuleRunTimeDirCleanUp (void) |
Variables | |
| CommandHash * | HOSTSERV [MAX_CMD_HASH] |
| CommandHash * | BOTSERV [MAX_CMD_HASH] |
| CommandHash * | MEMOSERV [MAX_CMD_HASH] |
| CommandHash * | NICKSERV [MAX_CMD_HASH] |
| CommandHash * | CHANSERV [MAX_CMD_HASH] |
| CommandHash * | HELPSERV [MAX_CMD_HASH] |
| CommandHash * | OPERSERV [MAX_CMD_HASH] |
| MessageHash * | IRCD [MAX_CMD_HASH] |
| ModuleHash * | MODULE_HASH [MAX_CMD_HASH] |
| Module * | mod_current_module |
| char * | mod_current_module_name = NULL |
| char * | mod_current_buffer = NULL |
| User * | mod_current_user |
| ModuleCallBack * | moduleCallBackHead = NULL |
| ModuleQueue * | mod_operation_queue = NULL |
| 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
| 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 |
Definition at line 1276 of file modules.c.
References alog(), CommandHash_::c, CMD_HASH, current, debug, EVENT_ADDCOMMAND, fatal(), mod_current_module_name, Command_::mod_name, CommandHash_::name, Command_::name, Command_::next, CommandHash_::next, send_event(), Command_::service, sstrdup(), and stricmp().
Referenced by addCoreCommand(), and moduleAddCommand().
| int addCoreCommand | ( | CommandHash * | cmdTable[], | |
| Command * | c | |||
| ) |
Add a CORE command ot the given command hash
| cmdTable | the command table to add the command to | |
| c | the command to add |
Definition at line 1048 of file modules.c.
References addCommand(), Command_::core, 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
| msgTable | the MessageHash we want to add to | |
| m | the Message we are adding |
Definition at line 1578 of file modules.c.
References addMessage(), and Message_::core.
Referenced by moduleAddIRCDMsgs(), and moduleAddMsgs().
| int addMessage | ( | MessageHash * | msgTable[], | |
| Message * | m, | |||
| int | pos | |||
| ) |
Add a message to the MessageHash.
| 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 |
Definition at line 1512 of file modules.c.
References alog(), CMD_HASH, current, debug, fatal(), ircd, MessageHash_::m, MessageHash_::name, Message_::name, Message_::next, MessageHash_::next, sstrdup(), stricmp(), ircdvars_::tokencaseless, and UseTokens.
Referenced by addCoreMessage(), and moduleAddMessage().
| int addModule | ( | Module * | m | ) |
Add the module to the list of currently loaded modules.
| m | the currently loaded module |
Definition at line 403 of file modules.c.
References CMD_HASH, current, fatal(), ModuleHash_::m, 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.
| 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 |
Definition at line 960 of file modules.c.
References Command_::admin_help, Command_::all_help, c, 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(), moduleAddOperServCmds(), and my_event_addcommand().
| Message* createMessage | ( | const char * | name, | |
| int(*)(char *source, int ac, char **av) | func | |||
| ) |
Create a new Message struct.
| name | the name of the message | |
| func | a pointer to the function to call when we recive this message |
Definition at line 1451 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.
| filename | the filename of the new module |
Definition at line 325 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, Module_::operHelp, sstrdup(), 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.
| 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 |
Definition at line 1350 of file modules.c.
References CommandHash_::c, CMD_HASH, current, EVENT_DELCOMMAND, Command_::mod_name, CommandHash_::name, Command_::name, Command_::next, CommandHash_::next, send_event(), 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
| msgTable | which MessageHash we are removing from | |
| m | the Message we want to remove the name of the module we are removing |
Definition at line 1648 of file modules.c.
References CMD_HASH, current, MessageHash_::m, 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.
| m | module to remove |
Definition at line 438 of file modules.c.
References CMD_HASH, current, destroyModule(), ModuleHash_::m, 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.
| c | Command to destroy |
Definition at line 1001 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, Command_::mod_name, Command_::name, Command_::next, Command_::routine, and Command_::service.
| int destroyMessage | ( | Message * | m | ) |
Destory a message, freeing its memory.
| m | the message to be destroyed |
Definition at line 1717 of file modules.c.
References Message_::func, Message_::mod_name, Message_::name, and Message_::next.
| int destroyModule | ( | Module * | m | ) |
Destory the module. free up all memory used by our module struct.
| m | the module to free |
Definition at line 361 of file modules.c.
References Module_::author, Module_::filename, Module_::handle, mod_current_module_name, moduleDeleteLanguage(), Module_::name, and Module_::version.
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.
| c | the command struct to print |
Definition at line 1210 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.
| cmdTable | the command table to read from | |
| name | the name of the command to print |
Definition at line 1184 of file modules.c.
References alog(), CommandHash_::c, CMD_HASH, current, 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.
| m | the message to display |
Definition at line 1253 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 :)
| name | the name of the message to print info for |
Definition at line 1228 of file modules.c.
References alog(), CMD_HASH, current, debug, displayMessage(), MessageHash_::m, MessageHash_::name, MessageHash_::next, and stricmp().
Referenced by moduleAddMessage(), and moduleDelMessage().
| int encryption_module_init | ( | void | ) |
Definition at line 158 of file modules.c.
References alog(), createModule(), destroyModule(), EncModule, ENCRYPTION, loadModule(), mod_current_module_name, 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 513 of file modules.c.
References current, ENCRYPTION, ModuleHash_::m, ModuleHash_::next, and Module_::type.
Referenced by loadModule().
| Command* findCommand | ( | CommandHash * | cmdTable[], | |
| const char * | name | |||
| ) |
Search the command table gieven for a command.
| cmdTable | the name of the command table to search | |
| name | the name of the command to look for |
Definition at line 1423 of file modules.c.
References CommandHash_::c, CMD_HASH, current, CommandHash_::name, CommandHash_::next, and stricmp().
Referenced by AnopeFini(), AnopeInit(), mod_help_cmd(), mod_run_cmd(), moduleDelCommand(), and reload_config().
| Message* findMessage | ( | MessageHash * | msgTable[], | |
| const char * | name | |||
| ) |
find a message in the given table. Looks up the message <name> in the MessageHash given
| MessageHash | the message table to search for this command, will almost always be IRCD | |
| name | the name of the command were looking for |
Definition at line 1475 of file modules.c.
References CMD_HASH, current, 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.
| name | the name of the module to find |
Definition at line 472 of file modules.c.
References CMD_HASH, current, ModuleHash_::m, ModuleHash_::name, ModuleHash_::next, and stricmp().
Referenced by do_help_cmd(), do_modinfo(), do_run_cmd(), do_set(), event_message_process(), event_process_hook(), loadModule(), moduleCallBackRun(), moduleDeleteLanguage(), moduleGetLangString(), moduleInsertLanguage(), moduleNoticeLang(), modules_core_init(), modules_delayed_init(), modules_init(), my_memo_lang(), process(), queueModuleLoad(), and queueModuleUnload().
| void handleModuleOperationQueue | ( | void | ) |
Execute all queued module operations
Definition at line 2809 of file modules.c.
References alog(), destroyModule(), loadModule(), ModuleQueue_::m, MOD_ERR_OK, MOD_OP_LOAD, MOD_OP_UNLOAD, ModuleGetErrStr(), Module_::name, ModuleQueue_::next, notice_lang(), ModuleQueue_::op, s_OperServ, ModuleQueue_::u, and unloadModule().
Referenced by process().
Loads a given module.
| m | the module to load | |
| u | the user who loaded it, NULL for auto-load |
Definition at line 599 of file modules.c.
References addModule(), alog(), ano_modclearerr, ano_modclose, ano_moderr, ano_modopen, ano_modsym, anope_cmd_global(), debug, ENCRYPTION, encryptionModuleLoaded(), EVENT_MODLOAD, Module_::filename, findModule(), Module_::handle, mod_current_module_name, MOD_ERR_OK, MOD_STOP, MODULE_EXT, moduleCopyFile(), Module_::name, user_::nick, notice_lang(), PROTOCOL, protocolModuleLoaded(), s_OperServ, send_event(), sstrdup(), Module_::type, and unloadModule().
Referenced by encryption_module_init(), handleModuleOperationQueue(), modules_core_init(), modules_delayed_init(), modules_init(), and protocol_module_init().
Add help for Admins.
| c | the Command to add help for | |
| func | the function to run when this help is asked for |
Definition at line 1996 of file modules.c.
References Command_::admin_help.
Referenced by AnopeInit().
| void moduleAddAuthor | ( | const char * | author | ) |
Add the modules author info
| author | the author of the module |
Definition at line 1748 of file modules.c.
References Module_::author, 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
| 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. |
Definition at line 1769 of file modules.c.
References alog(), debug, mod_current_module_name, 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);
| 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 |
Definition at line 1067 of file modules.c.
References addCommand(), alog(), Command_::core, debug, displayCommandFromHash(), MOD_ERR_OK, Command_::mod_name, Command_::name, Module_::name, s_BotServ, s_ChanServ, s_HelpServ, s_HostServ, s_MemoServ, s_NickServ, s_OperServ, Command_::service, and sstrdup().
Referenced by addMessageList(), AnopeInit(), and my_event_addcommand().
| 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
| 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 |
Definition at line 2199 of file modules.c.
References alog(), debug, do_backtrace(), ModuleData_::key, mod_current_module_name, moduleDataDebug(), moduleDelData(), ModuleData_::moduleName, ModuleData_::next, sstrdup(), and ModuleData_::value.
Referenced by mLoadData(), myAddChanInfo(), and myAddNickInfo().
Add help for all users
| c | the Command to add help for | |
| func | the function to run when this help is asked for |
Definition at line 2038 of file modules.c.
References Command_::all_help.
Referenced by AnopeInit().
| int moduleAddMessage | ( | Message * | m, | |
| int | pos | |||
| ) |
Add a module message to the IRCD message hash
| m | the Message to add | |
| pos | the Position to add the message to, e.g. MOD_HEAD, MOD_TAIL, MOD_UNIQUE |
Definition at line 1593 of file modules.c.
References addMessage(), Message_::core, debug, displayMessageFromHash(), Message_::mod_name, Message_::name, Module_::name, and sstrdup().
Referenced by AnopeInit().
Add help for opers..
| c | the Command to add help for | |
| func | the function to run when this help is asked for |
Definition at line 2010 of file modules.c.
References Command_::oper_help.
Referenced by AnopeInit().
Add help for registered users
| c | the Command to add help for | |
| func | the function to run when this help is asked for |
Definition at line 2024 of file modules.c.
References Command_::regular_help.
Referenced by AnopeInit().
Add help for Root admins.
| c | the Command to add help for | |
| func | the function to run when this help is asked for |
Definition at line 1982 of file modules.c.
References Command_::root_help.
Referenced by AnopeInit().
| void moduleAddVersion | ( | const char * | version | ) |
Add the modules version info.
| version | the version of the current module |
Definition at line 1737 of file modules.c.
References sstrdup(), and Module_::version.
Referenced by AnopeInit().
| void moduleCallBackDeleteEntry | ( | ModuleCallBack * | prev | ) |
Removes a entry from the modules callback list
| prev | a pointer to the previous entry in the list, NULL for the head |
Definition at line 1845 of file modules.c.
References ModuleCallBack_::argc, ModuleCallBack_::argv, ModuleCallBack_::func, 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
| mod_name | the name of the module were looking for | |
| found | have we found it? |
Definition at line 1875 of file modules.c.
References current, 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.
| mod_name | the name of the module we are preping for unload |
Definition at line 1942 of file modules.c.
References alog(), debug, moduleCallBackDeleteEntry(), and moduleCallBackFindEntry().
Referenced by prepForUnload().
| void moduleCallBackRun | ( | void | ) |
Execute a stored call back
Definition at line 1823 of file modules.c.
References alog(), ModuleCallBack_::argc, ModuleCallBack_::argv, debug, findModule(), ModuleCallBack_::func, mod_current_module_name, moduleCallBackDeleteEntry(), 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...
| moduleData | the moduleData struct to "clean" |
Definition at line 2413 of file modules.c.
References current, ModuleData_::key, ModuleData_::moduleName, ModuleData_::next, and ModuleData_::value.
Referenced by delchan(), delcore(), delete_user(), delmemo(), delnick(), do_del(), and moduleDelAllDataMod().
| int moduleCopyFile | ( | char * | name, | |
| char * | output | |||
| ) |
Copy the module from the modules folder to the runtime folder. This will prevent module updates while the modules is loaded from triggering a segfault, as the actaul file in use will be in the runtime folder.
| name | the name of the module to copy | |
| output | the destination to copy the module to |
Definition at line 537 of file modules.c.
References alog(), debug, and MODULE_EXT.
Referenced by loadModule().
| int moduleDataDebug | ( | ModuleData ** | md | ) |
Output module data information into the log file. This is a vwey "debug only" function to dump the whole contents of a moduleData struct into the log files.
| md | The module data for the struct to be used |
Definition at line 2179 of file modules.c.
References alog(), current, ModuleData_::key, ModuleData_::moduleName, ModuleData_::next, and ModuleData_::value.
Referenced by moduleAddData().
| void moduleDelAllData | ( | ModuleData ** | md | ) |
This will remove all data for a particular module from existing structs. Its primary use is modulePrepForUnload() however, based on past expericance with module coders wanting to do just about anything and everything, its safe to use from inside the module.
| md | The module data for the struct to be used |
Definition at line 2319 of file modules.c.
References alog(), current, debug, do_backtrace(), ModuleData_::key, mod_current_module_name, ModuleData_::moduleName, ModuleData_::next, sstrdup(), stricmp(), and ModuleData_::value.
Referenced by moduleDelAllDataMod().
| void moduleDelAllDataMod | ( | Module * | m | ) |
This will delete all module data used in any struct by module m.
| m | The module to clear all data for |
Definition at line 2358 of file modules.c.
References chanlists, MemoInfo::memocount, chaninfo_::memos, MemoInfo::memos, nickcore_::memos, mod_current_module_name, moduleCleanStruct(), chaninfo_::moduleData, nickalias_::moduleData, memo_::moduleData, nickcore_::moduleData, user_::moduleData, moduleDelAllData(), nalists, Module_::name, nclists, chaninfo_::next, nickalias_::next, nickcore_::next, user_::next, sstrdup(), and userlist.
Referenced by prepForUnload().
| void moduleDelCallback | ( | char * | name | ) |
Allow module coders to delete a callback by name.
| name | the name of the callback they wish to delete |
Definition at line 1901 of file modules.c.
References alog(), current, debug, mod_current_module_name, moduleCallBackDeleteEntry(), ModuleCallBack_::name, ModuleCallBack_::next, and ModuleCallBack_::owner_name.
Referenced by AnopeInit().
| int moduleDelCommand | ( | CommandHash * | cmdTable[], | |
| char * | name | |||
| ) |
Delete a command from the service given.
| cmdTable | the cmdTable for the services to remove the command from | |
| name | the name of the command to delete from the service |
Definition at line 1146 of file modules.c.
References c, debug, delCommand(), displayCommandFromHash(), findCommand(), Command_::mod_name, Module_::name, Command_::next, and stricmp().
Referenced by my_event_delcommand(), and prepForUnload().
| void moduleDelData | ( | ModuleData ** | md, | |
| char * | key | |||
| ) |
Delete the key/value pair indicated by "key" for the current module. This allows module coders to remove a previously stored key/value pair.
| md | The module data for the struct to be used | |
| key | The key to delete the key/value pair for |
Definition at line 2275 of file modules.c.
References alog(), current, debug, do_backtrace(), ModuleData_::key, mod_current_module_name, ModuleData_::moduleName, ModuleData_::next, sstrdup(), stricmp(), and ModuleData_::value.
Referenced by moduleAddData(), myAddChanInfo(), and myAddNickInfo().
| void moduleDeleteLanguage | ( | int | langNumber | ) |
Delete a language from a module
| langNumber | the language Number to delete |
Definition at line 2734 of file modules.c.
References ModuleLang_::argc, ModuleLang_::argv, findModule(), Module_::lang, mod_current_module_name, and Module_::name.
Referenced by destroyModule(), and moduleInsertLanguage().
| int moduleDelMessage | ( | char * | name | ) |
remove the given message from the IRCD message hash
| name | the name of the message to remove |
Definition at line 1621 of file modules.c.
References debug, delMessage(), displayMessageFromHash(), findMessage(), Message_::name, and Module_::name.
Referenced by prepForUnload().
| void moduleDisplayHelp | ( | int | service, | |
| User * | u | |||
| ) |
Display any extra module help for the given service.
| services | which services is help being dispalyed for? | |
| u | which user is requesting the help |
Definition at line 2136 of file modules.c.
References Module_::botHelp, Module_::chanHelp, current, Module_::helpHelp, Module_::hostHelp, ModuleHash_::m, Module_::memoHelp, mod_current_module_name, ModuleHash_::name, ModuleHash_::next, Module_::nickHelp, and Module_::operHelp.
Referenced by do_help().
| int moduleGetConfigDirective | ( | Directive * | d | ) |
Deal with modules who want to lookup config directives!
| h | The Directive to lookup in the config file |
Definition at line 2527 of file modules.c.
References alog(), linenum, MAXPARAMS, myStrGetOnlyToken(), myStrGetTokenRemainder(), Directive::name, normalizeBuffer(), parse_directive(), SERVICES_CONF, and stricmp().
Referenced by load_config(), mLoadConfig(), mReadConfig(), and my_load_config().
| char* moduleGetData | ( | ModuleData ** | md, | |
| char * | key | |||
| ) |
Returns the value from a key/value pair set. This allows module coders to retrive any data they have previuosly stored in any given struct
| md | The module data for the struct to be used | |
| key | The key to find the data for |
Definition at line 2240 of file modules.c.
References alog(), current, debug, do_backtrace(), ModuleData_::key, mod_current_module_name, ModuleData_::moduleName, ModuleData_::next, sstrdup(), stricmp(), and ModuleData_::value.
Referenced by mSaveData(), myChanInfo(), and myNickInfo().
| char * ModuleGetErrStr | ( | int | status | ) |
Definition at line 65 of file modules.c.
Referenced by encryption_module_init(), handleModuleOperationQueue(), modules_core_init(), modules_delayed_init(), modules_init(), and protocol_module_init().
| char* moduleGetLangString | ( | User * | u, | |
| int | number | |||
| ) |
Get the text of the given lanugage string in the corrent language, or in english.
| u | The user to send the message to | |
| number | The message number |
Definition at line 2702 of file modules.c.
References alog(), ModuleLang_::argc, ModuleLang_::argv, findModule(), Module_::lang, nickcore_::language, mod_current_module_name, user_::na, Module_::name, nickalias_::nc, and NSDefLanguage.
| char* moduleGetLastBuffer | ( | void | ) |
Return a copy of the complete last buffer. This is needed for modules who cant trust the strtok() buffer, as we dont know who will have already messed about with it. a pointer to a copy of the last buffer - DONT mess with this, copy if first if you must do things to it.
Definition at line 1962 of file modules.c.
References mod_current_buffer.
Referenced by do_tban(), hs_do_activate(), hs_do_list_out(), hs_do_reject(), hs_do_request(), my_cs_appendtopic(), my_cs_enforce(), my_ns_register(), my_ns_set(), myAddChanInfo(), myAddNickInfo(), myChanInfo(), and myNickInfo().
| void moduleInsertLanguage | ( | int | langNumber, | |
| int | ac, | |||
| char ** | av | |||
| ) |
Allow a module to add a set of language strings to anope
| langNumber | the language number for the strings | |
| ac | The language count for the strings | |
| av | The language sring list. |
Definition at line 2621 of file modules.c.
References alog(), ModuleLang_::argc, ModuleLang_::argv, debug, findModule(), Module_::lang, mod_current_module_name, moduleDeleteLanguage(), Module_::name, and sstrdup().
Referenced by m_AddLanguages(), mAddLanguages(), and my_add_languages().
| boolean moduleMinVersion | ( | int | major, | |
| int | minor, | |||
| int | patch, | |||
| int | build | |||
| ) |
Check the current version of anope against a given version number Specifiying -1 for minor,patch or build
| major | The major version of anope, the first part of the verison number | |
| minor | The minor version of anope, the second part of the version number | |
| patch | The patch version of anope, the third part of the version number | |
| build | The build revision of anope from SVN |
| void moduleNoticeLang | ( | char * | source, | |
| User * | u, | |||
| int | number, | |||
| ... | ||||
| ) |
Send a notice to the user in the correct language, or english.
| source | Who sends the notice | |
| u | The user to send the message to | |
| number | The message number | |
| ... | The argument list |
Definition at line 2651 of file modules.c.
References alog(), ModuleLang_::argc, ModuleLang_::argv, findModule(), Module_::lang, nickcore_::language, mod_current_module_name, user_::na, Module_::name, nickalias_::nc, notice_user(), NSDefLanguage, sstrdup(), strscpy(), and vsnprintf().
Referenced by check_email_limit_reached(), hs_do_activate(), hs_do_reject(), hs_do_request(), hs_help(), hs_help_activate(), hs_help_reject(), hs_help_request(), hs_help_waiting(), mChanHelp(), mMainChanHelp(), mMainNickHelp(), mNickHelp(), my_cs_appendtopic(), my_cs_enforce(), my_cs_help(), my_cs_help_appendtopic(), my_cs_help_enforce(), myAddChanInfo(), myAddNickInfo(), myFullHelp(), myFullHelpSyntax(), myHelp(), and mySendResponse().
| void ModuleRunTimeDirCleanUp | ( | void | ) |
Definition at line 2849 of file modules.c.
References alog(), BUFSIZE, debug, services_dir, snprintf(), and stricmp().
Referenced by do_listchans(), do_listnicks(), fatal(), fatal_perror(), fatal_sockerror(), main(), and services_shutdown().
| void modules_core_init | ( | int | number, | |
| char ** | list | |||
| ) |
Load up a list of core modules from the conf.
| number | The number of modules to load | |
| list | The list of modules to load |
Definition at line 127 of file modules.c.
References alog(), createModule(), debug, destroyModule(), findModule(), loadModule(), mod_current_module_name, MOD_ERR_OK, ModuleGetErrStr(), and Module_::name.
Referenced by moduleAddBotServCmds(), moduleAddChanServCmds(), moduleAddHelpServCmds(), moduleAddHostServCmds(), moduleAddMemoServCmds(), moduleAddNickServCmds(), and moduleAddOperServCmds().
| void modules_delayed_init | ( | void | ) |
Automaticaly load modules at startup, delayed. This function waits until the IRCD link has been made, and then attempts to load the specified modules.
Definition at line 235 of file modules.c.
References alog(), createModule(), destroyModule(), findModule(), loadModule(), mod_current_module_name, MOD_ERR_OK, ModuleGetErrStr(), ModulesDelayedAutoload, ModulesDelayedNumber, Module_::name, and nothird.
Referenced by init_tertiary().
| void modules_init | ( | void | ) |
Automaticaly load modules at startup. This will load modules at startup before the IRCD link is attempted, this allows admins to have a module relating to ircd support load
Definition at line 91 of file modules.c.
References alog(), createModule(), destroyModule(), findModule(), loadModule(), mod_current_module_name, MOD_ERR_OK, ModuleGetErrStr(), ModulesAutoload, ModulesNumber, Module_::name, and nothird.
Referenced by init_secondary().
Unload ALL loaded modules, no matter what kind of module it is. Do NEVER EVER, and i mean NEVER (and if that isn't clear enough yet, i mean: NEVER AT ALL) call this unless we're shutting down, or we'll fuck up Anope badly (protocol handling won't work for example). If anyone calls this function without a justified need for it, i reserve the right to break their legs in a painful way. And if that isn't enough discouragement, you'll wake up with your both legs broken tomorrow ;) -GD
Definition at line 276 of file modules.c.
References alog(), ano_modclose, ano_moderr, ano_modsym, delModule(), Module_::handle, ModuleHash_::m, mod_current_module_name, MOD_ERR_OK, Module_::name, ModuleHash_::next, prepForUnload(), PROTOCOL, and Module_::type.
Referenced by main(), services_restart(), services_shutdown(), and sighandler().
| void moduleSetBotHelp | ( | void(*)(User *u) | func | ) |
Add output to botserv help. when doing a /msg botserv help, your function will be called to allow it to send out a notice() with the code you wish to dispaly
| func | a pointer to the function which will display the code |
Definition at line 2088 of file modules.c.
References Module_::botHelp.
Referenced by AnopeInit().
| void moduleSetChanHelp | ( | void(*)(User *u) | func | ) |
Add output to chanserv help. when doing a /msg chanserv help, your function will be called to allow it to send out a notice() with the code you wish to dispaly
| func | a pointer to the function which will display the code |
Definition at line 2064 of file modules.c.
References Module_::chanHelp.
Referenced by AnopeInit().
| void moduleSetHelpHelp | ( | void(*)(User *u) | func | ) |
Add output to helpserv help. when doing a /msg helpserv help, your function will be called to allow it to send out a notice() with the code you wish to dispaly
| func | a pointer to the function which will display the code |
Definition at line 2124 of file modules.c.
References Module_::helpHelp.
| void moduleSetHostHelp | ( | void(*)(User *u) | func | ) |
Add output to hostserv help. when doing a /msg hostserv help, your function will be called to allow it to send out a notice() with the code you wish to dispaly
| func | a pointer to the function which will display the code |
Definition at line 2112 of file modules.c.
References Module_::hostHelp.
Referenced by AnopeInit().
| void moduleSetMemoHelp | ( | void(*)(User *u) | func | ) |
Add output to memoserv help. when doing a /msg memoserv help, your function will be called to allow it to send out a notice() with the code you wish to dispaly
| func | a pointer to the function which will display the code |
Definition at line 2076 of file modules.c.
References Module_::memoHelp.
Referenced by AnopeInit().
| void moduleSetNickHelp | ( | void(*)(User *u) | func | ) |
Add output to nickserv help. when doing a /msg nickserv help, your function will be called to allow it to send out a notice() with the code you wish to dispaly
| func | a pointer to the function which will display the code |
Definition at line 2052 of file modules.c.
References Module_::nickHelp.
Referenced by AnopeInit().
| void moduleSetOperHelp | ( | void(*)(User *u) | func | ) |
Add output to operserv help. when doing a /msg operserv help, your function will be called to allow it to send out a notice() with the code you wish to dispaly
| func | a pointer to the function which will display the code |
Definition at line 2100 of file modules.c.
References Module_::operHelp.
Referenced by AnopeInit().
| void moduleSetType | ( | MODType | type | ) |
Module setType() Lets the module set a type, CORE,PROTOCOL,3RD etc..
Definition at line 819 of file modules.c.
References Module_::type.
Referenced by AnopeInit(), encryption_module_init(), and protocol_module_init().
| int prepForUnload | ( | Module * | m | ) |
Prepare a module to be unloaded. Remove all commands and messages this module is providing, and delete any callbacks which are still pending.
| m | the module to prepare for unload |
ok, im going to walk every hash looking for commands we own, now, not exactly elegant or efficiant :)
Definition at line 831 of file modules.c.
References CommandHash_::c, c, current, delEventHandler(), delEventHook(), EVENT, EVENTHOOKS, EvtHookHash_::evh, EvtMessageHash_::evm, MessageHash_::m, EvtHook_::mod_name, EvtMessage_::mod_name, Message_::mod_name, Command_::mod_name, moduleCallBackPrepForUnload(), moduleDelAllDataMod(), moduleDelCommand(), moduleDelMessage(), Message_::name, Command_::name, Module_::name, EvtHook_::next, EvtHookHash_::next, EvtMessage_::next, EvtMessageHash_::next, Message_::next, MessageHash_::next, Command_::next, CommandHash_::next, and stricmp().
Referenced by modules_unload_all(), and unloadModule().
| int protocol_module_init | ( | void | ) |
Load the ircd protocol module up
Definition at line 183 of file modules.c.
References alog(), createModule(), destroyModule(), ircd, IRCDModule, loadModule(), mod_current_module_name, MOD_ERR_OK, ModuleGetErrStr(), moduleSetType(), Module_::name, nofork, Numeric, PROTOCOL, ircdvars_::token, ircdvars_::ts6, UseTokens, and UseTS6.
Referenced by init_primary().
| int protocolModuleLoaded | ( | ) |
Search all loaded modules looking for a protocol module.
Definition at line 494 of file modules.c.
References current, ModuleHash_::m, ModuleHash_::next, PROTOCOL, and Module_::type.
Referenced by loadModule().
| int queueModuleLoad | ( | char * | name, | |
| User * | u | |||
| ) |
Enqueue a module to load
| name | Name of the module to load | |
| u | User who requested the load |
Definition at line 2770 of file modules.c.
References createModule(), findModule(), MOD_OP_LOAD, and queueModuleOperation().
Referenced by do_modload().
| void queueModuleOperation | ( | Module * | m, | |
| ModuleOperation | op, | |||
| User * | u | |||
| ) |
Enqueue a module operation (load/unload/reload)
| m | Module to perform the operation on | |
| op | Operation to perform on the module | |
| u | User who requested the operation |
Definition at line 2752 of file modules.c.
References ModuleQueue_::m, ModuleQueue_::next, ModuleQueue_::op, scalloc(), and ModuleQueue_::u.
Referenced by queueModuleLoad(), and queueModuleUnload().
| int queueModuleUnload | ( | char * | name, | |
| User * | u | |||
| ) |
Enqueue a module to unload
| name | Name of the module to unload | |
| u | User who requested the unload |
Definition at line 2791 of file modules.c.
References findModule(), MOD_OP_UNLOAD, and queueModuleOperation().
Referenced by do_modunload().
Unload the given module.
| m | the module to unload | |
| u | the user who unloaded it |
Definition at line 748 of file modules.c.
References alog(), ano_modclose, ano_moderr, ano_modsym, anope_cmd_global(), delModule(), ENCRYPTION, EVENT_MODUNLOAD, Module_::handle, mod_current_module_name, MOD_ERR_OK, Module_::name, user_::nick, notice_lang(), prepForUnload(), PROTOCOL, s_OperServ, send_event(), and Module_::type.
Referenced by handleModuleOperationQueue(), and loadModule().
| 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 | |||
| ) |
Allow ircd protocol files to update the protect level info tables.
Definition at line 2486 of file modules.c.
References csmodeutil_::bsname, CA_AUTOPROTECT, CA_PROTECT, CA_PROTECTME, csmodeutils, levelinfo, csmodeutil_::mode, LevelInfo::name, csmodeutil_::name, sstrdup(), and LevelInfo::what.
Referenced by moduleAddIRCDMsgs().
| CommandHash* BOTSERV[MAX_CMD_HASH] |
| CommandHash* CHANSERV[MAX_CMD_HASH] |
| CommandHash* HELPSERV[MAX_CMD_HASH] |
| CommandHash* HOSTSERV[MAX_CMD_HASH] |
| MessageHash* IRCD[MAX_CMD_HASH] |
| CommandHash* MEMOSERV[MAX_CMD_HASH] |
| char* mod_current_buffer = NULL |
Definition at line 54 of file modules.c.
Referenced by moduleGetLastBuffer(), process(), and services_shutdown().
Definition at line 52 of file modules.c.
Referenced by do_help_cmd(), do_run_cmd(), event_message_process(), event_process_hook(), moduleAddEventHandler(), moduleAddEventHook(), moduleEventDelHandler(), moduleEventDelHook(), my_memo_lang(), and process().
| char* mod_current_module_name = NULL |
Definition at line 53 of file modules.c.
Referenced by addCommand(), destroyModule(), do_help_cmd(), do_run_cmd(), encryption_module_init(), event_message_process(), event_process_hook(), loadModule(), moduleAddCallback(), moduleAddData(), moduleCallBackRun(), moduleDelAllData(), moduleDelAllDataMod(), moduleDelCallback(), moduleDelData(), moduleDeleteLanguage(), moduleDisplayHelp(), moduleGetData(), moduleGetLangString(), moduleInsertLanguage(), moduleNoticeLang(), modules_core_init(), modules_delayed_init(), modules_init(), modules_unload_all(), my_memo_lang(), process(), protocol_module_init(), and unloadModule().
| ModuleQueue* mod_operation_queue = NULL |
| ModuleHash* MODULE_HASH[MAX_CMD_HASH] |
| ModuleCallBack* moduleCallBackHead = NULL |
| CommandHash* NICKSERV[MAX_CMD_HASH] |
| CommandHash* OPERSERV[MAX_CMD_HASH] |
1.7.1