diff options
author | rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-03-31 18:10:42 +0000 |
---|---|---|
committer | rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-03-31 18:10:42 +0000 |
commit | 6f9bbb2d39e28780c5b2b2d3cbf617b54727b11c (patch) | |
tree | 94a20676f05cd30775014b01cd07b765f66d4b5d /modules.c | |
parent | a97832683dcd4751c2b004770de355f4d902feb1 (diff) |
BUILD : 1.7.0 (15) BUGS : N/A NOTES : Added the ability for modules to add Commands and Messages outside of AnopeInit()
git-svn-id: svn://svn.anope.org/anope/trunk@15 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@9 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'modules.c')
-rw-r--r-- | modules.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -643,11 +643,18 @@ int moduleAddCommand(CommandHash * cmdTable[], Command * c, int pos) if (!cmdTable || !c) { return MOD_ERR_PARAMS; } + /* ok, this appears to be a module adding a command from outside of AnopeInit, try to look up its module struct for it */ + if ((mod_current_module_name) && (!mod_current_module)) { + mod_current_module = findModule(mod_current_module_name); + } + if (!mod_current_module) { return MOD_ERR_UNKNOWN; } /* shouldnt happen */ c->core = 0; - c->mod_name = sstrdup(mod_current_module->name); + if (!c->mod_name) { + c->mod_name = sstrdup(mod_current_module->name); + } if (cmdTable == HOSTSERV) { c->service = sstrdup(s_HostServ); @@ -1072,11 +1079,19 @@ int moduleAddMessage(Message * m, int pos) if (!m) { return MOD_ERR_PARAMS; } + + /* ok, this appears to be a module adding a message from outside of AnopeInit, try to look up its module struct for it */ + if ((mod_current_module_name) && (!mod_current_module)) { + mod_current_module = findModule(mod_current_module_name); + } + if (!mod_current_module) { return MOD_ERR_UNKNOWN; } /* shouldnt happen */ m->core = 0; - m->mod_name = sstrdup(mod_current_module->name); + if (!m->mod_name) { + m->mod_name = sstrdup(mod_current_module->name); + } status = addMessage(IRCD, m, pos); if (debug) { |