diff options
| author | Adam <Adam@anope.org> | 2016-11-25 16:35:10 -0500 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2016-11-25 16:35:56 -0500 |
| commit | a635344582a13d935631fbe930d79d3788359c8a (patch) | |
| tree | cd7b372d02f94c7f6c18542e06d29deff0f19842 /modules | |
| parent | f30d99f81f6fb8abd7ca555068173bad6c99e07a (diff) | |
Rename most ext fields names to be consistent with everything else, add accessors for many
Diffstat (limited to 'modules')
65 files changed, 926 insertions, 494 deletions
diff --git a/modules/botserv/assign.cpp b/modules/botserv/assign.cpp index 95691b6a9..eca103e9f 100644 --- a/modules/botserv/assign.cpp +++ b/modules/botserv/assign.cpp @@ -140,7 +140,7 @@ class CommandBSUnassign : public Command return; } - if (ci->HasFieldS("PERSIST") && !ModeManager::FindChannelModeByName("PERM")) + if (ci->IsPersist() && !ModeManager::FindChannelModeByName("PERM")) { source.Reply(_("You cannot unassign bots while persist is set on the channel.")); return; diff --git a/modules/botserv/badwords.cpp b/modules/botserv/badwords.cpp index 1348c8aff..914e89ea9 100644 --- a/modules/botserv/badwords.cpp +++ b/modules/botserv/badwords.cpp @@ -50,7 +50,7 @@ class BadWordsType : public Serialize::Type<BadWordImpl> Serialize::Field<BadWordImpl, BadWordType> type; BadWordsType(Module *me) : Serialize::Type<BadWordImpl>(me) - , channel(this, "ci", &BadWordImpl::channel, true) + , channel(this, "channel", &BadWordImpl::channel, true) , word(this, "word", &BadWordImpl::word) , type(this, "type", &BadWordImpl::type) { diff --git a/modules/botserv/main/botserv.cpp b/modules/botserv/main/botserv.cpp index a297db153..c6e1c6413 100644 --- a/modules/botserv/main/botserv.cpp +++ b/modules/botserv/main/botserv.cpp @@ -127,7 +127,7 @@ class BotServCore : public Module, public BotServ::BotServService void OnLeaveChannel(User *u, Channel *c) override { /* Channel is persistent, it shouldn't be deleted and the service bot should stay */ - if (c->ci && c->ci->HasFieldS("PERSIST")) + if (c->ci && c->ci->IsPersist()) return; /* Channel is syncing from a netburst, don't destroy it as more users are probably wanting to join immediately @@ -219,7 +219,7 @@ class BotServCore : public Module, public BotServ::BotServService /* Set default bot flags */ spacesepstream sep(Config->GetModule(this)->Get<Anope::string>("defaults", "greet fantasy")); for (Anope::string token; sep.GetToken(token);) - ci->SetS<bool>("BS_" + token.upper(), true); + ci->SetS<bool>(token, true); } void OnUserKicked(const MessageSource &source, User *target, const Anope::string &channel, ChannelStatus &status, const Anope::string &kickmsg) override diff --git a/modules/chanserv/akick.cpp b/modules/chanserv/akick.cpp index d253d6fb5..1930cb20b 100644 --- a/modules/chanserv/akick.cpp +++ b/modules/chanserv/akick.cpp @@ -58,10 +58,10 @@ class AutoKickImpl : public AutoKick class AutoKickType : public Serialize::Type<AutoKickImpl> { public: - Serialize::ObjectField<AutoKickImpl, ChanServ::Channel *> ci; + Serialize::ObjectField<AutoKickImpl, ChanServ::Channel *> channel; Serialize::Field<AutoKickImpl, Anope::string> mask; - Serialize::ObjectField<AutoKickImpl, NickServ::Account *> nc; + Serialize::ObjectField<AutoKickImpl, NickServ::Account *> account; Serialize::Field<AutoKickImpl, Anope::string> reason; Serialize::Field<AutoKickImpl, Anope::string> creator; @@ -70,9 +70,9 @@ class AutoKickType : public Serialize::Type<AutoKickImpl> AutoKickType(Module *me) : Serialize::Type<AutoKickImpl>(me) - , ci(this, "ci", &AutoKickImpl::channel, true) + , channel(this, "channel", &AutoKickImpl::channel, true) , mask(this, "mask", &AutoKickImpl::mask) - , nc(this, "nc", &AutoKickImpl::account, true) + , account(this, "account", &AutoKickImpl::account, true) , reason(this, "reason", &AutoKickImpl::reason) , creator(this, "creator", &AutoKickImpl::creator) , addtime(this, "addtime", &AutoKickImpl::addtime) @@ -83,12 +83,12 @@ class AutoKickType : public Serialize::Type<AutoKickImpl> ChanServ::Channel *AutoKickImpl::GetChannel() { - return Get(&AutoKickType::ci); + return Get(&AutoKickType::channel); } void AutoKickImpl::SetChannel(ChanServ::Channel *ci) { - Set(&AutoKickType::ci, ci); + Set(&AutoKickType::channel, ci); } Anope::string AutoKickImpl::GetMask() @@ -103,12 +103,12 @@ void AutoKickImpl::SetMask(const Anope::string &mask) NickServ::Account *AutoKickImpl::GetAccount() { - return Get(&AutoKickType::nc); + return Get(&AutoKickType::account); } void AutoKickImpl::SetAccount(NickServ::Account *nc) { - Set(&AutoKickType::nc, nc); + Set(&AutoKickType::account, nc); } Anope::string AutoKickImpl::GetReason() @@ -170,7 +170,7 @@ class CommandCSAKick : public Command { /* Also don't try to complete the mask if this is a channel */ - if (mask.equals_ci(ci->GetName()) && ci->HasFieldS("PEACE")) + if (mask.equals_ci(ci->GetName()) && ci->IsPeace()) { source.Reply(_("Access denied.")); return; @@ -232,7 +232,7 @@ class CommandCSAKick : public Command ; /* Check whether target nick has equal/higher access * or whether the mask matches a user with higher/equal access - Viper */ - else if (ci->HasFieldS("PEACE") && nc) + else if (ci->IsPeace() && nc) { ChanServ::AccessGroup nc_access = ci->AccessFor(nc), u_access = source.AccessFor(ci); if (nc == ci->GetFounder() || nc_access >= u_access) @@ -241,7 +241,7 @@ class CommandCSAKick : public Command return; } } - else if (ci->HasFieldS("PEACE")) + else if (ci->IsPeace()) { #warning "peace" #if 0 diff --git a/modules/chanserv/ban.cpp b/modules/chanserv/ban.cpp index 552ef03bf..44e2752a5 100644 --- a/modules/chanserv/ban.cpp +++ b/modules/chanserv/ban.cpp @@ -127,7 +127,7 @@ class CommandCSBan : public Command { ChanServ::AccessGroup u2_access = ci->AccessFor(u2); - if (u != u2 && ci->HasFieldS("PEACE") && u2_access >= u_access && !source.HasPriv("chanserv/kick")) + if (u != u2 && ci->IsPeace() && u2_access >= u_access && !source.HasPriv("chanserv/kick")) { source.Reply(_("Access denied. \002{0}\002 has the same or more privileges than you on \002{1}\002."), u2->nick, ci->GetName()); return; @@ -151,7 +151,7 @@ class CommandCSBan : public Command Anope::string mask = ci->GetIdealBan(u2); - bool override = !u_access.HasPriv("BAN") || (u != u2 && ci->HasFieldS("PEACE") && u2_access >= u_access); + bool override = !u_access.HasPriv("BAN") || (u != u2 && ci->IsPeace() && u2_access >= u_access); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << mask; if (!c->HasMode(mode, mask)) @@ -170,13 +170,15 @@ class CommandCSBan : public Command if (block->Get<bool>("kick", "yes")) { - if (ci->HasFieldS("SIGNKICK") || (ci->HasFieldS("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK"))) + if (ci->IsSignKick() || (ci->IsSignKickLevel() && !source.AccessFor(ci).HasPriv("SIGNKICK"))) { signkickformat = signkickformat.replace_all_cs("%m", reason); c->Kick(ci->WhoSends(), u2, "%s", signkickformat.c_str()); } else + { c->Kick(ci->WhoSends(), u2, "%s", reason.c_str()); + } } } else @@ -213,7 +215,7 @@ class CommandCSBan : public Command if (matched > 1 && !founder) continue; - if (u != uc->user && ci->HasFieldS("PEACE") && u2_access >= u_access) + if (u != uc->user && ci->IsPeace() && u2_access >= u_access) continue; else if (ci->c->MatchesList(uc->user, "EXCEPT")) continue; @@ -224,14 +226,16 @@ class CommandCSBan : public Command { ++kicked; - if (ci->HasFieldS("SIGNKICK") || (ci->HasFieldS("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK"))) + if (ci->IsSignKick() || (ci->IsSignKickLevel() && !u_access.HasPriv("SIGNKICK"))) { reason += " (Matches " + mask + ")"; signkickformat = signkickformat.replace_all_cs("%m", reason); c->Kick(ci->WhoSends(), uc->user, "%s", signkickformat.c_str()); } else + { c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), mask.c_str()); + } } } } diff --git a/modules/chanserv/drop.cpp b/modules/chanserv/drop.cpp index 1bc880ae9..77ab7e55e 100644 --- a/modules/chanserv/drop.cpp +++ b/modules/chanserv/drop.cpp @@ -52,7 +52,7 @@ class CommandCSDrop : public Command return; } - if ((ci->HasFieldS("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && !source.HasCommand("chanserv/drop")) + if ((ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && !source.HasCommand("chanserv/drop")) { source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->GetName()); return; @@ -62,7 +62,7 @@ class CommandCSDrop : public Command if (MOD_RESULT == EVENT_STOP) return; - bool override = (ci->HasFieldS("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")); + bool override = (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "(founder was: " << (ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "none") << ")"; Reference<Channel> c = ci->c; diff --git a/modules/chanserv/enforce.cpp b/modules/chanserv/enforce.cpp index 5a57d3cc2..c2a9fbe2d 100644 --- a/modules/chanserv/enforce.cpp +++ b/modules/chanserv/enforce.cpp @@ -32,8 +32,8 @@ class CommandCSEnforce : public Command * part of the code. This way we can enforce SECUREOPS even * if it's off. */ - bool hadsecureops = ci->HasFieldS("SECUREOPS"); - ci->SetS<bool>("SECUREOPS", true); + bool hadsecureops = ci->IsSecureOps(); + ci->SetSecureOps(true); for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it) { @@ -43,7 +43,7 @@ class CommandCSEnforce : public Command } if (!hadsecureops) - ci->UnsetS<bool>("SECUREOPS"); + ci->SetSecureOps(false); source.Reply(_("\002Secureops\002 enforced on \002{0}\002."), ci->GetName()); } diff --git a/modules/chanserv/kick.cpp b/modules/chanserv/kick.cpp index 4752d5940..a1ac7f62f 100644 --- a/modules/chanserv/kick.cpp +++ b/modules/chanserv/kick.cpp @@ -70,7 +70,7 @@ class CommandCSKick : public Command if (u2) { ChanServ::AccessGroup u2_access = ci->AccessFor(u2); - if (u != u2 && ci->HasFieldS("PEACE") && u2_access >= u_access && !source.HasPriv("chanserv/kick")) + if (u != u2 && ci->IsPeace() && u2_access >= u_access && !source.HasPriv("chanserv/kick")) source.Reply(_("Access denied. \002{0}\002 has the same or more privileges than you on \002{1}\002."), u2->nick, ci->GetName()); else if (u2->IsProtected()) source.Reply(_("Access denied. \002{0}\002 is protected and can not be kicked."), u2->nick); @@ -78,16 +78,18 @@ class CommandCSKick : public Command source.Reply(_("User \002{0}\002 is not on channel \002{1}\002."), u2->nick, c->name); else { - bool override = !u_access.HasPriv("KICK") || (u != u2 && ci->HasFieldS("PEACE") && u2_access >= u_access); + bool override = !u_access.HasPriv("KICK") || (u != u2 && ci->IsPeace() && u2_access >= u_access); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << u2->nick; - if (ci->HasFieldS("SIGNKICK") || (ci->HasFieldS("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK"))) + if (ci->IsSignKick() || (ci->IsSignKickLevel() && !u_access.HasPriv("SIGNKICK"))) { signkickformat = signkickformat.replace_all_cs("%m", reason); c->Kick(ci->WhoSends(), u2, "%s", signkickformat.c_str()); } else + { c->Kick(ci->WhoSends(), u2, "%s", reason.c_str()); + } } } else if (u_access.HasPriv("FOUNDER")) @@ -108,21 +110,23 @@ class CommandCSKick : public Command ++matched; ChanServ::AccessGroup u2_access = ci->AccessFor(uc->user); - if (u != uc->user && ci->HasFieldS("PEACE") && u2_access >= u_access) + if (u != uc->user && ci->IsPeace() && u2_access >= u_access) continue; else if (uc->user->IsProtected()) continue; ++kicked; - if (ci->HasFieldS("SIGNKICK") || (ci->HasFieldS("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK"))) + if (ci->IsSignKick() || (ci->IsSignKickLevel() && !u_access.HasPriv("SIGNKICK"))) { reason += " (Matches " + mask + ")"; signkickformat = signkickformat.replace_all_cs("%m", reason); c->Kick(ci->WhoSends(), uc->user, "%s", signkickformat.c_str()); } else + { c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), mask.c_str()); + } } } diff --git a/modules/chanserv/list.cpp b/modules/chanserv/list.cpp index c76d8661c..a60ae786c 100644 --- a/modules/chanserv/list.cpp +++ b/modules/chanserv/list.cpp @@ -85,7 +85,6 @@ class CommandCSList : public Command ListFormatter list(source.GetAccount()); list.AddColumn(_("Name")).AddColumn(_("Description")); - // XXX wtf Anope::map<ChanServ::Channel *> ordered_map; if (ChanServ::service) for (auto& it : ChanServ::service->GetChannels()) @@ -97,7 +96,7 @@ class CommandCSList : public Command if (!is_servadmin) { - if (ci->HasFieldS("CS_PRIVATE") || ci->HasFieldS("CS_SUSPENDED")) + if (ci->IsPrivate() || ci->HasFieldS("CS_SUSPENDED")) continue; if (ci->c && ci->c->HasMode("SECRET")) continue; @@ -113,7 +112,7 @@ class CommandCSList : public Command if (suspended && !ci->HasFieldS("CS_SUSPENDED")) continue; - if (channoexpire && !ci->HasFieldS("CS_NO_EXPIRE")) + if (channoexpire && !ci->IsNoExpire()) continue; if (pattern.equals_ci(ci->GetName()) || ci->GetName().equals_ci(spattern) || Anope::Match(ci->GetName(), pattern, false, true) || Anope::Match(ci->GetName(), spattern, false, true) || Anope::Match(ci->GetDesc(), pattern, false, true) || Anope::Match(ci->GetLastTopic(), pattern, false, true)) @@ -121,7 +120,7 @@ class CommandCSList : public Command if (((count + 1 >= from && count + 1 <= to) || (!from && !to)) && ++nchans <= listmax) { bool isnoexpire = false; - if (is_servadmin && (ci->HasFieldS("CS_NO_EXPIRE"))) + if (is_servadmin && ci->IsNoExpire()) isnoexpire = true; ListFormatter::ListEntry entry; @@ -217,13 +216,13 @@ class CommandCSSetPrivate : public Command if (params[1].equals_ci("ON")) { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable private"; - ci->SetS<bool>("CS_PRIVATE", true); + ci->SetPrivate(true); source.Reply(_("Private option for \002{0}\002 is now \002on\002."), ci->GetName()); } else if (params[1].equals_ci("OFF")) { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable private"; - ci->UnsetS<bool>("CS_PRIVATE"); + ci->SetPrivate(false); source.Reply(_("Private option for \002{0}\002 is now \002off\002."), ci->GetName()); } else @@ -252,14 +251,11 @@ class CSList : public Module CommandCSList commandcslist; CommandCSSetPrivate commandcssetprivate; - Serialize::Field<ChanServ::Channel, bool> priv; - public: CSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR) , EventHook<Event::ChanInfo>(this) , commandcslist(this) , commandcssetprivate(this) - , priv(this, "CS_PRIVATE") { } @@ -268,7 +264,7 @@ class CSList : public Module if (!show_all) return; - if (priv.HasExt(ci)) + if (ci->IsPrivate()) info.AddOption(_("Private")); } }; diff --git a/modules/chanserv/log.cpp b/modules/chanserv/log.cpp index 32025e6b0..b62e03d0e 100644 --- a/modules/chanserv/log.cpp +++ b/modules/chanserv/log.cpp @@ -61,12 +61,12 @@ class LogSettingImpl : public LogSetting class LogSettingType : public Serialize::Type<LogSettingImpl> { public: - Serialize::ObjectField<LogSettingImpl, ChanServ::Channel *> ci; + Serialize::ObjectField<LogSettingImpl, ChanServ::Channel *> channel; Serialize::Field<LogSettingImpl, Anope::string> service_name, command_service, command_name, method, extra, creator; Serialize::Field<LogSettingImpl, time_t> created; LogSettingType(Module *me) : Serialize::Type<LogSettingImpl>(me) - , ci(this, "ci", &LogSettingImpl::channel, true) + , channel(this, "channel", &LogSettingImpl::channel, true) , service_name(this, "service_name", &LogSettingImpl::service_name) , command_service(this, "command_service", &LogSettingImpl::command_service) , command_name(this, "command_name", &LogSettingImpl::command_name) @@ -80,12 +80,12 @@ class LogSettingType : public Serialize::Type<LogSettingImpl> ChanServ::Channel *LogSettingImpl::GetChannel() { - return Get(&LogSettingType::ci); + return Get(&LogSettingType::channel); } void LogSettingImpl::SetChannel(ChanServ::Channel *ci) { - Set(&LogSettingType::ci, ci); + Set(&LogSettingType::channel, ci); } Anope::string LogSettingImpl::GetServiceName() diff --git a/modules/chanserv/main/chanaccess.cpp b/modules/chanserv/main/chanaccess.cpp index bf05cdf8b..75c70ed9c 100644 --- a/modules/chanserv/main/chanaccess.cpp +++ b/modules/chanserv/main/chanaccess.cpp @@ -23,12 +23,12 @@ ChanServ::Channel *ChanAccessImpl::GetChannel() { - return Get(&ChanAccessType<ChanServ::ChanAccess>::ci); + return Get(&ChanAccessType<ChanServ::ChanAccess>::channel); } -void ChanAccessImpl::SetChannel(ChanServ::Cha |
