summaryrefslogtreecommitdiff
path: root/modules/extra
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-07-15 22:55:02 -0400
committerAdam <Adam@anope.org>2010-07-15 22:55:02 -0400
commita22f8d3b2de88b9bb6f80f0c2780846ae23ab389 (patch)
treea2fdf570868896a787df8a1169951b0028e68d6b /modules/extra
parent43b1e43afb85639485e36d24da351dc0f121be6e (diff)
Moved some files and diretories around, made cmake skip files it knows it can't compile because of missing dependices.
Diffstat (limited to 'modules/extra')
-rw-r--r--modules/extra/cs_appendtopic.cpp227
-rw-r--r--modules/extra/cs_enforce.cpp444
-rw-r--r--modules/extra/cs_set_misc.cpp196
-rw-r--r--modules/extra/cs_tban.cpp209
-rw-r--r--modules/extra/hs_request.cpp835
-rw-r--r--modules/extra/m_helpchan.cpp47
-rw-r--r--modules/extra/m_ssl.cpp142
-rw-r--r--modules/extra/mysql/db_mysql.h211
-rw-r--r--modules/extra/mysql/db_mysql_execute.cpp159
-rw-r--r--modules/extra/mysql/db_mysql_read.cpp618
-rw-r--r--modules/extra/mysql/db_mysql_write.cpp1040
-rw-r--r--modules/extra/ns_maxemail.cpp169
-rw-r--r--modules/extra/ns_set_misc.cpp213
13 files changed, 4510 insertions, 0 deletions
diff --git a/modules/extra/cs_appendtopic.cpp b/modules/extra/cs_appendtopic.cpp
new file mode 100644
index 000000000..03f20ba6c
--- /dev/null
+++ b/modules/extra/cs_appendtopic.cpp
@@ -0,0 +1,227 @@
+/* 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 <Alex_SGR@ntlworld.com>
+ * Included in the Anope module pack since Anope 1.7.9
+ * Anope Coder: GeniusDex <geniusdex@anope.org>
+ *
+ * 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"
+
+/* ------------------------------------------------------------
+ * Name: cs_appendtopic
+ * Author: SGR <Alex_SGR@ntlworld.com>
+ * 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 */
+/* ---------------------------------------------------------------------- */
+
+enum
+{
+ LNG_CHAN_HELP,
+ LNG_CHAN_HELP_APPENDTOPIC,
+ LNG_APPENDTOPIC_SYNTAX,
+ LNG_NUM_STRINGS
+};
+
+static Module *me;
+
+class CommandCSAppendTopic : public Command
+{
+ public:
+ CommandCSAppendTopic() : Command("APPENDTOPIC", 2, 2)
+ {
+ }
+
+ CommandReturn Execute(User *u, const std::vector<ci::string> &params)
+ {
+ 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 && whosends(ci) == ChanServ)
+ {
+ ChanServ->Join(c);
+ ircdproto->SendMode(NULL, c, "+o %s", Config.s_ChanServ); // XXX
+ }
+ ircdproto->SendTopic(whosends(ci), c, u->nick.c_str(), topic);
+ if (ircd->join2set && whosends(ci) == ChanServ)
+ ChanServ->Part(c);
+ }
+ 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);
+ }
+
+ void OnServHelp(User *u)
+ {
+ me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP);
+ }
+};
+
+class CSAppendTopic : public Module
+{
+ public:
+ CSAppendTopic(const std::string &modname, const std::string &creator) : Module(modname, creator)
+ {
+ me = this;
+
+ this->SetAuthor(AUTHOR);
+ 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);
+ }
+};
+
+MODULE_INIT(CSAppendTopic)
diff --git a/modules/extra/cs_enforce.cpp b/modules/extra/cs_enforce.cpp
new file mode 100644
index 000000000..c4cfbecc9
--- /dev/null
+++ b/modules/extra/cs_enforce.cpp
@@ -0,0 +1,444 @@
+/* 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 <geniusdex@anope.org>
+ *
+ * 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"
+
+enum
+{
+ LNG_CHAN_HELP,
+ LNG_ENFORCE_SYNTAX,
+ LNG_CHAN_HELP_ENFORCE,
+ LNG_CHAN_HELP_ENFORCE_R_ENABLED,
+ LNG_CHAN_HELP_ENFORCE_R_DISABLED,
+ LNG_CHAN_RESPONSE,
+ LNG_NUM_STRINGS
+};
+
+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_end = c->users.end(); it != it_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_end = c->users.end(); it != it_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_end = c->users.end(); it != it_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<ci::string> &params)
+ {
+ 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);
+ }
+
+ void OnServHelp(User *u)
+ {
+ me->NoticeLang(Config.s_ChanServ, u, LNG_CHAN_HELP);
+ }
+};
+
+class CSEnforce : public Module
+{
+ public:
+ CSEnforce(const std::string &modname, const std::string &creator) : Module(modname, creator)
+ {
+ me = this;
+
+ this->SetAuthor(AUTHOR);
+ 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);
+ }
+};
+
+MODULE_INIT(CSEnforce)
diff --git a/modules/extra/cs_set_misc.cpp b/modules/extra/cs_set_misc.cpp
new file mode 100644
index 000000000..453e242a3
--- /dev/null
+++ b/modules/extra/cs_set_misc.cpp
@@ -0,0 +1,196 @@
+/*
+ *
+ * (C) 2003-2010 Anope Team
+ * Contact us at team@anope.org
+ *
+ * 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.
+ */
+
+/*************************************************************************/
+
+#include "module.h"
+
+class CommandCSSetMisc : public Command
+{
+ std::string Desc;
+ public:
+ CommandCSSetMisc(const ci::string &cname, const std::string &desc, const ci::string &cpermission = "") : Command(cname, 1, 2, cpermission), Desc(desc)
+ {
+ }
+
+ CommandReturn Execute(User *u, const std::vector<ci::string> &params)
+ {
+ ChannelInfo *ci = cs_findchan(params[0]);
+ assert(ci);
+
+ ci->Shrink("chanserv:" + std::string(this->name.c_str()));
+ if (params.size() > 1)
+ {
+ ci->Extend("chanserv:" + std::string(this->name.c_str()), new ExtensibleItemRegular<ci::string>(params[1]));
+ notice_lang(Config.s_ChanServ, u, CHAN_SETTING_CHANGED, this->name.c_str(), ci->name.c_str(), params[1].c_str());
+ }
+ else
+ {
+ notice_lang(Config.s_ChanServ, u, CHAN_SETTING_UNSET, this->name.c_str(), ci->name.c_str());
+ }
+
+ return MOD_CONT;
+ }
+
+ void OnSyntaxError(User *u, const ci::string &)
+ {
+ syntax_error(Config.s_ChanServ, u, "SET", CHAN_SET_SYNTAX);
+ }
+
+ void OnServHelp(User *u)
+ {
+ u->SendMessage(Config.s_ChanServ, " %-10s %s", this->name.c_str(), this->Desc.c_str());
+ }
+};
+
+class CommandCSSASetMisc : public CommandCSSetMisc
+{
+ public:
+ CommandCSSASetMisc(const ci::string &cname, const std::string &desc) : CommandCSSetMisc(cname, desc, "chanserv/saset/" + cname)
+ {
+ }
+
+ void OnSyntaxError(User *u, const ci::string &)
+ {
+ syntax_error(Config.s_ChanServ, u, "SASET", CHAN_SASET_SYNTAX);
+ }
+};
+
+class CSSetMisc : public Module
+{
+ struct CommandInfo
+ {
+ std::string Name;
+ std::string Desc;
+ bool ShowHidden;
+
+ CommandInfo(const std::string &name, const std::string &desc, bool showhidden) : Name(name), Desc(desc), ShowHidden(showhidden) { }
+ };
+
+ std::map<std::string, CommandInfo *> Commands;
+
+ void RemoveAll()
+ {
+ if (Commands.empty())
+ return;
+
+ Command *set = FindCommand(ChanServ, "SET");
+ Command *saset = FindCommand(ChanServ, "SASET");
+
+ if (!set && !saset)
+ return;
+
+ for (std::map<std::string, CommandInfo *>::const_iterator it = this->Commands.begin(), it_end = this->Commands.end(); it != it_end; ++it)
+ {
+ if (set)
+ set->DelSubcommand(it->first.c_str());
+ if (saset)
+ saset->DelSubcommand(it->first.c_str());
+ delete it->second;
+ }
+
+ this->Commands.clear();
+ }
+
+ public:
+ CSSetMisc(const std::string &modname, const std::string &creator) : Module(modname, creator)
+ {
+ this->SetAuthor("Anope");
+ this->SetType(CORE);
+
+ Implementation i[] = { I_OnReload, I_OnChanInfo, I_OnDatabaseWriteMetadata, I_OnDatabaseReadMetadata };
+ ModuleManager::Attach(i, this, 4);
+
+ OnReload(true);
+ }
+
+ ~CSSetMisc()
+ {
+ RemoveAll();
+ }
+
+ void OnReload(bool)
+ {
+ RemoveAll();
+
+ Command *set = FindCommand(ChanServ, "SET");
+ Command *saset = FindCommand(ChanServ, "SASET");
+ if (!set && !saset)
+ return;
+
+ ConfigReader config;
+
+ for (int i = 0; true; ++i)
+ {
+ std::string cname = config.ReadValue("cs_set_misc", "name", "", i);
+ if (cname.empty())
+ break;
+ std::string desc = config.ReadValue("cs_set_misc", "desc", "", i);
+ bool showhidden = config.ReadFlag("cs_set_misc", "operonly", "no", i);
+
+ CommandInfo *info = new CommandInfo(cname, desc, showhidden);
+ if (!this->Commands.insert(std::make_pair(cname, info)).second)
+ {
+ Alog() << "cs_set_misc: Warning, unable to add duplicate entry " << cname;
+ delete info;
+ continue;
+ }
+
+ if (set)
+ set->AddSubcommand(new CommandCSSetMisc(cname.c_str(), desc));
+ if (saset)
+ saset->AddSubcommand(new CommandCSSASetMisc(cname.c_str(), desc));
+ }
+ }
+
+ void OnChanInfo(User *u, ChannelInfo *ci, bool ShowHidden)
+ {
+ for (std::map<std::string, CommandInfo *>::const_iterator it = this->Commands.begin(), it_end = this->Commands.end(); it != it_end; ++it)
+ {
+ if (!ShowHidden && it->second->ShowHidden)
+ continue;
+
+ ci::string value;
+ if (ci->GetExtRegular("chanserv:" + it->first, value))
+ {
+ u->SendMessage(Config.s_ChanServ, " %s: %s", it->first.c_str(), value.c_str());
+ }
+ }
+ }
+
+ void OnDatabaseWriteMetadata(void (*WriteMetadata)(const std::string &, const std::string &), ChannelInfo *ci)
+ {
+ for (std::map<std::string, CommandInfo *>::const_iterator it = this->Commands.begin(), it_end = this->Commands.end(); it != it_end; ++it)
+ {
+ ci::string value;
+
+ if (ci->GetExtRegular("chanserv:" + it->first, value))
+ {
+ WriteMetadata(it->first, ":" + std::string(value.c_str()));
+ }
+ }
+ }
+
+ EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const std::string &key, const std::vector<std::string> &params)
+ {
+ for (std::map<std::string, CommandInfo *>::const_iterator it = this->Commands.begin(), it_end = this->Commands.end(); it != it_end; ++it)
+ {
+ if (key == it->first)
+ {
+ ci->Extend("chanserv:" + it->first, new ExtensibleItemRegular<ci::string>(params[0].c_str()));
+ }
+ }
+
+ return EVENT_CONTINUE;
+ }
+};
+
+MODULE_INIT(CSSetMisc)
diff --git a/modules/extra/cs_tban.cpp b/modules/extra/cs_tban.cpp
new file mode 100644
index 000000000..844606222
--- /dev/null
+++ b/modules/extra/cs_tban.cpp
@@ -0,0 +1,209 @@
+/* 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 <rob@anope.org>
+ * Included in the Anope module pack since Anope 1.7.8
+ * Anope Coder: Rob <rob@anope.org>
+ *
+ * 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"
+
+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;
+
+enum
+{
+ TBAN_HELP,
+ TBAN_SYNTAX,
+ TBAN_HELP_DETAIL,
+ TBAN_RESPONSE,
+ LANG_NUM_STRINGS
+};
+
+class CommandCSTBan : public Command
+{
+ public:
+ CommandCSTBan() : Command("TBAN", 3, 3)
+ {
+ }
+
+ CommandReturn Execute(User *u, const std::vector<ci::string> &params)
+ {
+ 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, n