diff options
| author | Adam <Adam@anope.org> | 2010-12-06 17:06:57 -0500 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2010-12-12 19:37:03 -0500 |
| commit | aed53dbb47822a79eb9a6b61095ad04ec3d67818 (patch) | |
| tree | 72d3210b5609ea2163854d14ec7fb2f48d8b4d12 /modules/core | |
| parent | a507816701d136a1c22d2f6779d811840d61577c (diff) | |
Cleaned up some things, made the protocol modules use some basic inheritance to cut back on their code duplication. More work can be done in the future to remove even more of it.
Diffstat (limited to 'modules/core')
| -rw-r--r-- | modules/core/cs_forbid.cpp | 2 | ||||
| -rw-r--r-- | modules/core/cs_info.cpp | 2 | ||||
| -rw-r--r-- | modules/core/cs_list.cpp | 2 | ||||
| -rw-r--r-- | modules/core/cs_suspend.cpp | 2 | ||||
| -rw-r--r-- | modules/core/cs_unban.cpp | 2 | ||||
| -rw-r--r-- | modules/core/ns_ghost.cpp | 2 | ||||
| -rw-r--r-- | modules/core/ns_group.cpp | 2 | ||||
| -rw-r--r-- | modules/core/ns_info.cpp | 2 | ||||
| -rw-r--r-- | modules/core/ns_list.cpp | 2 | ||||
| -rw-r--r-- | modules/core/ns_register.cpp | 4 | ||||
| -rw-r--r-- | modules/core/os_chankill.cpp | 2 | ||||
| -rw-r--r-- | modules/core/os_defcon.cpp | 6 | ||||
| -rw-r--r-- | modules/core/os_noop.cpp | 4 |
13 files changed, 17 insertions, 17 deletions
diff --git a/modules/core/cs_forbid.cpp b/modules/core/cs_forbid.cpp index 19f4b6f04..d3976929d 100644 --- a/modules/core/cs_forbid.cpp +++ b/modules/core/cs_forbid.cpp @@ -71,7 +71,7 @@ class CommandCSForbid : public Command { UserContainer *uc = *it++; - if (is_oper(uc->user)) + if (uc->user->HasMode(UMODE_OPER)) continue; c->Kick(ChanServ, uc->user, "%s", !reason.empty() ? reason.c_str() : GetString(uc->user, CHAN_FORBID_REASON).c_str()); diff --git a/modules/core/cs_info.cpp b/modules/core/cs_info.cpp index 7f4784270..d842ad4ea 100644 --- a/modules/core/cs_info.cpp +++ b/modules/core/cs_info.cpp @@ -46,7 +46,7 @@ class CommandCSInfo : public Command if (ci->HasFlag(CI_FORBIDDEN)) { - if (is_oper(u) && !ci->forbidby.empty()) + if (u->HasMode(UMODE_OPER) && !ci->forbidby.empty()) source.Reply(CHAN_X_FORBIDDEN_OPER, chan.c_str(), ci->forbidby.c_str(), !ci->forbidreason.empty() ? ci->forbidreason.c_str() : GetString(u, NO_REASON).c_str()); else source.Reply(CHAN_X_FORBIDDEN, chan.c_str()); diff --git a/modules/core/cs_list.cpp b/modules/core/cs_list.cpp index 87d0afb79..73947c9de 100644 --- a/modules/core/cs_list.cpp +++ b/modules/core/cs_list.cpp @@ -33,7 +33,7 @@ public: int count = 0, from = 0, to = 0; bool forbidden = false, suspended = false, channoexpire = false; - if (Config->CSListOpersOnly && !is_oper(u)) + if (Config->CSListOpersOnly && !u->HasMode(UMODE_OPER)) { source.Reply(ACCESS_DENIED); return MOD_STOP; diff --git a/modules/core/cs_suspend.cpp b/modules/core/cs_suspend.cpp index ee0dd4d17..c2172dcb2 100644 --- a/modules/core/cs_suspend.cpp +++ b/modules/core/cs_suspend.cpp @@ -56,7 +56,7 @@ class CommandCSSuspend : public Command { UserContainer *uc = *it++; - if (is_oper(uc->user)) + if (uc->user->HasMode(UMODE_OPER)) continue; c->Kick(NULL, uc->user, "%s", !reason.empty() ? reason.c_str() : GetString(uc->user->Account(), CHAN_SUSPEND_REASON).c_str()); diff --git a/modules/core/cs_unban.cpp b/modules/core/cs_unban.cpp index f9b5908e0..df5d2877e 100644 --- a/modules/core/cs_unban.cpp +++ b/modules/core/cs_unban.cpp @@ -48,7 +48,7 @@ class CommandCSUnban : public Command return MOD_CONT; } - common_unban(ci, u2->nick); + common_unban(ci, u2); if (u2 == u) source.Reply(CHAN_UNBANNED, c->name.c_str()); else diff --git a/modules/core/ns_ghost.cpp b/modules/core/ns_ghost.cpp index 14796bc78..323b0378c 100644 --- a/modules/core/ns_ghost.cpp +++ b/modules/core/ns_ghost.cpp @@ -49,7 +49,7 @@ class CommandNSGhost : public Command { Log(LOG_COMMAND, u, this) << "for " << nick; Anope::string buf = "GHOST command used by " + u->nick; - kill_user(Config->s_NickServ, nick, buf); + kill_user(Config->s_NickServ, user, buf); source.Reply(NICK_GHOST_KILLED, nick.c_str()); } } diff --git a/modules/core/ns_group.cpp b/modules/core/ns_group.cpp index 697c29447..ebf6c74af 100644 --- a/modules/core/ns_group.cpp +++ b/modules/core/ns_group.cpp @@ -48,7 +48,7 @@ class CommandNSGroup : public Command if (Config->RestrictOperNicks) for (std::list<std::pair<Anope::string, Anope::string> >::iterator it = Config->Opers.begin(), it_end = Config->Opers.end(); it != it_end; ++it) - if (!is_oper(u) && u->nick.find_ci(it->first) != Anope::string::npos) + if (!u->HasMode(UMODE_OPER) && u->nick.find_ci(it->first) != Anope::string::npos) { source.Reply(NICK_CANNOT_BE_REGISTERED, u->nick.c_str()); return MOD_CONT; diff --git a/modules/core/ns_info.cpp b/modules/core/ns_info.cpp index 32d8fe8f7..a3ee2f70f 100644 --- a/modules/core/ns_info.cpp +++ b/modules/core/ns_info.cpp @@ -57,7 +57,7 @@ class CommandNSInfo : public Command } else if (na->HasFlag(NS_FORBIDDEN)) { - if (is_oper(u) && !na->last_usermask.empty()) + if (u->HasMode(UMODE_OPER) && !na->last_usermask.empty()) source.Reply(NICK_X_FORBIDDEN_OPER, nick.c_str(), na->last_usermask.c_str(), !na->last_realname.empty() ? na->last_realname.c_str() : GetString(u, NO_REASON).c_str()); else source.Reply(NICK_X_FORBIDDEN, nick.c_str()); diff --git a/modules/core/ns_list.cpp b/modules/core/ns_list.cpp index 89fba90d8..bf7a0efbd 100644 --- a/modules/core/ns_list.cpp +++ b/modules/core/ns_list.cpp @@ -49,7 +49,7 @@ class CommandNSList : public Command suspended = nsnoexpire = forbidden = unconfirmed = false; - if (Config->NSListOpersOnly && !is_oper(u)) /* reverse the help logic */ + if (Config->NSListOpersOnly && !u->HasMode(UMODE_OPER)) /* reverse the help logic */ { source.Reply(ACCESS_DENIED); return MOD_STOP; diff --git a/modules/core/ns_register.cpp b/modules/core/ns_register.cpp index abcba133d..edf8181e5 100644 --- a/modules/core/ns_register.cpp +++ b/modules/core/ns_register.cpp @@ -196,7 +196,7 @@ class CommandNSRegister : public CommandNSConfirm return MOD_CONT; } - if (!is_oper(u) && Config->NickRegDelay && Anope::CurTime - u->my_signon < Config->NickRegDelay) + if (!u->HasMode(UMODE_OPER) && Config->NickRegDelay && Anope::CurTime - u->my_signon < Config->NickRegDelay) { source.Reply(NICK_REG_DELAY, Config->NickRegDelay); return MOD_CONT; @@ -230,7 +230,7 @@ class CommandNSRegister : public CommandNSConfirm { Anope::string nick = it->first; - if (u->nick.find_ci(nick) != Anope::string::npos && !is_oper(u)) + if (u->nick.find_ci(nick) != Anope::string::npos && !u->HasMode(UMODE_OPER)) { source.Reply(NICK_CANNOT_BE_REGISTERED, u->nick.c_str()); return MOD_CONT; diff --git a/modules/core/os_chankill.cpp b/modules/core/os_chankill.cpp index 3201858e7..506adbdfb 100644 --- a/modules/core/os_chankill.cpp +++ b/modules/core/os_chankill.cpp @@ -70,7 +70,7 @@ class CommandOSChanKill : public Command { UserContainer *uc = *it++; - if (is_oper(uc->user)) + if (uc->user->HasMode(UMODE_OPER)) continue; SGLine->Add(OperServ, u, "*@" + uc->user->host, expires, realreason); diff --git a/modules/core/os_defcon.cpp b/modules/core/os_defcon.cpp index 0dd9dcedb..cc8809586 100644 --- a/modules/core/os_defcon.cpp +++ b/modules/core/os_defcon.cpp @@ -164,7 +164,7 @@ class OSDefcon : public Module } if (CheckDefCon(DEFCON_NO_NEW_CLIENTS) || CheckDefCon(DEFCON_AKILL_NEW_CLIENTS)) - kill_user(Config->s_OperServ, u->nick, Config->DefConAkillReason); + kill_user(Config->s_OperServ, u, Config->DefConAkillReason); return EVENT_STOP; } @@ -208,7 +208,7 @@ class OSDefcon : public Module EventReturn OnPreCommandRun(User *u, BotInfo *bi, Anope::string &command, Anope::string &message, ChannelInfo *ci) { - if (!is_oper(u) && (CheckDefCon(DEFCON_OPER_ONLY) || CheckDefCon(DEFCON_SILENT_OPER_ONLY))) + if (!u->HasMode(UMODE_OPER) && (CheckDefCon(DEFCON_OPER_ONLY) || CheckDefCon(DEFCON_SILENT_OPER_ONLY))) { if (!CheckDefCon(DEFCON_SILENT_OPER_ONLY)) u->SendMessage(bi, OPER_DEFCON_DENIED); @@ -281,7 +281,7 @@ class OSDefcon : public Module if (!Config->SessionLimitDetailsLoc.empty()) ircdproto->SendMessage(OperServ, u->nick, "%s", Config->SessionLimitDetailsLoc.c_str()); - kill_user(Config->s_OperServ, u->nick, "Session limit exceeded"); + kill_user(Config->s_OperServ, u, "Session limit exceeded"); ++session->hits; if (Config->MaxSessionKill && session->hits >= Config->MaxSessionKill) { diff --git a/modules/core/os_noop.cpp b/modules/core/os_noop.cpp index 0d740d29a..1e799d4d3 100644 --- a/modules/core/os_noop.cpp +++ b/modules/core/os_noop.cpp @@ -44,8 +44,8 @@ class CommandOSNOOP : public Command User *u2 = *it; ++it; - if (u2 && is_oper(u2) && Anope::Match(u2->server->GetName(), server, true)) - kill_user(Config->s_OperServ, u2->nick, reason); + if (u2 && u2->HasMode(UMODE_OPER) && Anope::Match(u2->server->GetName(), server, true)) + kill_user(Config->s_OperServ, u2, reason); } } else if (cmd.equals_ci("REVOKE")) |
