1
0
mirror of https://github.com/anope/anope.git synced 2026-07-05 21:33:14 +02:00

moduleInsertLanguage() -> Module::InsertLanguage()

git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1585 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
Robin Burchell w00t@inspircd.org
2008-11-08 01:13:19 +00:00
parent d5162d6e45
commit d2e5ef67e3
8 changed files with 888 additions and 931 deletions
+20 -29
View File
@@ -409,6 +409,26 @@ void Module::SetType(MODType type)
this->type = type;
}
void Module::InsertLanguage(int langNumber, int ac, const char **av)
{
int i;
if (debug)
alog("debug: %s Adding %d texts for language %d", this->name.c_str(), ac, langNumber);
if (this->lang[langNumber].argc > 0) {
moduleDeleteLanguage(langNumber);
}
this->lang[langNumber].argc = ac;
this->lang[langNumber].argv =
(char **)malloc(sizeof(char *) * ac);
for (i = 0; i < ac; i++) {
this->lang[langNumber].argv[i] = sstrdup(av[i]);
}
}
/**
* Add the module to the list of currently loaded modules.
@@ -2474,35 +2494,6 @@ int moduleGetConfigDirective(Directive * d)
return retval;
}
/**
* Allow a module to add a set of language strings to anope
* @param langNumber the language number for the strings
* @param ac The language count for the strings
* @param av The language sring list.
**/
void moduleInsertLanguage(int langNumber, int ac, const char **av)
{
int i;
if ((mod_current_module_name) && (!mod_current_module || mod_current_module_name != mod_current_module->name)) {
mod_current_module = findModule(mod_current_module_name);
}
if (debug)
alog("debug: %s Adding %d texts for language %d", mod_current_module->name.c_str(), ac, langNumber);
if (mod_current_module->lang[langNumber].argc > 0) {
moduleDeleteLanguage(langNumber);
}
mod_current_module->lang[langNumber].argc = ac;
mod_current_module->lang[langNumber].argv =
(char **)malloc(sizeof(char *) * ac);
for (i = 0; i < ac; i++) {
mod_current_module->lang[langNumber].argv[i] = sstrdup(av[i]);
}
}
/**
* Send a notice to the user in the correct language, or english.
* @param source Who sends the notice