From 4a2b9ebcf38d6c0a2860b966421b3af125438488 Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 25 May 2010 00:57:25 -0500 Subject: Renamed all of source files from .c to .cpp --- src/modules/CMakeLists.txt | 3 +- src/modules/Makefile | 10 +- src/modules/cs_appendtopic.c | 234 ------------ src/modules/cs_appendtopic.cpp | 234 ++++++++++++ src/modules/cs_enforce.c | 450 ---------------------- src/modules/cs_enforce.cpp | 450 ++++++++++++++++++++++ src/modules/cs_tban.c | 214 ----------- src/modules/cs_tban.cpp | 214 +++++++++++ src/modules/hs_request.c | 833 ----------------------------------------- src/modules/hs_request.cpp | 833 +++++++++++++++++++++++++++++++++++++++++ src/modules/ns_maxemail.c | 169 --------- src/modules/ns_maxemail.cpp | 169 +++++++++ src/modules/os_info.c | 516 ------------------------- src/modules/os_info.cpp | 516 +++++++++++++++++++++++++ 14 files changed, 2419 insertions(+), 2426 deletions(-) delete mode 100644 src/modules/cs_appendtopic.c create mode 100644 src/modules/cs_appendtopic.cpp delete mode 100644 src/modules/cs_enforce.c create mode 100644 src/modules/cs_enforce.cpp delete mode 100644 src/modules/cs_tban.c create mode 100644 src/modules/cs_tban.cpp delete mode 100644 src/modules/hs_request.c create mode 100644 src/modules/hs_request.cpp delete mode 100644 src/modules/ns_maxemail.c create mode 100644 src/modules/ns_maxemail.cpp delete mode 100644 src/modules/os_info.c create mode 100644 src/modules/os_info.cpp (limited to 'src/modules') diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt index 6cb5b5612..a7feab5d0 100644 --- a/src/modules/CMakeLists.txt +++ b/src/modules/CMakeLists.txt @@ -1,5 +1,4 @@ -# Find all the *.c and *.cpp files within the current source directory, and sort the list -file(GLOB MODULES_SRCS_C RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c") +# Find all the *.cpp files within the current source directory, and sort the list file(GLOB MODULES_SRCS_CPP RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp") set(MODULES_SRCS ${MODULES_SRCS_C} ${MODULES_SRCS_CPP}) sort_list(MODULES_SRCS) diff --git a/src/modules/Makefile b/src/modules/Makefile index 64b9373c7..c69128ea3 100644 --- a/src/modules/Makefile +++ b/src/modules/Makefile @@ -8,8 +8,7 @@ MAKEARGS = 'CFLAGS=${CFLAGS}' 'CC=${CC}' 'ANOPELIBS=${ANOPELIBS}' \ 'PROFILE=${PROFILE}' 'SHARED=${SHARED}' 'MODULEFLAGS=${MODULEFLAGS}'\ 'MAKEBIN=${MAKEBIN}' 'MYSQLDIR=${MYSQLDIR}' -OBJECTS= $(SRCS:.c=.so) -OBJECTS+= $(SRCS:.cpp=.so) +OBJECTS= $(SRCS:.cpp=.so) CDEFS= -rdynamic -Wall MYSQL_ARGS = -I$(MYSQLDIR)/include/ -L$(MYSQLDIR)/lib/ -Wl,-rpath -Wl,$(MYSQLDIR)/lib/ -lmysqlpp @@ -25,12 +24,7 @@ install: distclean: spotless -.SUFFIXES: .c .cpp .so - -.c.so: - $(MAKEBIN) $(CC) ${CFLAGS} ${CDEFS} ${MODULEFLAGS} \ - $(if $(shell grep RequiredLibraries $< | grep mysqlpp), $(MYSQL_ARGS)) $(if $(shell grep RequiredLibraries $< | grep ssl), -lssl) $(if $(shell grep RequiredLibraries $< | grep crypt), -lcrypt) \ - -I../${INCLUDEDIR} -o $@ $< +.SUFFIXES: .cpp .so .cpp.so: $(MAKEBIN) $(CC) ${CFLAGS} ${CDEFS} ${MODULEFLAGS} \ diff --git a/src/modules/cs_appendtopic.c b/src/modules/cs_appendtopic.c deleted file mode 100644 index 311ac0717..000000000 --- a/src/modules/cs_appendtopic.c +++ /dev/null @@ -1,234 +0,0 @@ -/* cs_appendtopic.c - Add text to a channels topic - * - * (C) 2003-2010 Anope Team - * Contact us at team@anope.org - * - * Based on the original module by SGR - * Included in the Anope module pack since Anope 1.7.9 - * Anope Coder: GeniusDex - * - * Please read COPYING and README for further details. - * - * Send bug reports to the Anope Coder instead of the module - * author, because any changes since the inclusion into anope - * are not supported by the original author. - * - */ -/*************************************************************************/ - -#include "module.h" - -#define AUTHOR "SGR" -#define VERSION VERSION_STRING - -/* ------------------------------------------------------------ - * Name: cs_appendtopic - * Author: SGR - * Date: 31/08/2003 - * ------------------------------------------------------------ - * - * This module has no configurable options. For information on - * this module, load it and refer to /ChanServ APPENDTOPIC HELP - * - * Thanks to dengel, Rob and Certus for all there support. - * Especially Rob, who always manages to show me where I have - * not allocated any memory. Even if it takes a few weeks of - * pestering to get him to look at it. - * - * ------------------------------------------------------------ - */ - -/* ---------------------------------------------------------------------- */ -/* DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING */ -/* ---------------------------------------------------------------------- */ - -#define LNG_NUM_STRINGS 3 - -#define LNG_CHAN_HELP 0 -#define LNG_CHAN_HELP_APPENDTOPIC 1 -#define LNG_APPENDTOPIC_SYNTAX 2 - -static Module *me; - -class CommandCSAppendTopic : public Command -{ - public: - CommandCSAppendTopic() : Command("APPENDTOPIC", 2, 2) - { - } - - CommandReturn Execute(User *u, const std::vector ¶ms) - { - const char *chan = params[0].c_str(); - const char *newtopic = params[1].c_str(); - char topic[1024]; - Channel *c = findchan(chan); - ChannelInfo *ci; - - if (c) - ci = c->ci; - - if (!c) - notice_lang(Config.s_ChanServ, u, CHAN_X_NOT_IN_USE, chan); - else if (!check_access(u, ci, CA_TOPIC)) - notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); - else - { - if (ci->last_topic) - { - snprintf(topic, sizeof(topic), "%s %s", ci->last_topic, newtopic); - delete [] ci->last_topic; - } - else - strscpy(topic, newtopic, sizeof(topic)); - - ci->last_topic = *topic ? sstrdup(topic) : NULL; - ci->last_topic_setter = u->nick; - ci->last_topic_time = time(NULL); - - if (c->topic) - delete [] c->topic; - c->topic = *topic ? sstrdup(topic) : NULL; - c->topic_setter = u->nick; - if (ircd->topictsbackward) - c->topic_time = c->topic_time - 1; - else - c->topic_time = ci->last_topic_time; - - if (!check_access(u, ci, CA_TOPIC)) - Alog() << Config.s_ChanServ << ": " << u->GetMask() << " changed topic of " << c->name << " as services admin."; - if (ircd->join2set) - { - if (whosends(ci) == findbot(Config.s_ChanServ)) - { - ircdproto->SendJoin(findbot(Config.s_ChanServ), c->name.c_str(), c->creation_time); - ircdproto->SendMode(NULL, c, "+o %s", Config.s_ChanServ); - } - } - ircdproto->SendTopic(whosends(ci), c, u->nick.c_str(), topic); - if (ircd->join2set) - { - if (whosends(ci) == findbot(Config.s_ChanServ)) - ircdproto->SendPart(findbot(Config.s_ChanServ), c, NULL); - } - } - return MOD_CONT; - } - - bool OnHelp(User *u, const ci::string &subcommand) - { - me->NoticeLang(Config.s_ChanServ, u, LNG_APPENDTOPIC_SYNTAX); - u->SendMessage(Config.s_ChanServ, " "); - me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP_APPENDTOPIC); - - return true; - } - - void OnSyntaxError(User *u, const ci::string &subcommand) - { - me->NoticeLang(Config.s_ChanServ, u, LNG_APPENDTOPIC_SYNTAX); - } -}; - -class CSAppendTopic : public Module -{ - public: - CSAppendTopic(const std::string &modname, const std::string &creator) : Module(modname, creator) - { - me = this; - - this->SetAuthor(AUTHOR); - this->SetVersion(VERSION); - this->SetType(SUPPORTED); - - this->AddCommand(ChanServ, new CommandCSAppendTopic()); - - /* English (US) */ - const char* langtable_en_us[] = { - /* LNG_CHAN_HELP */ - " APPENDTOPIC Add text to a channels topic", - /* LNG_CHAN_HELP_APPENDTOPIC */ - "This command allows users to append text to a currently set\n" - "channel topic. When TOPICLOCK is on, the topic is updated and\n" - "the new, updated topic is locked.", - /* LNG_APPENDTOPIC_SYNTAX */ - "Syntax: APPENDTOPIC channel text\n" - }; - - /* Dutch (NL) */ - const char* langtable_nl[] = { - /* LNG_CHAN_HELP */ - " APPENDTOPIC Voeg tekst aan een kanaal onderwerp toe", - /* LNG_CHAN_HELP_APPENDTOPIC */ - "Dit command stelt gebruikers in staat om text toe te voegen\n" - "achter het huidige onderwerp van een kanaal. Als TOPICLOCK aan\n" - "staat, zal het onderwerp worden bijgewerkt en zal het nieuwe,\n" - "bijgewerkte topic worden geforceerd.", - /* LNG_APPENDTOPIC_SYNTAX */ - "Gebruik: APPENDTOPIC kanaal tekst\n" - }; - - /* German (DE) */ - const char* langtable_de[] = { - /* LNG_CHAN_HELP */ - " APPENDTOPIC Fьgt einen Text zu einem Channel-Topic hinzu.", - /* LNG_CHAN_HELP_APPENDTOPIC */ - "Dieser Befehl erlaubt Benutzern, einen Text zu dem vorhandenen Channel-Topic\n" - "hinzuzufьgen. Wenn TOPICLOCK gesetzt ist, wird das Topic aktualisiert\n" - "und das neue, aktualisierte Topic wird gesperrt.", - /* LNG_APPENDTOPIC_SYNTAX */ - "Syntax: APPENDTOPIC Channel Text\n" - }; - - /* Portuguese (PT) */ - const char* langtable_pt[] = { - /* LNG_CHAN_HELP */ - " APPENDTOPIC Adiciona texto ao tуpico de um canal", - /* LNG_CHAN_HELP_APPENDTOPIC */ - "Este comando permite aos usuбrios anexar texto a um tуpico de canal\n" - "jб definido. Quando TOPICLOCK estб ativado, o tуpico й atualizado e\n" - "o novo tуpico й travado.", - /* LNG_APPENDTOPIC_SYNTAX */ - "Sintaxe: APPENDTOPIC canal texto\n" - }; - - /* Russian (RU) */ - const char* langtable_ru[] = { - /* LNG_CHAN_HELP */ - " APPENDTOPIC Добавляет текст к топику канала", - /* LNG_CHAN_HELP_APPENDTOPIC */ - "Данная команда позволяет добавить текст к топику, который установлен на указанном\n" - "канале. Если активирован режим TOPICLOCK, топик будет обновлен и заблокирован.\n" - "Примечание: текст будет ДОБАВЛЕН к топику, то есть старый топик удален НЕ БУДЕТ.\n", - /* LNG_APPENDTOPIC_SYNTAX */ - "Синтаксис: APPENDTOPIC #канал текст\n" - }; - - /* Italian (IT) */ - const char* langtable_it[] = { - /* LNG_CHAN_HELP */ - " APPENDTOPIC Aggiunge del testo al topic di un canale", - /* LNG_CHAN_HELP_APPENDTOPIC */ - "Questo comando permette agli utenti di aggiungere del testo ad un topic di un canale\n" - "giа impostato. Se TOPICLOCK и attivato, il topic viene aggiornato e il nuovo topic\n" - "viene bloccato.", - /* LNG_APPENDTOPIC_SYNTAX */ - "Sintassi: APPENDTOPIC canale testo\n" - }; - - this->InsertLanguage(LANG_EN_US, LNG_NUM_STRINGS, langtable_en_us); - this->InsertLanguage(LANG_NL, LNG_NUM_STRINGS, langtable_nl); - this->InsertLanguage(LANG_DE, LNG_NUM_STRINGS, langtable_de); - this->InsertLanguage(LANG_PT, LNG_NUM_STRINGS, langtable_pt); - this->InsertLanguage(LANG_RU, LNG_NUM_STRINGS, langtable_ru); - this->InsertLanguage(LANG_IT, LNG_NUM_STRINGS, langtable_it); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - this->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP); - } -}; - -MODULE_INIT(CSAppendTopic) diff --git a/src/modules/cs_appendtopic.cpp b/src/modules/cs_appendtopic.cpp new file mode 100644 index 000000000..311ac0717 --- /dev/null +++ b/src/modules/cs_appendtopic.cpp @@ -0,0 +1,234 @@ +/* cs_appendtopic.c - Add text to a channels topic + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Based on the original module by SGR + * Included in the Anope module pack since Anope 1.7.9 + * Anope Coder: GeniusDex + * + * Please read COPYING and README for further details. + * + * Send bug reports to the Anope Coder instead of the module + * author, because any changes since the inclusion into anope + * are not supported by the original author. + * + */ +/*************************************************************************/ + +#include "module.h" + +#define AUTHOR "SGR" +#define VERSION VERSION_STRING + +/* ------------------------------------------------------------ + * Name: cs_appendtopic + * Author: SGR + * Date: 31/08/2003 + * ------------------------------------------------------------ + * + * This module has no configurable options. For information on + * this module, load it and refer to /ChanServ APPENDTOPIC HELP + * + * Thanks to dengel, Rob and Certus for all there support. + * Especially Rob, who always manages to show me where I have + * not allocated any memory. Even if it takes a few weeks of + * pestering to get him to look at it. + * + * ------------------------------------------------------------ + */ + +/* ---------------------------------------------------------------------- */ +/* DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING */ +/* ---------------------------------------------------------------------- */ + +#define LNG_NUM_STRINGS 3 + +#define LNG_CHAN_HELP 0 +#define LNG_CHAN_HELP_APPENDTOPIC 1 +#define LNG_APPENDTOPIC_SYNTAX 2 + +static Module *me; + +class CommandCSAppendTopic : public Command +{ + public: + CommandCSAppendTopic() : Command("APPENDTOPIC", 2, 2) + { + } + + CommandReturn Execute(User *u, const std::vector ¶ms) + { + const char *chan = params[0].c_str(); + const char *newtopic = params[1].c_str(); + char topic[1024]; + Channel *c = findchan(chan); + ChannelInfo *ci; + + if (c) + ci = c->ci; + + if (!c) + notice_lang(Config.s_ChanServ, u, CHAN_X_NOT_IN_USE, chan); + else if (!check_access(u, ci, CA_TOPIC)) + notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); + else + { + if (ci->last_topic) + { + snprintf(topic, sizeof(topic), "%s %s", ci->last_topic, newtopic); + delete [] ci->last_topic; + } + else + strscpy(topic, newtopic, sizeof(topic)); + + ci->last_topic = *topic ? sstrdup(topic) : NULL; + ci->last_topic_setter = u->nick; + ci->last_topic_time = time(NULL); + + if (c->topic) + delete [] c->topic; + c->topic = *topic ? sstrdup(topic) : NULL; + c->topic_setter = u->nick; + if (ircd->topictsbackward) + c->topic_time = c->topic_time - 1; + else + c->topic_time = ci->last_topic_time; + + if (!check_access(u, ci, CA_TOPIC)) + Alog() << Config.s_ChanServ << ": " << u->GetMask() << " changed topic of " << c->name << " as services admin."; + if (ircd->join2set) + { + if (whosends(ci) == findbot(Config.s_ChanServ)) + { + ircdproto->SendJoin(findbot(Config.s_ChanServ), c->name.c_str(), c->creation_time); + ircdproto->SendMode(NULL, c, "+o %s", Config.s_ChanServ); + } + } + ircdproto->SendTopic(whosends(ci), c, u->nick.c_str(), topic); + if (ircd->join2set) + { + if (whosends(ci) == findbot(Config.s_ChanServ)) + ircdproto->SendPart(findbot(Config.s_ChanServ), c, NULL); + } + } + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &subcommand) + { + me->NoticeLang(Config.s_ChanServ, u, LNG_APPENDTOPIC_SYNTAX); + u->SendMessage(Config.s_ChanServ, " "); + me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP_APPENDTOPIC); + + return true; + } + + void OnSyntaxError(User *u, const ci::string &subcommand) + { + me->NoticeLang(Config.s_ChanServ, u, LNG_APPENDTOPIC_SYNTAX); + } +}; + +class CSAppendTopic : public Module +{ + public: + CSAppendTopic(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + me = this; + + this->SetAuthor(AUTHOR); + this->SetVersion(VERSION); + this->SetType(SUPPORTED); + + this->AddCommand(ChanServ, new CommandCSAppendTopic()); + + /* English (US) */ + const char* langtable_en_us[] = { + /* LNG_CHAN_HELP */ + " APPENDTOPIC Add text to a channels topic", + /* LNG_CHAN_HELP_APPENDTOPIC */ + "This command allows users to append text to a currently set\n" + "channel topic. When TOPICLOCK is on, the topic is updated and\n" + "the new, updated topic is locked.", + /* LNG_APPENDTOPIC_SYNTAX */ + "Syntax: APPENDTOPIC channel text\n" + }; + + /* Dutch (NL) */ + const char* langtable_nl[] = { + /* LNG_CHAN_HELP */ + " APPENDTOPIC Voeg tekst aan een kanaal onderwerp toe", + /* LNG_CHAN_HELP_APPENDTOPIC */ + "Dit command stelt gebruikers in staat om text toe te voegen\n" + "achter het huidige onderwerp van een kanaal. Als TOPICLOCK aan\n" + "staat, zal het onderwerp worden bijgewerkt en zal het nieuwe,\n" + "bijgewerkte topic worden geforceerd.", + /* LNG_APPENDTOPIC_SYNTAX */ + "Gebruik: APPENDTOPIC kanaal tekst\n" + }; + + /* German (DE) */ + const char* langtable_de[] = { + /* LNG_CHAN_HELP */ + " APPENDTOPIC Fьgt einen Text zu einem Channel-Topic hinzu.", + /* LNG_CHAN_HELP_APPENDTOPIC */ + "Dieser Befehl erlaubt Benutzern, einen Text zu dem vorhandenen Channel-Topic\n" + "hinzuzufьgen. Wenn TOPICLOCK gesetzt ist, wird das Topic aktualisiert\n" + "und das neue, aktualisierte Topic wird gesperrt.", + /* LNG_APPENDTOPIC_SYNTAX */ + "Syntax: APPENDTOPIC Channel Text\n" + }; + + /* Portuguese (PT) */ + const char* langtable_pt[] = { + /* LNG_CHAN_HELP */ + " APPENDTOPIC Adiciona texto ao tуpico de um canal", + /* LNG_CHAN_HELP_APPENDTOPIC */ + "Este comando permite aos usuбrios anexar texto a um tуpico de canal\n" + "jб definido. Quando TOPICLOCK estб ativado, o tуpico й atualizado e\n" + "o novo tуpico й travado.", + /* LNG_APPENDTOPIC_SYNTAX */ + "Sintaxe: APPENDTOPIC canal texto\n" + }; + + /* Russian (RU) */ + const char* langtable_ru[] = { + /* LNG_CHAN_HELP */ + " APPENDTOPIC Добавляет текст к топику канала", + /* LNG_CHAN_HELP_APPENDTOPIC */ + "Данная команда позволяет добавить текст к топику, который установлен на указанном\n" + "канале. Если активирован режим TOPICLOCK, топик будет обновлен и заблокирован.\n" + "Примечание: текст будет ДОБАВЛЕН к топику, то есть старый топик удален НЕ БУДЕТ.\n", + /* LNG_APPENDTOPIC_SYNTAX */ + "Синтаксис: APPENDTOPIC #канал текст\n" + }; + + /* Italian (IT) */ + const char* langtable_it[] = { + /* LNG_CHAN_HELP */ + " APPENDTOPIC Aggiunge del testo al topic di un canale", + /* LNG_CHAN_HELP_APPENDTOPIC */ + "Questo comando permette agli utenti di aggiungere del testo ad un topic di un canale\n" + "giа impostato. Se TOPICLOCK и attivato, il topic viene aggiornato e il nuovo topic\n" + "viene bloccato.", + /* LNG_APPENDTOPIC_SYNTAX */ + "Sintassi: APPENDTOPIC canale testo\n" + }; + + this->InsertLanguage(LANG_EN_US, LNG_NUM_STRINGS, langtable_en_us); + this->InsertLanguage(LANG_NL, LNG_NUM_STRINGS, langtable_nl); + this->InsertLanguage(LANG_DE, LNG_NUM_STRINGS, langtable_de); + this->InsertLanguage(LANG_PT, LNG_NUM_STRINGS, langtable_pt); + this->InsertLanguage(LANG_RU, LNG_NUM_STRINGS, langtable_ru); + this->InsertLanguage(LANG_IT, LNG_NUM_STRINGS, langtable_it); + + ModuleManager::Attach(I_OnChanServHelp, this); + } + void OnChanServHelp(User *u) + { + this->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP); + } +}; + +MODULE_INIT(CSAppendTopic) diff --git a/src/modules/cs_enforce.c b/src/modules/cs_enforce.c deleted file mode 100644 index 906e42ea6..000000000 --- a/src/modules/cs_enforce.c +++ /dev/null @@ -1,450 +0,0 @@ -/* cs_enforce - Add a /cs ENFORCE command to enforce various set - * options and channelmodes on a channel. - * - * (C) 2003-2010 Anope Team - * Contact us at team@anope.org - * - * Included in the Anope module pack since Anope 1.7.9 - * Anope Coder: GeniusDex - * - * Please read COPYING and README for further details. - * - * Send any bug reports to the Anope Coder, as he will be able - * to deal with it best. - */ - -#include "module.h" - -#define AUTHOR "Anope" -#define VERSION VERSION_STRING - -#define LNG_NUM_STRINGS 6 - -#define LNG_CHAN_HELP 0 -#define LNG_ENFORCE_SYNTAX 1 -#define LNG_CHAN_HELP_ENFORCE 2 -#define LNG_CHAN_HELP_ENFORCE_R_ENABLED 3 -#define LNG_CHAN_HELP_ENFORCE_R_DISABLED 4 -#define LNG_CHAN_RESPONSE 5 - -static Module *me; - -class CommandCSEnforce : public Command -{ - private: - void DoSet(Channel *c) - { - ChannelInfo *ci; - - if (!(ci = c->ci)) - return; - - if (ci->HasFlag(CI_SECUREOPS)) - this->DoSecureOps(c); - if (ci->HasFlag(CI_RESTRICTED)) - this->DoRestricted(c); - } - - void DoModes(Channel *c) - { - if (c->HasMode(CMODE_REGISTEREDONLY)) - this->DoCModeR(c); - } - - void DoSecureOps(Channel *c) - { - ChannelInfo *ci; - bool hadsecureops = false; - - if (!(ci = c->ci)) - return; - - Alog(LOG_DEBUG) << "[cs_enforce] Enforcing SECUREOPS on " << c->name; - - /* Dirty hack to allow chan_set_correct_modes to work ok. - * We pretend like SECUREOPS is on so it doesn't ignore that - * part of the code. This way we can enforce SECUREOPS even - * if it's off. - */ - if (!ci->HasFlag(CI_SECUREOPS)) - { - ci->SetFlag(CI_SECUREOPS); - hadsecureops = true; - } - - for (CUserList::iterator it = c->users.begin(); it != c->users.end(); ++it) - { - UserContainer *uc = *it; - - chan_set_correct_modes(uc->user, c, 0); - } - - if (hadsecureops) - { - ci->UnsetFlag(CI_SECUREOPS); - } - - } - - void DoRestricted(Channel *c) - { - ChannelInfo *ci; - int16 old_nojoin_level; - char mask[BUFSIZE]; - const char *reason; - - if (!(ci = c->ci)) - return; - - Alog(LOG_DEBUG) << "[cs_enforce] Enforcing RESTRICTED on " << c->name; - - old_nojoin_level = ci->levels[CA_NOJOIN]; - if (ci->levels[CA_NOJOIN] < 0) - ci->levels[CA_NOJOIN] = 0; - - for (CUserList::iterator it = c->users.begin(); it != c->users.end();) - { - UserContainer *uc = *it++; - - if (check_access(uc->user, ci, CA_NOJOIN)) - { - get_idealban(ci, uc->user, mask, sizeof(mask)); - reason = getstring(uc->user, CHAN_NOT_ALLOWED_TO_JOIN); - c->SetMode(NULL, CMODE_BAN, mask); - c->Kick(NULL, uc->user, "%s", reason); - } - } - - ci->levels[CA_NOJOIN] = old_nojoin_level; - } - - void DoCModeR(Channel *c) - { - ChannelInfo *ci; - char mask[BUFSIZE]; - const char *reason; - - if (!(ci = c->ci)) - return; - - Alog(LOG_DEBUG) << "[cs_enforce] Enforcing mode +R on " << c->name; - - for (CUserList::iterator it = c->users.begin(); it != c->users.end();) - { - UserContainer *uc = *it++; - - if (!uc->user->IsIdentified()) - { - get_idealban(ci, uc->user, mask, sizeof(mask)); - reason = getstring(uc->user, CHAN_NOT_ALLOWED_TO_JOIN); - if (!c->HasMode(CMODE_REGISTERED)) - { - c->SetMode(NULL, CMODE_BAN, mask); - } - c->Kick(NULL, uc->user, "%s", reason); - } - } - } - public: - CommandCSEnforce() : Command("ENFORCE", 1, 2) - { - } - - CommandReturn Execute(User *u, const std::vector ¶ms) - { - const char *chan = params[0].c_str(); - ci::string what = params.size() > 1 ? params[1] : ""; - Channel *c = findchan(chan); - ChannelInfo *ci; - - if (c) - ci = c->ci; - - if (!c) - notice_lang(Config.s_ChanServ, u, CHAN_X_NOT_IN_USE, chan); - else if (!check_access(u, ci, CA_AKICK)) - notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); - else - { - if (what.empty() || what == "SET") - { - this->DoSet(c); - me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_RESPONSE, !what.empty() ? what.c_str() : "SET"); - } - else if (what == "MODES") - { - this->DoModes(c); - me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_RESPONSE, what.c_str()); - } - else if (what == "SECUREOPS") - { - this->DoSecureOps(c); - me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_RESPONSE, what.c_str()); - } - else if (what == "RESTRICTED") - { - this->DoRestricted(c); - me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_RESPONSE, what.c_str()); - } - else if (what == "+R") - { - this->DoCModeR(c); - me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_RESPONSE, what.c_str()); - } - else - this->OnSyntaxError(u, ""); - } - - return MOD_CONT; - } - - bool OnHelp(User *u, const ci::string &subcommand) - { - me->NoticeLang(Config.s_ChanServ, u, LNG_ENFORCE_SYNTAX); - u->SendMessage(Config.s_ChanServ, " "); - me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP_ENFORCE); - u->SendMessage(Config.s_ChanServ, " "); - if (ModeManager::FindChannelModeByName(CMODE_REGISTERED)) - me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP_ENFORCE_R_ENABLED); - else - me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP_ENFORCE_R_DISABLED); - - return true; - } - - void OnSyntaxError(User *u, const ci::string &subcommand) - { - me->NoticeLang(Config.s_ChanServ, u, LNG_ENFORCE_SYNTAX); - } -}; - -class CSEnforce : public Module -{ - public: - CSEnforce(const std::string &modname, const std::string &creator) : Module(modname, creator) - { - me = this; - - this->SetAuthor(AUTHOR); - this->SetVersion(VERSION); - this->SetType(SUPPORTED); - - this->AddCommand(ChanServ, new CommandCSEnforce()); - - /* English (US) */ - const char* langtable_en_us[] = { - /* LNG_CHAN_HELP */ - " ENFORCE Enforce various channel modes and set options", - /* LNG_ENFORCE_SYNTAX */ - "Syntax: \002ENFORCE \037channel\037 [\037what\037]\002", - /* LNG_CHAN_HELP_ENFORCE */ - "Enforce various channel modes and set options. The \037channel\037\n" - "option indicates what channel to enforce the modes and options\n" - "on. The \037what\037 option indicates what modes and options to\n" - "enforce, and can be any of SET, SECUREOPS, RESTRICTED, MODES,\n" - "or +R. When left out, it defaults to SET.\n" - " \n" - "If \037what\037 is SET, it will enforce SECUREOPS and RESTRICTED\n" - "on the users currently in the channel, if they are set. Give\n" - "SECUREOPS to enforce the SECUREOPS option, even if it is not\n" - "enabled. Use RESTRICTED to enfore the RESTRICTED option, also\n" - "if it's not enabled.", - /* LNG_CHAN_HELP_ENFORCE_R_ENABLED */ - "If \037what\037 is MODES, it will enforce channelmode +R if it is\n" - "set. If +R is specified for \037what\037, the +R channelmode will\n" - "also be enforced, but even if it is not set. If it is not set,\n" - "users will be banned to ensure they don't just rejoin.", - /* LNG_CHAN_HELP_ENFORCE_R_DISABLED */ - "If \037what\037 is MODES, nothing will be enforced, since it would\n" - "enforce modes that the current ircd does not support. If +R is\n" - "specified for \037what\037, an equalivant of channelmode +R on\n" - "other ircds will be enforced. All users that are in the channel\n" - "but have not identified for their nickname will be kicked and\n" - "banned from the channel.", - /* LNG_CHAN_RESPONSE */ - "Enforced %s" - }; - - /* Dutch (NL) */ - const char* langtable_nl[] = { - /* LNG_CHAN_HELP */ - " ENFORCE Forceer enkele kanaalmodes en set-opties", - /* LNG_ENFORCE_SYNTAX */ - "Syntax: \002ENFORCE \037kanaal\037 [\037wat\037]\002", - /* LNG_CHAN_HELP_ENFORCE */ - "Forceer enkele kannalmodes en set-opties. De \037kanaal\037 optie\n" - "geeft aan op welk kanaal de modes en opties geforceerd moeten\n" - "worden. De \037wat\037 optie geeft aan welke modes en opties\n" - "geforceerd moeten worden; dit kan SET, SECUREOPS, RESTRICTED,\n" - "MODES, of +R zijn. Indien weggelaten is dit standaard SET.\n" - " \n" - "Als er voor \037wat\037 SET wordt ingevuld, zullen SECUREOPS en\n" - "RESTRICTED geforceerd worden op de gebruikers in het kanaal,\n" - "maar alleen als die opties aangezet zijn voor het kanaal. Als\n" - "SECUREOPS of RESTRICTED wordt gegeven voor \037wat\037 zal die optie\n" - "altijd geforceerd worden, ook als die niet is aangezet.", - /* LNG_CHAN_HELP_ENFORCE_R_ENABLED */ - "Als er voor \037wat\037 MODES wordt ingevuld, zal kanaalmode +R worden\n" - "geforceerd, als die op het kanaal aan staat. Als +R wordt ingevuld,\n" - "zal kanaalmode +R worden geforceerd, maar ook als die niet aan" - "staat voor het kanaal. Als +R niet aan staat, zullen alle ook\n" - "gebanned worden om te zorgen dat ze niet opnieuw het kanaal binnen\n" - "kunnen komen.", - /* LNG_CHAN_HELP_ENFORCE_R_DISABLED */ - "Als er voor \037wat\037 MODES wordt ingevuld, zal er niks gebeuren.\n" - "Normaal gesproken wordt er een kanaalmode geforceerd die op deze\n" - "server niet ondersteund wordt. Als +R wordt ingevuld voor \037wat\037\n" - "zullen alle gebruikers die in het kanaal zitten maar zich niet\n" - "hebben geidentificeerd voor hun nick uit het kanaal gekicked en\n" - "verbannen worden.", - /* LNG_CHAN_RESPONSE */ - "Enforced %s" - }; - - /* German (DE) */ - const char* langtable_de[] = { - /* LNG_CHAN_HELP */ - " ENFORCE Erzwingt verschieden Modes und SET Optionen", - /* LNG_ENFORCE_SYNTAX */ - "Syntax: \002ENFORCE \037Channel\037 [\037was\037]\002", - /* LNG_CHAN_HELP_ENFORCE */ - "Erzwingt verschieden Modes und SET Optionen. Die \037Channel\037\n" - "Option zeigt dir den Channel an, indem Modes und Optionen\n" - "zu erzwingen sind. Die \037was\037 Option zeigt dir welche Modes\n" - "und Optionen zu erzwingen sind. Die kцnnen nur SET, SECUREOPS,\n" - "RESTRICTED, MODES oder +R sein.Default ist SET.\n" - " \n" - "Wenn \037was\037 SET ist, wird SECUREOPS und RESTRICTED\n" - "auf die User die z.Z.in Channel sind erzwungen, wenn sie AN sind.\n" - "Benutze SECUREOPS oder RESTRICTED , um die Optionen einzeln\n" - "zu erzwingen, also wenn sie nicht eingeschaltet sind.", - /* LNG_CHAN_HELP_ENFORCE_R_ENABLED */ - "Wenn \037was\037 MODES ist, wird das ChannelMode +R erzwungen\n" - "falls an. Wenn \037was\037 +R ist, wird +R erzwungen aber eben\n" - "wenn noch nicht als Channel-Mode ist. Wenn +R noch nicht als\n" - "Channel-Mode war werden alle User aus den Channel gebannt um\n" - "sicher zu sein das sie nicht rejoinen.", - /* LNG_CHAN_HELP_ENFORCE_R_DISABLED */ - "Wenn \037was\037 MODES ist, wird nichts erzwungen weil es MODES seine\n" - "kцnnen die dein IRCD nicht unterstьtzt. Wenn \037was\037 +R ist\n" - "oder ein Modes was auf ein anderen IRCD gleich +R ist, wird es\n" - "erzwungen. Alle User die nicht fьr deren Nicknamen identifiziert\n" - "sind werden aus den Channel gekickt und gebannt.", - /* LNG_CHAN_RESPONSE */ - "Erzwungen %s" - }; - - /* Portuguese (PT) */ - const char* langtable_pt[] = { - /* LNG_CHAN_HELP */ - " ENFORCE Verifica o cumprimento de vбrios modos de canal e opзхes ajustadas", - /* LNG_ENFORCE_SYNTAX */ - "Sintaxe: \002ENFORCE \037canal\037 [\037opзгo\037]\002", - /* LNG_CHAN_HELP_ENFORCE */ - "Verifica o cumprimento de vбrios modos de canal e opзхes ajustadas.\n" - "O campo \037canal\037 indica qual canal deve ter os modos e opзхes verificadas\n" - "O campo \037opзгo\037 indica quais modos e opзхes devem ser verificadas,\n" - "e pode ser: SET, SECUREOPS, RESTRICTED, MODES ou +R\n" - "Quando deixado em branco, o padrгo й SET.\n" - " \n" - "Se \037opзгo\037 for SET, serгo verificadas as opзхes SECUREOPS e RESTRICTED\n" - "para usuбrios que estiverem no canal, caso elas estejam ativadas. Use\n" - "SECUREOPS para verificar a opзгo SECUREOPS, mesmo que ela nгo esteja ativada\n" - "Use RESTRICTED para verificar a opзгo RESTRICTED, mesmo que ela nгo esteja\n" - "ativada.", - /* LNG_CHAN_HELP_ENFORCE_R_ENABLED */ - "Se \037opзгo\037 for MODES, serб verificado o modo de canal +R caso ele\n" - "esteja ativado. Se +R for especificado para \037opзгo\037, o modo de canal\n" - "+R tambйm serб verificado, mesmo que ele nгo esteja ativado. Se ele nгo\n" - "estiver ativado, os usuбrios serгo banidos para evitar que reentrem no canal.", - /* LNG_CHAN_HELP_ENFORCE_R_DISABLED */ - "Se \037opзгo\037 for MODES, nada serб verificado, visto que isto poderia\n" - "verificar modos que o IRCd atual nгo suporta. Se +R for especificado\n" - "para \037opзгo\037, um equivalente ao modo de canal +R em outros IRCds\n" - "serб verificado. Todos os usuбrios que estгo no canal, mas nгo estejam\n" - "identificados para seus nicks serгo kickados e banidos do canal.", - /* LNG_CHAN_RESPONSE */ - "Verificado %s" - }; - - /* Russian (RU) */ - const char* langtable_ru[] = { - /* LNG_CHAN_HELP */ - " ENFORCE Перепроверка и установка различных режимов и опций канала", - /* LNG_ENFORCE_SYNTAX */ - "Синтаксис: \002ENFORCE \037#канал\037 \037параметр\037\002", - /* LNG_CHAN_HELP_ENFORCE */ - "Перепроверка и установка различных режимов и опций канала.\n" - "\037Параметр\037 указывает какие опции или режимы канала должны быть\n" - "перепроверены. В качестве параметра могут быть указаны: SET, SECUREOPS,\n" - "RESTRICTED, MODES, или +R. Если параметр не указан, по-умолчанию будет SET.\n" - " \n" - "Если в качестве \037параметра\037 указано SET, будут перепроверены опции\n" - "SECUREOPS и RESTRICTED относительно пользователей на указанном канале\n" - "(при условии, что опции включены). Отдельно указанный параметр SECUREOPS\n" - "применит опцию SECUREOPS (даже если она \037НЕ\037 установлена). Параметр\n" - "RESTRICTED применит опцию RESTRICTED (даже если она \037НЕ\037 установлена)", - /* LNG_CHAN_HELP_ENFORCE_R_ENABLED */ - "Если в качестве \037параметра\037 указано MODES, будет перепроверен режим +R\n" - "(если он установлен). Отдельно указанный параметр \037+R\037 применит\n" - "канальный режим +R, даже если он не установлен, и забанит всех пользователей,\n" - "которые не идентифицировались к своему нику или не имеют зарегистрированного ника.", - /* LNG_CHAN_HELP_ENFORCE_R_DISABLED */ - "Если в качестве \037параметра\037 указано MODES, перепроверка осуществлена\n" - "НЕ БУДЕТ, так как текущий IRCD не поддерживает необходимые режимы.\n" - "Отдельно указанный параметр \037+R\037 применит канальный режим, эквивалентный\n" - "режиму +R и забанит всех пользователей, которые не идентифицировались к своему\n" - "нику или не имеют зарегистрированного ника.", - /* LNG_CHAN_RESPONSE */ - "Перепроверено: %s" - }; - - /* Italian (IT) */ - const char* langtable_it[] = { - /* LNG_CHAN_HELP */ - " ENFORCE Forza diversi modi di canale ed opzioni SET", - /* LNG_ENFORCE_SYNTAX */ - "Sintassi: \002ENFORCE \037canale\037 [\037cosa\037]\002", - /* LNG_CHAN_HELP_ENFORCE */ - "Forza diversi modi di canale ed opzioni SET. Il parametro \037canale\037\n" - "indica il canale sul quale forzare i modi e le opzioni. Il parametro\n" - "\037cosa\037 indica i modi e le opzioni da forzare, e possono essere\n" - "qualsiasi delle opzioni SET, SECUREOPS, RESTRICTED, MODES, o +R.\n" - "Se non specificato, viene sottointeso SET.\n" - " \n" - "Se \037cosa\037 и SET, forzerа SECUREOPS e RESTRICTED sugli utenti\n" - "attualmente nel canale, se sono impostati. Specifica SECUREOPS per\n" - "forzare l'opzione SECUREOPS, anche se non и attivata. Specifica\n" - "RESTRICTED per forzare l'opzione RESTRICTED, anche se non и\n" - "attivata.", - /* LNG_CHAN_HELP_ENFORCE_R_ENABLED */ - "Se \037cosa\037 и MODES, forzerа il modo del canale +R se и impostato.\n" - "Se +R и specificato per \037cosa\037, il modo del canale +R verrа\n" - "forzato, anche se non и impostato. Se non и impostato, gli utenti\n" - "verranno bannati per assicurare che non rientrino semplicemente.", - /* LNG_CHAN_HELP_ENFORCE_R_DISABLED */ - "Se \037cosa\037 и MODES, niente verrа forzato, siccome forzerebbe\n" - "dei modi che l'ircd in uso non supporterebbe. Se +R и specificato\n" - "per \037cosa\037, un modo equivalente a +R sui altri ircd verrа\n" - "forzato. Tutti gli utenti presenti nel canale ma non identificati\n" - "per il loro nickname verranno bannati ed espulsi dal canale.\n", - /* LNG_CHAN_RESPONSE */ - "Forzato %s" - }; - - this->InsertLanguage(LANG_EN_US, LNG_NUM_STRINGS, langtable_en_us); - this->InsertLanguage(LANG_NL, LNG_NUM_STRINGS, langtable_nl); - this->InsertLanguage(LANG_DE, LNG_NUM_STRINGS, langtable_de); - this->InsertLanguage(LANG_PT, LNG_NUM_STRINGS, langtable_pt); - this->InsertLanguage(LANG_RU, LNG_NUM_STRINGS, langtable_ru); - this->InsertLanguage(LANG_IT, LNG_NUM_STRINGS, langtable_it); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - this->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP); - } -}; - -MODULE_INIT(CSEnforce) diff --git a/src/modules/cs_enforce.cpp b/src/modules/cs_enforce.cpp new file mode 100644 index 000000000..906e42ea6 --- /dev/null +++ b/src/modules/cs_enforce.cpp @@ -0,0 +1,450 @@ +/* cs_enforce - Add a /cs ENFORCE command to enforce various set + * options and channelmodes on a channel. + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Included in the Anope module pack since Anope 1.7.9 + * Anope Coder: GeniusDex + * + * Please read COPYING and README for further details. + * + * Send any bug reports to the Anope Coder, as he will be able + * to deal with it best. + */ + +#include "module.h" + +#define AUTHOR "Anope" +#define VERSION VERSION_STRING + +#define LNG_NUM_STRINGS 6 + +#define LNG_CHAN_HELP 0 +#define LNG_ENFORCE_SYNTAX 1 +#define LNG_CHAN_HELP_ENFORCE 2 +#define LNG_CHAN_HELP_ENFORCE_R_ENABLED 3 +#define LNG_CHAN_HELP_ENFORCE_R_DISABLED 4 +#define LNG_CHAN_RESPONSE 5 + +static Module *me; + +class CommandCSEnforce : public Command +{ + private: + void DoSet(Channel *c) + { + ChannelInfo *ci; + + if (!(ci = c->ci)) + return; + + if (ci->HasFlag(CI_SECUREOPS)) + this->DoSecureOps(c); + if (ci->HasFlag(CI_RESTRICTED)) + this->DoRestricted(c); + } + + void DoModes(Channel *c) + { + if (c->HasMode(CMODE_REGISTEREDONLY)) + this->DoCModeR(c); + } + + void DoSecureOps(Channel *c) + { + ChannelInfo *ci; + bool hadsecureops = false; + + if (!(ci = c->ci)) + return; + + Alog(LOG_DEBUG) << "[cs_enforce] Enforcing SECUREOPS on " << c->name; + + /* Dirty hack to allow chan_set_correct_modes to work ok. + * We pretend like SECUREOPS is on so it doesn't ignore that + * part of the code. This way we can enforce SECUREOPS even + * if it's off. + */ + if (!ci->HasFlag(CI_SECUREOPS)) + { + ci->SetFlag(CI_SECUREOPS); + hadsecureops = true; + } + + for (CUserList::iterator it = c->users.begin(); it != c->users.end(); ++it) + { + UserContainer *uc = *it; + + chan_set_correct_modes(uc->user, c, 0); + } + + if (hadsecureops) + { + ci->UnsetFlag(CI_SECUREOPS); + } + + } + + void DoRestricted(Channel *c) + { + ChannelInfo *ci; + int16 old_nojoin_level; + char mask[BUFSIZE]; + const char *reason; + + if (!(ci = c->ci)) + return; + + Alog(LOG_DEBUG) << "[cs_enforce] Enforcing RESTRICTED on " << c->name; + + old_nojoin_level = ci->levels[CA_NOJOIN]; + if (ci->levels[CA_NOJOIN] < 0) + ci->levels[CA_NOJOIN] = 0; + + for (CUserList::iterator it = c->users.begin(); it != c->users.end();) + { + UserContainer *uc = *it++; + + if (check_access(uc->user, ci, CA_NOJOIN)) + { + get_idealban(ci, uc->user, mask, sizeof(mask)); + reason = getstring(uc->user, CHAN_NOT_ALLOWED_TO_JOIN); + c->SetMode(NULL, CMODE_BAN, mask); + c->Kick(NULL, uc->user, "%s", reason); + } + } + + ci->levels[CA_NOJOIN] = old_nojoin_level; + } + + void DoCModeR(Channel *c) + { + ChannelInfo *ci; + char mask[BUFSIZE]; + const char *reason; + + if (!(ci = c->ci)) + return; + + Alog(LOG_DEBUG) << "[cs_enforce] Enforcing mode +R on " << c->name; + + for (CUserList::iterator it = c->users.begin(); it != c->users.end();) + { + UserContainer *uc = *it++; + + if (!uc->user->IsIdentified()) + { + get_idealban(ci, uc->user, mask, sizeof(mask)); + reason = getstring(uc->user, CHAN_NOT_ALLOWED_TO_JOIN); + if (!c->HasMode(CMODE_REGISTERED)) + { + c->SetMode(NULL, CMODE_BAN, mask); + } + c->Kick(NULL, uc->user, "%s", reason); + } + } + } + public: + CommandCSEnforce() : Command("ENFORCE", 1, 2) + { + } + + CommandReturn Execute(User *u, const std::vector ¶ms) + { + const char *chan = params[0].c_str(); + ci::string what = params.size() > 1 ? params[1] : ""; + Channel *c = findchan(chan); + ChannelInfo *ci; + + if (c) + ci = c->ci; + + if (!c) + notice_lang(Config.s_ChanServ, u, CHAN_X_NOT_IN_USE, chan); + else if (!check_access(u, ci, CA_AKICK)) + notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); + else + { + if (what.empty() || what == "SET") + { + this->DoSet(c); + me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_RESPONSE, !what.empty() ? what.c_str() : "SET"); + } + else if (what == "MODES") + { + this->DoModes(c); + me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_RESPONSE, what.c_str()); + } + else if (what == "SECUREOPS") + { + this->DoSecureOps(c); + me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_RESPONSE, what.c_str()); + } + else if (what == "RESTRICTED") + { + this->DoRestricted(c); + me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_RESPONSE, what.c_str()); + } + else if (what == "+R") + { + this->DoCModeR(c); + me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_RESPONSE, what.c_str()); + } + else + this->OnSyntaxError(u, ""); + } + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &subcommand) + { + me->NoticeLang(Config.s_ChanServ, u, LNG_ENFORCE_SYNTAX); + u->SendMessage(Config.s_ChanServ, " "); + me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP_ENFORCE); + u->SendMessage(Config.s_ChanServ, " "); + if (ModeManager::FindChannelModeByName(CMODE_REGISTERED)) + me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP_ENFORCE_R_ENABLED); + else + me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP_ENFORCE_R_DISABLED); + + return true; + } + + void OnSyntaxError(User *u, const ci::string &subcommand) + { + me->NoticeLang(Config.s_ChanServ, u, LNG_ENFORCE_SYNTAX); + } +}; + +class CSEnforce : public Module +{ + public: + CSEnforce(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + me = this; + + this->SetAuthor(AUTHOR); + this->SetVersion(VERSION); + this->SetType(SUPPORTED); + + this->AddCommand(ChanServ, new CommandCSEnforce()); + + /* English (US) */ + const char* langtable_en_us[] = { + /* LNG_CHAN_HELP */ + " ENFORCE Enforce various channel modes and set options", + /* LNG_ENFORCE_SYNTAX */ + "Syntax: \002ENFORCE \037channel\037 [\037what\037]\002", + /* LNG_CHAN_HELP_ENFORCE */ + "Enforce various channel modes and set options. The \037channel\037\n" + "option indicates what channel to enforce the modes and options\n" + "on. The \037what\037 option indicates what modes and options to\n" + "enforce, and can be any of SET, SECUREOPS, RESTRICTED, MODES,\n" + "or +R. When left out, it defaults to SET.\n" + " \n" + "If \037what\037 is SET, it will enforce SECUREOPS and RESTRICTED\n" + "on the users currently in the channel, if they are set. Give\n" + "SECUREOPS to enforce the SECUREOPS option, even if it is not\n" + "enabled. Use RESTRICTED to enfore the RESTRICTED option, also\n" + "if it's not enabled.", + /* LNG_CHAN_HELP_ENFORCE_R_ENABLED */ + "If \037what\037 is MODES, it will enforce channelmode +R if it is\n" + "set. If +R is specified for \037what\037, the +R channelmode will\n" + "also be enforced, but even if it is not set. If it is not set,\n" + "users will be banned to ensure they don't just rejoin.", + /* LNG_CHAN_HELP_ENFORCE_R_DISABLED */ + "If \037what\037 is MODES, nothing will be enforced, since it would\n" + "enforce modes that the current ircd does not support. If +R is\n" + "specified for \037what\037, an equalivant of channelmode +R on\n" + "other ircds will be enforced. All users that are in the channel\n" + "but have not identified for their nickname will be kicked and\n" + "banned from the channel.", + /* LNG_CHAN_RESPONSE */ + "Enforced %s" + }; + + /* Dutch (NL) */ + const char* langtable_nl[] = { + /* LNG_CHAN_HELP */ + " ENFORCE Forceer enkele kanaalmodes en set-opties", + /* LNG_ENFORCE_SYNTAX */ + "Syntax: \002ENFORCE \037kanaal\037 [\037wat\037]\002", + /* LNG_CHAN_HELP_ENFORCE */ + "Forceer enkele kannalmodes en set-opties. De \037kanaal\037 optie\n" + "geeft aan op welk kanaal de modes en opties geforceerd moeten\n" + "worden. De \037wat\037 optie geeft aan welke modes en opties\n" + "geforceerd moeten worden; dit kan SET, SECUREOPS, RESTRICTED,\n" + "MODES, of +R zijn. Indien weggelaten is dit standaard SET.\n" + " \n" + "Als er voor \037wat\037 SET wordt ingevuld, zullen SECUREOPS en\n" + "RESTRICTED geforceerd worden op de gebruikers in het kanaal,\n" + "maar alleen als die opties aangezet zijn voor het kanaal. Als\n" + "SECUREOPS of RESTRICTED wordt gegeven voor \037wat\037 zal die optie\n" + "altijd geforceerd worden, ook als die niet is aangezet.", + /* LNG_CHAN_HELP_ENFORCE_R_ENABLED */ + "Als er voor \037wat\037 MODES wordt ingevuld, zal kanaalmode +R worden\n" + "geforceerd, als die op het kanaal aan staat. Als +R wordt ingevuld,\n" + "zal kanaalmode +R worden geforceerd, maar ook als die niet aan" + "staat voor het kanaal. Als +R niet aan staat, zullen alle ook\n" + "gebanned worden om te zorgen dat ze niet opnieuw het kanaal binnen\n" + "kunnen komen.", + /* LNG_CHAN_HELP_ENFORCE_R_DISABLED */ + "Als er voor \037wat\037 MODES wordt ingevuld, zal er niks gebeuren.\n" + "Normaal gesproken wordt er een kanaalmode geforceerd die op deze\n" + "server niet ondersteund wordt. Als +R wordt ingevuld voor \037wat\037\n" + "zullen alle gebruikers die in het kanaal zitten maar zich niet\n" + "hebben geidentificeerd voor hun nick uit het kanaal gekicked en\n" + "verbannen worden.", + /* LNG_CHAN_RESPONSE */ + "Enforced %s" + }; + + /* German (DE) */ + const char* langtable_de[] = { + /* LNG_CHAN_HELP */ + " ENFORCE Erzwingt verschieden Modes und SET Optionen", + /* LNG_ENFORCE_SYNTAX */ + "Syntax: \002ENFORCE \037Channel\037 [\037was\037]\002", + /* LNG_CHAN_HELP_ENFORCE */ + "Erzwingt verschieden Modes und SET Optionen. Die \037Channel\037\n" + "Option zeigt dir den Channel an, indem Modes und Optionen\n" + "zu erzwingen sind. Die \037was\037 Option zeigt dir welche Modes\n" + "und Optionen zu erzwingen sind. Die kцnnen nur SET, SECUREOPS,\n" + "RESTRICTED, MODES oder +R sein.Default ist SET.\n" + " \n" + "Wenn \037was\037 SET ist, wird SECUREOPS und RESTRICTED\n" + "auf die User die z.Z.in Channel sind erzwungen, wenn sie AN sind.\n" + "Benutze SECUREOPS oder RESTRICTED , um die Optionen einzeln\n" + "zu erzwingen, also wenn sie nicht eingeschaltet sind.", + /* LNG_CHAN_HELP_ENFORCE_R_ENABLED */ + "Wenn \037was\037 MODES ist, wird das ChannelMode +R erzwungen\n" + "falls an. Wenn \037was\037 +R ist, wird +R erzwungen aber eben\n" + "wenn noch nicht als Channel-Mode ist. Wenn +R noch nicht als\n" + "Channel-Mode war werden alle User aus den Channel gebannt um\n" + "sicher zu sein das sie nicht rejoinen.", + /* LNG_CHAN_HELP_ENFORCE_R_DISABLED */ + "Wenn \037was\037 MODES ist, wird nichts erzwungen weil es MODES seine\n" + "kцnnen die dein IRCD nicht unterstьtzt. Wenn \037was\037 +R ist\n" + "oder ein Modes was auf ein anderen IRCD gleich +R ist, wird es\n" + "erzwungen. Alle User die nicht fьr deren Nicknamen identifiziert\n" + "sind werden aus den Channel gekickt und gebannt.", + /* LNG_CHAN_RESPONSE */ + "Erzwungen %s" + }; + + /* Portuguese (PT) */ + const char* langtable_pt[] = { + /* LNG_CHAN_HELP */ + " ENFORCE Verifica o cumprimento de vбrios modos de canal e opзхes ajustadas", + /* LNG_ENFORCE_SYNTAX */ + "Sintaxe: \002ENFORCE \037canal\037 [\037opзгo\037]\002", + /* LNG_CHAN_HELP_ENFORCE */ + "Verifica o cumprimento de vбrios modos de canal e opзхes ajustadas.\n" + "O campo \037canal\037 indica qual canal deve ter os modos e opзхes verificadas\n" + "O campo \037opзгo\037 indica quais modos e opзхes devem ser verificadas,\n" + "e pode ser: SET, SECUREOPS, RESTRICTED, MODES ou +R\n" + "Quando deixado em branco, o padrгo й SET.\n" + " \n" + "Se \037opзгo\037 for SET, serгo verificadas as opзхes SECUREOPS e RESTRICTED\n" + "para usuбrios que estiverem no canal, caso elas estejam ativadas. Use\n" + "SECUREOPS para verificar a opзгo SECUREOPS, mesmo que ela nгo esteja ativada\n" + "Use RESTRICTED para verificar a opзгo RESTRICTED, mesmo que ela nгo esteja\n" + "ativada.", + /* LNG_CHAN_HELP_ENFORCE_R_ENABLED */ + "Se \037opзгo\037 for MODES, serб verificado o modo de canal +R caso ele\n" + "esteja ativado. Se +R for especificado para \037opзгo\037, o modo de canal\n" + "+R tambйm serб verificado, mesmo que ele nгo esteja ativado. Se ele nгo\n" + "estiver ativado, os usuбrios serгo banidos para evitar que reentrem no canal.", + /* LNG_CHAN_HELP_ENFORCE_R_DISABLED */ + "Se \037opзгo\037 for MODES, nada serб verificado, visto que isto poderia\n" + "verificar modos que o IRCd atual nгo suporta. Se +R for especificado\n" + "para \037opзгo\037, um equivalente ao modo de canal +R em outros IRCds\n" + "serб verificado. Todos os usuбrios que estгo no canal, mas nгo estejam\n" + "identificados para seus nicks serгo kickados e banidos do canal.", + /* LNG_CHAN_RESPONSE */ + "Verificado %s" + }; + + /* Russian (RU) */ + const char* langtable_ru[] = { + /* LNG_CHAN_HELP */ + " ENFORCE Перепроверка и установка различных режимов и опций канала", + /* LNG_ENFORCE_SYNTAX */ + "Синтаксис: \002ENFORCE \037#канал\037 \037параметр\037\002", + /* LNG_CHAN_HELP_ENFORCE */ + "Перепроверка и установка различных режимов и опций канала.\n" + "\037Параметр\037 указывает какие опции или режимы канала должны быть\n" + "перепроверены. В качестве параметра могут быть указаны: SET, SECUREOPS,\n" + "RESTRICTED, MODES, или +R. Если параметр не указан, по-умолчанию будет SET.\n" + " \n" + "Если в качестве \037параметра\037 указано SET, будут перепроверены опции\n" + "SECUREOPS и RESTRICTED относительно пользователей на указанном канале\n" + "(при условии, что опции включены). Отдельно указанный параметр SECUREOPS\n" + "применит опцию SECUREOPS (даже если она \037НЕ\037 установлена). Параметр\n" + "RESTRICTED применит опцию RESTRICTED (даже если она \037НЕ\037 установлена)", + /* LNG_CHAN_HELP_ENFORCE_R_ENABLED */ + "Если в качестве \037параметра\037 указано MODES, будет перепроверен режим +R\n" + "(если он установлен). Отдельно указанный параметр \037+R\037 применит\n" + "канальный режим +R, даже если он не установлен, и забанит всех пользователей,\n" + "которые не идентифицировались к своему нику или не имеют зарегистрированного ника.", + /* LNG_CHAN_HELP_ENFORCE_R_DISABLED */ + "Если в качестве \037параметра\037 указано MODES, перепроверка осуществлена\n" + "НЕ БУДЕТ, так как текущий IRCD не поддерживает необходимые режимы.\n" + "Отдельно указанный параметр \037+R\037 применит канальный режим, эквивалентный\n" + "режиму +R и забанит всех пользователей, которые не идентифицировались к своему\n" + "нику или не имеют зарегистрированного ника.", + /* LNG_CHAN_RESPONSE */ + "Перепроверено: %s" + }; + + /* Italian (IT) */ + const char* langtable_it[] = { + /* LNG_CHAN_HELP */ + " ENFORCE Forza diversi modi di canale ed opzioni SET", + /* LNG_ENFORCE_SYNTAX */ + "Sintassi: \002ENFORCE \037canale\037 [\037cosa\037]\002", + /* LNG_CHAN_HELP_ENFORCE */ + "Forza diversi modi di canale ed opzioni SET. Il parametro \037canale\037\n" + "indica il canale sul quale forzare i modi e le opzioni. Il parametro\n" + "\037cosa\037 indica i modi e le opzioni da forzare, e possono essere\n" + "qualsiasi delle opzioni SET, SECUREOPS, RESTRICTED, MODES, o +R.\n" + "Se non specificato, viene sottointeso SET.\n" + " \n" + "Se \037cosa\037 и SET, forzerа SECUREOPS e RESTRICTED sugli utenti\n" + "attualmente nel canale, se sono impostati. Specifica SECUREOPS per\n" + "forzare l'opzione SECUREOPS, anche se non и attivata. Specifica\n" + "RESTRICTED per forzare l'opzione RESTRICTED, anche se non и\n" + "attivata.", + /* LNG_CHAN_HELP_ENFORCE_R_ENABLED */ + "Se \037cosa\037 и MODES, forzerа il modo del canale +R se и impostato.\n" + "Se +R и specificato per \037cosa\037, il modo del canale +R verrа\n" + "forzato, anche se non и impostato. Se non и impostato, gli utenti\n" + "verranno bannati per assicurare che non rientrino semplicemente.", + /* LNG_CHAN_HELP_ENFORCE_R_DISABLED */ + "Se \037cosa\037 и MODES, niente verrа forzato, siccome forzerebbe\n" + "dei modi che l'ircd in uso non supporterebbe. Se +R и specificato\n" + "per \037cosa\037, un modo equivalente a +R sui altri ircd verrа\n" + "forzato. Tutti gli utenti presenti nel canale ma non identificati\n" + "per il loro nickname verranno bannati ed espulsi dal canale.\n", + /* LNG_CHAN_RESPONSE */ + "Forzato %s" + }; + + this->InsertLanguage(LANG_EN_US, LNG_NUM_STRINGS, langtable_en_us); + this->InsertLanguage(LANG_NL, LNG_NUM_STRINGS, langtable_nl); + this->InsertLanguage(LANG_DE, LNG_NUM_STRINGS, langtable_de); + this->InsertLanguage(LANG_PT, LNG_NUM_STRINGS, langtable_pt); + this->InsertLanguage(LANG_RU, LNG_NUM_STRINGS, langtable_ru); + this->InsertLanguage(LANG_IT, LNG_NUM_STRINGS, langtable_it); + + ModuleManager::Attach(I_OnChanServHelp, this); + } + void OnChanServHelp(User *u) + { + this->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP); + } +}; + +MODULE_INIT(CSEnforce) diff --git a/src/modules/cs_tban.c b/src/modules/cs_tban.c deleted file mode 100644 index 710840d52..000000000 --- a/src/modules/cs_tban.c +++ /dev/null @@ -1,214 +0,0 @@ -/* cs_tban.c - Bans the user for a given length of time - * - * (C) 2003-2010 Anope Team - * Contact us at team@anope.org - * - * Based on the original module by Rob - * Included in the Anope module pack since Anope 1.7.8 - * Anope Coder: Rob - * - * Please read COPYING and README for further details. - * - * Send bug reports to the Anope Coder instead of the module - * author, because any changes since the inclusion into anope - * are not supported by the original author. - * - */ -/*************************************************************************/ - -#include "module.h" - -#define AUTHOR "Rob" -#define VERSION VERSION_STRING - -void mySendResponse(User *u, const char *channel, char *mask, const char *time); - -void addBan(Channel *c, time_t timeout, char *banmask); -int canBanUser(Channel *c, User *u, User *u2); - -void mAddLanguages(); - -static Module *me = NULL; - -#define LANG_NUM_STRINGS 4 -#define TBAN_HELP 0 -#define TBAN_SYNTAX 1 -#define TBAN_HELP_DETAIL 2 -#define TBAN_RESPONSE 3 - -class CommandCSTBan : public Command -{ - public: - CommandCSTBan() : Command("TBAN", 3, 3) - { - } - - CommandReturn Execute(User *u, const std::vector ¶ms) - { - char mask[BUFSIZE]; - Channel *c; - User *u2 = NULL; - - const char *chan = params[0].c_str(); - const char *nick = params[1].c_str(); - const char *time = params[2].c_str(); - - if (!(c = findchan(chan))) - notice_lang(Config.s_ChanServ, u, CHAN_X_NOT_IN_USE, chan); - else if (!(u2 = finduser(nick))) - notice_lang(Config.s_ChanServ, u, NICK_X_NOT_IN_USE, nick); - else - { - if (canBanUser(c, u, u2)) - { - get_idealban(c->ci, u2, mask, sizeof(mask)); - addBan(c, dotime(time), mask); - mySendResponse(u, chan, mask, time); - } - } - - return MOD_CONT; - } - - bool OnHelp(User *u, const ci::string &subcommand) - { - this->OnSyntaxError(u, ""); - u->SendMessage(Config.s_ChanServ, " "); - me->NoticeLang(Config.s_ChanServ, u, TBAN_HELP_DETAIL); - - return true; - } - - void OnSyntaxError(User *u, const ci::string &subcommand) - { - me->NoticeLang(Config.s_ChanServ, u, TBAN_SYNTAX); - } -}; - -class CSTBan : public Module -{ - public: - CSTBan(const std::string &modname, const std::string &creator) : Module(modname, creator) - { - me = this; - - this->AddCommand(ChanServ, new CommandCSTBan()); - - this->SetAuthor(AUTHOR); - this->SetVersion(VERSION); - this->SetType(SUPPORTED); - - const char* langtable_en_us[] = { - " TBAN Bans the user for a given length of time", - "Syntax: TBAN channel nick time", - "Bans the given user from a channel for a specified length of\n" - "time. If the ban is removed before by hand, it will NOT be replaced.", - "%s banned from %s, will auto-expire in %s" - }; - - const char* langtable_nl[] = { - " TBAN Verban een gebruiker voor een bepaalde tijd", - "Syntax: TBAN kanaal nick tijd", - "Verbant de gegeven gebruiken van het gegeven kanaal voor de\n" - "gegeven tijdsduur. Als de verbanning eerder wordt verwijderd,\n" - "zal deze NIET worden vervangen.", - "%s verbannen van %s, zal verlopen in %s" - }; - - const char* langtable_de[] = { - " TBAN Bant ein User fьr eine bestimmte Zeit aus ein Channel", - "Syntax: TBAN Channel Nickname Zeit", - "Bant ein User fьr eine bestimmte Zeit aus ein Channel\n" - "Wenn der Ban manuell entfernt wird, wird es NICHT ersetzt.", - "%s gebannt von %s, wird auto-auslaufen in %s" - }; - - const char* langtable_pt[] = { - " TBAN Bane o usuбrio por um determinado perнodo de tempo", - "Sintaxe: TBAN canal nick tempo", - "Bane de um canal o usuбrio especificado por um determinado perнodo de\n" - "tempo. Se o ban for removido manualmente antes do tempo, ele nгo serб recolocado.", - "%s foi banido do %s, irб auto-expirar em %s" - }; - - const char* langtable_ru[] = { - " TBAN Банит пользователя на указанный промежуток времени", - "Синтаксис: TBAN #канал ник время", - "Банит пользователя на указанный промежуток времени в секундах\n" - "Примечание: удаленный вручную (до своего истечения) бан НЕ БУДЕТ\n" - "переустановлен сервисами автоматически!", - "Установленный бан %s на канале %s истечет через %s секунд" - }; - - const char* langtable_it[] = { - " TBAN Banna l'utente per un periodo di tempo specificato", - "Sintassi: TBAN canale nick tempo", - "Banna l'utente specificato da un canale per un periodo di tempo\n" - "specificato. Se il ban viene rimosso a mano prima della scadenza, NON verrа rimpiazzato.", - "%s bannato da %s, scadrа automaticamente tra %s" - }; - - this->InsertLanguage(LANG_EN_US, LANG_NUM_STRINGS, langtable_en_us); - this->InsertLanguage(LANG_NL, LANG_NUM_STRINGS, langtable_nl); - this->InsertLanguage(LANG_DE, LANG_NUM_STRINGS, langtable_de); - this->InsertLanguage(LANG_PT, LANG_NUM_STRINGS, langtable_pt); - this->InsertLanguage(LANG_RU, LANG_NUM_STRINGS, langtable_ru); - this->InsertLanguage(LANG_IT, LANG_NUM_STRINGS, langtable_it); - - ModuleManager::Attach(I_OnChanServHelp, this); - } - void OnChanServHelp(User *u) - { - this->NoticeLang(Config.s_ChanServ, u, TBAN_HELP); - } -}; - -void mySendResponse(User *u, const char *channel, char *mask, const char *time) -{ - me->NoticeLang(Config.s_ChanServ, u, TBAN_RESPONSE, mask, channel, time); -} - -class TempBan : public CallBack -{ - private: - std::string chan; - std::string mask; - - public: - TempBan(time_t seconds, const std::string &channel, const std::string &banmask) : CallBack(me, seconds), chan(channel), mask(banmask) { } - - void Tick(time_t ctime) - { - Channel *c; - - if ((c = findchan(chan.c_str())) && c->ci) - { - c->RemoveMode(NULL, CMODE_BAN, mask); - } - } -}; - -void addBan(Channel *c, time_t timeout, char *banmask) -{ - c->SetMode(NULL, CMODE_BAN, banmask); - - new TempBan(timeout, c->name, banmask); -} - -int canBanUser(Channel * c, User * u, User * u2) -{ - ChannelInfo *ci = c->ci; - int ok = 0; - if (!check_access(u, ci, CA_BAN)) - notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); - else if (is_excepted(ci, u2)) - notice_lang(Config.s_ChanServ, u, CHAN_EXCEPTED, u2->nick.c_str(), ci->name.c_str()); - else if (u2->IsProtected()) - notice_lang(Config.s_ChanServ, u, ACCESS_DENIED); - else - ok = 1; - - return ok; -} - -MODULE_INIT(CSTBan) diff --git a/src/modules/cs_tban.cpp b/src/modules/cs_tban.cpp new file mode 100644 index 000000000..710840d52 --- /dev/null +++ b/src/modules/cs_tban.cpp @@ -0,0 +1,214 @@ +/* cs_tban.c - Bans the user for a given length of time + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Based on the original module by Rob + * Included in the Anope module pack since Anope 1.7.8 + * Anope Coder: Rob + * + * Please read COPYING and README for further details. + * + * Send bug reports to the Anope Coder instead of the module + * author, because any changes since the inclusion into anope + * are not supported by the original author. + * + */ +/*************************************************************************/ + +#include "module.h" + +#define AUTHOR "Rob" +#define VERSION VERSION_STRING + +void mySendResponse(User *u, const char *channel, char *mask, const char *time); + +void addBan(Channel *c, time_t timeout, char *banmask); +int canBanUser(Channel *c, User *u, User *u2); + +void mAddLanguages(); + +static Module *me = NULL; + +#define LANG_NUM_STRINGS 4 +#define TBAN_HELP 0 +#define TBAN_SYNTAX 1 +#define TBAN_HELP_DETAIL 2 +#define TBAN_RESPONSE 3 + +class CommandCSTBan : public Command +{ + public: + CommandCSTBan() : Command("TBAN", 3, 3) + { + } + + CommandReturn Execute(User *u, const std::vector ¶ms) + { + char mask[BUFSIZE]; + Channel *c; + User *u2 = NULL; + + const char *chan = params[0].c_str(); + const char *nick = params[1].c_str(); + const char *time = params[2].c_str(); + + if (!(c = findchan(chan))) + notice_lang(Config.s_ChanServ, u, CHAN_X_NOT_IN_USE, chan); + else if (!(u2 = finduser(nick))) + notice_lang(Config.s_ChanServ, u, NICK_X_NOT_IN_USE, nick); + else + { + if (canBanUser(c, u, u2)) + { + get_idealban(c->ci, u2, mask, sizeof(mask)); + addBan(c, dotime(time), mask); + mySendResponse(u, chan, mask, time); + } + } + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &subcommand) + { + this->OnSyntaxError(u, ""); + u->SendMessage(Config.s_ChanServ, " "); + me->NoticeLang(Config.s_ChanServ, u, TBAN_HELP_DETAIL); + + return true; + } + + void OnSyntaxError(User *u, const ci::string &subcommand) + { + me->NoticeLang(Config.s_ChanServ, u, TBAN_SYNTAX); + } +}; + +class CSTBan : public Module +{ + public: + CSTBan(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + me = this; + + this->AddCommand(ChanServ, new CommandCSTBan()); + + this->SetAuthor(AUTHOR); + this->SetVersion(VERSION); + this->SetType(SUPPORTED); + + const char* langtable_en_us[] = { + " TBAN Bans the user for a given length of time", + "Syntax: TBAN channel nick time", + "Bans the given user from a channel for a specified length of\n" + "time. If the ban is removed before by hand, it will NOT be replaced.", + "%s banned from %s, will auto-expire in %s" + }; + + const char* langtable_nl[] = { + " TBAN Verban een gebruiker voor een bepaalde tijd", + "Syntax: TBAN kanaal nick tijd", + "Verbant de gegeven gebruiken van het gegeven kanaal voor de\n" + "gegeven tijdsduur. Als de verbanning eerder wordt verwijderd,\n" + "zal deze NIET worden vervangen.", + "%s verbannen van %s, zal verlopen in %s" + }; + + const char* langtable_de[] = { + " TBAN Bant ein User fьr eine bestimmte Zeit aus ein Channel", + "Syntax: TBAN Channel Nickname Zeit", + "Bant ein User fьr eine bestimmte Zeit aus ein Channel\n" + "Wenn der Ban manuell entfernt wird, wird es NICHT ersetzt.", + "%s gebannt von %s, wird auto-auslaufen in %s" + }; + + const char* langtable_pt[] = { + " TBAN Bane o usuбrio por um determinado perнodo de tempo", + "Sintaxe: TBAN canal nick tempo", + "Bane de um canal o usuбrio especificado por um determinado perнodo de\n" + "tempo. Se o ban for removido manualmente antes do tempo, ele nгo serб recolocado.", + "%s foi banido do %s, irб auto-expirar em %s" + }; + + const char* langtable_ru[] = { + " TBAN Банит пользователя на указанный промежуток времени", + "Синтаксис: TBAN #канал ник время", + "Банит пользователя на указанный промежуток времени в секундах\n" + "Примечание: удаленный вручную (до своего истечения) бан НЕ БУДЕТ\n" + "переустановлен сервисами автоматически!", + "Установленный бан %s на канале %s истечет через %s секунд" + }; + + const char* langtable_it[] = { + " TBAN Banna l'utente per un periodo di tempo specificato", + "Sintassi: TBAN canale nick tempo", + "Banna l'utente specificato da un canale per un periodo di tempo\n" + "specificato. Se il ban viene rimosso a mano prima della scadenza, NON verrа rimpiazzato.", + "%s bannato da %s, scadrа automaticamente tra %s" + }; + + this->InsertLanguage(LANG_EN_US, LANG_NUM_STRINGS, langtable_en_us); + this->InsertLanguage(LANG_NL, LANG_NUM_STRINGS, langtable_nl); + this->InsertLanguage(LANG_DE, LANG_NUM_STRINGS, langtable_de); + this->InsertLanguage(LANG_PT, LANG_NUM_STRINGS, langtable_