diff options
| author | Adam <Adam@anope.org> | 2011-05-06 18:02:53 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2011-05-16 04:10:18 -0400 |
| commit | fd4b52ec385167794eaadb18ee635bef757728ee (patch) | |
| tree | 49d3e835b072a10887309d8d9155982a5aa61ed0 | |
| parent | b59602abf85d522bb2f188be70b6cb7c9556a856 (diff) | |
Added os_forbid
66 files changed, 586 insertions, 702 deletions
diff --git a/data/example.conf b/data/example.conf index d6d38cf87..0a4827a98 100644 --- a/data/example.conf +++ b/data/example.conf @@ -843,7 +843,7 @@ nickserv * * This directive is optional, but highly recommended. */ - modules = "ns_help ns_register ns_group ns_identify ns_access ns_cert ns_set ns_saset ns_set_autoop ns_set_email ns_set_greet ns_set_hide ns_set_kill ns_set_language ns_set_message ns_set_private ns_set_secure ns_saset_noexpire ns_drop ns_recover ns_release ns_sendpass ns_ghost ns_alist ns_info ns_list ns_logout ns_status ns_update ns_getpass ns_getemail ns_forbid ns_suspend ns_resetpass ns_ajoin" + modules = "ns_help ns_register ns_group ns_identify ns_access ns_cert ns_set ns_saset ns_set_autoop ns_set_email ns_set_greet ns_set_hide ns_set_kill ns_set_language ns_set_message ns_set_private ns_set_secure ns_saset_noexpire ns_drop ns_recover ns_release ns_sendpass ns_ghost ns_alist ns_info ns_list ns_logout ns_status ns_update ns_getpass ns_getemail ns_suspend ns_resetpass ns_ajoin" /* * Force users to give an e-mail address when they register a nick. @@ -930,13 +930,6 @@ nickserv #suspendexpire = 90d /* - * The lenth of time before a forbidden nick drops. - * - * This directive is optional. If not set, the default is to never. - */ - #forbidexpire = 90d - - /* * The length of time a user using an unconfirmed account has * before the account will be released for general use again. * @@ -1073,7 +1066,7 @@ chanserv * * This directive is optional, but highly recommended. */ - modules = "cs_help cs_register cs_set cs_saset cs_saset_noexpire cs_set_bantype cs_set_description cs_set_founder cs_set_keeptopic cs_set_opnotice cs_set_peace cs_set_persist cs_set_private cs_set_restricted cs_set_secure cs_set_securefounder cs_set_secureops cs_set_signkick cs_set_successor cs_set_topiclock cs_set_xop cs_xop cs_access cs_akick cs_drop cs_ban cs_clearusers cs_modes cs_getkey cs_invite cs_kick cs_list cs_topic cs_info cs_forbid cs_suspend cs_status cs_unban cs_clone cs_mode" + modules = "cs_help cs_register cs_set cs_saset cs_saset_noexpire cs_set_bantype cs_set_description cs_set_founder cs_set_keeptopic cs_set_opnotice cs_set_peace cs_set_persist cs_set_private cs_set_restricted cs_set_secure cs_set_securefounder cs_set_secureops cs_set_signkick cs_set_successor cs_set_topiclock cs_set_xop cs_xop cs_access cs_akick cs_drop cs_ban cs_clearusers cs_modes cs_getkey cs_invite cs_kick cs_list cs_topic cs_info cs_suspend cs_status cs_unban cs_clone cs_mode" /* * The default options for newly registered channels. Note that changing these options @@ -1427,7 +1420,7 @@ operserv * * This directive is optional, but highly recommended. */ - modules = "os_help os_stats os_staff os_mode os_kick os_akill os_snline os_sqline os_szline os_chanlist os_userlist os_news os_session os_noop os_jupe os_ignore os_set os_reload os_update os_restart os_quit os_shutdown os_chankill os_svsnick os_oline os_modload os_modunload os_modreload os_modlist os_modinfo os_config os_login" + modules = "os_help os_stats os_staff os_mode os_kick os_akill os_snline os_sqline os_szline os_chanlist os_userlist os_news os_session os_noop os_jupe os_ignore os_set os_reload os_update os_restart os_quit os_shutdown os_chankill os_svsnick os_oline os_modload os_modunload os_modreload os_modlist os_modinfo os_config os_login os_forbid" /* * If set, Services Admins will be able to use SUPERADMIN [ON|OFF] which will temporarily grant diff --git a/data/mysql/tables.sql b/data/mysql/tables.sql index 9fc0e55a0..5f49f7ea7 100644 --- a/data/mysql/tables.sql +++ b/data/mysql/tables.sql @@ -105,8 +105,6 @@ CREATE TABLE IF NOT EXISTS `anope_cs_info` ( `last_topic_setter` text NOT NULL, `last_topic_time` int(10) unsigned NOT NULL DEFAULT '0', `flags` text NOT NULL, - `forbidby` text NOT NULL, - `forbidreason` text NOT NULL, `bantype` smallint(6) NOT NULL DEFAULT '0', `memomax` smallint(5) unsigned NOT NULL DEFAULT '0', `botnick` varchar(255) NOT NULL DEFAULT '', diff --git a/docs/Changes.conf b/docs/Changes.conf index 650603e24..1cdf28ba9 100644 --- a/docs/Changes.conf +++ b/docs/Changes.conf @@ -6,6 +6,7 @@ global:globaloncycle global:globaloncycledown global:globaloncycleup global:anonymousglobal +operserv:modules added os_forbid ** MODIFIED CONFIGURATION DIRECTIVES ** opertype:permissions added memoserv/no-limit @@ -21,6 +22,8 @@ options:socketengine options:encryption options:database serverinfo:protocol +chanserv:modules removed cs_forbid +nickserv:modules removed ns_forbid Anope Version 1.9.4 ------------------- diff --git a/include/account.h b/include/account.h index 777efb5d0..15d2faa10 100644 --- a/include/account.h +++ b/include/account.h @@ -20,8 +20,6 @@ enum NickNameFlag { NS_BEGIN, - /* Nick may not be registered or used */ - NS_FORBIDDEN, /* Nick never expires */ NS_NO_EXPIRE, /* This nick is being held after a kill by an enforcer client diff --git a/include/channels.h b/include/channels.h index 5d18a381f..113b5c1f9 100644 --- a/include/channels.h +++ b/include/channels.h @@ -25,6 +25,8 @@ typedef std::list<UserContainer *> CUserList; enum ChannelFlag { + /* ChanServ is currently holding the channel */ + CH_INHABIT, /* Channel still exists when emptied */ CH_PERSIST, /* If set the channel is syncing users (channel was just created) and it should not be deleted */ @@ -33,6 +35,8 @@ enum ChannelFlag CH_LOGCHAN }; +const Anope::string ChannelFlagString[] = { "CH_INABIT", "CH_PERSIST", "CH_SYNCING", "CH_LOGCHAN", "" }; + class CoreExport Channel : public Extensible, public Flags<ChannelFlag, 3> { public: diff --git a/include/commands.h b/include/commands.h index e966e9e39..89fd1436c 100644 --- a/include/commands.h +++ b/include/commands.h @@ -36,7 +36,6 @@ extern CoreExport void mod_run_cmd(BotInfo *bi, User *u, ChannelInfo *ci, Comman enum CommandFlag { CFLAG_ALLOW_UNREGISTERED, - CFLAG_ALLOW_FORBIDDEN, CFLAG_ALLOW_SUSPENDED, CFLAG_ALLOW_UNREGISTEREDCHANNEL, CFLAG_STRIP_CHANNEL, @@ -45,7 +44,6 @@ enum CommandFlag const Anope::string CommandFlagStrings[] = { "CFLAG_ALLOW_UNREGISTERED", - "CFLAG_ALLOW_FORBIDDEN", "CFLAG_ALLOW_SUSPENDED", "CFLAG_ALLOW_UNREGISTEREDCHANNEL", "CFLAG_STRIP_CHANNEL", diff --git a/include/config.h b/include/config.h index 8a564e8ec..b06aa60d8 100644 --- a/include/config.h +++ b/include/config.h @@ -502,8 +502,6 @@ class CoreExport ServerConfig time_t NSExpire; /* How long before suspended nicks expire */ time_t NSSuspendExpire; - /* How long before forbidden nicks expire */ - time_t NSForbidExpire; /* Time before unconfirmed nicks expire */ time_t NSUnconfirmedExpire; /* Force email when registering */ diff --git a/include/language.h b/include/language.h index f4329a72b..8afd360de 100644 --- a/include/language.h +++ b/include/language.h @@ -19,15 +19,10 @@ #define NICK_X_NOT_REGISTERED "Nick \002%s\002 isn't registered." #define NICK_X_NOT_IN_USE "Nick \002%s\002 isn't currently in use." #define NICK_X_NOT_ON_CHAN "\002%s\002 is not currently on channel %s." -#define NICK_X_FORBIDDEN "Nick \002%s\002 may not be registered or used." -#define NICK_X_FORBIDDEN_OPER "Nick \002%s\002 has been forbidden by %s:\n" \ - "%s" -#define NICK_X_SUSPENDED "Nick %s is currently suspended." +#define NICK_X_SUSPENDED "Nick %s is currently suspended." +#define CHAN_X_SUSPENDED "Channel %s is currently suspended." #define CHAN_X_NOT_REGISTERED "Channel \002%s\002 isn't registered." #define CHAN_X_NOT_IN_USE "Channel \002%s\002 doesn't exist." -#define CHAN_X_FORBIDDEN "Channel \002%s\002 may not be registered or used." -#define CHAN_X_FORBIDDEN_OPER "Channel \002%s\002 has been forbidden by %s:\n" \ - "%s" #define NICK_IDENTIFY_REQUIRED "Password authentication required for that command.\n" \ "Retry after typing \002%s%s IDENTIFY \037password\037\002." #define MAIL_X_INVALID "\002%s\002 is not a valid e-mail address." diff --git a/include/regchannel.h b/include/regchannel.h index 851c4a7d1..8245b256d 100644 --- a/include/regchannel.h +++ b/include/regchannel.h @@ -18,8 +18,6 @@ enum ChannelInfoFlag { CI_BEGIN, - /* ChanServ is currently holding the channel */ - CI_INHABIT, /* Retain the topic even after the channel is emptied */ CI_KEEPTOPIC, /* Don't allow non-authorized users to be opped */ @@ -34,8 +32,6 @@ enum ChannelInfoFlag CI_PEACE, /* Don't allow any privileges unless a user is IDENTIFIED with NickServ */ CI_SECURE, - /* Don't allow the channel to be registered or used */ - CI_FORBIDDEN, /* Channel does not expire */ CI_NO_EXPIRE, /* Channel memo limit may not be changed */ @@ -63,7 +59,7 @@ enum ChannelInfoFlag }; const Anope::string ChannelInfoFlagStrings[] = { - "BEGIN", "INHABIT", "KEEPTOPIC", "SECUREOPS", "PRIVATE", "TOPICLOCK", "RESTRICTED", + "BEGIN", "KEEPTOPIC", "SECUREOPS", "PRIVATE", "TOPICLOCK", "RESTRICTED", "PEACE", "SECURE", "FORBIDDEN", "NO_EXPIRE", "MEMO_HARDMAX", "OPNOTICE", "SECUREFOUNDER", "SIGNKICK", "SIGNKICK_LEVEL", "XOP", "SUSPENDED", "PERSIST", "" }; @@ -154,10 +150,6 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag, Anope::string last_topic_setter; /* Setter */ time_t last_topic_time; /* Time */ - // These two should be using extensible - Anope::string forbidby; - Anope::string forbidreason; - int16 bantype; int16 *levels; /* Access levels for commands */ diff --git a/modules/core/bs_main.cpp b/modules/core/bs_main.cpp index 43c4d8fb2..159adde93 100644 --- a/modules/core/bs_main.cpp +++ b/modules/core/bs_main.cpp @@ -38,16 +38,9 @@ class BotServBotInfo : public BotInfo ChannelInfo *ci = cs_findchan(param); if (ci) { - if (ci->HasFlag(CI_FORBIDDEN) && !c->HasFlag(CFLAG_ALLOW_FORBIDDEN)) + if (ci->HasFlag(CI_SUSPENDED) && !c->HasFlag(CFLAG_ALLOW_SUSPENDED)) { - u->SendMessage(this, _(_(CHAN_X_FORBIDDEN)), ci->name.c_str()); - Log(LOG_COMMAND, "denied", this) << "Access denied for user " << u->GetMask() << " with command " << command << " because of FORBIDDEN channel " << ci->name; - PopLanguage(); - return; - } - else if (ci->HasFlag(CI_SUSPENDED) && !c->HasFlag(CFLAG_ALLOW_SUSPENDED)) - { - u->SendMessage(this, _(_(CHAN_X_FORBIDDEN)), ci->name.c_str()); + u->SendMessage(this, _(_(CHAN_X_SUSPENDED)), ci->name.c_str()); Log(LOG_COMMAND, "denied", this) << "Access denied for user " << u->GetMask() << " with command " << command << " because of SUSPENDED channel " << ci->name; PopLanguage(); return; diff --git a/modules/core/cs_access.cpp b/modules/core/cs_access.cpp index 243d62057..23d8c4e16 100644 --- a/modules/core/cs_access.cpp +++ b/modules/core/cs_access.cpp @@ -202,11 +202,6 @@ class CommandCSAccess : public Command NickAlias *na = findnick(mask); if (!na && mask.find_first_of("!@*") == Anope::string::npos) mask += "!*@*"; - else if (na && na->HasFlag(NS_FORBIDDEN)) - { - source.Reply(_(NICK_X_FORBIDDEN), mask.c_str()); - return MOD_CONT; - } ChanAccess *access = ci->GetAccess(mask, 0, false); if (access) diff --git a/modules/core/cs_akick.cpp b/modules/core/cs_akick.cpp index 8650aebd4..149e782a9 100644 --- a/modules/core/cs_akick.cpp +++ b/modules/core/cs_akick.cpp @@ -181,15 +181,7 @@ class CommandCSAKick : public Command mask = nick + "!" + user + "@" + host; } else - { - if (na->HasFlag(NS_FORBIDDEN)) - { - source.Reply(_(NICK_X_FORBIDDEN), mask.c_str()); - return; - } - nc = na->nc; - } /* Check excepts BEFORE we get this far */ if (ci->c) @@ -240,16 +232,13 @@ class CommandCSAKick : public Command * or higher access. - Viper */ for (nickalias_map::const_iterator it = NickAliasList.begin(), it_end = NickAliasList.end(); it != it_end; ++it) { - NickAlias *na2 = it->second; - - if (na2->HasFlag(NS_FORBIDDEN)) - continue; + na = it->second; - ChanAccess *na2_access = ci->GetAccess(na2->nc), *u_access = ci->GetAccess(u); - int16 na2_level = na2_access ? na2_access->level : 0, u_level = u_access ? u_access->level : 0; - if (na2->nc && (na2->nc == ci->founder || na2_level >= u_level)) + ChanAccess *na_access = ci->GetAccess(na->nc), *u_access = ci->GetAccess(u); + int16 na_level = na_access ? na_access->level : 0, u_level = u_access ? u_access->level : 0; + if (na->nc && (na->nc == ci->founder || na_level >= u_level)) { - Anope::string buf = na2->nick + "!" + na2->last_usermask; + Anope::string buf = na->nick + "!" + na->last_usermask; if (Anope::Match(buf, mask)) { source.Reply(_(ACCESS_DENIED)); diff --git a/modules/core/cs_drop.cpp b/modules/core/cs_drop.cpp index 3a1026f21..a13006196 100644 --- a/modules/core/cs_drop.cpp +++ b/modules/core/cs_drop.cpp @@ -19,7 +19,6 @@ class CommandCSDrop : public Command public: CommandCSDrop() : Command("DROP", 1, 1) { - this->SetFlag(CFLAG_ALLOW_FORBIDDEN); this->SetFlag(CFLAG_ALLOW_SUSPENDED); this->SetDesc(_("Cancel the registration of a channel")); } @@ -39,15 +38,9 @@ class CommandCSDrop : public Command ci = cs_findchan(chan); - if (ci->HasFlag(CI_FORBIDDEN) && !u->HasCommand("chanserv/drop")) - { - source.Reply(_(CHAN_X_FORBIDDEN), chan.c_str()); - return MOD_CONT; - } - if (ci->HasFlag(CI_SUSPENDED) && !u->HasCommand("chanserv/drop")) { - source.Reply(_(CHAN_X_FORBIDDEN), chan.c_str()); + source.Reply(_(CHAN_X_SUSPENDED), chan.c_str()); return MOD_CONT; } @@ -60,12 +53,6 @@ class CommandCSDrop : public Command if (ci->c && ModeManager::FindChannelModeByName(CMODE_REGISTERED)) ci->c->RemoveMode(NULL, CMODE_REGISTERED, "", false); - if (ircd->chansqline && ci->HasFlag(CI_FORBIDDEN)) - { - XLine x(ci->name); - ircdproto->SendSQLineDel(&x); - } - bool override = (ci->HasFlag(CI_SECUREFOUNDER) ? !IsFounder(u, ci) : !check_access(u, ci, CA_FOUNDER)); Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "founder: " << (ci->founder ? ci->founder->display : "none"); diff --git a/modules/core/cs_forbid.cpp b/modules/core/cs_forbid.cpp deleted file mode 100644 index e7f2b7894..000000000 --- a/modules/core/cs_forbid.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* ChanServ core functions - * - * (C) 2003-2011 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" -#include "chanserv.h" - -class CommandCSForbid : public Command -{ - public: - CommandCSForbid() : Command("FORBID", 1, 2, "chanserv/forbid") - { - this->SetFlag(CFLAG_ALLOW_UNREGISTEREDCHANNEL); - this->SetDesc(_("Prevent a channel from being used")); - } - - CommandReturn Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) - { - const Anope::string &chan = params[0]; - const Anope::string &reason = params.size() > 1 ? params[1] : ""; - - User *u = source.u; - ChannelInfo *ci = source.ci; - - if (Config->ForceForbidReason && reason.empty()) - { - SyntaxError(source, "FORBID", _("FORBID \037channel\037 \037reason\037")); - return MOD_CONT; - } - - if (chan[0] != '#') - { - source.Reply(_(CHAN_SYMBOL_REQUIRED)); - return MOD_CONT; - } - - if (readonly) - { - source.Reply(_(READ_ONLY_MODE)); - return MOD_CONT; - } - - if ((ci = cs_findchan(chan))) - delete ci; - - ci = new ChannelInfo(chan); - ci->SetFlag(CI_FORBIDDEN); - ci->forbidby = u->nick; - ci->forbidreason = reason; - - Channel *c = ci->c; - if (c) - { - /* Before banning everyone, it might be prudent to clear +e and +I lists.. - * to prevent ppl from rejoining.. ~ Viper */ - std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> modes = c->GetModeList(CMODE_EXCEPT); - for (; modes.first != modes.second; ++modes.first) - c->RemoveMode(NULL, CMODE_EXCEPT, modes.first->second); - modes = c->GetModeList(CMODE_INVITEOVERRIDE); - for (; modes.first != modes.second; ++modes.first) - c->RemoveMode(NULL, CMODE_INVITEOVERRIDE, modes.first->second); - - for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ) - { - UserContainer *uc = *it++; - - if (uc->user->HasMode(UMODE_OPER)) - continue; - - c->Kick(chanserv->Bot(), uc->user, "%s", !reason.empty() ? reason.c_str() : GetString(uc->user->Account(), "This channel has been forbidden.").c_str()); - } - } - - if (ircd->chansqline) - { - XLine x(chan, "Forbidden"); - ircdproto->SendSQLine(NULL, &x); - } - - Log(LOG_ADMIN, u, this, ci) << (!ci->forbidreason.empty() ? ci->forbidreason : "No reason"); - - source.Reply(_("Channel \002%s\002 is now forbidden."), chan.c_str()); - - FOREACH_MOD(I_OnChanForbidden, OnChanForbidden(ci)); - - return MOD_CONT; - } - - bool OnHelp(CommandSource &source, const Anope::string &subcommand) - { - source.Reply(_("Syntax: \002FORBID \037channel\037 [\037reason\037]\002\n" - " \n" - "Disallows anyone from registering or using the given\n" - "channel. May be cancelled by dropping the channel.\n" - " \n" - "Reason may be required on certain networks.")); - return true; - } - - void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) - { - SyntaxError(source, "FORBID", _("FORBID \037channel\037 [\037reason\037]")); - } -}; - -class CSForbid : public Module -{ - CommandCSForbid commandcsforbid; - - public: - CSForbid(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE) - { - this->SetAuthor("Anope"); - - if (!chanserv) - throw ModuleException("ChanServ is not loaded!"); - |
