1
0
mirror of https://github.com/anope/anope.git synced 2026-06-29 04:06:38 +02:00

Removed mod_current_module_name, so far no ill-effects...

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1808 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
cyberbotx
2008-11-28 06:20:40 +00:00
parent bdc13b4d6d
commit f439924aa2
5 changed files with 7 additions and 35 deletions
+3 -16
View File
@@ -6,9 +6,9 @@
* Please read COPYING and README for further details.
*
* Based on the original code of Epona by Lara.
* Based on the original code of Services by Andy Church.
*
* $Id$
* Based on the original code of Services by Andy Church.
*
* $Id$
*
*/
@@ -62,18 +62,14 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[],
notice_lang(service, u, OPER_DEFCON_DENIED);
}
} else {
mod_current_module_name = c->mod_name;
mod_current_module = NULL;
if ((c->has_priv == NULL) || c->has_priv(u)) {
retVal = c->routine(u);
mod_current_module_name = NULL;
if (retVal == MOD_CONT) {
current = c->next;
while (current && retVal == MOD_CONT) {
mod_current_module_name = current->mod_name;
mod_current_module = NULL;
retVal = current->routine(u);
mod_current_module_name = NULL;
current = current->next;
}
}
@@ -82,7 +78,6 @@ void mod_run_cmd(char *service, User * u, CommandHash * cmdTable[],
alog("Access denied for %s with service %s and command %s",
u->nick, service, cmd);
}
mod_current_module_name = NULL;
}
} else {
if ((!checkDefCon(DEFCON_SILENT_OPER_ONLY)) || is_oper(u)) {
@@ -135,16 +130,9 @@ void mod_help_cmd(char *service, User * u, CommandHash * cmdTable[],
int cont = MOD_CONT;
const char *p1 = NULL, *p2 = NULL, *p3 = NULL, *p4 = NULL;
Module *calling_module = mod_current_module;
const char *calling_module_name = mod_current_module_name;
for (current = c; (current) && (cont == MOD_CONT);
current = current->next) {
mod_current_module_name = current->mod_name;
if (mod_current_module_name)
mod_current_module = findModule(mod_current_module_name);
else
mod_current_module = NULL;
p1 = current->help_param1;
p2 = current->help_param2;
p3 = current->help_param3;
@@ -201,7 +189,6 @@ void mod_help_cmd(char *service, User * u, CommandHash * cmdTable[],
}
mod_current_module = calling_module;
mod_current_module_name = calling_module_name;
}
/*************************************************************************/
-4
View File
@@ -63,15 +63,11 @@ void event_process_hook(const char *name, int argc, char **argv)
evh = find_eventhook(name);
if (evh) {
if (evh->func) {
mod_current_module_name = evh->mod_name;
retVal = evh->func(argc, argv);
mod_current_module_name = NULL;
if (retVal == MOD_CONT) {
current = evh->next;
while (current && current->func && retVal == MOD_CONT) {
mod_current_module_name = current->mod_name;
retVal = current->func(argc, argv);
mod_current_module_name = NULL;
current = current->next;
}
}
-4
View File
@@ -172,8 +172,6 @@ int ModuleManager::LoadModule(const std::string &modname, User * u)
throw CoreException("Couldn't find constructor, yet moderror wasn't set?");
}
mod_current_module_name = modname.c_str();
/* Create module. */
std::string nick;
if (u)
@@ -210,8 +208,6 @@ int ModuleManager::LoadModule(const std::string &modname, User * u)
return MOD_STOP;
}
mod_current_module_name = NULL;
if (u)
{
ircdproto->SendGlobops(s_OperServ, "%s loaded module %s", u->nick, modname.c_str());
-2
View File
@@ -29,7 +29,6 @@ MessageHash *IRCD[MAX_CMD_HASH];
ModuleHash *MODULE_HASH[MAX_CMD_HASH];
Module *mod_current_module;
const char *mod_current_module_name = NULL;
char *mod_current_buffer = NULL;
ModuleCallBack *moduleCallBackHead = NULL;
@@ -1319,7 +1318,6 @@ void ModuleManager::RunCallbacks()
if (debug)
alog("debug: executing callback: %s", tmp->name ? tmp->name : "<unknown>");
if (tmp->func) {
mod_current_module_name = tmp->owner_name;
tmp->func(tmp->argc, tmp->argv);
mod_current_module = NULL;
moduleCallBackDeleteEntry(NULL);
+4 -9
View File
@@ -512,23 +512,18 @@ void my_memo_lang(User * u, char *name, int z, int number, ...)
char *s, *t, *buf;
User *u2;
if ((mod_current_module_name)
&& (!mod_current_module
|| mod_current_module_name != mod_current_module->name))
mod_current_module = findModule(mod_current_module_name);
u2 = finduser(name);
/* Find the users lang, and use it if we cant */
if (u2 && u2->na && u2->na->nc)
lang = u2->na->nc->language;
/* If the users lang isnt supported, drop back to enlgish */
if (mod_current_module->lang[lang].argc == 0)
if (me->lang[lang].argc == 0)
lang = LANG_EN_US;
/* If the requested lang string exists for the language */
if (mod_current_module->lang[lang].argc > number) {
fmt = mod_current_module->lang[lang].argv[number];
if (me->lang[lang].argc > number) {
fmt = me->lang[lang].argv[number];
buf = sstrdup(fmt);
s = buf;
@@ -546,7 +541,7 @@ void my_memo_lang(User * u, char *name, int z, int number, ...)
}
delete [] buf;
} else {
alog("%s: INVALID language string call, language: [%d], String [%d]", mod_current_module->name.c_str(), lang, number);
alog("%s: INVALID language string call, language: [%d], String [%d]", me->name.c_str(), lang, number);
}
}