diff options
| author | Adam <Adam@anope.org> | 2010-11-15 23:07:13 -0500 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2010-12-12 19:33:59 -0500 |
| commit | a85112172d842aa74aa5531788d383328d153e74 (patch) | |
| tree | 7c2b02feb21f64b0b039992b92b86a09920a1eb5 | |
| parent | 5f18cb018dee9ff71efbfdd247a8dc4ca472b16b (diff) | |
Removed and deprecated /cs set mlock, removed /cs clear, removed /os clearmodes, removed /cs akick (un)stick, added /cs clearusers
| -rw-r--r-- | data/example.conf | 13 | ||||
| -rw-r--r-- | include/config.h | 2 | ||||
| -rw-r--r-- | include/extern.h | 3 | ||||
| -rw-r--r-- | include/language.h | 12 | ||||
| -rw-r--r-- | include/services.h | 4 | ||||
| -rw-r--r-- | modules/core/cs_akick.cpp | 91 | ||||
| -rw-r--r-- | modules/core/cs_clear.cpp | 181 | ||||
| -rw-r--r-- | modules/core/cs_clearusers.cpp | 87 | ||||
| -rw-r--r-- | modules/core/cs_saset.cpp | 7 | ||||
| -rw-r--r-- | modules/core/cs_set.cpp | 7 | ||||
| -rw-r--r-- | modules/core/cs_set_mlock.cpp | 185 | ||||
| -rw-r--r-- | modules/core/db_plain.cpp | 6 | ||||
| -rw-r--r-- | modules/core/os_clearmodes.cpp | 189 | ||||
| -rw-r--r-- | modules/extra/db_mysql.cpp | 7 | ||||
| -rw-r--r-- | src/chanserv.cpp | 81 | ||||
| -rw-r--r-- | src/config.cpp | 2 | ||||
| -rw-r--r-- | src/language.cpp | 129 | ||||
| -rw-r--r-- | src/modes.cpp | 4 |
18 files changed, 128 insertions, 882 deletions
diff --git a/data/example.conf b/data/example.conf index aa6964e16..1216e163b 100644 --- a/data/example.conf +++ b/data/example.conf @@ -641,7 +641,7 @@ log * chanserv/list chanserv/suspend chanserv/topic chanserv/status * * chanserv/saset/bantype chanserv/saset/description chanserv/saset/email chanserv/saset/entrymsg - * chanserv/saset/founder chanserv/saset/keeptopic chanserv/saset/mlock chanserv/saset/opnotice + * chanserv/saset/founder chanserv/saset/keeptopic chanserv/saset/opnotice * chanserv/saset/peace chanserv/saset/persist chanserv/saset/private chanserv/saset/restricted * chanserv/saset/secure chanserv/saset/securefounder chanserv/saset/secureops * chanserv/saset/signkick chanserv/saset/successor chanserv/saset/topiclock @@ -661,7 +661,7 @@ log * operserv/global operserv/news operserv/stats operserv/kick * operserv/mode operserv/session operserv/modlist operserv/ignore * operserv/chankill operserv/akill operserv/sqline operserv/snline - * operserv/szline operserv/clearmodes operserv/staff operserv/defcon + * operserv/szline operserv/staff operserv/defcon * operserv/modload operserv/jupe operserv/set operserv/noop * operserv/quit operserv/update operserv/reload operserv/restart * operserv/shutdown operserv/svsnick operserv/oline operserv/umode @@ -693,7 +693,7 @@ opertype inherits = "Helper, Another Helper" /* What commands (see above) this opertype may use */ - commands = "chanserv/list chanserv/suspend chanserv/status chanserv/topic memoserv/staff nickserv/sendpass nickserv/resetpass nickserv/suspend operserv/mode operserv/chankill operserv/szline operserv/akill operserv/session operserv/clearmodes operserv/modlist operserv/sqline operserv/staff operserv/kick operserv/ignore operserv/snline" + commands = "chanserv/list chanserv/suspend chanserv/status chanserv/topic memoserv/staff nickserv/sendpass nickserv/resetpass nickserv/suspend operserv/mode operserv/chankill operserv/szline operserv/akill operserv/session operserv/modlist operserv/sqline operserv/staff operserv/kick operserv/ignore operserv/snline" /* What privs (see above) this opertype has */ privs = "chanserv/auspex chanserv/no-register-limit memoserv/* nickserv/auxpex nickserv/confirm" @@ -1044,7 +1044,7 @@ chanserv * The core modules to load for ChanServ. This is a space separated list that corresponds * to the base names of the modules for 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_entrymsg cs_set_founder cs_set_keeptopic cs_set_mlock 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_clear cs_modes cs_getkey cs_invite cs_kick cs_list cs_topic cs_info cs_forbid cs_suspend cs_status cs_unban cs_clone" + modules = "cs_help cs_register cs_set cs_saset cs_saset_noexpire cs_set_bantype cs_set_description cs_set_entrymsg 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" /* * The default options for newly registered channels. Note that changing these options @@ -1340,7 +1340,7 @@ operserv * The core modules to load for OperServ. This is a space separated list that corresponds * to the base names of the modules for OperServ. This directive is optional, but highly recommended. */ - modules = "os_help os_global os_stats os_staff os_mode os_kick os_clearmodes 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_defcon os_chankill os_svsnick os_oline os_umode os_modload os_modunload os_modreload os_modlist os_modinfo" + modules = "os_help os_global 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_defcon os_chankill os_svsnick os_oline os_umode os_modload os_modunload os_modreload os_modlist os_modinfo" /* * If set, Services Admins will be able to use SUPERADMIN [ON|OFF] which will temporarily grant @@ -1388,7 +1388,6 @@ operserv * - bados: A non-IRCop attempts to use OperServ * - osglobal: OperServ's GLOBAL command was used * - osmode: OperServ's MODE command was used - * - osclearmodes: OperServ's CLEARMODES command was used * - oskick: OperServ's KICK command was used * - osakill: OperServ's AKILL command was used * - ossnline: OperServ's SNLINE command was used @@ -1410,7 +1409,7 @@ operserv * * This directive is optional, if left blank, there will be no notifications. */ - notifications="osglobal osmode osclearmodes oskick osakill ossnline ossqline osszline osnoop osjupe getpass setpass forbid drop" + notifications="osglobal osmode oskick osakill ossnline ossqline osszline osnoop osjupe getpass setpass forbid drop" /* * Enables session limiting. Session limiting prevents users from connecting more than a certain diff --git a/include/config.h b/include/config.h index ff6608b1e..0dfd70d9d 100644 --- a/include/config.h +++ b/include/config.h @@ -711,8 +711,6 @@ class CoreExport ServerConfig bool WallOSGlobal; /* Send a WALLOPS/GLOBOPS when someone uses the MODE command */ bool WallOSMode; - /* Send a WALLOPS/GLOBOPS when someone uses the CLEARMODES command */ - bool WallOSClearmodes; /* Send a WALLOPS/GLOBOPS when someone uses the KICK command */ bool WallOSKick; /* Send a WALLOPS/GLOBOPS when someone uses the AKILL command */ diff --git a/include/extern.h b/include/extern.h index a3e919e5b..b8bcb5be3 100644 --- a/include/extern.h +++ b/include/extern.h @@ -115,9 +115,6 @@ E bool IsFounder(User *user, ChannelInfo *ci); E int get_access(User *user, ChannelInfo *ci); E void update_cs_lastseen(User *user, ChannelInfo *ci); E int get_idealban(ChannelInfo *ci, User *u, Anope::string &ret); -E AutoKick *is_stuck(ChannelInfo *ci, const Anope::string &mask); -E void stick_mask(ChannelInfo *ci, AutoKick *akick); -E void stick_all(ChannelInfo *ci); E int levelinfo_maxwidth; E Anope::string get_mlock_modes(ChannelInfo *ci, int complete); diff --git a/include/language.h b/include/language.h index 5406e3480..0b1c60f2c 100644 --- a/include/language.h +++ b/include/language.h @@ -5,6 +5,7 @@ enum LanguageString COMMAND_IDENTIFY_REQUIRED, COMMAND_CANNOT_USE, COMMAND_CAN_USE, + COMMAND_DEPRECATED, USER_RECORD_NOT_FOUND, UNKNOWN_COMMAND, UNKNOWN_COMMAND_HELP, @@ -348,11 +349,7 @@ enum LanguageString CHAN_ENTRY_MSG_UNSET, CHAN_SET_BANTYPE_INVALID, CHAN_SET_BANTYPE_CHANGED, - CHAN_SET_MLOCK_UNKNOWN_CHAR, - CHAN_SET_MLOCK_IMPOSSIBLE_CHAR, - CHAN_SET_MLOCK_L_REQUIRED, - CHAN_SET_MLOCK_K_REQUIRED, - CHAN_MLOCK_CHANGED, + CHAN_SET_MLOCK_DEPRECATED, CHAN_SET_KEEPTOPIC_SYNTAX, CHAN_SET_KEEPTOPIC_ON, CHAN_SET_KEEPTOPIC_OFF, @@ -498,8 +495,6 @@ enum LanguageString CHAN_AKICK_ADDED, CHAN_AKICK_NOT_FOUND, CHAN_AKICK_NO_MATCH, - CHAN_AKICK_STUCK, - CHAN_AKICK_UNSTUCK, CHAN_AKICK_DELETED, CHAN_AKICK_DELETED_ONE, CHAN_AKICK_DELETED_SEVERAL, @@ -507,7 +502,6 @@ enum LanguageString CHAN_AKICK_LIST_HEADER, CHAN_AKICK_LIST_FORMAT, CHAN_AKICK_VIEW_FORMAT, - CHAN_AKICK_VIEW_FORMAT_STUCK, CHAN_AKICK_LAST_USED, CHAN_AKICK_ENFORCE_DONE, CHAN_AKICK_CLEAR, @@ -1304,7 +1298,6 @@ enum LanguageString CHAN_HELP_CMD_SET_DESC, CHAN_HELP_CMD_SET_ENTRYMSG, CHAN_HELP_CMD_SET_BANTYPE, - CHAN_HELP_CMD_SET_MLOCK, CHAN_HELP_CMD_SET_KEEPTOPIC, CHAN_HELP_CMD_SET_OPNOTICE, CHAN_HELP_CMD_SET_PEACE, @@ -1327,7 +1320,6 @@ enum LanguageString CHAN_HELP_SET_BANTYPE, CHAN_HELP_SET_KEEPTOPIC, CHAN_HELP_SET_TOPICLOCK, - CHAN_HELP_SET_MLOCK, CHAN_HELP_SET_PEACE, CHAN_HELP_SET_PRIVATE, CHAN_HELP_SET_RESTRICTED, diff --git a/include/services.h b/include/services.h index 182444238..38abf931f 100644 --- a/include/services.h +++ b/include/services.h @@ -586,9 +586,7 @@ struct ChanAccess enum AutoKickFlag { /* Is by nick core, not mask */ - AK_ISNICK, - /* This entry is stuck */ - AK_STUCK + AK_ISNICK }; /* AutoKick data. */ diff --git a/modules/core/cs_akick.cpp b/modules/core/cs_akick.cpp index 175b20047..f539952d7 100644 --- a/modules/core/cs_akick.cpp +++ b/modules/core/cs_akick.cpp @@ -117,7 +117,7 @@ class AkickViewCallback : public AkickListCallback else timebuf = GetString(u, UNKNOWN); - u->SendMessage(ChanServ, akick->HasFlag(AK_STUCK) ? CHAN_AKICK_VIEW_FORMAT_STUCK : CHAN_AKICK_VIEW_FORMAT, index + 1, akick->HasFlag(AK_ISNICK) ? akick->nc->display.c_str() : akick->mask.c_str(), !akick->creator.empty() ? akick->creator.c_str() : GetString(u, UNKNOWN).c_str(), timebuf.c_str(), !akick->reason.empty() ? akick->reason.c_str() : GetString(u, NO_REASON).c_str()); + u->SendMessage(ChanServ, CHAN_AKICK_VIEW_FORMAT, index + 1, akick->HasFlag(AK_ISNICK) ? akick->nc->display.c_str() : akick->mask.c_str(), !akick->creator.empty() ? akick->creator.c_str() : GetString(u, UNKNOWN).c_str(), timebuf.c_str(), !akick->reason.empty() ? akick->reason.c_str() : GetString(u, NO_REASON).c_str()); if (akick->last_used) u->SendMessage(ChanServ, CHAN_AKICK_LAST_USED, do_strftime(akick->last_used).c_str()); @@ -270,89 +270,6 @@ class CommandCSAKick : public Command this->DoEnforce(u, ci); } - void DoStick(User *u, ChannelInfo *ci, const std::vector<Anope::string> ¶ms) - { - NickAlias *na; - NickCore *nc; - Anope::string mask = params[2]; - unsigned i, end; - AutoKick *akick; - - if (!ci->GetAkickCount()) - { - u->SendMessage(ChanServ, CHAN_AKICK_LIST_EMPTY, ci->name.c_str()); - return; - } - - na = findnick(mask); - nc = na ? na->nc : NULL; - - for (i = 0, end = ci->GetAkickCount(); i < end; ++i) - { - akick = ci->GetAkick(i); - - if (akick->HasFlag(AK_ISNICK)) - continue; - if (mask.equals_ci(akick->mask)) - break; - } - - if (i == end) - { - u->SendMessage(ChanServ, CHAN_AKICK_NOT_FOUND, mask.c_str(), ci->name.c_str()); - return; - } - - bool override = !check_access(u, ci, CA_AKICK); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "STICK " << akick->mask; - - akick->SetFlag(AK_STUCK); - u->SendMessage(ChanServ, CHAN_AKICK_STUCK, akick->mask.c_str(), ci->name.c_str()); - - if (ci->c) - stick_mask(ci, akick); - } - - void DoUnStick(User *u, ChannelInfo *ci, const std::vector<Anope::string> ¶ms) - { - NickAlias *na; - NickCore *nc; - AutoKick *akick; - unsigned i, end; - Anope::string mask = params[2]; - - if (!ci->GetAkickCount()) - { - u->SendMessage(ChanServ, CHAN_AKICK_LIST_EMPTY, ci->name.c_str()); - return; - } - - na = findnick(mask); - nc = na ? na->nc : NULL; - - for (i = 0, end = ci->GetAkickCount(); i < end; ++i) - { - akick = ci->GetAkick(i); - - if (akick->HasFlag(AK_ISNICK)) - continue; - if (mask.equals_ci(akick->mask)) - break; - } - - if (i == end) - { - u->SendMessage(ChanServ, CHAN_AKICK_NOT_FOUND, mask.c_str(), ci->name.c_str()); - return; - } - - bool override = !check_access(u, ci, CA_AKICK); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, u, this, ci) << "UNSTICK " << akick->mask; - - akick->UnsetFlag(AK_STUCK); - u->SendMessage(ChanServ, CHAN_AKICK_UNSTUCK, akick->mask.c_str(), ci->name.c_str()); - } - void DoDel(User *u, ChannelInfo *ci, const std::vector<Anope::string> ¶ms) { Anope::string mask = params[2]; @@ -542,7 +459,7 @@ class CommandCSAKick : public Command ChannelInfo *ci = cs_findchan(chan); - if (mask.empty() && (cmd.equals_ci("ADD") || cmd.equals_ci("STICK") || cmd.equals_ci("UNSTICK") || cmd.equals_ci("DEL"))) + if (mask.empty() && (cmd.equals_ci("ADD") || cmd.equals_ci("DEL"))) this->OnSyntaxError(u, cmd); else if (!check_access(u, ci, CA_AKICK) && !u->Account()->HasPriv("chanserv/access/modify")) u->SendMessage(ChanServ, ACCESS_DENIED); @@ -550,10 +467,6 @@ class CommandCSAKick : public Command u->SendMessage(ChanServ, CHAN_AKICK_DISABLED); else if (cmd.equals_ci("ADD")) this->DoAdd(u, ci, params); - else if (cmd.equals_ci("STICK")) - this->DoStick(u, ci, params); - else if (cmd.equals_ci("UNSTICK")) - this->DoUnStick(u, ci, params); else if (cmd.equals_ci("DEL")) this->DoDel(u, ci, params); else if (cmd.equals_ci("LIST")) diff --git a/modules/core/cs_clear.cpp b/modules/core/cs_clear.cpp deleted file mode 100644 index e9763dbdf..000000000 --- a/modules/core/cs_clear.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* ChanServ core functions - * - * (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 CommandCSClear : public Command -{ - public: - CommandCSClear() : Command("CLEAR", 2, 2) - { - } - - CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) - { - Anope::string chan = params[0]; - Anope::string what = params[1]; - Channel *c = findchan(chan); - ChannelInfo *ci = c ? c->ci : NULL; - Anope::string modebuf; - - ChannelMode *owner = ModeManager::FindChannelModeByName(CMODE_OWNER); - ChannelMode *admin = ModeManager::FindChannelModeByName(CMODE_PROTECT); - ChannelMode *op = ModeManager::FindChannelModeByName(CMODE_OP); - ChannelMode *halfop = ModeManager::FindChannelModeByName(CMODE_HALFOP); - ChannelMode *voice = ModeManager::FindChannelModeByName(CMODE_VOICE); - - if (c) - // XXX - Log(LOG_COMMAND, u, this, ci) << what; - - if (!c) - u->SendMessage(ChanServ, CHAN_X_NOT_IN_USE, chan.c_str()); - else if (!check_access(u, ci, CA_CLEAR)) - u->SendMessage(ChanServ, ACCESS_DENIED); - else if (what.equals_ci("bans")) - { - c->ClearBans(); - - u->SendMessage(ChanServ, CHAN_CLEARED_BANS, chan.c_str()); - } - else if (ModeManager::FindChannelModeByName(CMODE_EXCEPT) && what.equals_ci("excepts")) - { - c->ClearExcepts(); - - u->SendMessage(ChanServ, CHAN_CLEARED_EXCEPTS, chan.c_str()); - } - else if (ModeManager::FindChannelModeByName(CMODE_INVITE) && what.equals_ci("invites")) - { - c->ClearInvites(); - - u->SendMessage(ChanServ, CHAN_CLEARED_INVITES, chan.c_str()); - } - else if (what.equals_ci("modes")) - { - c->ClearModes(); - check_modes(c); - - u->SendMessage(ChanServ, CHAN_CLEARED_MODES, chan.c_str()); - } - else if (what.equals_ci("ops")) - { - if (ircd->svsmode_ucmode) - { - if (owner) - { - modebuf = "-" + owner->ModeChar; - - ircdproto->SendSVSModeChan(c, modebuf, ""); - } - if (admin) - { - modebuf = "-" + admin->ModeChar; - - ircdproto->SendSVSModeChan(c, modebuf, ""); - } - if (op) - { - modebuf = "-" + op->ModeChar; - - ircdproto->SendSVSModeChan(c, modebuf, ""); - } - } - else - { - for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ++it) - { - UserContainer *uc = *it; - - if (uc->Status->HasFlag(CMODE_OWNER)) - c->RemoveMode(NULL, owner, uc->user->nick); - if (uc->Status->HasFlag(CMODE_PROTECT)) - c->RemoveMode(NULL, admin, uc->user->nick); - if (uc->Status->HasFlag(CMODE_OP)) - c->RemoveMode(NULL, op, uc->user->nick); - } - } - - u->SendMessage(ChanServ, CHAN_CLEARED_OPS, chan.c_str()); - } - else if ((halfop && what.equals_ci("hops")) || (voice && what.equals_ci("voices"))) - { - ChannelMode *cm = what.equals_ci("hops") ? halfop : voice; - - if (ircd->svsmode_ucmode) - { - modebuf = "-" + cm->ModeChar; - - ircdproto->SendSVSModeChan(c, modebuf, ""); - } - else - { - for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ++it) - { - UserContainer *uc = *it; - - if (uc->Status->HasFlag(cm->Name)) - c->RemoveMode(NULL, cm, uc->user->nick); - } - } - } - else if (what.equals_ci("users")) - { - Anope::string buf = "CLEAR USERS command from " + u->nick; - - for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ) - { - UserContainer *uc = *it++; - - c->Kick(NULL, uc->user, "%s", buf.c_str()); - } - - u->SendMessage(ChanServ, CHAN_CLEARED_USERS, chan.c_str()); - } - else - SyntaxError(ChanServ, u, "CLEAR", CHAN_CLEAR_SYNTAX); - - return MOD_CONT; - } - - bool OnHelp(User *u, const Anope::string &subcommand) - { - u->SendMessage(ChanServ, CHAN_HELP_CLEAR); - return true; - } - - void OnSyntaxError(User *u, const Anope::string &subcommand) - { - SyntaxError(ChanServ, u, "CLEAR", CHAN_CLEAR_SYNTAX); - } - - void OnServHelp(User *u) - { - u->SendMessage(ChanServ, CHAN_HELP_CMD_CLEAR); - } -}; - -class CSClear : public Module -{ - CommandCSClear commandcsclear; - - public: - CSClear(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) - { - this->SetAuthor("Anope"); - this->SetType(CORE); - - this->AddCommand(ChanServ, &commandcsclear); - } -}; - -MODULE_INIT(CSClear) diff --git a/modules/core/cs_clearusers.cpp b/modules/core/cs_clearusers.cpp new file mode 100644 index 000000000..55c6f684e --- /dev/null +++ b/modules/core/cs_clearusers.cpp @@ -0,0 +1,87 @@ +/* ChanServ core functions + * + * (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 CommandCSClearUsers : public Command +{ + public: + CommandCSClearUsers() : Command("CLEARUSERS", 1, 1) + { + } + + CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) + { + Anope::string chan = params[0]; + Anope::string what = params[1]; + Channel *c = findchan(chan); + ChannelInfo *ci = c ? c->ci : NULL; + Anope::string modebuf; + + ChannelMode *owner = ModeManager::FindChannelModeByName(CMODE_OWNER); + ChannelMode *admin = ModeManager::FindChannelModeByName(CMODE_PROTECT); + ChannelMode *op = ModeManager::FindChannelModeByName(CMODE_OP); + ChannelMode *halfop = ModeManager::FindChannelModeByName(CMODE_HALFOP); + ChannelMode *voice = ModeManager::FindChannelModeByName(CMODE_VOICE); + + if (!c) + u->SendMessage(ChanServ, CHAN_X_NOT_IN_USE, chan.c_str()); + else if (!check_access(u, ci, CA_CLEAR)) + u->SendMessage(ChanServ, ACCESS_DENIED); + + Anope::string buf = "CLEAR USERS command from " + u->nick + " (" + u->Account()->display + ")"; + + for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ) + { + UserContainer *uc = *it++; + + c->Kick(NULL, uc->user, "%s", buf.c_str()); + } + + u->SendMessage(ChanServ, CHAN_CLEARED_USERS, chan.c_str()); + + return MOD_CONT; + } + + bool OnHelp(User *u, const Anope::string &subcommand) + { + u->SendMessage(ChanServ, CHAN_HELP_CLEAR); + return true; + } + + void OnSyntaxError(User *u, const Anope::string &subcommand) + { + SyntaxError(ChanServ, u, "CLEAR", CHAN_CLEAR_SYNTAX); + } + + void OnServHelp(User *u) + { + u->SendMessage(ChanServ, CHAN_HELP_CMD_CLEAR); + } +}; + +class CSClearUsers : public Module +{ + CommandCSClearUsers commandcsclearusers; + + public: + CSClearUsers(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetType(CORE); + + this->AddCommand(ChanServ, &commandcsclearusers); + } +}; + +MODULE_INIT(CSClearUsers) diff --git a/modules/core/cs_saset.cpp b/modules/core/cs_saset.cpp index 0e485e540..491e5725f 100644 --- a/modules/core/cs_saset.cpp +++ b/modules/core/cs_saset.cpp @@ -36,6 +36,13 @@ class CommandCSSASet : public Command return MOD_CONT; } + // XXX Remove after 1.9.4 release + if (params[1].equals_ci("MLOCK")) + { + u->SendMessage(ChanServ, CHAN_SET_MLOCK_DEPRECATED); + return MOD_CONT; + } + Command *c = this->FindCommand(params[1]); if (c) diff --git a/modules/core/cs_set.cpp b/modules/core/cs_set.cpp index fe37e7ea6..04721cab8 100644 --- a/modules/core/cs_set.cpp +++ b/modules/core/cs_set.cpp @@ -41,6 +41,13 @@ class CommandCSSet : public Command return MOD_CONT; } + // XXX Remove after 1.9.4 release + if (params[1].equals_ci("MLOCK")) + { + u->SendMessage(ChanServ, CHAN_SET_MLOCK_DEPRECATED); + return MOD_CONT; + } + Command *c = this->FindCommand(params[1]); if (c) diff --git a/modules/core/cs_set_mlock.cpp b/modules/core/cs_set_mlock.cpp deleted file mode 100644 index 2556653a2..000000000 --- a/modules/core/cs_set_mlock.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/* ChanServ core functions - * - * (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 CommandCSSetMLock : public Command -{ - public: - CommandCSSetMLock(const Anope::string &cpermission = "") : Command("MLOCK", 1, 0, cpermission) - { - } - - CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) - { - ChannelInfo *ci = cs_findchan(params[0]); - if (!ci) - throw CoreException("NULL ci in CommandCSSetMLock"); - - int add = -1; /* 1 if adding, 0 if deleting, -1 if neither */ - ChannelMode *cm; - unsigned paramcount = 2; - - ci->ClearMLock(); - ci->ClearParams(); - - if (ModeManager::FindChannelModeByName(CMODE_REGISTERED)) - ci->SetMLock(CMODE_REGISTERED, true); - - Anope::string modes = params[1]; - for (Anope::string::const_iterator ch = modes.begin(), end = modes.end(); ch != end; ++ch) - { - switch (*ch) - { - case '+': - add = 1; - continue; - case '-': - add = 0; - continue; - default: - if (add < 0) - continue; - } - - if ((cm = ModeManager::FindChannelModeByChar(*ch))) - { - if (cm->Type == MODE_STATUS || cm->Type == MODE_LIST || !cm->CanSet(u)) - u->SendMessage(ChanServ, CHAN_SET_MLOCK_IMPOSSIBLE_CHAR, *ch); - else if (add) - { - ci->RemoveMLock(cm->Name); - - if (cm->Type == MODE_PARAM) - { - if (paramcount >= params.size()) - continue; - - Anope::string param = params[paramcount++]; - - ChannelModeParam *cmp = debug_cast<ChannelModeParam *>(cm); - - if (!cmp || !cmp->IsValid(param)) - continue; - - ci->SetMLock(cmp->Name, true, param); - } - else - ci->SetMLock(cm->Name, true); - } - else - ci->SetMLock(cm->Name, false); - } - else - u->SendMessage(ChanServ, CHAN_SET_MLOCK_UNKNOWN_CHAR, *ch); - } - - /* We can't mlock +L if +l is not mlocked as well. */ - if (ModeManager::FindChannelModeByName(CMODE_REDIRECT) && ci->HasMLock(CMODE_REDIRECT, true) && !ci->HasMLock(CMODE_LIMIT, true)) - { - ci->RemoveMLock(CMODE_REDIRECT); - u->SendMessage(ChanServ, CHAN_SET_MLOCK_L_REQUIRED); - } - - /* Some ircd we can't set NOKNOCK without INVITE */ - /* So check if we need there is a NOKNOCK MODE and that we need INVITEONLY */ - if (ModeManager::FindChannelModeByName(CMODE_NOKNOCK) && ircd->knock_needs_i && ci->HasMLock(CMODE_NOKNOCK, true) && !ci->HasMLock(CMODE_INVITE, true)) - { - ci->RemoveMLock(CMODE_NOKNOCK); - u->SendMessage(ChanServ, CHAN_SET_MLOCK_K_REQUIRED); - } - - /* Since we always enforce mode r there is no way to have no - * mode lock at all. - */ - if (!get_mlock_modes(ci, 0).empty()) - u->SendMessage(ChanServ, CHAN_MLOCK_CHANGED, ci->name.c_str(), get_mlock_modes(ci, 0).c_str()); - - /* Implement the new lock. */ - if (ci->c) - check_modes(ci->c); - - return MOD_CONT; - } - - bool OnHelp(User *u, const Anope::string &) - { - u->SendMessage(ChanServ, CHAN_HELP_SET_MLOCK, "SET"); - return true; - } - - void OnSyntaxError(User *u, const Anope::string &) - { - // XXX - SyntaxError(ChanServ, u, "SET", CHAN_SET_SYNTAX); - } - - void OnServHelp(User *u) - { - u->SendMessage(ChanServ, CHAN_HELP_CMD_SET_MLOCK); - } -}; - -class CommandCSSASetMLock : public CommandCSSetMLock -{ - public: - CommandCSSASetMLock() : CommandCSSetMLock("chanserv/saset/mlock") - { - } - - bool OnHelp(User *u, const Anope::string &) - { - u->SendMessage(ChanServ, CHAN_HELP_SET_MLOCK, "SASET"); - return true; - } - - void OnSyntaxError(User *u, const Anope::string &) - { - // XXX - SyntaxError(ChanServ, u, "SASET", CHAN_SASET_SYNTAX); - } -}; - -class CSSetMLock : public Module -{ - CommandCSSetMLock commandcssetmlock; - CommandCSSASetMLock commandcssasetmlock; - - public: - CSSetMLock(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) - { - this->SetAuthor("Anope"); - this->SetType(CORE); - - Command *c = FindCommand(ChanServ, "SET"); - if (c) - c->AddSubcommand(&commandcssetmlock); - - c = FindCommand(ChanServ, "SASET"); - if (c) - c->AddSubcommand(&commandcssasetmlock); - } - - ~CSSetMLock() - { - Command *c = FindCommand(ChanServ, "SET"); - if (c) - c->DelSubcommand(&commandcssetmlock); - - c = FindCommand(ChanServ, "SASET"); - if (c) - c->DelSubcommand(&commandcssasetmlock); - } -}; - -MODULE_INIT(CSSetMLock) diff --git a/modules/core/db_plain.cpp b/modules/core/db_plain.cpp index 19acd810d..d6f7963d5 100644 --- a/modules/core/db_plain.cpp +++ b/modules/core/db_plain.cpp @@ -710,7 +710,7 @@ class DBPlain : public Module } else if (key.equals_ci("AKICK")) { - bool Stuck = params[0].equals_ci("STUCK"); + // 0 is the old stuck bool Nick = params[1].equals_ci("NICK"); NickCore *nc = NULL; if (Nick) @@ -728,8 +728,6 @@ class DBPlain : public Module ak = ci->AddAkick(params[3], nc, params.size() > 6 ? params[6] : "", params[4].is_pos_number_only() ? convertTo<time_t>(params[4]) : 0, params[5].is_pos_number_only() ? convertTo<time_t>(params[5]) : 0); else ak = ci->AddAkick(params[3], params[2], params.size() > 6 ? params[6] : "", params[4].is_pos_number_only() ? convertTo<time_t>(params[4]) : 0, params[5].is_pos_number_only() ? convertTo<time_t>(params[5]) : 0); - if (Stuck) - ak->SetFlag(AK_STUCK); if (Nick) ak->SetFlag(AK_ISNICK); @@ -968,7 +966,7 @@ class DBPlain : public Module db << "MD ACCESS " << ci->GetAccess(k)->nc->display << " " << ci->GetAccess(k)->level << " " << ci->GetAccess(k)->last_seen << " " << ci->GetAccess(k)->creator << endl; for (unsigned k = 0, end = ci->GetAkickCount(); k < end; ++k) { - db << "MD AKICK " << (ci->GetAkick(k)->HasFlag(AK_STUCK) ? "STUCK " : "UNSTUCK ") << (ci->GetAkick(k)->HasFlag(AK_ISNICK) ? "NICK " : "MASK ") << + db << "MD AKICK 0 " << (ci->GetAkick(k)->HasFlag(AK_ISNICK) ? "NICK " : "MASK ") << (ci->GetAkick(k)->HasFlag(AK_ISNICK) ? ci->GetAkick(k)->nc->display : ci->GetAkick(k)->mask) << " " << ci->GetAkick(k)->creator << " " << ci->GetAkick(k)->addtime << " " << ci->last_used << " :"; if (!ci->GetAkick(k)->reason.empty()) db << ci->GetAkick(k)->reason; diff --git a/modules/core/os_clearmodes.cpp b/modules/core/os_clearmodes.cpp deleted file mode 100644 index 0042ac58f..000000000 --- a/modules/core/os_clearmodes.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* OperServ core functions - * - * (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 CommandOSClearModes : public Command -{ - public: - CommandOSClearModes() : Command("CLEARMODES", 1, 2, "operserv/clearmodes") - { - } - - CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) - { - Anope::string chan = params[0]; - Channel *c; - int all = 0; - ChannelMode *cm; - Anope::string buf; - - if (!(c = findchan(chan))) - { - u->SendMessage(OperServ, CHAN_X_NOT_IN_USE, chan.c_str()); - return MOD_CONT; - } - else if (c->bouncy_modes) - { - u->SendMessage(OperServ, OPER_BOUNCY_MODES_U_LINE); - return MOD_CONT; - } - else - { - Anope::string s = params.size() > 1 ? params[1] : ""; - if (!s.empty()) - { - if (s.equals_ci("ALL")) - all = 1; - else - { - this->OnSyntaxError(u, ""); - return MOD_CONT; - } - } - - if (Config->WallOSClearmodes) - ircdproto->SendGlobops(OperServ, "%s used CLEARMODES%s on %s", u->nick.c_str(), all ? " ALL" : "", chan.c_str()); - if (all) - { - /* Clear mode +o */ - if (ircd->svsmode_ucmode) - ircdproto->SendSVSModeChan(c, "-o", ""); - else - { - for (CUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end; ++it) - { - UserContainer *uc = *it; - - if (uc->Status->HasFlag(CMODE_OP)) - c->RemoveMode(NULL, CMODE_OP, uc->user->nick); |
