From ddaa001dafb5122e6e363e4acbbe6ce045b7b104 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 21 Jan 2013 22:31:16 -0500 Subject: Merge usefulness of Flags and Extensible classes into Extensible, made most flags we have juse strings instead of defines/enums --- modules/commands/bs_assign.cpp | 6 +- modules/commands/bs_bot.cpp | 4 +- modules/commands/bs_botlist.cpp | 4 +- modules/commands/bs_info.cpp | 36 +++--- modules/commands/bs_kick.cpp | 74 ++++++----- modules/commands/bs_set.cpp | 24 ++-- modules/commands/cs_akick.cpp | 28 ++--- modules/commands/cs_ban.cpp | 22 ++-- modules/commands/cs_clone.cpp | 14 +-- modules/commands/cs_drop.cpp | 6 +- modules/commands/cs_enforce.cpp | 22 ++-- modules/commands/cs_getkey.cpp | 2 +- modules/commands/cs_info.cpp | 44 +++---- modules/commands/cs_kick.cpp | 8 +- modules/commands/cs_list.cpp | 10 +- modules/commands/cs_mode.cpp | 2 +- modules/commands/cs_register.cpp | 20 +-- modules/commands/cs_seen.cpp | 6 +- modules/commands/cs_set.cpp | 78 ++++++------ modules/commands/cs_status.cpp | 4 +- modules/commands/cs_suspend.cpp | 112 +++++------------ modules/commands/cs_topic.cpp | 10 +- modules/commands/cs_updown.cpp | 4 +- modules/commands/help.cpp | 6 +- modules/commands/hs_off.cpp | 2 +- modules/commands/hs_on.cpp | 2 +- modules/commands/ms_cancel.cpp | 2 +- modules/commands/ms_check.cpp | 2 +- modules/commands/ms_info.cpp | 26 ++-- modules/commands/ms_list.cpp | 8 +- modules/commands/ms_read.cpp | 8 +- modules/commands/ms_rsend.cpp | 2 +- modules/commands/ms_set.cpp | 34 ++--- modules/commands/ns_access.cpp | 2 +- modules/commands/ns_ajoin.cpp | 20 +-- modules/commands/ns_alist.cpp | 4 +- modules/commands/ns_cert.cpp | 6 +- modules/commands/ns_group.cpp | 18 +-- modules/commands/ns_identify.cpp | 6 +- modules/commands/ns_info.cpp | 38 +++--- modules/commands/ns_list.cpp | 16 +-- modules/commands/ns_logout.cpp | 2 +- modules/commands/ns_recover.cpp | 17 ++- modules/commands/ns_register.cpp | 28 ++--- modules/commands/ns_resetpass.cpp | 4 +- modules/commands/ns_set.cpp | 65 +++++----- modules/commands/ns_status.cpp | 2 +- modules/commands/ns_suspend.cpp | 108 ++++++---------- modules/commands/ns_update.cpp | 2 +- modules/commands/os_chankill.cpp | 2 +- modules/commands/os_defcon.cpp | 53 ++++---- modules/commands/os_dns.cpp | 4 +- modules/commands/os_forbid.cpp | 14 +-- modules/commands/os_ignore.cpp | 4 +- modules/commands/os_jupe.cpp | 2 +- modules/commands/os_list.cpp | 26 ++-- modules/commands/os_login.cpp | 6 +- modules/commands/os_news.cpp | 4 +- modules/commands/os_noop.cpp | 8 +- modules/commands/os_oline.cpp | 2 +- modules/commands/os_sxline.cpp | 6 +- modules/database/db_flatfile.cpp | 16 ++- modules/database/db_old.cpp | 90 ++++++------- modules/database/db_plain.cpp | 104 ++++++++------- modules/extra/cs_statusupdate.cpp | 14 +-- modules/extra/m_chanstats.cpp | 19 +-- modules/extra/m_dnsbl.cpp | 2 +- modules/extra/m_helpchan.cpp | 6 +- modules/extra/m_proxyscan.cpp | 2 +- modules/extra/m_sql_oper.cpp | 4 +- modules/extra/m_ssl.cpp | 35 +++--- modules/extra/m_xmlrpc_main.cpp | 12 +- modules/extra/webcpanel/pages/chanserv/drop.cpp | 6 +- modules/extra/webcpanel/pages/chanserv/set.cpp | 70 +++++------ modules/extra/webcpanel/pages/memoserv/memos.cpp | 10 +- modules/extra/webcpanel/pages/nickserv/alist.cpp | 4 +- modules/extra/webcpanel/pages/nickserv/info.cpp | 54 ++++---- modules/protocol/bahamut.cpp | 54 ++++---- modules/protocol/hybrid.cpp | 58 ++++----- modules/protocol/inspircd11.cpp | 94 +++++++------- modules/protocol/inspircd12.cpp | 148 +++++++++++----------- modules/protocol/inspircd20.cpp | 134 ++++++++++---------- modules/protocol/ngircd.cpp | 76 +++++------ modules/protocol/plexus.cpp | 52 ++++---- modules/protocol/ratbox.cpp | 18 +-- modules/protocol/unreal.cpp | 154 +++++++++++------------ modules/pseudoclients/botserv.cpp | 26 ++-- modules/pseudoclients/chanserv.cpp | 8 +- modules/pseudoclients/global.cpp | 2 +- modules/pseudoclients/memoserv.cpp | 10 +- modules/pseudoclients/nickserv.cpp | 52 ++++---- modules/pseudoclients/operserv.cpp | 14 +-- 92 files changed, 1189 insertions(+), 1260 deletions(-) (limited to 'modules') diff --git a/modules/commands/bs_assign.cpp b/modules/commands/bs_assign.cpp index e6bb5e539..e778faffe 100644 --- a/modules/commands/bs_assign.cpp +++ b/modules/commands/bs_assign.cpp @@ -48,13 +48,13 @@ class CommandBSAssign : public Command } AccessGroup access = source.AccessFor(ci); - if (ci->botflags.HasFlag(BS_NOBOT) || (!access.HasPriv("ASSIGN") && !source.HasPriv("botserv/administration"))) + if (ci->HasExt("BS_NOBOT") || (!access.HasPriv("ASSIGN") && !source.HasPriv("botserv/administration"))) { source.Reply(ACCESS_DENIED); return; } - if (bi->HasFlag(BI_PRIVATE) && !source.HasCommand("botserv/assign/private")) + if (bi->oper_only && !source.HasCommand("botserv/assign/private")) { source.Reply(ACCESS_DENIED); return; @@ -121,7 +121,7 @@ class CommandBSUnassign : public Command return; } - if (ci->HasFlag(CI_PERSIST) && !ModeManager::FindChannelModeByName(CMODE_PERM)) + if (ci->HasExt("PERSIST") && !ModeManager::FindChannelModeByName("PERM")) { source.Reply(_("You can not unassign bots while persist is set on the channel.")); return; diff --git a/modules/commands/bs_bot.cpp b/modules/commands/bs_bot.cpp index 737e81a46..793d739c8 100644 --- a/modules/commands/bs_bot.cpp +++ b/modules/commands/bs_bot.cpp @@ -107,7 +107,7 @@ class CommandBSBot : public Command return; } - if (bi->HasFlag(BI_CONF)) + if (bi->conf) { source.Reply(_("Bot %s is not changable."), bi->nick.c_str()); return; @@ -232,7 +232,7 @@ class CommandBSBot : public Command return; } - if (bi->HasFlag(BI_CONF)) + if (bi->conf) { source.Reply(_("Bot %s is not deletable."), bi->nick.c_str()); return; diff --git a/modules/commands/bs_botlist.cpp b/modules/commands/bs_botlist.cpp index 148a4fb20..c4a559443 100644 --- a/modules/commands/bs_botlist.cpp +++ b/modules/commands/bs_botlist.cpp @@ -33,11 +33,11 @@ class CommandBSBotList : public Command { BotInfo *bi = it->second; - if (source.HasCommand("botserv/botlist") || !bi->HasFlag(BI_PRIVATE)) + if (source.HasCommand("botserv/botlist") || !bi->oper_only) { ++count; ListFormatter::ListEntry entry; - entry["Nick"] = (bi->HasFlag(BI_PRIVATE) ? "* " : "") + bi->nick; + entry["Nick"] = (bi->oper_only ? "* " : "") + bi->nick; entry["Mask"] = bi->GetIdent() + "@" + bi->host; list.AddEntry(entry); } diff --git a/modules/commands/bs_info.cpp b/modules/commands/bs_info.cpp index 60f2901a3..7edcedfda 100644 --- a/modules/commands/bs_info.cpp +++ b/modules/commands/bs_info.cpp @@ -38,9 +38,9 @@ class CommandBSInfo : public Command buffers.push_back(buf); } - void CheckOptStr(Anope::string &buf, BotServFlag flag, const char *option, Flags &flags, const NickCore *nc) + void CheckOptStr(Anope::string &buf, const Anope::string &flag, const char *option, Extensible *flags, const NickCore *nc) { - if (flags.HasFlag(flag)) + if (flags->HasExt(flag)) { if (!buf.empty()) buf += ", "; @@ -69,7 +69,7 @@ class CommandBSInfo : public Command info[_("Mask")] = bi->GetIdent() + "@" + bi->host; info[_("Real name")] = bi->realname; info[_("Created")] = Anope::strftime(bi->created); - info[_("Options")] = bi->HasFlag(BI_PRIVATE) ? _("Private") : _("None"); + info[_("Options")] = bi->oper_only ? _("Private") : _("None"); info[_("Used on")] = stringify(bi->GetChannelCount()) + " channel(s)"; std::vector replies; @@ -101,7 +101,7 @@ class CommandBSInfo : public Command Anope::string enabled = Language::Translate(source.nc, _("Enabled")); Anope::string disabled = Language::Translate(source.nc, _("Disabled")); - if (ci->botflags.HasFlag(BS_KICK_BADWORDS)) + if (ci->HasExt("BS_KICK_BADWORDS")) { if (ci->ttb[TTB_BADWORDS]) info[_("Bad words kicker")] = Anope::printf("%s (%d kick(s) to ban)", enabled.c_str(), ci->ttb[TTB_BADWORDS]); @@ -111,7 +111,7 @@ class CommandBSInfo : public Command else info[_("Bad words kicker")] = disabled; - if (ci->botflags.HasFlag(BS_KICK_BOLDS)) + if (ci->HasExt("BS_KICK_BOLDS")) { if (ci->ttb[TTB_BOLDS]) info[_("Bolds kicker")] = Anope::printf("%s (%d kick(s) to ban)", enabled.c_str(), ci->ttb[TTB_BOLDS]); @@ -121,7 +121,7 @@ class CommandBSInfo : public Command else info[_("Bolds kicker")] = disabled; - if (ci->botflags.HasFlag(BS_KICK_CAPS)) + if (ci->HasExt("BS_KICK_CAPS")) { if (ci->ttb[TTB_CAPS]) info[_("Caps kicker")] = Anope::printf(_("%s (%d kick(s) to ban; minimum %d/%d%%"), enabled.c_str(), ci->ttb[TTB_CAPS], ci->capsmin, ci->capspercent); @@ -131,7 +131,7 @@ class CommandBSInfo : public Command else info[_("Caps kicker")] = disabled; - if (ci->botflags.HasFlag(BS_KICK_COLORS)) + if (ci->HasExt("BS_KICK_COLORS")) { if (ci->ttb[TTB_COLORS]) info[_("Colors kicker")] = Anope::printf(_("%s (%d kick(s) to ban)"), enabled.c_str(), ci->ttb[TTB_COLORS]); @@ -141,7 +141,7 @@ class CommandBSInfo : public Command else info[_("Colors kicker")] = disabled; - if (ci->botflags.HasFlag(BS_KICK_FLOOD)) + if (ci->HasExt("BS_KICK_FLOOD")) { if (ci->ttb[TTB_FLOOD]) info[_("Flood kicker")] = Anope::printf(_("%s (%d kick(s) to ban; %d lines in %ds"), enabled.c_str(), ci->ttb[TTB_FLOOD], ci->floodlines, ci->floodsecs); @@ -151,7 +151,7 @@ class CommandBSInfo : public Command else info[_("Flood kicker")] = disabled; - if (ci->botflags.HasFlag(BS_KICK_REPEAT)) + if (ci->HasExt("BS_KICK_REPEAT")) { if (ci->ttb[TTB_REPEAT]) info[_("Repeat kicker")] = Anope::printf(_("%s (%d kick(s) to ban; %d times)"), enabled.c_str(), ci->ttb[TTB_REPEAT], ci->repeattimes); @@ -161,7 +161,7 @@ class CommandBSInfo : public Command else info[_("Repeat kicker")] = disabled; - if (ci->botflags.HasFlag(BS_KICK_REVERSES)) + if (ci->HasExt("BS_KICK_REVERSES")) { if (ci->ttb[TTB_REVERSES]) info[_("Reverses kicker")] = Anope::printf(_("%s (%d kick(s) to ban)"), enabled.c_str(), ci->ttb[TTB_REVERSES]); @@ -171,7 +171,7 @@ class CommandBSInfo : public Command else info[_("Reverses kicker")] = disabled; - if (ci->botflags.HasFlag(BS_KICK_UNDERLINES)) + if (ci->HasExt("BS_KICK_UNDERLINES")) { if (ci->ttb[TTB_UNDERLINES]) info[_("Underlines kicker")] = Anope::printf(_("%s (%d kick(s) to ban)"), enabled.c_str(), ci->ttb[TTB_UNDERLINES]); @@ -181,7 +181,7 @@ class CommandBSInfo : public Command else info[_("Underlines kicker")] = disabled; - if (ci->botflags.HasFlag(BS_KICK_ITALICS)) + if (ci->HasExt("BS_KICK_ITALICS")) { if (ci->ttb[TTB_ITALICS]) info[_("Italics kicker")] = Anope::printf(_("%s (%d kick(s) to ban)"), enabled.c_str(), ci->ttb[TTB_ITALICS]); @@ -191,7 +191,7 @@ class CommandBSInfo : public Command else info[_("Italics kicker")] = disabled; - if (ci->botflags.HasFlag(BS_KICK_AMSGS)) + if (ci->HasExt("BS_KICK_AMSGS")) { if (ci->ttb[TTB_AMSGS]) info[_("AMSG kicker")] = Anope::printf(_("%s (%d kick(s) to ban)"), enabled.c_str(), ci->ttb[TTB_AMSGS]); @@ -202,11 +202,11 @@ class CommandBSInfo : public Command info[_("AMSG kicker")] = disabled; Anope::string flags; - CheckOptStr(flags, BS_DONTKICKOPS, _("Ops protection"), ci->botflags, source.nc); - CheckOptStr(flags, BS_DONTKICKVOICES, _("Voices protection"), ci->botflags, source.nc); - CheckOptStr(flags, BS_FANTASY, _("Fantasy"), ci->botflags, source.nc); - CheckOptStr(flags, BS_GREET, _("Greet"), ci->botflags, source.nc); - CheckOptStr(flags, BS_NOBOT, _("No bot"), ci->botflags, source.nc); + CheckOptStr(flags, "BS_DONTKICKOPS", _("Ops protection"), ci, source.nc); + CheckOptStr(flags, "BS_DONTKICKVOICES", _("Voices protection"), ci, source.nc); + CheckOptStr(flags, "BS_FANTASY", _("Fantasy"), ci, source.nc); + CheckOptStr(flags, "BS_GREET", _("Greet"), ci, source.nc); + CheckOptStr(flags, "BS_NOBOT", _("No bot"), ci, source.nc); info[_("Options")] = flags.empty() ? _("None") : flags; diff --git a/modules/commands/bs_kick.cpp b/modules/commands/bs_kick.cpp index fe48d7d8e..499f21464 100644 --- a/modules/commands/bs_kick.cpp +++ b/modules/commands/bs_kick.cpp @@ -72,7 +72,7 @@ class CommandBSKick : public Command else ci->ttb[TTB_BADWORDS] = 0; - ci->botflags.SetFlag(BS_KICK_BADWORDS); + ci->ExtendMetadata("BS_KICK_BADWORDS"); if (ci->ttb[TTB_BADWORDS]) source.Reply(_("Bot will now kick \002bad words\002, and will place a ban after \n" "%d kicks for the same user. Use the BADWORDS command\n" @@ -83,7 +83,7 @@ class CommandBSKick : public Command } else { - ci->botflags.UnsetFlag(BS_KICK_BADWORDS); + ci->Shrink("BS_KICK_BADWORDS"); source.Reply(_("Bot won't kick \002bad words\002 anymore.")); } } @@ -108,7 +108,7 @@ class CommandBSKick : public Command } else ci->ttb[TTB_BOLDS] = 0; - ci->botflags.SetFlag(BS_KICK_BOLDS); + ci->ExtendMetadata("BS_KICK_BOLDS"); if (ci->ttb[TTB_BOLDS]) source.Reply(_("Bot will now kick \002bolds\002, and will place a ban after\n%d kicks to the same user."), ci->ttb[TTB_BOLDS]); else @@ -116,7 +116,7 @@ class CommandBSKick : public Command } else { - ci->botflags.UnsetFlag(BS_KICK_BOLDS); + ci->Shrink("BS_KICK_BOLDS"); source.Reply(_("Bot won't kick \002bolds\002 anymore.")); } } @@ -163,7 +163,7 @@ class CommandBSKick : public Command if (ci->capspercent < 1 || ci->capspercent > 100) ci->capspercent = 25; - ci->botflags.SetFlag(BS_KICK_CAPS); + ci->ExtendMetadata("BS_KICK_CAPS"); if (ci->ttb[TTB_CAPS]) source.Reply(_("Bot will now kick \002caps\002 (they must constitute at least\n" "%d characters and %d%% of the entire message), and will \n" @@ -174,7 +174,7 @@ class CommandBSKick : public Command } else { - ci->botflags.UnsetFlag(BS_KICK_CAPS); + ci->Shrink("BS_KICK_CAPS"); source.Reply(_("Bot won't kick \002caps\002 anymore.")); } } @@ -200,7 +200,7 @@ class CommandBSKick : public Command else ci->ttb[TTB_COLORS] = 0; - ci->botflags.SetFlag(BS_KICK_COLORS); + ci->ExtendMetadata("BS_KICK_COLORS"); if (ci->ttb[TTB_COLORS]) source.Reply(_("Bot will now kick \002colors\002, and will place a ban after %d\nkicks for the same user."), ci->ttb[TTB_COLORS]); else @@ -208,7 +208,7 @@ class CommandBSKick : public Command } else { - ci->botflags.UnsetFlag(BS_KICK_COLORS); + ci->Shrink("BS_KICK_COLORS"); source.Reply(_("Bot won't kick \002colors\002 anymore.")); } } @@ -257,7 +257,7 @@ class CommandBSKick : public Command if (ci->floodsecs > Config->BSKeepData) ci->floodsecs = Config->BSKeepData; - ci->botflags.SetFlag(BS_KICK_FLOOD); + ci->ExtendMetadata("BS_KICK_FLOOD"); if (ci->ttb[TTB_FLOOD]) source.Reply(_("Bot will now kick \002flood\002 (%d lines in %d seconds and\nwill place a ban after %d kicks for the same user."), ci->floodlines, ci->floodsecs, ci->ttb[TTB_FLOOD]); else @@ -265,7 +265,7 @@ class CommandBSKick : public Command } else { - ci->botflags.UnsetFlag(BS_KICK_FLOOD); + ci->Shrink("BS_KICK_FLOOD"); source.Reply(_("Bot won't kick \002flood\002 anymore.")); } } @@ -302,7 +302,7 @@ class CommandBSKick : public Command if (ci->repeattimes < 2) ci->repeattimes = 3; - ci->botflags.SetFlag(BS_KICK_REPEAT); + ci->ExtendMetadata("BS_KICK_REPEAT"); if (ci->ttb[TTB_REPEAT]) source.Reply(_("Bot will now kick \002repeats\002 (users that say the\n" "same thing %d times), and will place a ban after %d \n" @@ -313,7 +313,7 @@ class CommandBSKick : public Command } else { - ci->botflags.UnsetFlag(BS_KICK_REPEAT); + ci->Shrink("BS_KICK_REPEAT"); source.Reply(_("Bot won't kick \002repeats\002 anymore.")); } } @@ -338,7 +338,7 @@ class CommandBSKick : public Command } else ci->ttb[TTB_REVERSES] = 0; - ci->botflags.SetFlag(BS_KICK_REVERSES); + ci->ExtendMetadata("BS_KICK_REVERSES"); if (ci->ttb[TTB_REVERSES]) source.Reply(_("Bot will now kick \002reverses\002, and will place a ban after %d\nkicks for the same user."), ci->ttb[TTB_REVERSES]); else @@ -346,7 +346,7 @@ class CommandBSKick : public Command } else { - ci->botflags.UnsetFlag(BS_KICK_REVERSES); + ci->Shrink("BS_KICK_REVERSES"); source.Reply(_("Bot won't kick \002reverses\002 anymore.")); } } @@ -372,7 +372,7 @@ class CommandBSKick : public Command else ci->ttb[TTB_UNDERLINES] = 0; - ci->botflags.SetFlag(BS_KICK_UNDERLINES); + ci->ExtendMetadata("BS_KICK_UNDERLINES"); if (ci->ttb[TTB_UNDERLINES]) source.Reply(_("Bot will now kick \002underlines\002, and will place a ban after %d\nkicks for the same user."), ci->ttb[TTB_UNDERLINES]); else @@ -380,7 +380,7 @@ class CommandBSKick : public Command } else { - ci->botflags.UnsetFlag(BS_KICK_UNDERLINES); + ci->Shrink("BS_KICK_UNDERLINES"); source.Reply(_("Bot won't kick \002underlines\002 anymore.")); } } @@ -406,7 +406,7 @@ class CommandBSKick : public Command else ci->ttb[TTB_ITALICS] = 0; - ci->botflags.SetFlag(BS_KICK_ITALICS); + ci->ExtendMetadata("BS_KICK_ITALICS"); if (ci->ttb[TTB_ITALICS]) source.Reply(_("Bot will now kick \002italics\002, and will place a ban after\n%d kicks for the same user."), ci->ttb[TTB_ITALICS]); else @@ -414,7 +414,7 @@ class CommandBSKick : public Command } else { - ci->botflags.UnsetFlag(BS_KICK_ITALICS); + ci->Shrink("BS_KICK_ITALICS"); source.Reply(_("Bot won't kick \002italics\002 anymore.")); } } @@ -440,7 +440,7 @@ class CommandBSKick : public Command else ci->ttb[TTB_AMSGS] = 0; - ci->botflags.SetFlag(BS_KICK_AMSGS); + ci->ExtendMetadata("BS_KICK_AMSGS"); if (ci->ttb[TTB_AMSGS]) source.Reply(_("Bot will now kick for \002amsgs\002, and will place a ban after %d\nkicks for the same user."), ci->ttb[TTB_AMSGS]); else @@ -448,7 +448,7 @@ class CommandBSKick : public Command } else { - ci->botflags.UnsetFlag(BS_KICK_AMSGS); + ci->Shrink("BS_KICK_AMSGS"); source.Reply(_("Bot won't kick for \002amsgs\002 anymore.")); } } @@ -741,7 +741,7 @@ class BSKick : public Module Anope::string mask = ci->GetIdealBan(u); - ci->c->SetMode(NULL, CMODE_BAN, mask); + ci->c->SetMode(NULL, "BAN", mask); FOREACH_MOD(I_OnBotBan, OnBotBan(u, ci, mask)); } } @@ -796,15 +796,11 @@ class BSKick : public Module if (ci == NULL) return; - bool Allow = true; if (ci->AccessFor(u).HasPriv("NOKICK")) - Allow = false; - else if (ci->botflags.HasFlag(BS_DONTKICKOPS) && (c->HasUserStatus(u, CMODE_HALFOP) || c->HasUserStatus(u, CMODE_OP) || c->HasUserStatus(u, CMODE_PROTECT) || c->HasUserStatus(u, CMODE_OWNER))) - Allow = false; - else if (ci->botflags.HasFlag(BS_DONTKICKVOICES) && c->HasUserStatus(u, CMODE_VOICE)) - Allow = false; - - if (!Allow) + return; + else if (ci->HasExt("BS_DONTKICKOPS") && (c->HasUserStatus(u, "HALFOP") || c->HasUserStatus(u, "OP") || c->HasUserStatus(u, "PROTECT") || c->HasUserStatus(u, "OWNER"))) + return; + else if (ci->HasExt("BS_DONTKICKVOICES") && c->HasUserStatus(u, "VOICE")) return; Anope::string realbuf = msg; @@ -822,7 +818,7 @@ class BSKick : public Module return; /* Bolds kicker */ - if (ci->botflags.HasFlag(BS_KICK_BOLDS) && realbuf.find(2) != Anope::string::npos) + if (ci->HasExt("BS_KICK_BOLDS") && realbuf.find(2) != Anope::string::npos) { check_ban(ci, u, TTB_BOLDS); bot_kick(ci, u, _("Don't use bolds on this channel!")); @@ -830,7 +826,7 @@ class BSKick : public Module } /* Color kicker */ - if (ci->botflags.HasFlag(BS_KICK_COLORS) && realbuf.find(3) != Anope::string::npos) + if (ci->HasExt("BS_KICK_COLORS") && realbuf.find(3) != Anope::string::npos) { check_ban(ci, u, TTB_COLORS); bot_kick(ci, u, _("Don't use colors on this channel!")); @@ -838,7 +834,7 @@ class BSKick : public Module } /* Reverses kicker */ - if (ci->botflags.HasFlag(BS_KICK_REVERSES) && realbuf.find(22) != Anope::string::npos) + if (ci->HasExt("BS_KICK_REVERSES") && realbuf.find(22) != Anope::string::npos) { check_ban(ci, u, TTB_REVERSES); bot_kick(ci, u, _("Don't use reverses on this channel!")); @@ -846,7 +842,7 @@ class BSKick : public Module } /* Italics kicker */ - if (ci->botflags.HasFlag(BS_KICK_ITALICS) && realbuf.find(29) != Anope::string::npos) + if (ci->HasExt("BS_KICK_ITALICS") && realbuf.find(29) != Anope::string::npos) { check_ban(ci, u, TTB_ITALICS); bot_kick(ci, u, _("Don't use italics on this channel!")); @@ -854,7 +850,7 @@ class BSKick : public Module } /* Underlines kicker */ - if (ci->botflags.HasFlag(BS_KICK_UNDERLINES) && realbuf.find(31) != Anope::string::npos) + if (ci->HasExt("BS_KICK_UNDERLINES") && realbuf.find(31) != Anope::string::npos) { check_ban(ci, u, TTB_UNDERLINES); bot_kick(ci, u, _("Don't use underlines on this channel!")); @@ -862,7 +858,7 @@ class BSKick : public Module } /* Caps kicker */ - if (ci->botflags.HasFlag(BS_KICK_CAPS) && realbuf.length() >= static_cast(ci->capsmin)) + if (ci->HasExt("BS_KICK_CAPS") && realbuf.length() >= static_cast(ci->capsmin)) { int i = 0, l = 0; @@ -888,7 +884,7 @@ class BSKick : public Module } /* Bad words kicker */ - if (ci->botflags.HasFlag(BS_KICK_BADWORDS)) + if (ci->HasExt("BS_KICK_BADWORDS")) { bool mustkick = false; @@ -969,7 +965,7 @@ class BSKick : public Module if (ud) { /* Flood kicker */ - if (ci->botflags.HasFlag(BS_KICK_FLOOD)) + if (ci->HasExt("BS_KICK_FLOOD")) { if (Anope::CurTime - ud->last_start > ci->floodsecs) { @@ -987,7 +983,7 @@ class BSKick : public Module } /* Repeat kicker */ - if (ci->botflags.HasFlag(BS_KICK_REPEAT)) + if (ci->HasExt("BS_KICK_REPEAT")) { if (!ud->lastline.equals_ci(realbuf)) ud->times = 0; @@ -1009,7 +1005,7 @@ class BSKick : public Module Channel *chan = (*it)->chan; ++it; - if (chan->ci && chan->ci->botflags.HasFlag(BS_KICK_AMSGS) && !chan->ci->AccessFor(u).HasPriv("NOKICK")) + if (chan->ci && chan->ci->HasExt("BS_KICK_AMSGS") && !chan->ci->AccessFor(u).HasPriv("NOKICK")) { check_ban(chan->ci, u, TTB_AMSGS); bot_kick(chan->ci, u, _("Don't use AMSGs!")); diff --git a/modules/commands/bs_set.cpp b/modules/commands/bs_set.cpp index 8c5bfce50..1bb0992b3 100644 --- a/modules/commands/bs_set.cpp +++ b/modules/commands/bs_set.cpp @@ -90,7 +90,7 @@ class CommandBSSetDontKickOps : public Command bool override = !access.HasPriv("SET"); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickops"; - ci->botflags.SetFlag(BS_DONTKICKOPS); + ci->ExtendMetadata("BS_DONTKICKOPS"); source.Reply(_("Bot \002won't kick ops\002 on channel %s."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) @@ -98,7 +98,7 @@ class CommandBSSetDontKickOps : public Command bool override = !access.HasPriv("SET"); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickops"; - ci->botflags.UnsetFlag(BS_DONTKICKOPS); + ci->Shrink("BS_DONTKICKOPS"); source.Reply(_("Bot \002will kick ops\002 on channel %s."), ci->name.c_str()); } else @@ -152,7 +152,7 @@ class CommandBSSetDontKickVoices : public Command bool override = !access.HasPriv("SET"); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickvoices"; - ci->botflags.SetFlag(BS_DONTKICKVOICES); + ci->ExtendMetadata("BS_DONTKICKVOICES"); source.Reply(_("Bot \002won't kick voices\002 on channel %s."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) @@ -160,7 +160,7 @@ class CommandBSSetDontKickVoices : public Command bool override = !access.HasPriv("SET"); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickvoices"; - ci->botflags.UnsetFlag(BS_DONTKICKVOICES); + ci->Shrink("BS_DONTKICKVOICES"); source.Reply(_("Bot \002will kick voices\002 on channel %s."), ci->name.c_str()); } else @@ -215,7 +215,7 @@ class CommandBSSetFantasy : public Command bool override = !source.AccessFor(ci).HasPriv("SET"); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable fantasy"; - ci->botflags.SetFlag(BS_FANTASY); + ci->ExtendMetadata("BS_FANTASY"); source.Reply(_("Fantasy mode is now \002on\002 on channel %s."), ci->name.c_str()); } else if (value.equals_ci("OFF")) @@ -223,7 +223,7 @@ class CommandBSSetFantasy : public Command bool override = !source.AccessFor(ci).HasPriv("SET"); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable fantasy"; - ci->botflags.UnsetFlag(BS_FANTASY); + ci->Shrink("BS_FANTASY"); source.Reply(_("Fantasy mode is now \002off\002 on channel %s."), ci->name.c_str()); } else @@ -286,7 +286,7 @@ class CommandBSSetGreet : public Command bool override = !source.AccessFor(ci).HasPriv("SET"); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable greets"; - ci->botflags.SetFlag(BS_GREET); + ci->ExtendMetadata("BS_GREET"); source.Reply(_("Greet mode is now \002on\002 on channel %s."), ci->name.c_str()); } else if (value.equals_ci("OFF")) @@ -294,7 +294,7 @@ class CommandBSSetGreet : public Command bool override = !source.AccessFor(ci).HasPriv("SET"); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable greets"; - ci->botflags.UnsetFlag(BS_GREET); + ci->Shrink("BS_GREET"); source.Reply(_("Greet mode is now \002off\002 on channel %s."), ci->name.c_str()); } else @@ -338,7 +338,7 @@ class CommandBSSetNoBot : public Command bool override = !source.AccessFor(ci).HasPriv("SET"); Log(override ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to enable nobot"; - ci->botflags.SetFlag(BS_NOBOT); + ci->ExtendMetadata("BS_NOBOT"); if (ci->bi) ci->bi->UnAssign(source.GetUser(), ci); source.Reply(_("No Bot mode is now \002on\002 on channel %s."), ci->name.c_str()); @@ -348,7 +348,7 @@ class CommandBSSetNoBot : public Command bool override = !source.AccessFor(ci).HasPriv("SET"); Log(override ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to disable nobot"; - ci->botflags.UnsetFlag(BS_NOBOT); + ci->Shrink("BS_NOBOT"); source.Reply(_("No Bot mode is now \002off\002 on channel %s."), ci->name.c_str()); } else @@ -388,12 +388,12 @@ class CommandBSSetPrivate : public Command if (value.equals_ci("ON")) { - bi->SetFlag(BI_PRIVATE); + bi->ExtendMetadata("PRIVATE"); source.Reply(_("Private mode of bot %s is now \002on\002."), bi->nick.c_str()); } else if (value.equals_ci("OFF")) { - bi->UnsetFlag(BI_PRIVATE); + bi->Shrink("PRIVATE"); source.Reply(_("Private mode of bot %s is now \002off\002."), bi->nick.c_str()); } else diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp index e4280adb4..1559113b8 100644 --- a/modules/commands/cs_akick.cpp +++ b/modules/commands/cs_akick.cpp @@ -72,7 +72,7 @@ class CommandCSAKick : public Command /* Check excepts BEFORE we get this far */ if (ci->c) { - std::pair modes = ci->c->GetModeList(CMODE_EXCEPT); + std::pair modes = ci->c->GetModeList("EXCEPT"); for (; modes.first != modes.second; ++modes.first) { if (Anope::Match(modes.first->second, mask)) @@ -85,7 +85,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 */ - if (ci->HasFlag(CI_PEACE) && nc) + if (ci->HasExt("PEACE") && nc) { AccessGroup nc_access = ci->AccessFor(nc), u_access = source.AccessFor(ci); if (nc == ci->GetFounder() || nc_access >= u_access) @@ -94,7 +94,7 @@ class CommandCSAKick : public Command return; } } - else if (ci->HasFlag(CI_PEACE)) + else if (ci->HasExt("PEACE")) { /* Match against all currently online users with equal or * higher access. - Viper */ @@ -103,7 +103,7 @@ class CommandCSAKick : public Command User *u2 = it->second; AccessGroup nc_access = ci->AccessFor(nc), u_access = source.AccessFor(ci); - Entry entry_mask(CMODE_BEGIN, mask); + Entry entry_mask("", mask); if ((ci->AccessFor(u2).HasPriv("FOUNDER") || nc_access >= u_access) && entry_mask.Matches(u2)) { @@ -134,9 +134,9 @@ class CommandCSAKick : public Command for (unsigned j = 0, end = ci->GetAkickCount(); j < end; ++j) { akick = ci->GetAkick(j); - if (akick->HasFlag(AK_ISNICK) ? akick->nc == nc : mask.equals_ci(akick->mask)) + if (akick->nc ? akick->nc == nc : mask.equals_ci(akick->mask)) { - source.Reply(_("\002%s\002 already exists on %s autokick list."), akick->HasFlag(AK_ISNICK) ? akick->nc->display.c_str() : akick->mask.c_str(), ci->name.c_str()); + source.Reply(_("\002%s\002 already exists on %s autokick list."), akick->nc ? akick->nc->display.c_str() : akick->mask.c_str(), ci->name.c_str()); return; } } @@ -223,7 +223,7 @@ class CommandCSAKick : public Command { const AutoKick *akick = ci->GetAkick(i); - if ((akick->HasFlag(AK_ISNICK) && akick->nc == nc) || (!akick->HasFlag(AK_ISNICK) && mask.equals_ci(akick->mask))) + if (akick->nc ? akick->nc == nc : mask.equals_ci(akick->mask)) break; } @@ -298,9 +298,9 @@ class CommandCSAKick : public Command if (!mask.empty()) { - if (!akick->HasFlag(AK_ISNICK) && !Anope::Match(akick->mask, mask)) + if (!akick->nc && !Anope::Match(akick->mask, mask)) continue; - if (akick->HasFlag(AK_ISNICK) && !Anope::Match(akick->nc->display, mask)) + if (akick->nc && !Anope::Match(akick->nc->display, mask)) continue; } @@ -508,7 +508,7 @@ class CSAKick : public Module EventReturn OnCheckKick(User *u, ChannelInfo *ci, Anope::string &mask, Anope::string &reason) anope_override { - if (ci->c->MatchesList(u, CMODE_EXCEPT)) + if (ci->c->MatchesList(u, "EXCEPT")) return EVENT_CONTINUE; for (unsigned j = 0, end = ci->GetAkickCount(); j < end; ++j) @@ -516,23 +516,23 @@ class CSAKick : public Module AutoKick *autokick = ci->GetAkick(j); bool kick = false; - if (autokick->HasFlag(AK_ISNICK)) + if (autokick->nc) { if (autokick->nc == u->Account()) kick = true; } else { - Entry akick_mask(CMODE_BEGIN, autokick->mask); + Entry akick_mask("", autokick->mask); if (akick_mask.Matches(u)) kick = true; } if (kick) { - Log(LOG_DEBUG_2) << u->nick << " matched akick " << (autokick->HasFlag(AK_ISNICK) ? autokick->nc->display : autokick->mask); + Log(LOG_DEBUG_2) << u->nick << " matched akick " << (autokick->nc ? autokick->nc->display : autokick->mask); autokick->last_used = Anope::CurTime; - if (!autokick->HasFlag(AK_ISNICK)) + if (!autokick->nc) mask = autokick->mask; reason = autokick->reason.empty() ? Config->CSAutokickReason : autokick->reason; return EVENT_STOP; diff --git a/modules/commands/cs_ban.cpp b/modules/commands/cs_ban.cpp index 613e75195..2ec40582d 100644 --- a/modules/commands/cs_ban.cpp +++ b/modules/commands/cs_ban.cpp @@ -28,7 +28,7 @@ class TempBan : public CallBack { Channel *c = Channel::Find(this->channel); if (c) - c->RemoveMode(NULL, CMODE_BAN, this->mask); + c->RemoveMode(NULL, "BAN", this->mask); } }; @@ -96,13 +96,13 @@ class CommandCSBan : public Command { AccessGroup u2_access = ci->AccessFor(u2); - if (u != u2 && ci->HasFlag(CI_PEACE) && u2_access >= u_access) + if (u != u2 && ci->HasExt("PEACE") && u2_access >= u_access) source.Reply(ACCESS_DENIED); /* * Dont ban/kick the user on channels where he is excepted * to prevent services <-> server wars. */ - else if (ci->c->MatchesList(u2, CMODE_EXCEPT)) + else if (ci->c->MatchesList(u2, "EXCEPT")) source.Reply(CHAN_EXCEPTED, u2->nick.c_str(), ci->name.c_str()); else if (u2->IsProtected()) source.Reply(ACCESS_DENIED); @@ -113,9 +113,9 @@ class CommandCSBan : public Command // XXX need a way to detect if someone is overriding Log(LOG_COMMAND, source, this, ci) << "for " << mask; - if (!c->HasMode(CMODE_BAN, mask)) + if (!c->HasMode("BAN", mask)) { - c->SetMode(NULL, CMODE_BAN, mask); + c->SetMode(NULL, "BAN", mask); if (ban_time) { new TempBan(ban_time, c, mask); @@ -127,7 +127,7 @@ class CommandCSBan : public Command if (!c->FindUser(u2)) return; - if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !source.AccessFor(ci).HasPriv("SIGNKICK"))) + if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK"))) c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), source.GetNick().c_str()); else c->Kick(ci->WhoSends(), u2, "%s", reason.c_str()); @@ -137,9 +137,9 @@ class CommandCSBan : public Command { Log(LOG_COMMAND, source, this, ci) << "for " << target; - if (!c->HasMode(CMODE_BAN, target)) + if (!c->HasMode("BAN", target)) { - c->SetMode(NULL, CMODE_BAN, target); + c->SetMode(NULL, "BAN", target); if (ban_time) { new TempBan(ban_time, c, target); @@ -158,15 +158,15 @@ class CommandCSBan : public Command AccessGroup u2_access = ci->AccessFor(uc->user); - if (u != uc->user && ci->HasFlag(CI_PEACE) && u2_access >= u_access) + if (u != uc->user && ci->HasExt("PEACE") && u2_access >= u_access) continue; - else if (ci->c->MatchesList(uc->user, CMODE_EXCEPT)) + else if (ci->c->MatchesList(uc->user, "EXCEPT")) continue; else if (uc->user->IsProtected()) continue; ++kicked; - if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !u_access.HasPriv("SIGNKICK"))) + if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK"))) c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), target.c_str(), source.GetNick().c_str()); else c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), target.c_str()); diff --git a/modules/commands/cs_clone.cpp b/modules/commands/cs_clone.cpp index fa09fa28e..631f69ec9 100644 --- a/modules/commands/cs_clone.cpp +++ b/modules/commands/cs_clone.cpp @@ -74,18 +74,18 @@ public: if (u && u->FindChannel(target_ci->c) != NULL) { /* On most ircds you do not receive the admin/owner mode till its registered */ - if ((cm = ModeManager::FindChannelModeByName(CMODE_OWNER))) + if ((cm = ModeManager::FindChannelModeByName("OWNER"))) target_ci->c->SetMode(NULL, cm, u->GetUID()); - else if ((cm = ModeManager::FindChannelModeByName(CMODE_PROTECT))) + else if ((cm = ModeManager::FindChannelModeByName("PROTECT"))) target_ci->c->RemoveMode(NULL, cm, u->GetUID()); } /* Mark the channel as persistent */ - if (target_ci->c->HasMode(CMODE_PERM)) - target_ci->SetFlag(CI_PERSIST); + if (target_ci->c->HasMode("PERM")) + target_ci->ExtendMetadata("PERSIST"); /* Persist may be in def cflags, set it here */ - else if (target_ci->HasFlag(CI_PERSIST) && (cm = ModeManager::FindChannelModeByName(CMODE_PERM))) - target_ci->c->SetMode(NULL, CMODE_PERM); + else if (target_ci->HasExt("PERSIST") && (cm = ModeManager::FindChannelModeByName("PERM"))) + target_ci->c->SetMode(NULL, cm); if (target_ci->bi && target_ci->c->FindUser(target_ci->bi) == NULL) target_ci->bi->Join(target_ci->c, &ModeManager::DefaultBotModes); @@ -130,7 +130,7 @@ public: for (unsigned i = 0; i < ci->GetAkickCount(); ++i) { const AutoKick *akick = ci->GetAkick(i); - if (akick->HasFlag(AK_ISNICK)) + if (akick->nc) target_ci->AddAkick(akick->creator, akick->nc, akick->reason, akick->addtime, akick->last_used); else target_ci->AddAkick(akick->creator, akick->mask, akick->reason, akick->addtime, akick->last_used); diff --git a/modules/commands/cs_drop.cpp b/modules/commands/cs_drop.cpp index 2e7efef7d..36912527f 100644 --- a/modules/commands/cs_drop.cpp +++ b/modules/commands/cs_drop.cpp @@ -39,19 +39,19 @@ class CommandCSDrop : public Command return; } - if (ci->HasFlag(CI_SUSPENDED) && !source.HasCommand("chanserv/drop")) + if (ci->HasExt("SUSPENDED") && !source.HasCommand("chanserv/drop")) { source.Reply(CHAN_X_SUSPENDED, chan.c_str()); return; } - if ((ci->HasFlag(CI_SECUREFOUNDER) ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && !source.HasCommand("chanserv/drop")) + if ((ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && !source.HasCommand("chanserv/drop")) { source.Reply(ACCESS_DENIED); return; } - bool override = (ci->HasFlag(CI_SECUREFOUNDER) ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")); + bool override = (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "(founder was: " << (ci->GetFounder() ? ci->GetFounder()->display : "none") << ")"; FOREACH_MOD(I_OnChanDrop, OnChanDrop(ci)); diff --git a/modules/commands/cs_enforce.cpp b/modules/commands/cs_enforce.cpp index c4c00a5ef..cf080f1cc 100644 --- a/modules/commands/cs_enforce.cpp +++ b/modules/commands/cs_enforce.cpp @@ -25,8 +25,8 @@ class CommandCSEnforce : public Command * part of the code. This way we can enforce SECUREOPS even * if it's off. */ - bool hadsecureops = ci->HasFlag(CI_SECUREOPS); - ci->SetFlag(CI_SECUREOPS); + bool hadsecureops = ci->HasExt("SECUREOPS"); + ci->ExtendMetadata("SECUREOPS"); for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it) { @@ -36,7 +36,7 @@ class CommandCSEnforce : public Command } if (!hadsecureops) - ci->UnsetFlag(CI_SECUREOPS); + ci->Shrink("SECUREOPS"); source.Reply(_("Secureops enforced on %s."), ci->name.c_str()); } @@ -64,7 +64,7 @@ class CommandCSEnforce : public Command Anope::string mask = ci->GetIdealBan(user); Anope::string reason = Language::Translate(user, _("RESTRICTED enforced by ")) + source.GetNick(); - ci->c->SetMode(NULL, CMODE_BAN, mask); + ci->c->SetMode(NULL, "BAN", mask); ci->c->Kick(NULL, user, "%s", reason.c_str()); } @@ -94,8 +94,8 @@ class CommandCSEnforce : public Command Anope::string mask = ci->GetIdealBan(user); Anope::string reason = Language::Translate(user, _("REGONLY enforced by ")) + source.GetNick(); - if (!ci->c->HasMode(CMODE_REGISTEREDONLY)) - ci->c->SetMode(NULL, CMODE_BAN, mask); + if (!ci->c->HasMode("REGISTEREDONLY")) + ci->c->SetMode(NULL, "BAN", mask); ci->c->Kick(NULL, user, "%s", reason.c_str()); } @@ -115,7 +115,7 @@ class CommandCSEnforce : public Command if (user->IsProtected()) continue; - if (!user->HasMode(UMODE_SSL)) + if (!user->HasMode("SSL")) users.push_back(user); } @@ -125,8 +125,8 @@ class CommandCSEnforce : public Command Anope::string mask = ci->GetIdealBan(user); Anope::string reason = Language::Translate(user, _("SSLONLY enforced by ")) + source.GetNick(); - if (!ci->c->HasMode(CMODE_SSL)) - ci->c->SetMode(NULL, CMODE_BAN, mask); + if (!ci->c->HasMode("SSL")) + ci->c->SetMode(NULL, "BAN", mask); ci->c->Kick(NULL, user, "%s", reason.c_str()); } @@ -144,7 +144,7 @@ class CommandCSEnforce : public Command if (user->IsProtected()) continue; - if (ci->c->MatchesList(user, CMODE_BAN) && !ci->c->MatchesList(user, CMODE_EXCEPT)) + if (ci->c->MatchesList(user, "BAN") && !ci->c->MatchesList(user, "EXCEPT")) users.push_back(user); } @@ -162,7 +162,7 @@ class CommandCSEnforce : public Command void DoLimit(CommandSource &source, ChannelInfo *ci) { Anope::string l_str; - if (!ci->c->GetParam(CMODE_LIMIT, l_str)) + if (!ci->c->GetParam("LIMIT", l_str)) { source.Reply(_("No limit is set on %s."), ci->name.c_str()); return; diff --git a/modules/commands/cs_getkey.cpp b/modules/commands/cs_getkey.cpp index b0d0dfcf9..1ac5633ea 100644 --- a/modules/commands/cs_getkey.cpp +++ b/modules/commands/cs_getkey.cpp @@ -40,7 +40,7 @@ class CommandCSGetKey : public Command } Anope::string key; - if (!ci->c || !ci->c->GetParam(CMODE_KEY, key)) + if (!ci->c || !ci->c->GetParam("KEY", key)) { source.Reply(_("Channel \002%s\002 has no key."), chan.c_str()); return; diff --git a/modules/commands/cs_info.cpp b/modules/commands/cs_info.cpp index c007d9341..074e48fd0 100644 --- a/modules/commands/cs_info.cpp +++ b/modules/commands/cs_info.cpp @@ -15,9 +15,9 @@ class CommandCSInfo : public Command { - void CheckOptStr(Anope::string &buf, ChannelInfoFlag opt, const char *str, const ChannelInfo *ci, const NickCore *nc) + void CheckOptStr(Anope::string &buf, const Anope::string &opt, const char *str, const ChannelInfo *ci, const NickCore *nc) { - if (ci->HasFlag(opt)) + if (ci->HasExt(opt)) { if (!buf.empty()) buf += ", "; @@ -31,7 +31,7 @@ class CommandCSInfo : public Command { this->SetDesc(_("Lists information about the named registered channel")); this->SetSyntax(_("\037channel\037")); - this->SetFlag(CFLAG_ALLOW_UNREGISTERED); + this->AllowUnregistered(true); } void Execute(CommandSource &source, const std::vector ¶ms) anope_override @@ -68,8 +68,8 @@ class CommandCSInfo : public Command info["Registered"] = Anope::strftime(ci->time_registered); info["Last used"] = Anope::strftime(ci->last_used); - const ModeLock *secret = ci->GetMLock(CMODE_SECRET); - if (!ci->last_topic.empty() && (show_all || ((!secret || secret->set == false) && (!ci->c || !ci->c->HasMode(CMODE_SECRET))))) + const ModeLock *secret = ci->GetMLock("SECRET"); + if (!ci->last_topic.empty() && (show_all || ((!secret || secret->set == false) && (!ci->c || !ci->c->HasMode("SECRET"))))) { info["Last topic"] = ci->last_topic; info["Topic set by"] = ci->last_topic_setter; @@ -80,21 +80,21 @@ class CommandCSInfo : public Command info["Ban type"] = stringify(ci->bantype); Anope::string optbuf; - CheckOptStr(optbuf, CI_KEEPTOPIC, _("Topic Retention"), ci, nc); - CheckOptStr(optbuf, CI_PEACE, _("Peace"), ci, nc); - CheckOptStr(optbuf, CI_PRIVATE, _("Private"), ci, nc); - CheckOptStr(optbuf, CI_RESTRICTED, _("Restricted Access"), ci, nc); - CheckOptStr(optbuf, CI_SECURE, _("Secure"), ci, nc); - CheckOptStr(optbuf, CI_SECUREFOUNDER, _("Secure Founder"), ci, nc); - CheckOptStr(optbuf, CI_SECUREOPS, _("Secure Ops"), ci, nc); - if (ci->HasFlag(CI_SIGNKICK)) - CheckOptStr(optbuf, CI_SIGNKICK, _("Signed kicks"), ci, nc); + CheckOptStr(optbuf, "KEEPTOPIC", _("Topic Retention"), ci, nc); + CheckOptStr(optbuf, "PEACE", _("Peace"), ci, nc); + CheckOptStr(optbuf, "PRIVATE", _("Private"), ci, nc); + CheckOptStr(optbuf, "RESTRICTED", _("Restricted Access"), ci, nc); + CheckOptStr(optbuf, "SECURE", _("Secure"), ci, nc); + CheckOptStr(optbuf, "SECUREFOUNDER", _("Secure Founder"), ci, nc); + CheckOptStr(optbuf, "SECUREOPS", _("Secure Ops"), ci, nc); + if (ci->HasExt("SIGNKICK")) + CheckOptStr(optbuf, "SIGNKICK", _("Signed kicks"), ci, nc); else - CheckOptStr(optbuf, CI_SIGNKICK_LEVEL, _("Signed kicks"), ci, nc); - CheckOptStr(optbuf, CI_TOPICLOCK, _("Topic Lock"), ci, nc); - CheckOptStr(optbuf, CI_PERSIST, _("Persistant"), ci, nc); - CheckOptStr(optbuf, CI_NO_EXPIRE, _("No expire"), ci, nc); - CheckOptStr(optbuf, CI_STATS, _("Chanstats"), ci, nc); + CheckOptStr(optbuf, "SIGNKICK_LEVEL", _("Signed kicks"), ci, nc); + CheckOptStr(optbuf, "TOPICLOCK", _("Topic Lock"), ci, nc); + CheckOptStr(optbuf, "PERSIST", _("Persistant"), ci, nc); + CheckOptStr(optbuf, "NO_EXPIRE", _("No expire"), ci, nc); + CheckOptStr(optbuf, "STATS", _("Chanstats"), ci, nc); info["Options"] = optbuf.empty() ? _("None") : optbuf; @@ -102,12 +102,12 @@ class CommandCSInfo : public Command if (!ml.empty()) info["Mode lock"] = ml; - if (!ci->HasFlag(CI_NO_EXPIRE)) + if (!ci->HasExt("NO_EXPIRE")) info["Expires on"] = Anope::strftime(ci->last_used + Config->CSExpire); } - if (ci->HasFlag(CI_SUSPENDED)) + if (ci->HasExt("SUSPENDED")) { - Anope::string *by = ci->GetExt *>("suspend_by"), *reason = ci->GetExt *>("suspend_reason"); + Anope::string *by = ci->GetExt("suspend_by"), *reason = ci->GetExt("suspend_reason"); if (by != NULL) info["Suspended"] = Anope::printf("[%s] %s", by->c_str(), (reason && !reason->empty() ? reason->c_str() : NO_REASON)); } diff --git a/modules/commands/cs_kick.cpp b/modules/commands/cs_kick.cpp index addcb797a..cfc8908c4 100644 --- a/modules/commands/cs_kick.cpp +++ b/modules/commands/cs_kick.cpp @@ -55,7 +55,7 @@ class CommandCSKick : public Command else if (u2) { AccessGroup u2_access = ci->AccessFor(u2); - if (u != u2 && ci->HasFlag(CI_PEACE) && u2_access >= u_access) + if (u != u2 && ci->HasExt("PEACE") && u2_access >= u_access) source.Reply(ACCESS_DENIED); else if (u2->IsProtected()) source.Reply(ACCESS_DENIED); @@ -66,7 +66,7 @@ class CommandCSKick : public Command // XXX Log(LOG_COMMAND, source, this, ci) << "for " << u2->nick; - if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !u_access.HasPriv("SIGNKICK"))) + if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK"))) c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), source.GetNick().c_str()); else c->Kick(ci->WhoSends(), u2, "%s", reason.c_str()); @@ -86,13 +86,13 @@ class CommandCSKick : public Command ++matched; AccessGroup u2_access = ci->AccessFor(uc->user); - if (u != uc->user && ci->HasFlag(CI_PEACE) && u2_access >= u_access) + if (u != uc->user && ci->HasExt("PEACE") && u2_access >= u_access) continue; else if (uc->user->IsProtected()) continue; ++kicked; - if (ci->HasFlag(CI_SIGNKICK) || (ci->HasFlag(CI_SIGNKICK_LEVEL) && !u_access.HasPriv("SIGNKICK"))) + if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK"))) c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), target.c_str(), source.GetNick().c_str()); else c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), target.c_str()); diff --git a/modules/commands/cs_list.cpp b/modules/commands/cs_list.cpp index 7c34c4c36..09e89c219 100644 --- a/modules/commands/cs_list.cpp +++ b/modules/commands/cs_list.cpp @@ -78,11 +78,11 @@ class CommandCSList : public Command { const ChannelInfo *ci = it->second; - if (!is_servadmin && (ci->HasFlag(CI_PRIVATE) || ci->HasFlag(CI_SUSPENDED))) + if (!is_servadmin && (ci->HasExt("PRIVATE") || ci->HasExt("SUSPENDED"))) continue; - else if (suspended && !ci->HasFlag(CI_SUSPENDED)) + else if (suspended && !ci->HasExt("SUSPENDED")) continue; - else if (channoexpire && !ci->HasFlag(CI_NO_EXPIRE)) + else if (channoexpire && !ci->HasExt("NO_EXPIRE")) continue; if (pattern.equals_ci(ci->name) || ci->name.equals_ci(spattern) || Anope::Match(ci->name, pattern, false, true) || Anope::Match(ci->name, spattern, false, true)) @@ -90,12 +90,12 @@ class CommandCSList : public Command if (((count + 1 >= from && count + 1 <= to) || (!from && !to)) && ++nchans <= Config->CSListMax) { bool isnoexpire = false; - if (is_servadmin && (ci->HasFlag(CI_NO_EXPIRE))) + if (is_servadmin && (ci->HasExt("NO_EXPIRE"))) isnoexpire = true; ListFormatter::ListEntry entry; entry["Name"] = (isnoexpire ? "!" : "") + ci->name; - if (ci->HasFlag(CI_SUSPENDED)) + if (ci->HasExt("SUSPENDED")) entry["Description"] = "[Suspended]"; else entry["Description"] = ci->desc; diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp index c261c5cb9..ff87be0dc 100644 --- a/modules/commands/cs_mode.cpp +++ b/modules/commands/cs_mode.cpp @@ -22,7 +22,7 @@ class CommandCSMode : public Command const Anope::string accesses[] = { "VOICE", "HALFOP", "OPDEOP", "PROTECT", "OWNER", "" }, accesses_self[] = { "VOICEME", "HALFOPME", "OPDEOPME", "PROTECTME", "OWNERME", "" }; - const ChannelModeName modes[] = { CMODE_VOICE, CMODE_HALFOP, CMODE_OP, CMODE_PROTECT, CMODE_OWNER }; + const Anope::string modes[] = { "VOICE", "HALFOP", "OP", "PROTECT", "OWNER" }; ChannelModeStatus *cms = anope_dynamic_static_cast(cm); AccessGroup access = source.AccessFor(ci); unsigned short u_level = 0; diff --git a/modules/commands/cs_register.cpp b/modules/commands/cs_register.cpp index 22b1619dc..a79942fc3 100644 --- a/modules/commands/cs_register.cpp +++ b/modules/commands/cs_register.cpp @@ -34,7 +34,7 @@ class CommandCSRegister : public Command if (Anope::ReadOnly) source.Reply(_("Sorry, channel registration is temporarily disabled.")); - else if (nc->HasFlag(NI_UNCONFIRMED)) + else if (nc->HasExt("UNCONFIRMED")) source.Reply(_("You must confirm your account before you can register a channel.")); else if (chan[0] == '&') source.Reply(_("Local channels cannot be registered.")); @@ -46,7 +46,7 @@ class CommandCSRegister : public Command source.Reply(CHAN_X_NOT_IN_USE, chan.c_str()); else if (ci) source.Reply(_("Channel \002%s\002 is already registered!"), chan.c_str()); - else if (c && !c->HasUserStatus(u, CMODE_OP)) + else if (c && !c->HasUserStatus(u, "OP")) source.Reply(_("You must be a channel operator to register the channel.")); else if (Config->CSMaxReg && nc->channelcount >= Config->CSMaxReg && !source.HasPriv("chanserv/no-register-limit")) source.Reply(nc->channelcount > Config->CSMaxReg ? CHAN_EXCEEDED_CHANNEL_LIMIT : CHAN_REACHED_CHANNEL_LIMIT, Config->CSMaxReg); @@ -56,9 +56,9 @@ class CommandCSRegister : public Command ci->SetFounder(nc); ci->desc = chdesc; - for (std::list >::const_iterator it = ModeManager::ModeLockOn.begin(), it_end = ModeManager::ModeLockOn.end(); it != it_end; ++it) + for (std::list >::const_iterator it = ModeManager::ModeLockOn.begin(), it_end = ModeManager::ModeLockOn.end(); it != it_end; ++it) ci->SetMLock(ModeManager::FindChannelModeByName(it->first), true, it->second, source.GetNick()); - for (std::list::const_iterator it = ModeManager::ModeLockOff.begin(), it_end = ModeManager::ModeLockOff.end(); it != it_end; ++it) + for (std::list::const_iterator it = ModeManager::ModeLockOff.begin(), it_end = ModeManager::ModeLockOff.end(); it != it_end; ++it) ci->SetMLock(ModeManager::FindChannelModeByName(*it), false, "", source.GetNick()); if (c && !c->topic.empty()) @@ -82,18 +82,18 @@ class CommandCSRegister : public Command if (u && u->FindChannel(c) != NULL) { /* On most ircds you do not receive the admin/owner mode till its registered */ - if ((cm = ModeManager::FindChannelModeByName(CMODE_OWNER))) + if ((cm = ModeManager::FindChannelModeByName("OWNER"))) c->SetMode(NULL, cm, u->GetUID()); - else if ((cm = ModeManager::FindChannelModeByName(CMODE_PROTECT))) + else if ((cm = ModeManager::FindChannelModeByName("PROTECT"))) c->RemoveMode(NULL, cm, u->GetUID()); } /* Mark the channel as persistent */ - if (c->HasMode(CMODE_PERM)) - ci->SetFlag(CI_PERSIST); + if (c->HasMode("PERM")) + ci->Extend("PERSIST"); /* Persist may be in def cflags, set it here */ - else if (ci->HasFlag(CI_PERSIST) && (cm = ModeManager::FindChannelModeByName(CMODE_PERM))) - c->SetMode(NULL, CMODE_PERM); + else if (ci->HasExt("PERSIST") && (cm = ModeManager::FindChannelModeByName("PERM"))) + c->SetMode(NULL, "PERM"); } FOREACH_MOD(I_OnChanRegistered, OnChanRegistered(ci)); diff --git a/modules/commands/cs_seen.cpp b/modules/commands/cs_seen.cpp index c5ae87a22..76cfe1eb9 100644 --- a/modules/commands/cs_seen.cpp +++ b/modules/commands/cs_seen.cpp @@ -98,11 +98,11 @@ static bool ShouldHide(const Anope::string &channel, User *u) Channel *targetchan = Channel::Find(channel); const ChannelInfo *targetchan_ci = targetchan ? *targetchan->ci : ChannelInfo::Find(channel); - if (targetchan && targetchan->HasMode(CMODE_SECRET)) + if (targetchan && targetchan->HasMode("SECRET")) return true; - else if (targetchan_ci && targetchan_ci->HasFlag(CI_PRIVATE)) + else if (targetchan_ci && targetchan_ci->HasExt("PRIVATE")) return true; - else if (u && u->HasMode(UMODE_PRIV)) + else if (u && u->HasMode("PRIV")) return true; return false; } diff --git a/modules/commands/cs_set.cpp b/modules/commands/cs_set.cpp index 97ee81a5a..49ad2acf3 100644 --- a/modules/commands/cs_set.cpp +++ b/modules/commands/cs_set.cpp @@ -130,12 +130,12 @@ class CommandCSSetAutoOp : public Command if (params[1].equals_ci("ON")) { - ci->UnsetFlag(CI_NOAUTOOP); + ci->Shrink("NOAUTOOP"); source.Reply(_("Services will now automatically give modes to users in \2%s\2"), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { - ci->SetFlag(CI_NOAUTOOP); + ci->ExtendMetadata("NOAUTOOP"); source.Reply(_("Services will no longer automatically give modes to users in \2%s\2"), ci->name.c_str()); } else @@ -247,12 +247,12 @@ class CommandCSSetChanstats : public Command if (params[1].equals_ci("ON")) { - ci->SetFlag(CI_STATS); + ci->ExtendMetadata("STATS"); source.Reply(_("Chanstats statistics are now enabled for this channel")); } else if (params[1].equals_ci("OFF")) { - ci->UnsetFlag(CI_STATS); + ci->Shrink("STATS"); source.Reply(_("Chanstats statistics are now disabled for this channel")); } else @@ -351,7 +351,7 @@ class CommandCSSetFounder : public Command return; } - if (source.permission.empty() && (ci->HasFlag(CI_SECUREFOUNDER) ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER"))) + if (source.permission.empty() && (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER"))) { source.Reply(ACCESS_DENIED); return; @@ -421,12 +421,12 @@ class CommandCSSetKeepTopic : public Command if (params[1].equals_ci("ON")) { - ci->SetFlag(CI_KEEPTOPIC); + ci->ExtendMetadata("KEEPTOPIC"); source.Reply(_("Topic retention option for %s is now \002on\002."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { - ci->UnsetFlag(CI_KEEPTOPIC); + ci->Shrink("KEEPTOPIC"); source.Reply(_("Topic retention option for %s is now \002off\002."), ci->name.c_str()); } else @@ -478,12 +478,12 @@ class CommandCSSetPeace : public Command if (params[1].equals_ci("ON")) { - ci->SetFlag(CI_PEACE); + ci->ExtendMetadata("PEACE"); source.Reply(_("Peace option for %s is now \002on\002."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { - ci->UnsetFlag(CI_PEACE); + ci->Shrink("PEACE"); source.Reply(_("Peace option for %s is now \002off\002."), ci->name.c_str()); } else @@ -533,15 +533,15 @@ class CommandCSSetPersist : public Command return; } - ChannelMode *cm = ModeManager::FindChannelModeByName(CMODE_PERM); + ChannelMode *cm = ModeManager::FindChannelModeByName("PERM"); if (params[1].equals_ci("ON")) { - if (!ci->HasFlag(CI_PERSIST)) + if (!ci->HasExt("PERSIST")) { - ci->SetFlag(CI_PERSIST); + ci->ExtendMetadata("PERSIST"); if (ci->c) - ci->c->SetFlag(CH_PERSIST); + ci->c->Extend("PERSIST"); /* Channel doesn't exist, create it */ if (!ci->c) @@ -569,7 +569,7 @@ class CommandCSSetPersist : public Command /* Set the perm mode */ if (cm) { - if (ci->c && !ci->c->HasMode(CMODE_PERM)) + if (ci->c && !ci->c->HasMode("PERM")) ci->c->SetMode(NULL, cm); /* Add it to the channels mlock */ ci->SetMLock(cm, true); @@ -580,16 +580,16 @@ class CommandCSSetPersist : public Command } else if (params[1].equals_ci("OFF")) { - if (ci->HasFlag(CI_PERSIST)) + if (ci->HasExt("PERSIST")) { - ci->UnsetFlag(CI_PERSIST); + ci->Shrink("PERSIST"); if (ci->c) - ci->c->UnsetFlag(CH_PERSIST); + ci->c->Shrink("PERSIST"); /* Unset perm mode */ if (cm) { - if (ci->c && ci->c->HasMode(CMODE_PERM)) + if (ci->c && ci->c->HasMode("PERM")) ci->c->RemoveMode(NULL, cm); /* Remove from mlock */ ci->RemoveMLock(cm, true); @@ -676,12 +676,12 @@ class CommandCSSetPrivate : public Command if (params[1].equals_ci("ON")) { - ci->SetFlag(CI_PRIVATE); + ci->ExtendMetadata("PRIVATE"); source.Reply(_("Private option for %s is now \002on\002."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { - ci->UnsetFlag(CI_PRIVATE); + ci->Shrink("PRIVATE"); source.Reply(_("Private option for %s is now \002off\002."), ci->name.c_str()); } else @@ -733,12 +733,12 @@ class CommandCSSetRestricted : public Command if (params[1].equals_ci("ON")) { - ci->SetFlag(CI_RESTRICTED); + ci->ExtendMetadata("RESTRICTED"); source.Reply(_("Restricted access option for %s is now \002on\002."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { - ci->UnsetFlag(CI_RESTRICTED); + ci->Shrink("RESTRICTED"); source.Reply(_("Restricted access option for %s is now \002off\002."), ci->name.c_str()); } else @@ -789,12 +789,12 @@ class CommandCSSetSecure : public Command if (params[1].equals_ci("ON")) { - ci->SetFlag(CI_SECURE); + ci->ExtendMetadata("SECURE"); source.Reply(_("Secure option for %s is now \002on\002."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { - ci->UnsetFlag(CI_SECURE); + ci->Shrink("SECURE"); source.Reply(_("Secure option for %s is now \002off\002."), ci->name.c_str()); } else @@ -847,12 +847,12 @@ class CommandCSSetSecureFounder : public Command if (params[1].equals_ci("ON")) { - ci->SetFlag(CI_SECUREFOUNDER); + ci->ExtendMetadata("SECUREFOUNDER"); source.Reply(_("Secure founder option for %s is now \002on\002."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { - ci->UnsetFlag(CI_SECUREFOUNDER); + ci->Shrink("SECUREFOUNDER"); source.Reply(_("Secure founder option for %s is now \002off\002."), ci->name.c_str()); } else @@ -905,12 +905,12 @@ class CommandCSSetSecureOps : public Command if (params[1].equals_ci("ON")) { - ci->SetFlag(CI_SECUREOPS); + ci->ExtendMetadata("SECUREOPS"); source.Reply(_("Secure ops option for %s is now \002on\002."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { - ci->UnsetFlag(CI_SECUREOPS); + ci->Shrink("SECUREOPS"); source.Reply(_("Secure ops option for %s is now \002off\002."), ci->name.c_str()); } else @@ -961,21 +961,21 @@ class CommandCSSetSignKick : public Command if (params[1].equals_ci("ON")) { - ci->SetFlag(CI_SIGNKICK); - ci->UnsetFlag(CI_SIGNKICK_LEVEL); + ci->ExtendMetadata("SIGNKICK"); + ci->Shrink("SIGNKICK_LEVEL"); source.Reply(_("Signed kick option for %s is now \002on\002."), ci->name.c_str()); } else if (params[1].equals_ci("LEVEL")) { - ci->SetFlag(CI_SIGNKICK_LEVEL); - ci->UnsetFlag(CI_SIGNKICK); + ci->ExtendMetadata("SIGNKICK_LEVEL"); + ci->Shrink("SIGNKICK"); source.Reply(_("Signed kick option for %s is now \002ON\002, but depends of the\n" "level of the user that is using the command."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { - ci->UnsetFlag(CI_SIGNKICK); - ci->UnsetFlag(CI_SIGNKICK_LEVEL); + ci->Shrink("SIGNKICK"); + ci->Shrink("SIGNKICK_LEVEL"); source.Reply(_("Signed kick option for %s is now \002off\002."), ci->name.c_str()); } else @@ -1029,7 +1029,7 @@ class CommandCSSetSuccessor : public Command return; } - if (ci->HasFlag(CI_SECUREFOUNDER) ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) + if (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) { source.Reply(ACCESS_DENIED); return; @@ -1110,12 +1110,12 @@ class CommandCSSASetNoexpire : public Command if (params[1].equals_ci("ON")) { - ci->SetFlag(CI_NO_EXPIRE); + ci->ExtendMetadata("NO_EXPIRE"); source.Reply(_("Channel %s \002will not\002 expire."), ci->name.c_str()); } else if (params[1].equals_ci("OFF")) { - ci->UnsetFlag(CI_NO_EXPIRE); + ci->Shrink("NO_EXPIRE"); source.Reply(_("Channel %s \002will\002 expire."), ci->name.c_str()); } else @@ -1181,12 +1181,12 @@ class CSSet : public Module void OnChanRegistered(ChannelInfo *ci) anope_override { if (CSDefChanstats) - ci->SetFlag(CI_STATS); + ci->ExtendMetadata("STATS"); } EventReturn OnCheckKick(User *u, ChannelInfo *ci, Anope::string &mask, Anope::string &reason) anope_override { - if (!ci->HasFlag(CI_RESTRICTED) || ci->c->MatchesList(u, CMODE_EXCEPT)) + if (!ci->HasExt("RESTRICTED") || ci->c->MatchesList(u, "EXCEPT")) return EVENT_CONTINUE; if (ci->AccessFor(u).empty() && (!ci->GetFounder() || u->Account() != ci->GetFounder())) diff --git a/modules/commands/cs_status.cpp b/modules/commands/cs_status.cpp index 767ebd148..078de28e0 100644 --- a/modules/commands/cs_status.cpp +++ b/modules/commands/cs_status.cpp @@ -71,14 +71,14 @@ public: { AutoKick *autokick = ci->GetAkick(j); - if (autokick->HasFlag(AK_ISNICK)) + if (autokick->nc) { if (na && *autokick->nc == na->nc) source.Reply(_("\2%s\2 is on the auto kick list (%s)."), na->nc->display.c_str(), autokick->reason.c_str()); } else if (u != NULL) { - Entry akick_mask(CMODE_BEGIN, autokick->mask); + Entry akick_mask("", autokick->mask); if (akick_mask.Matches(u))