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/chanserv | |
| parent | f30d99f81f6fb8abd7ca555068173bad6c99e07a (diff) | |
Rename most ext fields names to be consistent with everything else, add accessors for many
Diffstat (limited to 'modules/chanserv')
| -rw-r--r-- | modules/chanserv/akick.cpp | 22 | ||||
| -rw-r--r-- | modules/chanserv/ban.cpp | 14 | ||||
| -rw-r--r-- | modules/chanserv/drop.cpp | 4 | ||||
| -rw-r--r-- | modules/chanserv/enforce.cpp | 6 | ||||
| -rw-r--r-- | modules/chanserv/kick.cpp | 14 | ||||
| -rw-r--r-- | modules/chanserv/list.cpp | 16 | ||||
| -rw-r--r-- | modules/chanserv/log.cpp | 8 | ||||
| -rw-r--r-- | modules/chanserv/main/chanaccess.cpp | 6 | ||||
| -rw-r--r-- | modules/chanserv/main/chanaccesstype.h | 4 | ||||
| -rw-r--r-- | modules/chanserv/main/channel.cpp | 178 | ||||
| -rw-r--r-- | modules/chanserv/main/channel.h | 78 | ||||
| -rw-r--r-- | modules/chanserv/main/channeltype.cpp | 18 | ||||
| -rw-r--r-- | modules/chanserv/main/channeltype.h | 6 | ||||
| -rw-r--r-- | modules/chanserv/main/chanserv.cpp | 19 | ||||
| -rw-r--r-- | modules/chanserv/mode.cpp | 14 | ||||
| -rw-r--r-- | modules/chanserv/register.cpp | 2 | ||||
| -rw-r--r-- | modules/chanserv/seen.cpp | 2 | ||||
| -rw-r--r-- | modules/chanserv/set.cpp | 115 | ||||
| -rw-r--r-- | modules/chanserv/set_misc.cpp | 2 | ||||
| -rw-r--r-- | modules/chanserv/topic.cpp | 31 | ||||
| -rw-r--r-- | modules/chanserv/updown.cpp | 4 |
21 files changed, 392 insertions, 171 deletions
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::Channel *ci) +void ChanAccessImpl::SetChannel(ChanServ::Channel *channel) { - Object::Set(&ChanAccessType<ChanServ::ChanAccess>::ci, ci); + Object::Set(&ChanAccessType<ChanServ::ChanAccess>::channel, channel); } Anope::string ChanAccessImpl::GetCreator() diff --git a/modules/chanserv/main/chanaccesstype.h b/modules/chanserv/main/chanaccesstype.h index c755a7df5..b93747be7 100644 --- a/modules/chanserv/main/chanaccesstype.h +++ b/modules/chanserv/main/chanaccesstype.h @@ -23,7 +23,7 @@ class ChanAccessType : public Serialize::Type<T> static_assert(std::is_base_of<ChanServ::ChanAccess, T>::value, ""); public: - Serialize::ObjectField<ChanServ::ChanAccess, ChanServ::Channel *> ci; + Serialize::ObjectField<ChanServ::ChanAccess, ChanServ::Channel *> channel; Serialize::Field<ChanServ::ChanAccess, Anope::string> mask; Serialize::ObjectField<ChanServ::ChanAccess, Serialize::Object *> obj; Serialize::Field<ChanServ::ChanAccess, Anope::string> creator; @@ -31,7 +31,7 @@ class ChanAccessType : public Serialize::Type<T> Serialize::Field<ChanServ::ChanAccess, time_t> created; ChanAccessType(Module *me) : Serialize::Type<T>(me) - , ci(this, "ci", &ChanServ::ChanAccess::channel, true) + , channel(this, "channel", &ChanServ::ChanAccess::channel, true) , mask(this, "mask", &ChanServ::ChanAccess::mask) , obj(this, "obj", &ChanServ::ChanAccess::object, true) , creator(this, "creator", &ChanServ::ChanAccess::creator) diff --git a/modules/chanserv/main/channel.cpp b/modules/chanserv/main/channel.cpp index 67a4c94ec..a35c80901 100644 --- a/modules/chanserv/main/channel.cpp +++ b/modules/chanserv/main/channel.cpp @@ -76,7 +76,7 @@ time_t ChannelImpl::GetTimeRegistered() return Get(&ChannelType::time_registered); } -void ChannelImpl::SetTimeRegistered(const time_t &t) +void ChannelImpl::SetTimeRegistered(time_t t) { Set(&ChannelType::time_registered, t); } @@ -86,7 +86,7 @@ time_t ChannelImpl::GetLastUsed() return Get(&ChannelType::last_used); } -void ChannelImpl::SetLastUsed(const time_t &t) +void ChannelImpl::SetLastUsed(time_t t) { Set(&ChannelType::last_used, t); } @@ -116,7 +116,7 @@ time_t ChannelImpl::GetLastTopicTime() return Get(&ChannelType::last_topic_time); } -void ChannelImpl::SetLastTopicTime(const time_t &t) +void ChannelImpl::SetLastTopicTime(time_t t) { Set(&ChannelType::last_topic_time, t); } @@ -126,7 +126,7 @@ int16_t ChannelImpl::GetBanType() return Get(&ChannelType::bantype); } -void ChannelImpl::SetBanType(const int16_t &i) +void ChannelImpl::SetBanType(int16_t i) { Set(&ChannelType::bantype, i); } @@ -136,19 +136,19 @@ time_t ChannelImpl::GetBanExpire() return Get(&ChannelType::banexpire); } -void ChannelImpl::SetBanExpire(const time_t &t) +void ChannelImpl::SetBanExpire(time_t t) { Set(&ChannelType::banexpire, t); } BotInfo *ChannelImpl::GetBI() { - return Get(&ChannelType::bi); + return Get(&ChannelType::servicebot); } void ChannelImpl::SetBI(BotInfo *bi) { - Set(&ChannelType::bi, bi); + Set(&ChannelType::servicebot, bi); } ServiceBot *ChannelImpl::GetBot() @@ -187,6 +187,166 @@ NickServ::Account *ChannelImpl::GetSuccessor() return Get(&ChannelType::successor); } +bool ChannelImpl::IsGreet() +{ + return Get(&ChannelType::greet); +} + +void ChannelImpl::SetGreet(bool greet) +{ + Set(&ChannelType::greet, greet); +} + +bool ChannelImpl::IsFantasy() +{ + return Get(&ChannelType::fantasy); +} + +void ChannelImpl::SetFantasy(bool fantasy) +{ + Set(&ChannelType::fantasy, fantasy); +} + +bool ChannelImpl::IsNoAutoop() +{ + return Get(&ChannelType::noautoop); +} + +void ChannelImpl::SetNoAutoop(bool noautoop) +{ + Set(&ChannelType::noautoop, noautoop); +} + +bool ChannelImpl::IsPeace() +{ + return Get(&ChannelType::peace); +} + +void ChannelImpl::SetPeace(bool peace) +{ + Set(&ChannelType::peace, peace); +} + +bool ChannelImpl::IsSecureFounder() +{ + return Get(&ChannelType::securefounder); +} + +void ChannelImpl::SetSecureFounder(bool securefounder) +{ + Set(&ChannelType::securefounder, securefounder); +} + +bool ChannelImpl::IsRestricted() +{ + return Get(&ChannelType::restricted); +} + +void ChannelImpl::SetRestricted(bool restricted) +{ + Set(&ChannelType::restricted, restricted); +} + +bool ChannelImpl::IsSecure() +{ + return Get(&ChannelType::secure); +} + +void ChannelImpl::SetSecure(bool secure) +{ + Set(&ChannelType::secure, secure); +} + +bool ChannelImpl::IsSecureOps() +{ + return Get(&ChannelType::secureops); +} + +void ChannelImpl::SetSecureOps(bool secureops) +{ + Set(&ChannelType::secureops, secureops); +} + +bool ChannelImpl::IsSignKick() +{ + return Get(&ChannelType::signkick); +} + +void ChannelImpl::SetSignKick(bool signkick) +{ + Set(&ChannelType::signkick, signkick); +} + +bool ChannelImpl::IsSignKickLevel() +{ + return Get(&ChannelType::signkicklevel); +} + +void ChannelImpl::SetSignKickLevel(bool signkicklevel) +{ + Set(&ChannelType::signkicklevel, signkicklevel); +} + +bool ChannelImpl::IsNoExpire() +{ + return Get(&ChannelType::noexpire); +} + +void ChannelImpl::SetNoExpire(bool noexpire) +{ + Set(&ChannelType::noexpire, noexpire); +} + +bool ChannelImpl::IsKeepModes() +{ + return Get(&ChannelType::keepmodes); +} + +void ChannelImpl::SetKeepModes(bool keepmodes) +{ + Set(&ChannelType::keepmodes, keepmodes); +} + +bool ChannelImpl::IsPersist() +{ + return Get(&ChannelType::persist); +} + +void ChannelImpl::SetPersist(bool persist) +{ + Set(&ChannelType::persist, persist); +} + +bool ChannelImpl::IsTopicLock() +{ + return Get(&ChannelType::topiclock); +} + +void ChannelImpl::SetTopicLock(bool topiclock) +{ + Set(&ChannelType::topiclock, topiclock); +} + +bool ChannelImpl::IsKeepTopic() +{ + return Get(&ChannelType::keeptopic); +} + +void ChannelImpl::SetKeepTopic(bool keeptopic) +{ + Set(&ChannelType::keeptopic, keeptopic); +} + +bool ChannelImpl::IsPrivate() +{ + return Get(&ChannelType::_private); +} + +void ChannelImpl::SetPrivate(bool _private) +{ + Set(&ChannelType::_private, _private); +} + ChanServ::ChanAccess *ChannelImpl::GetAccess(unsigned index) { std::vector<ChanServ::ChanAccess *> a = GetRefs<ChanServ::ChanAccess *>(); @@ -200,8 +360,8 @@ ChanServ::AccessGroup ChannelImpl::AccessFor(const User *u, bool updateLastUsed) if (u == NULL) return group; - const NickServ::Account *nc = u->Account(); - if (nc == NULL && !this->HasFieldS("NS_SECURE") && u->IsRecognized()) + NickServ::Account *nc = u->Account(); + if (nc == NULL && !nc->IsSecure() && u->IsRecognized()) { NickServ::Nick *na = NickServ::FindNick(u->nick); if (na != NULL) diff --git a/modules/chanserv/main/channel.h b/modules/chanserv/main/channel.h index 94f56ddd4..fd9a357eb 100644 --- a/modules/chanserv/main/channel.h +++ b/modules/chanserv/main/channel.h @@ -29,6 +29,22 @@ class ChannelImpl : public ChanServ::Channel int16_t bantype = 0; time_t banexpire = 0; BotInfo *bi = nullptr; + bool greet = false; + bool fantasy = false; + bool noautoop = false; + bool peace = false; + bool securefounder = false; + bool restricted = false; + bool secure = false; + bool secureops = false; + bool signkick = false; + bool signkicklevel = false; + bool noexpire = false; + bool keepmodes = false; + bool persist = false; + bool topiclock = false; + bool keeptopic = false; + bool _private = false; public: ChannelImpl(Serialize::TypeBase *type) : ChanServ::Channel(type) { } @@ -43,10 +59,10 @@ class ChannelImpl : public ChanServ::Channel void SetDesc(const Anope::string &) override; time_t GetTimeRegistered() override; - void SetTimeRegistered(const time_t &) override; + void SetTimeRegistered(time_t) override; time_t GetLastUsed() override; - void SetLastUsed(const time_t &) override; + void SetLastUsed(time_t) override; Anope::string GetLastTopic() override; void SetLastTopic(const Anope::string &) override; @@ -55,13 +71,13 @@ class ChannelImpl : public ChanServ::Channel void SetLastTopicSetter(const Anope::string &) override; time_t GetLastTopicTime() override; - void SetLastTopicTime(const time_t &) override; + void SetLastTopicTime(time_t) override; int16_t GetBanType() override; - void SetBanType(const int16_t &) override; + void SetBanType(int16_t) override; time_t GetBanExpire() override; - void SetBanExpire(const time_t &) override; + void SetBanExpire(time_t) override; BotInfo *GetBI() override; void SetBI(BotInfo *) override; @@ -77,11 +93,59 @@ class ChannelImpl : public ChanServ::Channel void SetSuccessor(NickServ::Account *nc) override; NickServ::Account *GetSuccessor() override; + bool IsGreet() override; + void SetGreet(bool) override; + + bool IsFantasy() override; + void SetFantasy(bool) override; + + bool IsNoAutoop() override; + void SetNoAutoop(bool) override; + + bool IsPeace() override; + void SetPeace(bool) override; + + bool IsSecureFounder() override; + void SetSecureFounder(bool) override; + + bool IsRestricted() override; + void SetRestricted(bool) override; + + bool IsSecure() override; + void SetSecure(bool) override; + + bool IsSecureOps() override; + void SetSecureOps(bool) override; + + bool IsSignKick() override; + void SetSignKick(bool) override; + + bool IsSignKickLevel() override; + void SetSignKickLevel(bool) override; + + bool IsNoExpire() override; + void SetNoExpire(bool) override; + + bool IsKeepModes() override; + void SetKeepModes(bool) override; + + bool IsPersist() override; + void SetPersist(bool) override; + + bool IsTopicLock() override; + void SetTopicLock(bool) override; + + bool IsKeepTopic() override; + void SetKeepTopic(bool) override; + + bool IsPrivate() override; + void SetPrivate(bool) override; + bool IsFounder(const User *user) override; - ChanServ::ChanAccess *GetAccess(unsigned index) /*const*/ override; + ChanServ::ChanAccess *GetAccess(unsigned index) override; ChanServ::AccessGroup AccessFor(const User *u, bool = true) override; ChanServ::AccessGroup AccessFor(NickServ::Account *nc, bool = true) override; - unsigned GetAccessCount()/* const*/ override; + unsigned GetAccessCount() override; void ClearAccess() override; AutoKick* AddAkick(const Anope::string &user, NickServ::Account *akicknc, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0) override; AutoKick* AddAkick(const Anope::string &user, const Anope::string &mask, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0) override; diff --git a/modules/chanserv/main/channeltype.cpp b/modules/chanserv/main/channeltype.cpp index 37c290ef1..3f72cbb6b 100644 --- a/modules/chanserv/main/channeltype.cpp +++ b/modules/chanserv/main/channeltype.cpp @@ -32,7 +32,23 @@ ChannelType::ChannelType(Module *me) : Serialize::Type<ChannelImpl>(me) , banexpire(this, "banexpire", &ChannelImpl::banexpire) , founder(this, "founder", &ChannelImpl::founder) , successor(this, "successor", &ChannelImpl::successor) - , bi(this, "bi", &ChannelImpl::bi) + , servicebot(this, "servicebot", &ChannelImpl::bi) + , greet(this, "greet", &ChannelImpl::greet) + , fantasy(this, "fantasy", &ChannelImpl::fantasy) + , noautoop(this, "noautoop", &ChannelImpl::noautoop) + , peace(this, "peace", &ChannelImpl::peace) + , securefounder(this, "securefounder", &ChannelImpl::securefounder) + , restricted(this, "restricted", &ChannelImpl::restricted) + , secure(this, "secure", &ChannelImpl::secure) + , secureops(this, "secureops", &ChannelImpl::secureops) + , signkick(this, "signkick", &ChannelImpl::signkick) + , signkicklevel(this, "signkicklevel", &ChannelImpl::signkicklevel) + , noexpire(this, "noexpire", &ChannelImpl::noexpire) + , keepmodes(this, "keepmodes", &ChannelImpl::keepmodes) + , persist(this, "persist", &ChannelImpl::persist) + , topiclock(this, "topiclock", &ChannelImpl::topiclock) + , keeptopic(this, "keeptopic", &ChannelImpl::keeptopic) + , _private(this, "private", &ChannelImpl::_private) { } diff --git a/modules/chanserv/main/channeltype.h b/modules/chanserv/main/channeltype.h index 1f1c92201..4f833c82b 100644 --- a/modules/chanserv/main/channeltype.h +++ b/modules/chanserv/main/channeltype.h @@ -45,7 +45,11 @@ class ChannelType : public Serialize::Type<ChannelImpl> /* Who gets the channel if the founder nick is dropped or expires */ Serialize::ObjectField<ChannelImpl, NickServ::Account *> successor; - Serialize::ObjectField<ChannelImpl, BotInfo *> bi; + Serialize::ObjectField<ChannelImpl, BotInfo *> servicebot; + + Serialize::Field<ChannelImpl, bool> greet, fantasy, noautoop, peace, securefounder, + restricted, secure, secureops, signkick, signkicklevel, noexpire, keepmodes, + persist, topiclock, keeptopic, _private; ChannelType(Module *); diff --git a/modules/chanserv/main/chanserv.cpp b/modules/chanserv/main/chanserv.cpp index c6b30c2df..b6aedb0dd 100644 --- a/modules/chanserv/main/chanserv.cpp +++ b/modules/chanserv/main/chanserv.cpp @@ -249,16 |
