summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-01-21 22:31:16 -0500
committerAdam <Adam@anope.org>2013-01-21 22:31:16 -0500
commitddaa001dafb5122e6e363e4acbbe6ce045b7b104 (patch)
tree0364a76606ac6e2881ebd663601ce260f7c1101e /modules
parent51c049e1a738e9124bab3961f35b830906517421 (diff)
Merge usefulness of Flags and Extensible classes into Extensible, made most flags we have juse strings instead of defines/enums
Diffstat (limited to 'modules')
-rw-r--r--modules/commands/bs_assign.cpp6
-rw-r--r--modules/commands/bs_bot.cpp4
-rw-r--r--modules/commands/bs_botlist.cpp4
-rw-r--r--modules/commands/bs_info.cpp36
-rw-r--r--modules/commands/bs_kick.cpp74
-rw-r--r--modules/commands/bs_set.cpp24
-rw-r--r--modules/commands/cs_akick.cpp28
-rw-r--r--modules/commands/cs_ban.cpp22
-rw-r--r--modules/commands/cs_clone.cpp14
-rw-r--r--modules/commands/cs_drop.cpp6
-rw-r--r--modules/commands/cs_enforce.cpp22
-rw-r--r--modules/commands/cs_getkey.cpp2
-rw-r--r--modules/commands/cs_info.cpp44
-rw-r--r--modules/commands/cs_kick.cpp8
-rw-r--r--modules/commands/cs_list.cpp10
-rw-r--r--modules/commands/cs_mode.cpp2
-rw-r--r--modules/commands/cs_register.cpp20
-rw-r--r--modules/commands/cs_seen.cpp6
-rw-r--r--modules/commands/cs_set.cpp78
-rw-r--r--modules/commands/cs_status.cpp4
-rw-r--r--modules/commands/cs_suspend.cpp112
-rw-r--r--modules/commands/cs_topic.cpp10
-rw-r--r--modules/commands/cs_updown.cpp4
-rw-r--r--modules/commands/help.cpp6
-rw-r--r--modules/commands/hs_off.cpp2
-rw-r--r--modules/commands/hs_on.cpp2
-rw-r--r--modules/commands/ms_cancel.cpp2
-rw-r--r--modules/commands/ms_check.cpp2
-rw-r--r--modules/commands/ms_info.cpp26
-rw-r--r--modules/commands/ms_list.cpp8
-rw-r--r--modules/commands/ms_read.cpp8
-rw-r--r--modules/commands/ms_rsend.cpp2
-rw-r--r--modules/commands/ms_set.cpp34
-rw-r--r--modules/commands/ns_access.cpp2
-rw-r--r--modules/commands/ns_ajoin.cpp20
-rw-r--r--modules/commands/ns_alist.cpp4
-rw-r--r--modules/commands/ns_cert.cpp6
-rw-r--r--modules/commands/ns_group.cpp18
-rw-r--r--modules/commands/ns_identify.cpp6
-rw-r--r--modules/commands/ns_info.cpp38
-rw-r--r--modules/commands/ns_list.cpp16
-rw-r--r--modules/commands/ns_logout.cpp2
-rw-r--r--modules/commands/ns_recover.cpp17
-rw-r--r--modules/commands/ns_register.cpp28
-rw-r--r--modules/commands/ns_resetpass.cpp4
-rw-r--r--modules/commands/ns_set.cpp65
-rw-r--r--modules/commands/ns_status.cpp2
-rw-r--r--modules/commands/ns_suspend.cpp108
-rw-r--r--modules/commands/ns_update.cpp2
-rw-r--r--modules/commands/os_chankill.cpp2
-rw-r--r--modules/commands/os_defcon.cpp53
-rw-r--r--modules/commands/os_dns.cpp4
-rw-r--r--modules/commands/os_forbid.cpp14
-rw-r--r--modules/commands/os_ignore.cpp4
-rw-r--r--modules/commands/os_jupe.cpp2
-rw-r--r--modules/commands/os_list.cpp26
-rw-r--r--modules/commands/os_login.cpp6
-rw-r--r--modules/commands/os_news.cpp4
-rw-r--r--modules/commands/os_noop.cpp8
-rw-r--r--modules/commands/os_oline.cpp2
-rw-r--r--modules/commands/os_sxline.cpp6
-rw-r--r--modules/database/db_flatfile.cpp16
-rw-r--r--modules/database/db_old.cpp90
-rw-r--r--modules/database/db_plain.cpp104
-rw-r--r--modules/extra/cs_statusupdate.cpp14
-rw-r--r--modules/extra/m_chanstats.cpp19
-rw-r--r--modules/extra/m_dnsbl.cpp2
-rw-r--r--modules/extra/m_helpchan.cpp6
-rw-r--r--modules/extra/m_proxyscan.cpp2
-rw-r--r--modules/extra/m_sql_oper.cpp4
-rw-r--r--modules/extra/m_ssl.cpp35
-rw-r--r--modules/extra/m_xmlrpc_main.cpp12
-rw-r--r--modules/extra/webcpanel/pages/chanserv/drop.cpp6
-rw-r--r--modules/extra/webcpanel/pages/chanserv/set.cpp70
-rw-r--r--modules/extra/webcpanel/pages/memoserv/memos.cpp10
-rw-r--r--modules/extra/webcpanel/pages/nickserv/alist.cpp4
-rw-r--r--modules/extra/webcpanel/pages/nickserv/info.cpp54
-rw-r--r--modules/protocol/bahamut.cpp54
-rw-r--r--modules/protocol/hybrid.cpp58
-rw-r--r--modules/protocol/inspircd11.cpp94
-rw-r--r--modules/protocol/inspircd12.cpp148
-rw-r--r--modules/protocol/inspircd20.cpp134
-rw-r--r--modules/protocol/ngircd.cpp76
-rw-r--r--modules/protocol/plexus.cpp52
-rw-r--r--modules/protocol/ratbox.cpp18
-rw-r--r--modules/protocol/unreal.cpp154
-rw-r--r--modules/pseudoclients/botserv.cpp26
-rw-r--r--modules/pseudoclients/chanserv.cpp8
-rw-r--r--modules/pseudoclients/global.cpp2
-rw-r--r--modules/pseudoclients/memoserv.cpp10
-rw-r--r--modules/pseudoclients/nickserv.cpp52
-rw-r--r--modules/pseudoclients/operserv.cpp14
92 files changed, 1189 insertions, 1260 deletions
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<BotServFlag> &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<Anope::string> 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<unsigned>(ci->capsmin))
+ if (ci->HasExt("BS_KICK_CAPS") && realbuf.length() >= static_cast<unsigned>(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<Channel::ModeList::iterator, Channel::ModeList::iterator> modes = ci->c->GetModeList(CMODE_EXCEPT);
+ std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> 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<Anope::string> &params) 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<ExtensibleItemClass<Anope::string> *>("suspend_by"), *reason = ci->GetExt<ExtensibleItemClass<Anope::string> *>("suspend_reason");
+ Anope::string *by = ci->GetExt<Anope::string *>("suspend_by"), *reason = ci->GetExt<Anope::string *>("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<ChannelModeStatus *>(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<std::pair<ChannelModeName, Anope::string> >::const_iterator it = ModeManager::ModeLockOn.begin(), it_end = ModeManager::ModeLockOn.end(); it != it_end; ++it)
+ for (std::list<std::pair<Anope::string, Anope::string> >::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<ChannelModeName>::const_iterator it = ModeManager::ModeLockOff.begin(), it_end = ModeManager::ModeLockOff.end(); it != it_end; ++it)
+ for (std::list<Anope::string>::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))
source.Reply(_("\2%s\2 matches auto kick entry %s (%s)."), u->nick.c_str(), autokick->mask.c_str(), autokick->reason.c_str());
}
diff --git a/modules/commands/cs_suspend.cpp b/modules/commands/cs_suspend.cpp
index cb9d77818..594d72772 100644
--- a/modules/commands/cs_suspend.cpp
+++ b/modules/commands/cs_suspend.cpp
@@ -13,46 +13,6 @@
#include "module.h"
-struct ChanSuspend : ExtensibleItem, Serializable
-{
- Anope::string chan;
- time_t when;
-
- ChanSuspend() : Serializable("ChanSuspend")
- {
- }
-
- void Serialize(Serialize::Data &sd) const anope_override
- {
- sd["chan"] << this->chan;
- sd["when"] << this->when;
- }
-
- static Serializable* Unserialize(Serializable *obj, Serialize::Data &sd)
- {
- Anope::string schan;
-
- sd["chan"] >> schan;
-
- ChannelInfo *ci = ChannelInfo::Find(schan);
- if (ci == NULL)
- return NULL;
-
- ChanSuspend *cs;
- if (obj)
- cs = anope_dynamic_static_cast<ChanSuspend *>(obj);
- else
- cs = new ChanSuspend();
-
- sd["chan"] >> cs->chan;
- sd["when"] >> cs->when;
-
- if (!obj)
- ci->Extend("ci_suspend_expire", cs);
- return cs;
- }
-};
-
class CommandCSSuspend : public Command
{
public:
@@ -95,10 +55,10 @@ class CommandCSSuspend : public Command
return;
}
- ci->SetFlag(CI_SUSPENDED);
- ci->Extend("suspend_by", new ExtensibleItemClass<Anope::string>(source.GetNick()));
+ ci->ExtendMetadata("SUSPENDED");
+ ci->ExtendMetadata("suspend:by", source.GetNick());
if (!reason.empty())
- ci->Extend("suspend_reason", new ExtensibleItemClass<Anope::string>(reason));
+ ci->ExtendMetadata("suspend:reason", reason);
if (ci->c)
{
@@ -108,7 +68,7 @@ class CommandCSSuspend : public Command
{
ChanUserContainer *uc = *it;
User *user = uc->user;
- if (!user->HasMode(UMODE_OPER) && user->server != Me)
+ if (!user->HasMode("OPER") && user->server != Me)
users.push_back(user);
}
@@ -117,13 +77,7 @@ class CommandCSSuspend : public Command
}
if (expiry_secs > 0)
- {
- ChanSuspend *cs = new ChanSuspend();
- cs->chan = ci->name;
- cs->when = Anope::CurTime + expiry_secs;
-
- ci->Extend("cs_suspend_expire", cs);
- }
+ ci->ExtendMetadata("suspend:expire", stringify(Anope::CurTime + expiry_secs));
Log(LOG_ADMIN, source, this, ci) << (!reason.empty() ? reason : "No reason") << ", expires in " << (expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never");
source.Reply(_("Channel \002%s\002 is now suspended."), ci->name.c_str());
@@ -172,20 +126,20 @@ class CommandCSUnSuspend : public Command
}
/* Only UNSUSPEND already suspended channels */
- if (!ci->HasFlag(CI_SUSPENDED))
+ if (!ci->HasExt("SUSPENDED"))
{
- source.Reply(_("Couldn't release channel \002%s\002!"), ci->name.c_str());
+ source.Reply(_("Channel \2%s\2 isn't suspended."), ci->name.c_str());
return;
}
- Anope::string *by = ci->GetExt<ExtensibleItemClass<Anope::string> *>("suspend_by"), *reason = ci->GetExt<ExtensibleItemClass<Anope::string> *>("suspend_reason");
+ Anope::string *by = ci->GetExt<ExtensibleItemClass<Anope::string> *>("suspend:by"), *reason = ci->GetExt<ExtensibleItemClass<Anope::string> *>("suspend:reason");
if (by != NULL)
Log(LOG_ADMIN, source, this, ci) << " which was suspended by " << *by << " for: " << (reason && !reason->empty() ? *reason : "No reason");
- ci->UnsetFlag(CI_SUSPENDED);
- ci->Shrink("suspend_by");
- ci->Shrink("suspend_reason");
- ci->Shrink("cs_suspend_expire");
+ ci->Shrink("SUSPENDED");
+ ci->Shrink("suspend:by");
+ ci->Shrink("suspend:reason");
+ ci->Shrink("suspend:expire");
source.Reply(_("Channel \002%s\002 is now released."), ci->name.c_str());
@@ -206,13 +160,12 @@ class CommandCSUnSuspend : public Command
class CSSuspend : public Module
{
- Serialize::Type chansuspend_type;
CommandCSSuspend commandcssuspend;
CommandCSUnSuspend commandcsunsuspend;
public:
CSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- chansuspend_type("ChanSuspend", ChanSuspend::Unserialize), commandcssuspend(this), commandcsunsuspend(this)
+ commandcssuspend(this), commandcsunsuspend(this)
{
this->SetAuthor("Anope");
@@ -220,40 +173,37 @@ class CSSuspend : public Module
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
}
- ~CSSuspend()
- {
- for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
- {
- ChannelInfo *ci = it->second;
- ci->Shrink("cs_suspend_expire");
- ci->Shrink("suspend_by");
- ci->Shrink("suspend_reason");
- }
- }
-
void OnPreChanExpire(ChannelInfo *ci, bool &expire) anope_override
{
- if (!ci->HasFlag(CI_SUSPENDED))
+ if (!ci->HasExt("SUSPENDED"))
return;
expire = false;
- ChanSuspend *cs = ci->GetExt<ChanSuspend *>("cs_suspend_expire");
- if (cs != NULL && cs->when < Anope::CurTime)
+ Anope::string *str = ci->GetExt<ExtensibleItemClass<Anope::string> *>("suspend:expire");
+ if (str == NULL)
+ return;
+
+ try
{
- ci->last_used = Anope::CurTime;
- ci->UnsetFlag(CI_SUSPENDED);
- ci->Shrink("cs_suspend_expire");
- ci->Shrink("suspend_by");
- ci->Shrink("suspend_reason");
+ time_t when = convertTo<time_t>(*str);
+ if (when < Anope::CurTime)
+ {
+ ci->last_used = Anope::CurTime;
+ ci->Shrink("SUSPENDED");
+ ci->Shrink("suspend:expire");
+ ci->Shrink("suspend:by");
+ ci->Shrink("suspend:reason");
- Log(LOG_NORMAL, "expire", ChanServ) << "Expiring suspend for " << ci->name;
+ Log(LOG_NORMAL, "expire", ChanServ) << "Expiring suspend for " << ci->name;
+ }
}
+ catch (const ConvertException &) { }
}
EventReturn OnCheckKick(User *u, ChannelInfo *ci, Anope::string &mask, Anope::string &reason) anope_override
{
- if (u->HasMode(UMODE_OPER) || !ci->HasFlag(CI_SUSPENDED))
+ if (u->HasMode("OPER") || !ci->HasExt("SUSPENDED"))
return EVENT_CONTINUE;
reason = Language::Translate(u, _("This channel may not be used."));
diff --git a/modules/commands/cs_topic.cpp b/modules/commands/cs_topic.cpp
index bccece802..6518b0959 100644
--- a/modules/commands/cs_topic.cpp
+++ b/modules/commands/cs_topic.cpp
@@ -15,13 +15,13 @@ class CommandCSTopic : public Command
{
void Lock(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
- ci->SetFlag(CI_TOPICLOCK);
+ ci->ExtendMetadata("TOPICLOCK");
source.Reply(_("Topic lock option for %s is now \002on\002."), ci->name.c_str());
}
void Unlock(CommandSource &source, ChannelInfo *ci, const std::vector<Anope::string> &params)
{
- ci->UnsetFlag(CI_TOPICLOCK);
+ ci->Shrink("TOPICLOCK");
source.Reply(_("Topic lock option for %s is now \002off\002."), ci->name.c_str());
}
@@ -29,11 +29,11 @@ class CommandCSTopic : public Command
{
const Anope::string &topic = params.size() > 2 ? params[2] : "";
- bool has_topiclock = ci->HasFlag(CI_TOPICLOCK);
- ci->UnsetFlag(CI_TOPICLOCK);
+ bool has_topiclock = ci->HasExt("TOPICLOCK");
+ ci->Shrink("TOPICLOCK");
ci->c->ChangeTopic(source.GetNick(), topic, Anope::CurTime);
if (has_topiclock)
- ci->SetFlag(CI_TOPICLOCK);
+ ci->ExtendMetadata("TOPICLOCK");
bool override = !source.AccessFor(ci).HasPriv("TOPIC");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << (!topic.empty() ? "to change the topic to: " : "to unset the topic") << (!topic.empty() ? topic : "");
diff --git a/modules/commands/cs_updown.cpp b/modules/commands/cs_updown.cpp
index e219f5f86..bfd9574a9 100644
--- a/modules/commands/cs_updown.cpp
+++ b/modules/commands/cs_updown.cpp
@@ -18,9 +18,9 @@ class CommandCSUp : public Command
public:
CommandCSUp(Module *creator) : Command(creator, "chanserv/up", 0, 1)
{
- this->SetFlag(CFLAG_REQUIRE_USER);
this->SetDesc(_("Updates your status on a channel"));
this->SetSyntax(_("[\037channel\037]"));
+ this->RequireUser(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
@@ -74,9 +74,9 @@ class CommandCSDown : public Command
public:
CommandCSDown(Module *creator) : Command(creator, "chanserv/down", 0, 1)
{
- this->SetFlag(CFLAG_REQUIRE_USER);
this->SetDesc(_("Removes your status from a channel"));
this->SetSyntax(_("[\037channel\037]"));
+ this->RequireUser(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
diff --git a/modules/commands/help.cpp b/modules/commands/help.cpp
index 1bfbdeb77..890964fc9 100644
--- a/modules/commands/help.cpp
+++ b/modules/commands/help.cpp
@@ -33,7 +33,7 @@ class CommandHelp : public Command
CommandHelp(Module *creator) : Command(creator, "generic/help", 0)
{
this->SetDesc(_("Displays this list and give information about commands"));
- this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
+ this->AllowUnregistered(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
@@ -75,7 +75,7 @@ class CommandHelp : public Command
continue;
else if (!Config->HidePrivilegedCommands)
; // Always show with HidePrivilegedCommands disabled
- else if (!c->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !source.GetAccount())
+ else if (!c->AllowUnregistered() && !source.GetAccount())
continue;
else if (!info.permission.empty() && !source.HasCommand(info.permission))
continue;
@@ -166,7 +166,7 @@ class CommandHelp : public Command
source.Reply(" ");
source.Reply(_("Access to this command requires the permission \002%s\002 to be present in your opertype."), info.permission.c_str());
}
- if (!c->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !source.nc)
+ if (!c->AllowUnregistered() && !source.nc)
{
if (info.permission.empty())
source.Reply(" ");
diff --git a/modules/commands/hs_off.cpp b/modules/commands/hs_off.cpp
index 0dfd7b16b..a8066b24a 100644
--- a/modules/commands/hs_off.cpp
+++ b/modules/commands/hs_off.cpp
@@ -18,9 +18,9 @@ class CommandHSOff : public Command
public:
CommandHSOff(Module *creator) : Command(creator, "hostserv/off", 0, 0)
{
- this->SetFlag(CFLAG_REQUIRE_USER);
this->SetDesc(_("Deactivates your assigned vhost"));
this->SetSyntax("");
+ this->RequireUser(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
diff --git a/modules/commands/hs_on.cpp b/modules/commands/hs_on.cpp
index d64354b50..135b96f9a 100644
--- a/modules/commands/hs_on.cpp
+++ b/modules/commands/hs_on.cpp
@@ -18,9 +18,9 @@ class CommandHSOn : public Command
public:
CommandHSOn(Module *creator) : Command(creator, "hostserv/on", 0, 0)
{
- this->SetFlag(CFLAG_REQUIRE_USER);
this->SetDesc(_("Activates your assigned vhost"));
this->SetSyntax("");
+ this->RequireUser(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
diff --git a/modules/commands/ms_cancel.cpp b/modules/commands/ms_cancel.cpp
index 2095e5a1a..908c4ef96 100644
--- a/modules/commands/ms_cancel.cpp
+++ b/modules/commands/ms_cancel.cpp
@@ -47,7 +47,7 @@ class CommandMSCancel : public Command
else
na = NickAlias::Find(nname);
for (int i = mi->memos->size() - 1; i >= 0; --i)
- if (mi->GetMemo(i)->HasFlag(MF_UNREAD) && source.nc->display.equals_ci(mi->GetMemo(i)->sender))
+ if (mi->GetMemo(i)->unread && source.nc->display.equals_ci(mi->GetMemo(i)->sender))
{
if (ischan)
FOREACH_MOD(I_OnMemoDel, OnMemoDel(ci, mi, mi->GetMemo(i)));
diff --git a/modules/commands/ms_check.cpp b/modules/commands/ms_check.cpp
index 759c83289..98191a073 100644
--- a/modules/commands/ms_check.cpp
+++ b/modules/commands/ms_check.cpp
@@ -47,7 +47,7 @@ class CommandMSCheck : public Command
{
found = true; /* Yes, we've found the memo */
- if (mi->GetMemo(i)->HasFlag(MF_UNREAD))
+ if (mi->GetMemo(i)->unread)
source.Reply(_("The last memo you sent to %s (sent on %s) has not yet been read."), na->nick.c_str(), Anope::strftime(mi->GetMemo(i)->time).c_str());
else
source.Reply(_("The last memo you sent to %s (sent on %s) has been read."), na->nick.c_str(), Anope::strftime(mi->GetMemo(i)->time).c_str());
diff --git a/modules/commands/ms_info.cpp b/modules/commands/ms_info.cpp
index d95a9f0fe..437245f16 100644
--- a/modules/commands/ms_info.cpp
+++ b/modules/commands/ms_info.cpp
@@ -40,7 +40,7 @@ class CommandMSInfo : public Command
return;
}
mi = &na->nc->memos;
- hardmax = na->nc->HasFlag(NI_MEMO_HARDMAX) ? 1 : 0;
+ hardmax = na->nc->HasExt("MEMO_HARDMAX") ? 1 : 0;
}
else if (!nname.empty() && nname[0] == '#')
{
@@ -56,7 +56,7 @@ class CommandMSInfo : public Command
return;
}
mi = &ci->memos;
- hardmax = ci->HasFlag(CI_MEMO_HARDMAX) ? 1 : 0;
+ hardmax = ci->HasExt("MEMO_HARDMAX") ? 1 : 0;
}
else if (!nname.empty()) /* It's not a chan and we aren't services admin */
{
@@ -66,7 +66,7 @@ class CommandMSInfo : public Command
else
{
mi = &nc->memos;
- hardmax = nc->HasFlag(NI_MEMO_HARDMAX) ? 1 : 0;
+ hardmax = nc->HasExt("MEMO_HARDMAX") ? 1 : 0;
}
if (!nname.empty() && (ci || na->nc != nc))
@@ -75,7 +75,7 @@ class CommandMSInfo : public Command
source.Reply(_("%s currently has no memos."), nname.c_str());
else if (mi->memos->size() == 1)
{
- if (mi->GetMemo(0)->HasFlag(MF_UNREAD))
+ if (mi->GetMemo(0)->unread)
source.Reply(_("%s currently has \0021\002 memo, and it has not yet been read."), nname.c_str());
else
source.Reply(_("%s currently has \0021\002 memo."), nname.c_str());
@@ -84,7 +84,7 @@ class CommandMSInfo : public Command
{
unsigned count = 0, i, end;
for (i = 0, end = mi->memos->size(); i < end; ++i)
- if (mi->GetMemo(i)->HasFlag(MF_UNREAD))
+ if (mi->GetMemo(i)->unread)
++count;
if (count == mi->memos->size())
source.Reply(_("%s currently has \002%d\002 memos; all of them are unread."), nname.c_str(), count);
@@ -116,11 +116,11 @@ class CommandMSInfo : public Command
to rewrite the whole thing (it pisses me off). */
if (na)
{
- if (na->nc->HasFlag(NI_MEMO_RECEIVE) && na->nc->HasFlag(NI_MEMO_SIGNON))
+ if (na->nc->HasExt("MEMO_RECEIVE") && na->nc->HasExt("MEMO_SIGNON"))
source.Reply(_("%s is notified of new memos at logon and when they arrive."), nname.c_str());
- else if (na->nc->HasFlag(NI_MEMO_RECEIVE))
+ else if (na->nc->HasExt("MEMO_RECEIVE"))
source.Reply(_("%s is notified when new memos arrive."), nname.c_str());
- else if (na->nc->HasFlag(NI_MEMO_SIGNON))
+ else if (na->nc->HasExt("MEMO_SIGNON"))
source.Reply(_("%s is notified of news memos at logon."), nname.c_str());
else
source.Reply(_("%s is not notified of new memos."), nname.c_str());
@@ -132,7 +132,7 @@ class CommandMSInfo : public Command
source.Reply(_("You currently have no memos."));
else if (mi->memos->size() == 1)
{
- if (mi->GetMemo(0)->HasFlag(MF_UNREAD))
+ if (mi->GetMemo(0)->unread)
source.Reply(_("You currently have \0021\002 memo, and it has not yet been read."));
else
source.Reply(_("You currently have \0021\002 memo."));
@@ -141,7 +141,7 @@ class CommandMSInfo : public Command
{
unsigned count = 0, i, end;
for (i = 0, end = mi->memos->size(); i < end; ++i)
- if (mi->GetMemo(i)->HasFlag(MF_UNREAD))
+ if (mi->GetMemo(i)->unread)
++count;
if (count == mi->memos->size())
source.Reply(_("You currently have \002%d\002 memos; all of them are unread."), count);
@@ -171,11 +171,11 @@ class CommandMSInfo : public Command
source.Reply(_("You have no limit on the number of memos you may keep."));
/* Ripped too. But differently because of a seg fault (loughs) */
- if (nc->HasFlag(NI_MEMO_RECEIVE) && nc->HasFlag(NI_MEMO_SIGNON))
+ if (nc->HasExt("MEMO_RECEIVE") && nc->HasExt("MEMO_SIGNON"))
source.Reply(_("You will be notified of new memos at logon and when they arrive."));
- else if (nc->HasFlag(NI_MEMO_RECEIVE))
+ else if (nc->HasExt("MEMO_RECEIVE"))
source.Reply(_("You will be notified when new memos arrive."));
- else if (nc->HasFlag(NI_MEMO_SIGNON))
+ else if (nc->HasExt("MEMO_SIGNON"))
source.Reply(_("You will be notified of new memos at logon."));
else
source.Reply(_("You will not be notified of new memos."));
diff --git a/modules/commands/ms_list.cpp b/modules/commands/ms_list.cpp
index ccbb99cb1..3181f9dff 100644
--- a/modules/commands/ms_list.cpp
+++ b/modules/commands/ms_list.cpp
@@ -85,7 +85,7 @@ class CommandMSList : public Command
const Memo *m = mi->GetMemo(number);
ListFormatter::ListEntry entry;
- entry["Number"] = (m->HasFlag(MF_UNREAD) ? "* " : " ") + stringify(number + 1);
+ entry["Number"] = (m->unread ? "* " : " ") + stringify(number + 1);
entry["Sender"] = m->sender;
entry["Date/Time"] = Anope::strftime(m->time);
this->list.AddEntry(entry);
@@ -100,7 +100,7 @@ class CommandMSList : public Command
{
unsigned i, end;
for (i = 0, end = mi->memos->size(); i < end; ++i)
- if (mi->GetMemo(i)->HasFlag(MF_UNREAD))
+ if (mi->GetMemo(i)->unread)
break;
if (i == end)
{
@@ -114,13 +114,13 @@ class CommandMSList : public Command
for (unsigned i = 0, end = mi->memos->size(); i < end; ++i)
{
- if (!param.empty() && !mi->GetMemo(i)->HasFlag(MF_UNREAD))
+ if (!param.empty() && !mi->GetMemo(i)->unread)
continue;
const Memo *m = mi->GetMemo(i);
ListFormatter::ListEntry entry;
- entry["Number"] = (m->HasFlag(MF_UNREAD) ? "* " : " ") + stringify(i + 1);
+ entry["Number"] = (m->unread ? "* " : " ") + stringify(i + 1);
entry["Sender"] = m->sender;
entry["Date/Time"] = Anope::strftime(m->time);
list.AddEntry(entry);
diff --git a/modules/commands/ms_read.cpp b/modules/commands/ms_read.cpp
index 51bcb1b1f..14b952922 100644
--- a/modules/commands/ms_read.cpp
+++ b/modules/commands/ms_read.cpp
@@ -47,7 +47,7 @@ static void rsend_notify(CommandSource &source, MemoInfo *mi, Memo *m, const Ano
}
/* Remove receipt flag from the original memo */
- m->UnsetFlag(MF_RECEIPT);
+ m->receipt = false;
}
class MemoListCallback : public NumberList
@@ -76,10 +76,10 @@ class MemoListCallback : public NumberList
else
source.Reply(_("Memo %d from %s (%s). To delete, type: \002%s%s DEL %d\002"), index + 1, m->sender.c_str(), Anope::strftime(m->time).c_str(), Config->UseStrictPrivMsgString.c_str(), Config->MemoServ.c_str(), index + 1);
source.Reply("%s", m->text.c_str());
- m->UnsetFlag(MF_UNREAD);
+ m->unread = false;
/* Check if a receipt notification was requested */
- if (m->HasFlag(MF_RECEIPT))
+ if (m->receipt)
rsend_notify(source, mi, m, ci ? ci->name : source.GetNick());
}
};
@@ -138,7 +138,7 @@ class CommandMSRead : public Command
{
int readcount = 0;
for (i = 0, end = mi->memos->size(); i < end; ++i)
- if (mi->GetMemo(i)->HasFlag(MF_UNREAD))
+ if (mi->GetMemo(i)->unread)
{
MemoListCallback::DoRead(source, mi, ci, i);
++readcount;
diff --git a/modules/commands/ms_rsend.cpp b/modules/commands/ms_rsend.cpp
index 3a4a7ef35..19bd80437 100644
--- a/modules/commands/ms_rsend.cpp
+++ b/modules/commands/ms_rsend.cpp
@@ -68,7 +68,7 @@ class CommandMSRSend : public Command
throw CoreException("NULL mi in ms_rsend");
Memo *m = (mi->memos->size() ? mi->GetMemo(mi->memos->size() - 1) : NULL);
if (m != NULL)
- m->SetFlag(MF_RECEIPT);
+ m->receipt = true;
}
}
diff --git a/modules/commands/ms_set.cpp b/modules/commands/ms_set.cpp
index 548c35b7b..99cb8f28e 100644
--- a/modules/commands/ms_set.cpp
+++ b/modules/commands/ms_set.cpp
@@ -23,27 +23,27 @@ class CommandMSSet : public Command
if (param.equals_ci("ON"))
{
- nc->SetFlag(NI_MEMO_SIGNON);
- nc->SetFlag(NI_MEMO_RECEIVE);
+ nc->ExtendMetadata("MEMO_SIGNON");
+ nc->ExtendMetadata("MEMO_RECEIVE");
source.Reply(_("%s will now notify you of memos when you log on and when they are sent to you."), Config->MemoServ.c_str());
}
else if (param.equals_ci("LOGON"))
{
- nc->SetFlag(NI_MEMO_SIGNON);
- nc->UnsetFlag(NI_MEMO_RECEIVE);
+ nc->ExtendMetadata("MEMO_SIGNON");
+ nc->Shrink("MEMO_RECEIVE");
source.Reply(_("%s will now notify you of memos when you log on or unset /AWAY."), Config->MemoServ.c_str());
}
else if (param.equals_ci("NEW"))
{
- nc->UnsetFlag(NI_MEMO_SIGNON);
- nc->SetFlag(NI_MEMO_RECEIVE);
+ nc->Shrink("MEMO_SIGNON");
+ nc->ExtendMetadata("MEMO_RECEIVE");
source.Reply(_("%s will now notify you of memos when they are sent to you."), Config->MemoServ.c_str());
}
else if (param.equals_ci("MAIL"))
{
if (!nc->email.empty())
{
- nc->SetFlag(NI_MEMO_MAIL);
+ nc->ExtendMetadata("MEMO_MAIL");
source.Reply(_("You will now be informed about new memos via email."));
}
else
@@ -51,14 +51,14 @@ class CommandMSSet : public Command
}
else if (param.equals_ci("NOMAIL"))
{
- nc->UnsetFlag(NI_MEMO_MAIL);
+ nc->Shrink("MEMO_MAIL");
source.Reply(_("You will no longer be informed via email."));
}
else if (param.equals_ci("OFF"))
{
- nc->UnsetFlag(NI_MEMO_SIGNON);
- nc->UnsetFlag(NI_MEMO_RECEIVE);
- nc->UnsetFlag(NI_MEMO_MAIL);
+ nc->Shrink("MEMO_SIGNON");
+ nc->Shrink("MEMO_RECEIVE");
+ nc->Shrink("MEMO_MAIL");
source.Reply(_("%s will not send you any notification of memos."), Config->MemoServ.c_str());
}
else
@@ -123,16 +123,16 @@ class CommandMSSet : public Command
if (!chan.empty())
{
if (!p2.empty())
- ci->SetFlag(CI_MEMO_HARDMAX);
+ ci->ExtendMetadata("MEMO_HARDMAX");
else
- ci->UnsetFlag(CI_MEMO_HARDMAX);
+ ci->Shrink("MEMO_HARDMAX");
}
else
{
if (!p2.empty())
- nc->SetFlag(NI_MEMO_HARDMAX);
+ nc->ExtendMetadata("MEMO_HARDMAX");
else
- nc->UnsetFlag(NI_MEMO_HARDMAX);
+ nc->Shrink("MEMO_HARDMAX");
}
limit = -1;
try
@@ -148,12 +148,12 @@ class CommandMSSet : public Command
this->OnSyntaxError(source, "");
return;
}
- if (!chan.empty() && ci->HasFlag(CI_MEMO_HARDMAX))
+ if (!chan.empty() && ci->HasExt("MEMO_HARDMAX"))
{
source.Reply(_("The memo limit for %s may not be changed."), chan.c_str());
return;
}
- else if (chan.empty() && nc->HasFlag(NI_MEMO_HARDMAX))
+ else if (chan.empty() && nc->HasExt("MEMO_HARDMAX"))
{
source.Reply(_("You are not permitted to change your memo limit."));
return;
diff --git a/modules/commands/ns_access.cpp b/modules/commands/ns_access.cpp
index 564d4a9e3..c37f17926 100644
--- a/modules/commands/ns_access.cpp
+++ b/modules/commands/ns_access.cpp
@@ -135,7 +135,7 @@ class CommandNSAccess : public Command
source.Reply(BAD_USERHOST_MASK);
source.Reply(MORE_INFO, Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str(), this->name.c_str());
}
- else if (nc->HasFlag(NI_SUSPENDED))
+ else if (nc->HasExt("SUSPENDED"))
source.Reply(NICK_X_SUSPENDED, nc->display.c_str());
else if (cmd.equals_ci("ADD"))
return this->DoAdd(source, nc, mask);
diff --git a/modules/commands/ns_ajoin.cpp b/modules/commands/ns_ajoin.cpp
index 5db4e4c8b..efb4c7b9f 100644
--- a/modules/commands/ns_ajoin.cpp
+++ b/modules/commands/ns_ajoin.cpp
@@ -268,28 +268,28 @@ class NSAJoin : public Module
if (ci != NULL)
{
- if (ci->HasFlag(CI_SUSPENDED))
+ if (ci->HasExt("SUSPENDED"))
continue;
}
if (c != NULL)
{
if (c->FindUser(u) != NULL)
continue;
- else if (c->HasMode(CMODE_OPERONLY) && !u->HasMode(UMODE_OPER))
+ else if (c->HasMode("OPERONLY") && !u->HasMode("OPER"))
continue;
- else if (c->HasMode(CMODE_ADMINONLY) && !u->HasMode(UMODE_ADMIN))
+ else if (c->HasMode("ADMINONLY") && !u->HasMode("ADMIN"))
continue;
- else if (c->HasMode(CMODE_SSL) && !u->HasMode(UMODE_SSL))
+ else if (c->HasMode("SSL") && !u->HasMode("SSL"))
continue;
- else if (c->MatchesList(u, CMODE_BAN) == true && c->MatchesList(u, CMODE_EXCEPT) == false)
+ else if (c->MatchesList(u, "BAN") == true && c->MatchesList(u, "EXCEPT") == false)
need_invite = true;
- else if (c->HasMode(CMODE_INVITE) && c->MatchesList(u, CMODE_INVITEOVERRIDE) == false)
+ else if (c->HasMode("INVITE") && c->MatchesList(u, "INVITEOVERRIDE") == false)
need_invite = true;
- if (c->HasMode(CMODE_KEY))
+ if (c->HasMode("KEY"))
{
Anope::string k;
- if (c->GetParam(CMODE_KEY, k))
+ if (c->GetParam("KEY", k))
{
if (ci->AccessFor(u).HasPriv("GETKEY"))
key = k;
@@ -297,10 +297,10 @@ class NSAJoin : public Module
need_invite = true;
}
}
- if (c->HasMode(CMODE_LIMIT))
+ if (c->HasMode("LIMIT"))
{
Anope::string l;
- if (c->GetParam(CMODE_LIMIT, l))
+ if (c->GetParam("LIMIT", l))
{
try
{
diff --git a/modules/commands/ns_alist.cpp b/modules/commands/ns_alist.cpp
index 227eac0f5..6d3bebdc9 100644
--- a/modules/commands/ns_alist.cpp
+++ b/modules/commands/ns_alist.cpp
@@ -55,7 +55,7 @@ class CommandNSAList : public Command
{
++chan_count;
entry["Number"] = stringify(chan_count);
- entry["Channel"] = (ci->HasFlag(CI_NO_EXPIRE) ? "!" : "") + ci->name;
+ entry["Channel"] = (ci->HasExt("NO_EXPIRE") ? "!" : "") + ci->name;
entry["Access"] = "Founder";
list.AddEntry(entry);
continue;
@@ -68,7 +68,7 @@ class CommandNSAList : public Command
++chan_count;
entry["Number"] = stringify(chan_count);
- entry["Channel"] = (ci->HasFlag(CI_NO_EXPIRE) ? "!" : "") + ci->name;
+ entry["Channel"] = (ci->HasExt("NO_EXPIRE") ? "!" : "") + ci->name;
for (unsigned i = 0; i < access.size(); ++i)
entry["Access"] = entry["Access"] + ", " + access[i]->AccessSerialize();
entry["Access"] = entry["Access"].substr(2);
diff --git a/modules/commands/ns_cert.cpp b/modules/commands/ns_cert.cpp
index 37f0cadc6..bbfbdd3e8 100644
--- a/modules/commands/ns_cert.cpp
+++ b/modules/commands/ns_cert.cpp
@@ -24,7 +24,7 @@ class CommandNSCert : public Command
return;
}
- if (nc->HasFlag(NI_SUSPENDED))
+ if (nc->HasExt("SUSPENDED"))
{
source.Reply(NICK_X_SUSPENDED, nc->display.c_str());
return;
@@ -157,7 +157,7 @@ class CommandNSCert : public Command
NickCore *nc = source.nc;
- if (source.nc->HasFlag(NI_SUSPENDED))
+ if (source.nc->HasExt("SUSPENDED"))
source.Reply(NICK_X_SUSPENDED, source.nc->display.c_str());
else if (cmd.equals_ci("ADD"))
return this->DoAdd(source, nc, mask);
@@ -207,7 +207,7 @@ class NSCert : public Module
return;
if (u->IsIdentified() && u->Account() == na->nc)
return;
- if (na->nc->HasFlag(NI_SUSPENDED))
+ if (na->nc->HasExt("SUSPENDED"))
return;
if (!na->nc->FindCert(u->fingerprint))
return;
diff --git a/modules/commands/ns_group.cpp b/modules/commands/ns_group.cpp
index 7bffbb910..9ce8ebc95 100644
--- a/modules/commands/ns_group.cpp
+++ b/modules/commands/ns_group.cpp
@@ -46,8 +46,8 @@ class NSGroupRequest : public IdentifyRequest
u->Login(target->nc);
IRCD->SendLogin(u);
- if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false)
- u->SetMode(NickServ, UMODE_REGISTERED);
+ if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasExt("UNCONFIRMED") == false)
+ u->SetMode(NickServ, "REGISTERED");
FOREACH_MOD(I_OnNickGroup, OnNickGroup(u, target));
Log(LOG_COMMAND, source, cmd) << "makes " << nick << " join group of " << target->nick << " (" << target->nc->display << ") (email: " << (!target->nc->email.empty() ? target->nc->email : "none") << ")";
@@ -78,10 +78,10 @@ class CommandNSGroup : public Command
public:
CommandNSGroup(Module *creator) : Command(creator, "nickserv/group", 1, 2)
{
- this->SetFlag(CFLAG_REQUIRE_USER);
- this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
this->SetDesc(_("Join a group"));
this->SetSyntax(_("\037target\037 \037password\037"));
+ this->AllowUnregistered(true);
+ this->RequireUser(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
@@ -107,7 +107,7 @@ class CommandNSGroup : public Command
{
Oper *o = Config->Opers[i];
- if (!u->HasMode(UMODE_OPER) && u->nick.find_ci(o->name) != Anope::string::npos)
+ if (!u->HasMode("OPER") && u->nick.find_ci(o->name) != Anope::string::npos)
{
source.Reply(NICK_CANNOT_BE_REGISTERED, u->nick.c_str());
return;
@@ -119,7 +119,7 @@ class CommandNSGroup : public Command
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
else if (Anope::CurTime < u->lastnickreg + Config->NSRegDelay)
source.Reply(_("Please wait %d seconds before using the GROUP command again."), (Config->NSRegDelay + u->lastnickreg) - Anope::CurTime);
- else if (target->nc->HasFlag(NI_SUSPENDED))
+ else if (target->nc->HasExt("SUSPENDED"))
{
Log(LOG_COMMAND, source, this) << "tried to use GROUP for SUSPENDED nick " << target->nick;
source.Reply(NICK_X_SUSPENDED, target->nick.c_str());
@@ -203,9 +203,9 @@ class CommandNSUngroup : public Command
public:
CommandNSUngroup(Module *creator) : Command(creator, "nickserv/ungroup", 0, 1)
{
- this->SetFlag(CFLAG_REQUIRE_USER);
this->SetDesc(_("Remove a nick from a group"));
this->SetSyntax(_("[\037nick\037]"));
+ this->RequireUser(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
@@ -247,7 +247,7 @@ class CommandNSUngroup : public Command
User *user = User::Find(na->nick);
if (user)
/* The user on the nick who was ungrouped may be identified to the old group, set -r */
- user->RemoveMode(NickServ, UMODE_REGISTERED);
+ user->RemoveMode(NickServ, "REGISTERED");
}
return;
@@ -308,7 +308,7 @@ class CommandNSGList : public Command
ListFormatter::ListEntry entry;
entry["Nick"] = na2->nick;
- entry["Expires"] = (na2->HasFlag(NS_NO_EXPIRE) || !Config->NSExpire) ? "Does not expire" : ("expires in " + Anope::strftime(na2->last_seen + Config->NSExpire));
+ entry["Expires"] = (na2->HasExt("NO_EXPIRE") || !Config->NSExpire) ? "Does not expire" : ("expires in " + Anope::strftime(na2->last_seen + Config->NSExpire));
list.AddEntry(entry);
}
diff --git a/modules/commands/ns_identify.cpp b/modules/commands/ns_identify.cpp
index 97f217c6d..adbe97de5 100644
--- a/modules/commands/ns_identify.cpp
+++ b/modules/commands/ns_identify.cpp
@@ -64,10 +64,10 @@ class CommandNSIdentify : public Command
public:
CommandNSIdentify(Module *creator) : Command(creator, "nickserv/identify", 1, 2)
{
- this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
- this->SetFlag(CFLAG_REQUIRE_USER);
this->SetDesc(_("Identify yourself with your password"));
this->SetSyntax(_("[\037account\037] \037password\037"));
+ this->AllowUnregistered(true);
+ this->RequireUser(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
@@ -78,7 +78,7 @@ class CommandNSIdentify : public Command
Anope::string pass = params[params.size() - 1];
NickAlias *na = NickAlias::Find(nick);
- if (na && na->nc->HasFlag(NI_SUSPENDED))
+ if (na && na->nc->HasExt("SUSPENDED"))
source.Reply(NICK_X_SUSPENDED, na->nick.c_str());
else if (u->Account() && na && u->Account() == na->nc)
source.Reply(_("You are already identified."));
diff --git a/modules/commands/ns_info.cpp b/modules/commands/ns_info.cpp
index 21ff0e413..56dbd47f8 100644
--- a/modules/commands/ns_info.cpp
+++ b/modules/commands/ns_info.cpp
@@ -16,9 +16,9 @@
class CommandNSInfo : public Command
{
private:
- template<typename T> void CheckOptStr(NickCore *core, Anope::string &buf, T opt, const char *str, const Flags<T> *nc, bool reverse_logic = false)
+ void CheckOptStr(NickCore *core, Anope::string &buf, const Anope::string &opt, const char *str, const Extensible *e, bool reverse_logic = false)
{
- if (reverse_logic ? !nc->HasFlag(opt) : nc->HasFlag(opt))
+ if (reverse_logic != e->HasExt(opt))
{
if (!buf.empty())
buf += ", ";
@@ -29,9 +29,9 @@ class CommandNSInfo : public Command
public:
CommandNSInfo(Module *creator) : Command(creator, "nickserv/info", 0, 2)
{
- this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
this->SetDesc(_("Displays information about a given nickname"));
this->SetSyntax(_("[\037nickname\037]"));
+ this->AllowUnregistered(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
@@ -62,10 +62,10 @@ class CommandNSInfo : public Command
source.Reply(_("%s is %s"), na->nick.c_str(), na->last_realname.c_str());
- if (na->nc->HasFlag(NI_UNCONFIRMED))
+ if (na->nc->HasExt("UNCONFIRMED"))
source.Reply(_("%s nickname is unconfirmed."), na->nick.c_str());
- if (na->nc->IsServicesOper() && (show_hidden || !na->nc->HasFlag(NI_HIDE_STATUS)))
+ if (na->nc->IsServicesOper() && (show_hidden || !na->nc->HasExt("HIDE_STATUS")))
source.Reply(_("%s is a services operator of type %s."), na->nick.c_str(), na->nc->o->ot->GetName().c_str());
InfoFormatter info(source.nc);
@@ -74,14 +74,14 @@ class CommandNSInfo : public Command
{
if (show_hidden && !na->last_realhost.empty())
info[_("Online from")] = na->last_realhost;
- if (show_hidden || !na->nc->HasFlag(NI_HIDE_MASK))
+ if (show_hidden || !na->nc->HasExt("HIDE_MASK"))
info[_("Online from")] = na->last_usermask;
else
source.Reply(_("%s is currently online."), na->nick.c_str());
}
else
{
- if (show_hidden || !na->nc->HasFlag(NI_HIDE_MASK))
+ if (show_hidden || !na->nc->HasExt("HIDE_MASK"))
info[_("Last seen address")] = na->last_usermask;
if (show_hidden && !na->last_realhost.empty())
info[_("Last seen address")] = na->last_realhost;
@@ -92,10 +92,10 @@ class CommandNSInfo : public Command
if (!nick_online)
info[_("Last seen")] = Anope::strftime(na->last_seen);
- if (!na->last_quit.empty() && (show_hidden || !na->nc->HasFlag(NI_HIDE_QUIT)))
+ if (!na->last_quit.empty() && (show_hidden || !na->nc->HasExt("HIDE_QUIT")))
info[_("Last quit message")] = na->last_quit;
- if (!na->nc->email.empty() && (show_hidden || !na->nc->HasFlag(NI_HIDE_EMAIL)))
+ if (!na->nc->email.empty() && (show_hidden || !na->nc->HasExt("HIDE_EMAIL")))
info[_("Email address")] = na->nc->email;
if (show_hidden)
@@ -113,20 +113,20 @@ class CommandNSInfo : public Command
Anope::string optbuf;
- CheckOptStr<NickCoreFlag>(source.nc, optbuf, NI_KILLPROTECT, _("Protection"), na->nc);
- CheckOptStr<NickCoreFlag>(source.nc, optbuf, NI_SECURE, _("Security"), na->nc);
- CheckOptStr<NickCoreFlag>(source.nc, optbuf, NI_PRIVATE, _("Private"), na->nc);
- CheckOptStr<NickCoreFlag>(source.nc, optbuf, NI_MSG, _("Message mode"), na->nc);
- CheckOptStr<NickCoreFlag>(source.nc, optbuf, NI_AUTOOP, _("Auto-op"), na->nc);
- CheckOptStr<NickCoreFlag>(source.nc, optbuf, NI_SUSPENDED, _("Suspended"), na->nc);
- CheckOptStr<NickCoreFlag>(source.nc, optbuf, NI_STATS, _("Chanstats"), na->nc);
- CheckOptStr<NickNameFlag>(source.nc, optbuf, NS_NO_EXPIRE, _("No expire"), na);
+ CheckOptStr(source.nc, optbuf, "KILLPROTECT", _("Protection"), na->nc);
+ CheckOptStr(source.nc, optbuf, "SECURE", _("Security"), na->nc);
+ CheckOptStr(source.nc, optbuf, "PRIVATE", _("Private"), na->nc);
+ CheckOptStr(source.nc, optbuf, "MSG", _("Message mode"), na->nc);
+ CheckOptStr(source.nc, optbuf, "AUTOOP", _("Auto-op"), na->nc);
+ CheckOptStr(source.nc, optbuf, "SUSPENDED", _("Suspended"), na->nc);
+ CheckOptStr(source.nc, optbuf, "STATS", _("Chanstats"), na->nc);
+ CheckOptStr(source.nc, optbuf, "NO_EXPIRE", _("No expire"), na);
info[_("Options")] = optbuf.empty() ? _("None") : optbuf;
- if (na->nc->HasFlag(NI_UNCONFIRMED) == false)
+ if (na->nc->HasExt("UNCONFIRMED") == false)
{
- if (na->HasFlag(NS_NO_EXPIRE) || !Config->NSExpire)
+ if (na->HasExt("NO_EXPIRE") || !Config->NSExpire)
;
else
info[_("Expires")] = Anope::strftime(na->last_seen + Config->NSExpire);
diff --git a/modules/commands/ns_list.cpp b/modules/commands/ns_list.cpp
index 0ec05d407..4d59c5b0f 100644
--- a/modules/commands/ns_list.cpp
+++ b/modules/commands/ns_list.cpp
@@ -80,13 +80,13 @@ class CommandNSList : public Command
const NickAlias *na = it->second;
/* Don't show private nicks to non-services admins. */
- if (na->nc->HasFlag(NI_PRIVATE) && !is_servadmin && na->nc != mync)
+ if (na->nc->HasExt("PRIVATE") && !is_servadmin && na->nc != mync)
continue;
- else if (nsnoexpire && !na->HasFlag(NS_NO_EXPIRE))
+ else if (nsnoexpire && !na->HasExt("NO_EXPIRE"))
continue;
- else if (suspended && !na->nc->HasFlag(NI_SUSPENDED))
+ else if (suspended && !na->nc->HasExt("SUSPENDED"))
continue;
- else if (unconfirmed && !na->nc->HasFlag(NI_UNCONFIRMED))
+ else if (unconfirmed && !na->nc->HasExt("UNCONFIRMED"))
continue;
/* We no longer compare the pattern against the output buffer.
@@ -98,16 +98,16 @@ class CommandNSList : public Command
if (((count + 1 >= from && count + 1 <= to) || (!from && !to)) && ++nnicks <= Config->NSListMax)
{
bool isnoexpire = false;
- if (is_servadmin && na->HasFlag(NS_NO_EXPIRE))
+ if (is_servadmin && na->HasExt("NO_EXPIRE"))
isnoexpire = true;
ListFormatter::ListEntry entry;
entry["Nick"] = (isnoexpire ? "!" : "") + na->nick;
- if (na->nc->HasFlag(NI_HIDE_MASK) && !is_servadmin && na->nc != mync)
+ if (na->nc->HasExt("HIDE_MASK") && !is_servadmin && na->nc != mync)
entry["Last usermask"] = "[Hostname hidden]";
- else if (na->nc->HasFlag(NI_SUSPENDED))
+ else if (na->nc->HasExt("SUSPENDED"))
entry["Last usermask"] = "[Suspended]";
- else if (na->nc->HasFlag(NI_UNCONFIRMED))
+ else if (na->nc->HasExt("UNCONFIRMED"))
entry["Last usermask"] = "[Unconfirmed]";
else
entry["Last usermask"] = na->last_usermask;
diff --git a/modules/commands/ns_logout.cpp b/modules/commands/ns_logout.cpp
index 4fd00d57b..018d34128 100644
--- a/modules/commands/ns_logout.cpp
+++ b/modules/commands/ns_logout.cpp
@@ -53,7 +53,7 @@ class CommandNSLogout : public Command
source.Reply(_("Your nick has been logged out."));
IRCD->SendLogout(u2);
- u2->RemoveMode(NickServ, UMODE_REGISTERED);
+ u2->RemoveMode(NickServ, "REGISTERED");
u2->Logout();
/* Send out an event */
diff --git a/modules/commands/ns_recover.cpp b/modules/commands/ns_recover.cpp
index a0b88f763..184d88588 100644
--- a/modules/commands/ns_recover.cpp
+++ b/modules/commands/ns_recover.cpp
@@ -37,7 +37,7 @@ class NSRecoverRequest : public IdentifyRequest
Log(LOG_COMMAND, source, cmd) << "for " << na->nick;
/* Nick is being held by us, release it */
- if (na->HasFlag(NS_HELD))
+ if (na->HasExt("HELD"))
{
na->Release();
source.Reply(_("Service's hold on \002%s\002 has been released."), na->nick.c_str());
@@ -50,7 +50,7 @@ class NSRecoverRequest : public IdentifyRequest
// same person that is executing the command, so kill them off (old GHOST command).
else if (u->Account() == na->nc)
{
- if (!source.GetAccount() && na->nc->HasFlag(NI_SECURE))
+ if (!source.GetAccount() && na->nc->HasExt("SECURE"))
{
source.GetUser()->Login(u->Account());
Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << u->Account()->display;
@@ -83,7 +83,7 @@ class NSRecoverRequest : public IdentifyRequest
/* User is not identified or not identified to the same account as the person using this command */
else
{
- if (!source.GetAccount() && na->nc->HasFlag(NI_SECURE))
+ if (!source.GetAccount() && na->nc->HasExt("SECURE"))
{
source.GetUser()->Login(na->nc); // Identify the user using the command if they arent identified
Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << na->nick << " (" << na->nc->display << ")";
@@ -126,9 +126,9 @@ class CommandNSRecover : public Command
public:
CommandNSRecover(Module *creator) : Command(creator, "nickserv/recover", 1, 2)
{
- this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
this->SetDesc(_("Regains control of your nick"));
this->SetSyntax("\037nickname\037 [\037password\037]");
+ this->AllowUnregistered(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
@@ -151,7 +151,7 @@ class CommandNSRecover : public Command
source.Reply(NICK_X_NOT_REGISTERED, nick.c_str());
return;
}
- else if (na->nc->HasFlag(NI_SUSPENDED))
+ else if (na->nc->HasExt("SUSPENDED"))
{
source.Reply(NICK_X_SUSPENDED, na->nick.c_str());
return;
@@ -160,7 +160,7 @@ class CommandNSRecover : public Command
bool ok = false;
if (source.GetAccount() == na->nc)
ok = true;
- else if (!na->nc->HasFlag(NI_SECURE) && source.GetUser() && na->nc->IsOnAccess(source.GetUser()))
+ else if (!na->nc->HasExt("SECURE") && source.GetUser() && na->nc->IsOnAccess(source.GetUser()))
ok = true;
else if (source.GetUser() && !source.GetUser()->fingerprint.empty() && na->nc->FindCert(source.GetUser()->fingerprint))
ok = true;
@@ -265,9 +265,8 @@ class NSRecover : public Module
std::map<Anope::string, ChannelStatus>::iterator it = ei->find(c->name);
if (it != ei->end())
{
- for (size_t j = CMODE_BEGIN + 1; j < CMODE_END; ++j)
- if (it->second.HasFlag(static_cast<ChannelModeName>(j)))
- c->SetMode(c->ci->WhoSends(), ModeManager::FindChannelModeByName(static_cast<ChannelModeName>(j)), u->GetUID());
+ for (std::set<Anope::string>::iterator it2 = it->second.modes.begin(), it2_end = it->second.modes.end(); it2 != it2_end; ++it)
+ c->SetMode(c->ci->WhoSends(), ModeManager::FindChannelModeByName(*it2), u->GetUID());
ei->erase(it);
if (ei->empty())
diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp
index 2e1a884f2..852f0110d 100644
--- a/modules/commands/ns_register.cpp
+++ b/modules/commands/ns_register.cpp
@@ -20,25 +20,25 @@ class CommandNSConfirm : public Command
public:
CommandNSConfirm(Module *creator) : Command(creator, "nickserv/confirm", 1, 2)
{
- this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
this->SetDesc(_("Confirm an auth code"));
this->SetSyntax(_("\037passcode\037"));
+ this->AllowUnregistered(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
{
const Anope::string &passcode = params[0];
- if (source.nc && !source.nc->HasFlag(NI_UNCONFIRMED) && source.HasPriv("nickserv/confirm"))
+ if (source.nc && !source.nc->HasExt("UNCONFIRMED") && source.HasPriv("nickserv/confirm"))
{
NickAlias *na = NickAlias::Find(passcode);
if (na == NULL)
source.Reply(NICK_X_NOT_REGISTERED, passcode.c_str());
- else if (na->nc->HasFlag(NI_UNCONFIRMED) == false)
+ else if (na->nc->HasExt("UNCONFIRMED") == false)
source.Reply(_("Nick \002%s\002 is already confirmed."), na->nick.c_str());
else
{
- na->nc->UnsetFlag(NI_UNCONFIRMED);
+ na->nc->Shrink("UNCONFIRMED");
Log(LOG_ADMIN, source, this) << "to confirm nick " << na->nick << " (" << na->nc->display << ")";
source.Reply(_("Nick \002%s\002 has been confirmed."), na->nick.c_str());
}
@@ -52,14 +52,14 @@ class CommandNSConfirm : public Command
nc->Shrink("ns_register_passcode");
Log(LOG_COMMAND, source, this) << "to confirm their email";
source.Reply(_("Your email address of \002%s\002 has been confirmed."), source.nc->email.c_str());
- nc->UnsetFlag(NI_UNCONFIRMED);
+ nc->Shrink("UNCONFIRMED");
if (source.GetUser())
{
IRCD->SendLogin(source.GetUser());
const NickAlias *na = NickAlias::Find(source.GetNick());
- if (!Config->NoNicknameOwnership && na != NULL && na->nc == source.GetAccount() && na->nc->HasFlag(NI_UNCONFIRMED) == false)
- source.GetUser()->SetMode(NickServ, UMODE_REGISTERED);
+ if (!Config->NoNicknameOwnership && na != NULL && na->nc == source.GetAccount() && na->nc->HasExt("UNCONFIRMED") == false)
+ source.GetUser()->SetMode(NickServ, "REGISTERED");
}
}
else
@@ -100,12 +100,12 @@ class CommandNSRegister : public Command
public:
CommandNSRegister(Module *creator) : Command(creator, "nickserv/register", 1, 2)
{
- this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
this->SetDesc(_("Register a nickname"));
if (Config->NSForceEmail)
this->SetSyntax(_("\037password\037 \037email\037"));
else
this->SetSyntax(_("\037password\037 \037[email]\037"));
+ this->AllowUnregistered(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
@@ -130,7 +130,7 @@ class CommandNSRegister : public Command
return;
}
- if (u && !u->HasMode(UMODE_OPER) && Config->NickRegDelay && Anope::CurTime - u->timestamp < Config->NickRegDelay)
+ if (u && !u->HasMode("OPER") && Config->NickRegDelay && Anope::CurTime - u->timestamp < Config->NickRegDelay)
{
source.Reply(_("You must have been using this nick for at least %d seconds to register."), Config->NickRegDelay);
return;
@@ -211,12 +211,12 @@ class CommandNSRegister : public Command
if (Config->NSRegistration.equals_ci("admin"))
{
- nc->SetFlag(NI_UNCONFIRMED);
+ nc->ExtendMetadata("UNCONFIRMED");
source.Reply(_("All new accounts must be validated by an administrator. Please wait for your registration to be confirmed."));
}
else if (Config->NSRegistration.equals_ci("mail"))
{
- nc->SetFlag(NI_UNCONFIRMED);
+ nc->ExtendMetadata("UNCONFIRMED");
if (SendRegmail(u, na, source.service))
{
source.Reply(_("A passcode has been sent to %s, please type %s%s confirm <passcode> to confirm your email address."), email.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str());
@@ -228,8 +228,8 @@ class CommandNSRegister : public Command
if (u)
{
IRCD->SendLogin(u);
- if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false)
- u->SetMode(NickServ, UMODE_REGISTERED);
+ if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasExt("UNCONFIRMED") == false)
+ u->SetMode(NickServ, "REGISTERED");
}
}
@@ -294,7 +294,7 @@ class CommandNSResend : public Command
if (na == NULL)
source.Reply(NICK_NOT_REGISTERED);
- else if (na->nc != source.GetAccount() || source.nc->HasFlag(NI_UNCONFIRMED) == false)
+ else if (na->nc != source.GetAccount() || source.nc->HasExt("UNCONFIRMED") == false)
source.Reply(_("Your account is already confirmed."));
else
{
diff --git a/modules/commands/ns_resetpass.cpp b/modules/commands/ns_resetpass.cpp
index d09cb6418..03f3186e3 100644
--- a/modules/commands/ns_resetpass.cpp
+++ b/modules/commands/ns_resetpass.cpp
@@ -20,9 +20,9 @@ class CommandNSResetPass : public Command
public:
CommandNSResetPass(Module *creator) : Command(creator, "nickserv/resetpass", 1, 1)
{
- this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
this->SetDesc(_("Helps you reset lost passwords"));
this->SetSyntax(_("\037nickname\037"));
+ this->AllowUnregistered(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
@@ -106,7 +106,7 @@ class NSResetPass : public Module
Log(LOG_COMMAND, source, &commandnsresetpass) << "confirmed RESETPASS to forcefully identify to " << na->nick;
- nc->UnsetFlag(NI_UNCONFIRMED);
+ nc->Shrink("UNCONFIRMED");
if (source.GetUser())
{
diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp
index 255778038..d37f7bf6f 100644
--- a/modules/commands/ns_set.cpp
+++ b/modules/commands/ns_set.cpp
@@ -223,12 +223,12 @@ class CommandNSSetAutoOp : public Command
if (param.equals_ci("ON"))
{
- nc->SetFlag(NI_AUTOOP);
+ nc->ExtendMetadata("AUTOOP");
source.Reply(_("Services will now autoop %s in channels."), nc->display.c_str());
}
else if (param.equals_ci("OFF"))
{
- nc->UnsetFlag(NI_AUTOOP);
+ nc->Shrink("AUTOOP");
source.Reply(_("Services will no longer autoop %s in channels."), nc->display.c_str());
}
else
@@ -301,12 +301,12 @@ class CommandNSSetChanstats : public Command
if (param.equals_ci("ON"))
{
- na->nc->SetFlag(NI_STATS);
+ na->nc->ExtendMetadata("STATS");
source.Reply(_("Chanstat statistics are now enabled for your nick"));
}
else if (param.equals_ci("OFF"))
{
- na->nc->UnsetFlag(NI_STATS);
+ na->nc->Shrink("STATS");
source.Reply(_("Chanstat statistics are now disabled for your nick"));
}
else
@@ -669,30 +669,29 @@ class CommandNSSetHide : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- Anope::string onmsg, offmsg;
- NickCoreFlag flag;
+ Anope::string onmsg, offmsg, flag;
if (param.equals_ci("EMAIL"))
{
- flag = NI_HIDE_EMAIL;
+ flag = "HIDE_EMAIL";
onmsg = _("The E-mail address of \002%s\002 will now be hidden from %s INFO displays.");
offmsg = _("The E-mail address of \002%s\002 will now be shown in %s INFO displays.");
}
else if (param.equals_ci("USERMASK"))
{
- flag = NI_HIDE_MASK;
+ flag = "HIDE_MASK";
onmsg = _("The last seen user@host mask of \002%s\002 will now be hidden from %s INFO displays.");
offmsg = _("The last seen user@host mask of \002%s\002 will now be shown in %s INFO displays.");
}
else if (param.equals_ci("STATUS"))
{
- flag = NI_HIDE_STATUS;
+ flag = "HIDE_STATUS";
onmsg = _("The services access status of \002%s\002 will now be hidden from %s INFO displays.");
offmsg = _("The services access status of \002%s\002 will now be shown in %s INFO displays.");
}
else if (param.equals_ci("QUIT"))
{
- flag = NI_HIDE_QUIT;
+ flag = "HIDE_QUIT";
onmsg = _("The last quit message of \002%s\002 will now be hidden from %s INFO displays.");
offmsg = _("The last quit message of \002%s\002 will now be shown in %s INFO displays.");
}
@@ -704,12 +703,12 @@ class CommandNSSetHide : public Command
if (arg.equals_ci("ON"))
{
- nc->SetFlag(flag);
+ nc->ExtendMetadata(flag);
source.Reply(onmsg.c_str(), nc->display.c_str(), Config->NickServ.c_str());
}
else if (arg.equals_ci("OFF"))
{
- nc->UnsetFlag(flag);
+ nc->Shrink(flag);
source.Reply(offmsg.c_str(), nc->display.c_str(), Config->NickServ.c_str());
}
else
@@ -799,25 +798,25 @@ class CommandNSSetKill : public Command
if (param.equals_ci("ON"))
{
- nc->SetFlag(NI_KILLPROTECT);
- nc->UnsetFlag(NI_KILL_QUICK);
- nc->UnsetFlag(NI_KILL_IMMED);
+ nc->ExtendMetadata("KILLPROTECT");
+ nc->Shrink("KILL_QUICK");
+ nc->Shrink("KILL_IMMED");
source.Reply(_("Protection is now \002on\002 for \002%s\002."), nc->display.c_str());
}
else if (param.equals_ci("QUICK"))
{
- nc->SetFlag(NI_KILLPROTECT);
- nc->SetFlag(NI_KILL_QUICK);
- nc->UnsetFlag(NI_KILL_IMMED);
+ nc->ExtendMetadata("KILLPROTECT");
+ nc->ExtendMetadata("KILL_QUICK");
+ nc->Shrink("KILL_IMMED");
source.Reply(_("Protection is now \002on\002 for \002%s\002, with a reduced delay."), nc->display.c_str());
}
else if (param.equals_ci("IMMED"))
{
if (Config->NSAllowKillImmed)
{
- nc->SetFlag(NI_KILLPROTECT);
- nc->SetFlag(NI_KILL_IMMED);
- nc->UnsetFlag(NI_KILL_QUICK);
+ nc->ExtendMetadata("KILLPROTECT");
+ nc->ExtendMetadata("KILL_IMMED");
+ nc->Shrink("KILL_QUICK");
source.Reply(_("Protection is now \002on\002 for \002%s\002, with no delay."), nc->display.c_str());
}
else
@@ -825,9 +824,9 @@ class CommandNSSetKill : public Command
}
else if (param.equals_ci("OFF"))
{
- nc->UnsetFlag(NI_KILLPROTECT);
- nc->UnsetFlag(NI_KILL_QUICK);
- nc->UnsetFlag(NI_KILL_IMMED);
+ nc->Shrink("KILLPROTECT");
+ nc->Shrink("KILL_QUICK");
+ nc->Shrink("KILL_IMMED");
source.Reply(_("Protection is now \002off\002 for \002%s\002."), nc->display.c_str());
}
else
@@ -1029,12 +1028,12 @@ class CommandNSSetMessage : public Command
if (param.equals_ci("ON"))
{
- nc->SetFlag(NI_MSG);
+ nc->ExtendMetadata("MSG");
source.Reply(_("Services will now reply to \002%s\002 with \002messages\002."), nc->display.c_str());
}
else if (param.equals_ci("OFF"))
{
- nc->UnsetFlag(NI_MSG);
+ nc->Shrink("MSG");
source.Reply(_("Services will now reply to \002%s\002 with \002notices\002."), nc->display.c_str());
}
else
@@ -1116,12 +1115,12 @@ class CommandNSSetPrivate : public Command
if (param.equals_ci("ON"))
{
- nc->SetFlag(NI_PRIVATE);
+ nc->ExtendMetadata("PRIVATE");
source.Reply(_("Private option is now \002on\002 for \002%s\002."), nc->display.c_str());
}
else if (param.equals_ci("OFF"))
{
- nc->UnsetFlag(NI_PRIVATE);
+ nc->Shrink("PRIVATE");
source.Reply(_("Private option is now \002off\002 for \002%s\002."), nc->display.c_str());
}
else
@@ -1203,12 +1202,12 @@ class CommandNSSetSecure : public Command
if (param.equals_ci("ON"))
{
- nc->SetFlag(NI_SECURE);
+ nc->ExtendMetadata("SECURE");
source.Reply(_("Secure option is now \002on\002 for \002%s\002."), nc->display.c_str());
}
else if (param.equals_ci("OFF"))
{
- nc->UnsetFlag(NI_SECURE);
+ nc->Shrink("SECURE");
source.Reply(_("Secure option is now \002off\002 for \002%s\002."), nc->display.c_str());
}
else
@@ -1286,12 +1285,12 @@ class CommandNSSASetNoexpire : public Command
if (param.equals_ci("ON"))
{
- na->SetFlag(NS_NO_EXPIRE);
+ na->ExtendMetadata("NO_EXPIRE");
source.Reply(_("Nick %s \002will not\002 expire."), na->nick.c_str());
}
else if (param.equals_ci("OFF"))
{
- na->UnsetFlag(NS_NO_EXPIRE);
+ na->Shrink("NO_EXPIRE");
source.Reply(_("Nick %s \002will\002 expire."), na->nick.c_str());
}
else
@@ -1388,7 +1387,7 @@ class NSSet : public Module
void OnNickRegister(NickAlias *na) anope_override
{
if (NSDefChanstats)
- na->nc->SetFlag(NI_STATS);
+ na->nc->ExtendMetadata("STATS");
}
EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> &params) anope_override
diff --git a/modules/commands/ns_status.cpp b/modules/commands/ns_status.cpp
index 2a8625f81..1d1637177 100644
--- a/modules/commands/ns_status.cpp
+++ b/modules/commands/ns_status.cpp
@@ -18,9 +18,9 @@ class CommandNSStatus : public Command
public:
CommandNSStatus(Module *creator) : Command(creator, "nickserv/status", 0, 16)
{
- this->SetFlag(CFLAG_ALLOW_UNREGISTERED);
this->SetDesc(_("Returns the owner status of the given nickname"));
this->SetSyntax(_("\037nickname\037..."));
+ this->AllowUnregistered(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
diff --git a/modules/commands/ns_suspend.cpp b/modules/commands/ns_suspend.cpp
index c7b36b4f5..5cf1a223a 100644
--- a/modules/commands/ns_suspend.cpp
+++ b/modules/commands/ns_suspend.cpp
@@ -13,47 +13,6 @@
#include "module.h"
-struct NickSuspend : ExtensibleItem, Serializable
-{
- Anope::string nick;
- time_t when;
-
- NickSuspend() : Serializable("NickSuspend")
- {
- }
-
- void Serialize(Serialize::Data &sd) const anope_override
- {
- sd["nick"] << this->nick;
- sd["when"] << this->when;
- }
-
- static Serializable* Unserialize(Serializable *obj, Serialize::Data &sd)
- {
- Anope::string snick;
-
- sd["nick"] >> snick;
-
- const NickAlias *na = NickAlias::Find(snick);
- if (na == NULL)
- return NULL;
-
- NickSuspend *ns;
- if (obj)
- ns = anope_dynamic_static_cast<NickSuspend *>(obj);
- else
- ns = new NickSuspend();
-
- sd["nick"] >> ns->nick;
- sd["when"] >> ns->when;
-
- if (!obj)
- na->nc->Extend("ns_suspend_expire", ns);
-
- return ns;
- }
-};
-
class CommandNSSuspend : public Command
{
public:
@@ -101,11 +60,18 @@ class CommandNSSuspend : public Command
NickCore *nc = na->nc;
- nc->SetFlag(NI_SUSPENDED);
- nc->SetFlag(NI_SECURE);
- nc->UnsetFlag(NI_KILLPROTECT);
- nc->UnsetFlag(NI_KILL_QUICK);
- nc->UnsetFlag(NI_KILL_IMMED);
+ nc->ExtendMetadata("SUSPENDED");
+ nc->ExtendMetadata("SECURE");
+ nc->Shrink("KILLPROTECT");
+ nc->Shrink("KILL_QUICK");
+ nc->Shrink("KILL_IMMED");
+
+ nc->ExtendMetadata("suspend:by", source.GetNick());
+ if (!reason.empty())
+ nc->ExtendMetadata("suspend:reason", reason);
+ if (expiry_secs > 0)
+ nc->ExtendMetadata("suspend:expire", stringify(Anope::CurTime + expiry_secs));
+
for (std::list<Serialize::Reference<NickAlias> >::iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end;)
{
@@ -124,15 +90,6 @@ class CommandNSSuspend : public Command
}
}
- if (expiry_secs > 0)
- {
- NickSuspend *ns = new NickSuspend();
- ns->nick = na->nick;
- ns->when = Anope::CurTime + expiry_secs;
-
- nc->Extend("ns_suspend_expire", ns);
- }
-
Log(LOG_ADMIN, source, this) << "for " << nick << " (" << (!reason.empty() ? reason : "No reason") << "), expires in " << (expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never");
source.Reply(_("Nick %s is now suspended."), nick.c_str());
@@ -179,14 +136,16 @@ class CommandNSUnSuspend : public Command
return;
}
- if (!na->nc->HasFlag(NI_SUSPENDED))
+ if (!na->nc->HasExt("SUSPENDED"))
{
source.Reply(_("Nick %s is not suspended."), na->nick.c_str());
return;
}
- na->nc->UnsetFlag(NI_SUSPENDED);
- na->nc->Shrink("ns_suspend_expire");
+ na->nc->Shrink("SUSPENDED");
+ na->nc->Shrink("suspend:expire");
+ na->nc->Shrink("suspend:by");
+ na->nc->Shrink("suspend:reason");
Log(LOG_ADMIN, source, this) << "for " << na->nick;
source.Reply(_("Nick %s is now released."), nick.c_str());
@@ -207,13 +166,12 @@ class CommandNSUnSuspend : public Command
class NSSuspend : public Module
{
- Serialize::Type nicksuspend_type;
CommandNSSuspend commandnssuspend;
CommandNSUnSuspend commandnsunsuspend;
public:
NSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE),
- nicksuspend_type("NickSuspend", NickSuspend::Unserialize), commandnssuspend(this), commandnsunsuspend(this)
+ commandnssuspend(this), commandnsunsuspend(this)
{
this->SetAuthor("Anope");
@@ -221,28 +179,32 @@ class NSSuspend : public Module
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
}
- ~NSSuspend()
- {
- for (nickcore_map::const_iterator it = NickCoreList->begin(), it_end = NickCoreList->end(); it != it_end; ++it)
- it->second->Shrink("ns_suspend_expire");
- }
-
void OnPreNickExpire(NickAlias *na, bool &expire) anope_override
{
- if (!na->nc->HasFlag(NI_SUSPENDED))
+ if (!na->nc->HasExt("SUSPENDED"))
return;
expire = false;
- NickSuspend *ns = na->nc->GetExt<NickSuspend *>("ns_suspend_expire");
- if (ns != NULL && ns->when < Anope::CurTime)
+ Anope::string *str = na->nc->GetExt<ExtensibleItemClass<Anope::string> *>("suspend:expire");
+ if (str == NULL)
+ return;
+
+ try
{
- na->last_seen = Anope::CurTime;
- na->nc->UnsetFlag(NI_SUSPENDED);
- na->nc->Shrink("ns_suspend_expire");
+ time_t when = convertTo<time_t>(*str);
+ if (when < Anope::CurTime)
+ {
+ na->last_seen = Anope::CurTime;
+ na->nc->Shrink("SUSPENDED");
+ na->nc->Shrink("suspend:expire");
+ na->nc->Shrink("suspend:by");
+ na->nc->Shrink("suspend:reason");
- Log(LOG_NORMAL, "expire", NickServ) << "Expiring suspend for " << na->nick;
+ Log(LOG_NORMAL, "expire", NickServ) << "Expiring suspend for " << na->nick;
+ }
}
+ catch (const ConvertException &) { }
}
};
diff --git a/modules/commands/ns_update.cpp b/modules/commands/ns_update.cpp
index e6718f3e6..309a95087 100644
--- a/modules/commands/ns_update.cpp
+++ b/modules/commands/ns_update.cpp
@@ -18,9 +18,9 @@ class CommandNSUpdate : public Command
public:
CommandNSUpdate(Module *creator) : Command(creator, "nickserv/update", 0, 0)
{
- this->SetFlag(CFLAG_REQUIRE_USER);
this->SetDesc(_("Updates your current status, i.e. it checks for new memos"));
this->SetSyntax("");
+ this->RequireUser(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
diff --git a/modules/commands/os_chankill.cpp b/modules/commands/os_chankill.cpp
index 0e711f8ca..3fea40043 100644
--- a/modules/commands/os_chankill.cpp
+++ b/modules/commands/os_chankill.cpp
@@ -76,7 +76,7 @@ class CommandOSChanKill : public Command
{
ChanUserContainer *uc = *it++;
- if (uc->user->server == Me || uc->user->HasMode(UMODE_OPER))
+ if (uc->user->server == Me || uc->user->HasMode("OPER"))
continue;
XLine *x = new XLine("*@" + uc->user->host, source.GetNick(), expires, realreason, XLineManager::GenerateUID());
diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp
index c5ee032bd..e2aa43c0b 100644
--- a/modules/commands/os_defcon.cpp
+++ b/modules/commands/os_defcon.cpp
@@ -34,9 +34,8 @@ bool DefConModesSet = false;
struct DefconConfig
{
std::vector<std::bitset<32> > DefCon;
- Flags<ChannelModeName> DefConModesOn;
- Flags<ChannelModeName> DefConModesOff;
- std::map<ChannelModeName, Anope::string> DefConModesOnParams;
+ std::set<Anope::string> DefConModesOn, DefConModesOff;
+ std::map<Anope::string, Anope::string> DefConModesOnParams;
int defaultlevel, sessionlimit;
Anope::string chanmodes, message, offmessage, akillreason;
@@ -70,19 +69,19 @@ struct DefconConfig
this->DefCon[dlevel][level] = false;
}
- bool SetDefConParam(ChannelModeName Name, const Anope::string &buf)
+ bool SetDefConParam(const Anope::string &name, const Anope::string &buf)
{
- return DefConModesOnParams.insert(std::make_pair(Name, buf)).second;
+ return DefConModesOnParams.insert(std::make_pair(name, buf)).second;
}
- void UnsetDefConParam(ChannelModeName Name)
+ void UnsetDefConParam(const Anope::string &name)
{
- DefConModesOnParams.erase(Name);
+ DefConModesOnParams.erase(name);
}
- bool GetDefConParam(ChannelModeName Name, Anope::string &buf)
+ bool GetDefConParam(const Anope::string &name, Anope::string &buf)
{
- std::map<ChannelModeName, Anope::string>::iterator it = DefConModesOnParams.find(Name);
+ std::map<Anope::string, Anope::string>::iterator it = DefConModesOnParams.find(name);
buf.clear();
@@ -260,8 +259,8 @@ class OSDefcon : public Module
spacesepstream ss(DConfig.chanmodes);
- DConfig.DefConModesOn.ClearFlags();
- DConfig.DefConModesOff.ClearFlags();
+ DConfig.DefConModesOn.clear();
+ DConfig.DefConModesOff.clear();
ss.GetToken(modes);
/* Loop while there are modes to set */
@@ -291,8 +290,8 @@ class OSDefcon : public Module
}
else if (add)
{
- DConfig.DefConModesOn.SetFlag(cm->name);
- DConfig.DefConModesOff.UnsetFlag(cm->name);
+ DConfig.DefConModesOn.insert(cm->name);
+ DConfig.DefConModesOff.erase(cm->name);
if (cm->type == MODE_PARAM)
{
@@ -310,9 +309,9 @@ class OSDefcon : public Module
DConfig.SetDefConParam(cmp->name, param);
}
}
- else if (DConfig.DefConModesOn.HasFlag(cm->name))
+ else if (DConfig.DefConModesOn.count(cm->name))
{
- DConfig.DefConModesOn.UnsetFlag(cm->name);
+ DConfig.DefConModesOn.erase(cm->name);
if (cm->type == MODE_PARAM)
DConfig.UnsetDefConParam(cm->name);
@@ -321,9 +320,9 @@ class OSDefcon : public Module
}
/* We can't mlock +L if +l is not mlocked as well. */
- if ((cm = ModeManager::FindChannelModeByName(CMODE_REDIRECT)) && DConfig.DefConModesOn.HasFlag(cm->name) && !DConfig.DefConModesOn.HasFlag(CMODE_LIMIT))
+ if ((cm = ModeManager::FindChannelModeByName("REDIRECT")) && DConfig.DefConModesOn.count(cm->name) && !DConfig.DefConModesOn.count("LIMIT"))
{
- DConfig.DefConModesOn.UnsetFlag(CMODE_REDIRECT);
+ DConfig.DefConModesOn.erase("REDIRECT");
Log(this) << "DefConChanModes must lock mode +l as well to lock mode +L";
}
@@ -412,13 +411,13 @@ class OSDefcon : public Module
this->ParseModeString();
}
- EventReturn OnChannelModeSet(Channel *c, MessageSource &, ChannelModeName Name, const Anope::string &param) anope_override
+ EventReturn OnChannelModeSet(Channel *c, MessageSource &, const Anope::string &mname, const Anope::string &param) anope_override
{
- ChannelMode *cm = ModeManager::FindChannelModeByName(Name);
+ ChannelMode *cm = ModeManager::FindChannelModeByName(mname);
- if (DConfig.Check(DEFCON_FORCE_CHAN_MODES) && cm && DConfig.DefConModesOff.HasFlag(Name))
+ if (DConfig.Check(DEFCON_FORCE_CHAN_MODES) && cm && DConfig.DefConModesOff.count(mname))
{
- c->RemoveMode(OperServ, Name, param);
+ c->RemoveMode(OperServ, cm, param);
return EVENT_STOP;
}
@@ -426,18 +425,18 @@ class OSDefcon : public Module
return EVENT_CONTINUE;
}
- EventReturn OnChannelModeUnset(Channel *c, MessageSource &, ChannelModeName Name, const Anope::string &) anope_override
+ EventReturn OnChannelModeUnset(Channel *c, MessageSource &, const Anope::string &mname, const Anope::string &) anope_override
{
- ChannelMode *cm = ModeManager::FindChannelModeByName(Name);
+ ChannelMode *cm = ModeManager::FindChannelModeByName(mname);
- if (DConfig.Check(DEFCON_FORCE_CHAN_MODES) && cm && DConfig.DefConModesOn.HasFlag(Name))
+ if (DConfig.Check(DEFCON_FORCE_CHAN_MODES) && cm && DConfig.DefConModesOn.count(mname))
{
Anope::string param;
- if (DConfig.GetDefConParam(Name, param))
- c->SetMode(OperServ, Name, param);
+ if (DConfig.GetDefConParam(mname, param))
+ c->SetMode(OperServ, cm, param);
else
- c->SetMode(OperServ, Name);
+ c->SetMode(OperServ, cm);
return EVENT_STOP;
diff --git a/modules/commands/os_dns.cpp b/modules/commands/os_dns.cpp
index 3afb09870..86110ca3f 100644
--- a/modules/commands/os_dns.cpp
+++ b/modules/commands/os_dns.cpp
@@ -352,7 +352,7 @@ class CommandOSDNS : public Command
}
Server *serv = Server::Find(params[1]);
- if (!serv || serv == Me || serv->HasFlag(SERVER_JUPED))
+ if (!serv || serv == Me || serv->IsJuped())
{
source.Reply(_("Server %s is not linked to the network."), params[1].c_str());
return;
@@ -703,7 +703,7 @@ class ModuleDNS : public Module
void OnNewServer(Server *s) anope_override
{
- if (s == Me || s->HasFlag(SERVER_JUPED))
+ if (s == Me || s->IsJuped())
return;
if (!Me->IsSynced() || this->readd_connected_servers)
{
diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp
index 02daec4a2..4b807ab1a 100644
--- a/modules/commands/os_forbid.cpp
+++ b/modules/commands/os_forbid.cpp
@@ -262,7 +262,7 @@ class OSForbid : public Module
void OnUserNickChange(User *u, const Anope::string &) anope_override
{
- if (u->HasMode(UMODE_OPER))
+ if (u->HasMode("OPER"))
return;
ForbidData *d = this->forbidService.FindForbid(u->nick, FT_NICK);
@@ -281,7 +281,7 @@ class OSForbid : public Module
void OnJoinChannel(User *u, Channel *c) anope_override
{
- if (u->HasMode(UMODE_OPER) || !OperServ)
+ if (u->HasMode("OPER") || !OperServ)
return;
ForbidData *d = this->forbidService.FindForbid(c->name, FT_CHAN);
@@ -292,16 +292,16 @@ class OSForbid : public Module
XLine x(c->name, OperServ->nick, Anope::CurTime + Config->CSInhabit, d->reason);
IRCD->SendSQLine(NULL, &x);
}
- else if (!c->HasFlag(CH_INHABIT))
+ else if (!c->HasExt("INHABIT"))
{
/* Join ChanServ and set a timer for this channel to part ChanServ later */
c->Hold();
/* Set +si to prevent rejoin */
- c->SetMode(NULL, CMODE_NOEXTERNAL);
- c->SetMode(NULL, CMODE_TOPIC);
- c->SetMode(NULL, CMODE_SECRET);
- c->SetMode(NULL, CMODE_INVITE);
+ c->SetMode(NULL, "NOEXTERNAL");
+ c->SetMode(NULL, "TOPIC");
+ c->SetMode(NULL, "SECRET");
+ c->SetMode(NULL, "INVITE");
}
if (d->reason.empty())
diff --git a/modules/commands/os_ignore.cpp b/modules/commands/os_ignore.cpp
index f4b9c2383..6e2eb0f83 100644
--- a/modules/commands/os_ignore.cpp
+++ b/modules/commands/os_ignore.cpp
@@ -93,7 +93,7 @@ class OSIgnoreService : public IgnoreService
{
for (; ign != ign_end; ++ign)
{
- Entry ignore_mask(CMODE_BEGIN, ign->mask);
+ Entry ignore_mask("", ign->mask);
if (ignore_mask.Matches(u, true))
break;
}
@@ -325,7 +325,7 @@ class OSIgnore : public Module
EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) anope_override
{
- if (!u->HasMode(UMODE_OPER) && this->osignoreservice.Find(u->nick))
+ if (!u->HasMode("OPER") && this->osignoreservice.Find(u->nick))
return EVENT_STOP;
return EVENT_CONTINUE;
diff --git a/modules/commands/os_jupe.cpp b/modules/commands/os_jupe.cpp
index be8012a9b..f329d0db5 100644
--- a/modules/commands/os_jupe.cpp
+++ b/modules/commands/os_jupe.cpp
@@ -37,7 +37,7 @@ class CommandOSJupe : public Command
Anope::string rbuf = "Juped by " + source.GetNick() + (!reason.empty() ? ": " + reason : "");
if (server)
IRCD->SendSquit(server, rbuf);
- Server *juped_server = new Server(Me, jserver, 1, rbuf, Servers::TS6_SID_Retrieve(), SERVER_JUPED);
+ Server *juped_server = new Server(Me, jserver, 1, rbuf, Servers::TS6_SID_Retrieve(), true);
IRCD->SendServer(juped_server);
Log(LOG_ADMIN, source, this) << "on " << jserver << " (" << rbuf << ")";
diff --git a/modules/commands/os_list.cpp b/modules/commands/os_list.cpp
index 5fffb3f5b..7178618b6 100644
--- a/modules/commands/os_list.cpp
+++ b/modules/commands/os_list.cpp
@@ -26,13 +26,13 @@ class CommandOSChanList : public Command
{
const Anope::string &pattern = !params.empty() ? params[0] : "";
const Anope::string &opt = params.size() > 1 ? params[1] : "";
- std::list<ChannelModeName> Modes;
+ std::set<Anope::string> modes;
User *u2;
if (!opt.empty() && opt.equals_ci("SECRET"))
{
- Modes.push_back(CMODE_SECRET);
- Modes.push_back(CMODE_PRIVATE);
+ modes.insert("SECRET");
+ modes.insert("PRIVATE");
}
ListFormatter list;
@@ -46,8 +46,8 @@ class CommandOSChanList : public Command
{
ChanUserContainer *cc = *uit;
- if (!Modes.empty())
- for (std::list<ChannelModeName>::iterator it = Modes.begin(), it_end = Modes.end(); it != it_end; ++it)
+ if (!modes.empty())
+ for (std::set<Anope::string>::iterator it = modes.begin(), it_end = modes.end(); it != it_end; ++it)
if (!cc->chan->HasMode(*it))
continue;
@@ -69,8 +69,8 @@ class CommandOSChanList : public Command
if (!pattern.empty() && !Anope::Match(c->name, pattern, false, true))
continue;
- if (!Modes.empty())
- for (std::list<ChannelModeName>::iterator it = Modes.begin(), it_end = Modes.end(); it != it_end; ++it)
+ if (!modes.empty())
+ for (std::set<Anope::string>::iterator it = modes.begin(), it_end = modes.end(); it != it_end; ++it)
if (!c->HasMode(*it))
continue;
@@ -124,10 +124,10 @@ class CommandOSUserList : public Command
const Anope::string &pattern = !params.empty() ? params[0] : "";
const Anope::string &opt = params.size() > 1 ? params[1] : "";
Channel *c;
- std::list<UserModeName> Modes;
+ std::set<Anope::string> modes;
if (!opt.empty() && opt.equals_ci("INVISIBLE"))
- Modes.push_back(UMODE_INVIS);
+ modes.insert("INVIS");
ListFormatter list;
list.AddColumn("Name").AddColumn("Mask");
@@ -140,8 +140,8 @@ class CommandOSUserList : public Command
{
ChanUserContainer *uc = *cuit;
- if (!Modes.empty())
- for (std::list<UserModeName>::iterator it = Modes.begin(), it_end = Modes.end(); it != it_end; ++it)
+ if (!modes.empty())
+ for (std::set<Anope::string>::iterator it = modes.begin(), it_end = modes.end(); it != it_end; ++it)
if (!uc->user->HasMode(*it))
continue;
@@ -169,8 +169,8 @@ class CommandOSUserList : public Command
Anope::string mask = u2->nick + "!" + u2->GetIdent() + "@" + u2->GetDisplayedHost(), mask2 = u2->nick + "!" + u2->GetIdent() + "@" + u2->host, mask3 = u2->nick + "!" + u2->GetIdent() + "@" + (!u2->ip.empty() ? u2->ip : u2->host);
if (!Anope::Match(mask, pattern) && !Anope::Match(mask2, pattern) && !Anope::Match(mask3, pattern))
continue;
- if (!Modes.empty())
- for (std::list<UserModeName>::iterator mit = Modes.begin(), mit_end = Modes.end(); mit != mit_end; ++mit)
+ if (!modes.empty())
+ for (std::set<Anope::string>::iterator mit = modes.begin(), mit_end = modes.end(); mit != mit_end; ++mit)
if (!u2->HasMode(*mit))
continue;
}
diff --git a/modules/commands/os_login.cpp b/modules/commands/os_login.cpp
index 5dbe964eb..76b9e15ba 100644
--- a/modules/commands/os_login.cpp
+++ b/modules/commands/os_login.cpp
@@ -19,9 +19,9 @@ class CommandOSLogin : public Command
public:
CommandOSLogin(Module *creator) : Command(creator, "operserv/login", 1, 1)
{
- this->SetFlag(CFLAG_REQUIRE_USER);
this->SetDesc(Anope::printf(_("Login to %s"), Config->OperServ.c_str()));
this->SetSyntax(_("\037password\037"));
+ this->RequireUser(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
@@ -44,7 +44,7 @@ class CommandOSLogin : public Command
else
{
Log(LOG_ADMIN, source, this) << "and successfully identified to " << source.service->nick;
- u->Extend("os_login_password_correct", NULL);
+ u->Extend("os_login_password_correct");
source.Reply(_("Password accepted."));
}
@@ -67,9 +67,9 @@ class CommandOSLogout : public Command
public:
CommandOSLogout(Module *creator) : Command(creator, "operserv/logout", 0, 0)
{
- this->SetFlag(CFLAG_REQUIRE_USER);
this->SetDesc(Anope::printf(_("Logout from %s"), Config->OperServ.c_str()));
this->SetSyntax("");
+ this->RequireUser(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
diff --git a/modules/commands/os_news.cpp b/modules/commands/os_news.cpp
index adf424c51..9ec3a2479 100644
--- a/modules/commands/os_news.cpp
+++ b/modules/commands/os_news.cpp
@@ -399,9 +399,9 @@ class OSNews : public Module
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
}
- void OnUserModeSet(User *u, UserModeName Name) anope_override
+ void OnUserModeSet(User *u, const Anope::string &mname) anope_override
{
- if (Name == UMODE_OPER)
+ if (mname == "OPER")
DisplayNews(u, NEWS_OPER);
}
diff --git a/modules/commands/os_noop.cpp b/modules/commands/os_noop.cpp
index 263c1cbb0..92c9db668 100644
--- a/modules/commands/os_noop.cpp
+++ b/modules/commands/os_noop.cpp
@@ -31,7 +31,7 @@ class CommandOSNOOP : public Command
Server *s = Server::Find(server);
if (s == NULL)
source.Reply(_("Server %s does not exist."), server.c_str());
- else if (s == Me || s->HasFlag(SERVER_JUPED))
+ else if (s == Me || s->IsJuped())
source.Reply(_("You may not NOOP services."));
else if (cmd.equals_ci("SET"))
{
@@ -49,7 +49,7 @@ class CommandOSNOOP : public Command
User *u2 = it->second;
++it;
- if (u2->server == s && u2->HasMode(UMODE_OPER))
+ if (u2->server == s && u2->HasMode("OPER"))
u2->Kill(Config->OperServ, reason);
}
}
@@ -89,9 +89,9 @@ class OSNOOP : public Module
ModuleManager::Attach(I_OnUserModeSet, this);
}
- void OnUserModeSet(User *u, UserModeName Name) anope_override
+ void OnUserModeSet(User *u, const Anope::string &mname) anope_override
{
- if (Name == UMODE_OPER && u->server->HasExt("noop"))
+ if (mname == "OPER" && u->server->HasExt("noop"))
{
Anope::string *setter = u->server->GetExt<ExtensibleItemClass<Anope::string> *>("noop");
if (setter)
diff --git a/modules/commands/os_oline.cpp b/modules/commands/os_oline.cpp
index ebb308a59..e067a07a6 100644
--- a/modules/commands/os_oline.cpp
+++ b/modules/commands/os_oline.cpp
@@ -34,7 +34,7 @@ class CommandOSOLine : public Command
else if (u2 && flag[0] == '+')
{
IRCD->SendSVSO(source.service, nick, flag);
- u2->SetMode(source.service, UMODE_OPER);
+ u2->SetMode(source.service, "OPER");
u2->SendMessage(source.service, _("You are now an IRC Operator."));
source.Reply(_("Operflags \002%s\002 have been added for \002%s\002."), flag.c_str(), nick.c_str());
Log(LOG_ADMIN, source, this) << "for " << nick;
diff --git a/modules/commands/os_sxline.cpp b/modules/commands/os_sxline.cpp
index bca7991ba..cd617181a 100644
--- a/modules/commands/os_sxline.cpp
+++ b/modules/commands/os_sxline.cpp
@@ -391,7 +391,7 @@ class CommandOSSNLine : public CommandOSSXLineBase
User *user = it->second;
++it;
- if (!user->HasMode(UMODE_OPER) && user->server != Me && Anope::Match(user->realname, x->mask, false, true))
+ if (!user->HasMode("OPER") && user->server != Me && Anope::Match(user->realname, x->mask, false, true))
user->Kill(Config->ServerName, rreason);
}
}
@@ -601,7 +601,7 @@ class CommandOSSQLine : public CommandOSSXLineBase
ChanUserContainer *uc = *it;
User *user = uc->user;
- if (!user->HasMode(UMODE_OPER) && user->server != Me)
+ if (!user->HasMode("OPER") && user->server != Me)
users.push_back(user);
}
@@ -616,7 +616,7 @@ class CommandOSSQLine : public CommandOSSXLineBase
User *user = it->second;
++it;
- if (!user->HasMode(UMODE_OPER) && user->server != Me && Anope::Match(user->nick, x->mask, false, true))
+ if (!user->HasMode("OPER") && user->server != Me && Anope::Match(user->nick, x->mask, false, true))
user->Kill(Config->ServerName, rreason);
}
}
diff --git a/modules/database/db_flatfile.cpp b/modules/database/db_flatfile.cpp
index 6208b7afe..b1f86d984 100644
--- a/modules/database/db_flatfile.cpp
+++ b/modules/database/db_flatfile.cpp
@@ -15,13 +15,19 @@
class SaveData : public Serialize::Data
{
public:
+ Anope::string last;
std::fstream *fs;
SaveData() : fs(NULL) { }
std::iostream& operator[](const Anope::string &key) anope_override
{
- *fs << "\nDATA " << key << " ";
+ if (key != last)
+ {
+ *fs << "\nDATA " << key << " ";
+ last = key;
+ }
+
return *fs;
}
};
@@ -57,6 +63,14 @@ class LoadData : public Serialize::Data
this->ss << this->data[key];
return this->ss;
}
+
+ std::set<Anope::string> KeySet() const anope_override
+ {
+ std::set<Anope::string> keys;
+ for (std::map<Anope::string, Anope::string>::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
+ keys.insert(it->first);
+ return keys;
+ }
void Reset()
{
diff --git a/modules/database/db_old.cpp b/modules/database/db_old.cpp
index d6d81c3f8..ac453fdbe 100644
--- a/modules/database/db_old.cpp
+++ b/modules/database/db_old.cpp
@@ -461,37 +461,37 @@ static void LoadNicks()
READ(read_uint32(&uint, f));
if (uint & OLD_NI_KILLPROTECT)
- nc->SetFlag(NI_KILLPROTECT);
+ nc->ExtendMetadata("KILLPROTECT");
if (uint & OLD_NI_SECURE)
- nc->SetFlag(NI_SECURE);
+ nc->ExtendMetadata("SECURE");
if (uint & OLD_NI_MSG)
- nc->SetFlag(NI_MSG);
+ nc->ExtendMetadata("MSG");
if (uint & OLD_NI_MEMO_HARDMAX)
- nc->SetFlag(NI_MEMO_HARDMAX);
+ nc->ExtendMetadata("MEMO_HARDMAX");
if (uint & OLD_NI_MEMO_SIGNON)
- nc->SetFlag(NI_MEMO_SIGNON);
+ nc->ExtendMetadata("MEMO_SIGNON");
if (uint & OLD_NI_MEMO_RECEIVE)
- nc->SetFlag(NI_MEMO_RECEIVE);
+ nc->ExtendMetadata("MEMO_RECEIVE");
if (uint & OLD_NI_PRIVATE)
- nc->SetFlag(NI_PRIVATE);
+ nc->ExtendMetadata("PRIVATE");
if (uint & OLD_NI_HIDE_EMAIL)
- nc->SetFlag(NI_HIDE_EMAIL);
+ nc->ExtendMetadata("HIDE_EMAIL");
if (uint & OLD_NI_HIDE_MASK)
- nc->SetFlag(NI_HIDE_MASK);
+ nc->ExtendMetadata("HIDE_MASK");
if (uint & OLD_NI_HIDE_QUIT)
- nc->SetFlag(NI_HIDE_QUIT);
+ nc->ExtendMetadata("HIDE_QUIT");
if (uint & OLD_NI_KILL_QUICK)
- nc->SetFlag(NI_KILL_QUICK);
+ nc->ExtendMetadata("KILL_QUICK");
if (uint & OLD_NI_KILL_IMMED)
- nc->SetFlag(NI_KILL_IMMED);
+ nc->ExtendMetadata("KILL_IMMED");
if (uint & OLD_NI_MEMO_MAIL)
- nc->SetFlag(NI_MEMO_MAIL);
+ nc->ExtendMetadata("MEMO_MAIL");
if (uint & OLD_NI_HIDE_STATUS)
- nc->SetFlag(NI_HIDE_STATUS);
+ nc->ExtendMetadata("HIDE_STATUS");
if (uint & OLD_NI_SUSPENDED)
- nc->SetFlag(NI_SUSPENDED);
+ nc->ExtendMetadata("SUSPENDED");
if (!(uint & OLD_NI_AUTOOP))
- nc->SetFlag(NI_AUTOOP);
+ nc->ExtendMetadata("AUTOOP");
uint16_t u16;
READ(read_uint16(&u16, f));
@@ -609,7 +609,7 @@ static void LoadNicks()
na->last_seen = last_seen;
if (tmpu16 & OLD_NS_NO_EXPIRE)
- na->SetFlag(NS_NO_EXPIRE);
+ na->ExtendMetadata("NO_EXPIRE");
Log(LOG_DEBUG) << "Loaded NickAlias " << na->nick;
}
@@ -675,7 +675,7 @@ static void LoadBots()
bi->created = created;
if (flags & OLD_BI_PRIVATE)
- bi->SetFlag(BI_PRIVATE);
+ bi->ExtendMetadata("PRIVATE");
Log(LOG_DEBUG) << "Loaded bot " << bi->nick;
}
@@ -730,31 +730,31 @@ static void LoadChannels()
// Temporary flags cleanup
tmpu32 &= ~0x80000000;
if (tmpu32 & OLD_CI_KEEPTOPIC)
- ci->SetFlag(CI_KEEPTOPIC);
+ ci->ExtendMetadata("KEEPTOPIC");
if (tmpu32 & OLD_CI_SECUREOPS)
- ci->SetFlag(CI_SECUREOPS);
+ ci->ExtendMetadata("SECUREOPS");
if (tmpu32 & OLD_CI_PRIVATE)
- ci->SetFlag(CI_PRIVATE);
+ ci->ExtendMetadata("PRIVATE");
if (tmpu32 & OLD_CI_TOPICLOCK)
- ci->SetFlag(CI_TOPICLOCK);
+ ci->ExtendMetadata("TOPICLOCK");
if (tmpu32 & OLD_CI_RESTRICTED)
- ci->SetFlag(CI_RESTRICTED);
+ ci->ExtendMetadata("RESTRICTED");
if (tmpu32 & OLD_CI_PEACE)
- ci->SetFlag(CI_PEACE);
+ ci->ExtendMetadata("PEACE");
if (tmpu32 & OLD_CI_SECURE)
- ci->SetFlag(CI_SECURE);
+ ci->ExtendMetadata("SECURE");
if (tmpu32 & OLD_CI_NO_EXPIRE)
- ci->SetFlag(CI_NO_EXPIRE);
+ ci->ExtendMetadata("NO_EXPIRE");
if (tmpu32 & OLD_CI_MEMO_HARDMAX)
- ci->SetFlag(CI_MEMO_HARDMAX);
+ ci->ExtendMetadata("MEMO_HARDMAX");
if (tmpu32 & OLD_CI_SECUREFOUNDER)
- ci->SetFlag(CI_SECUREFOUNDER);
+ ci->ExtendMetadata("SECUREFOUNDER");
if (tmpu32 & OLD_CI_SIGNKICK)
- ci->SetFlag(CI_SIGNKICK);
+ ci->ExtendMetadata("SIGNKICK");
if (tmpu32 & OLD_CI_SIGNKICK_LEVEL)
- ci->SetFlag(CI_SIGNKICK_LEVEL);
+ ci->ExtendMetadata("SIGNKICK_LEVEL");
if (tmpu32 & OLD_CI_SUSPENDED)
- ci->SetFlag(CI_SUSPENDED);
+ ci->ExtendMetadata("SUSPENDED");
READ(read_string(buffer, f));
READ(read_string(buffer, f));
@@ -775,7 +775,7 @@ static void LoadChannels()
level = ACCESS_FOUNDER;
if (j == 10 && level < 0) // NOJOIN
- ci->UnsetFlag(CI_RESTRICTED); // If CSDefRestricted was enabled this can happen
+ ci->Shrink("RESTRICTED"); // If CSDefRestricted was enabled this can happen
ci->SetLevel(GetLevelName(j), level);
}
@@ -865,31 +865,31 @@ static void LoadChannels()
READ(read_int32(&tmp32, f));
if (tmp32 & OLD_BS_DONTKICKOPS)
- ci->botflags.SetFlag(BS_DONTKICKOPS);
+ ci->ExtendMetadata("BS_DONTKICKOPS");
if (tmp32 & OLD_BS_DONTKICKVOICES)
- ci->botflags.SetFlag(BS_DONTKICKVOICES);
+ ci->ExtendMetadata("BS_DONTKICKVOICES");
if (tmp32 & OLD_BS_FANTASY)
- ci->botflags.SetFlag(BS_FANTASY);
+ ci->ExtendMetadata("BS_FANTASY");
if (tmp32 & OLD_BS_GREET)
- ci->botflags.SetFlag(BS_GREET);
+ ci->ExtendMetadata("BS_GREET");
if (tmp32 & OLD_BS_NOBOT)
- ci->botflags.SetFlag(BS_NOBOT);
+ ci->ExtendMetadata("BS_NOBOT");
if (tmp32 & OLD_BS_KICK_BOLDS)
- ci->botflags.SetFlag(BS_KICK_BOLDS);
+ ci->ExtendMetadata("BS_KICK_BOLDS");
if (tmp32 & OLD_BS_KICK_COLORS)
- ci->botflags.SetFlag(BS_KICK_COLORS);
+ ci->ExtendMetadata("BS_KICK_COLORS");
if (tmp32 & OLD_BS_KICK_REVERSES)
- ci->botflags.SetFlag(BS_KICK_REVERSES);
+ ci->ExtendMetadata("BS_KICK_REVERSES");
if (tmp32 & OLD_BS_KICK_UNDERLINES)
- ci->botflags.SetFlag(BS_KICK_UNDERLINES);
+ ci->ExtendMetadata("BS_KICK_UNDERLINES");
if (tmp32 & OLD_BS_KICK_BADWORDS)
- ci->botflags.SetFlag(BS_KICK_BADWORDS);
+ ci->ExtendMetadata("BS_KICK_BADWORDS");
if (tmp32 & OLD_BS_KICK_CAPS)
- ci->botflags.SetFlag(BS_KICK_CAPS);
+ ci->ExtendMetadata("BS_KICK_CAPS");
if (tmp32 & OLD_BS_KICK_FLOOD)
- ci->botflags.SetFlag(BS_KICK_FLOOD);
+ ci->ExtendMetadata("BS_KICK_FLOOD");
if (tmp32 & OLD_BS_KICK_REPEAT)
- ci->botflags.SetFlag(BS_KICK_REPEAT);
+ ci->ExtendMetadata("BS_KICK_REPEAT");
READ(read_int16(&tmp16, f));
for (int16_t j = 0; j < tmp16; ++j)
diff --git a/modules/database/db_plain.cpp b/modules/database/db_plain.cpp
index b5a8fc7ae..1256a2012 100644
--- a/modules/database/db_plain.cpp
+++ b/modules/database/db_plain.cpp
@@ -79,7 +79,10 @@ EventReturn OnDatabaseReadMetadata(NickCore *nc, const Anope::string &key, const
else if (key.equals_ci("CERT"))
nc->AddCert(params[0]);
else if (key.equals_ci("FLAGS"))
- nc->FromVector(params);
+ {
+ for (unsigned i = 0; i < params.size(); ++i)
+ nc->ExtendMetadata(params[i]);
+ }
else if (key.equals_ci("MI"))
{
Memo *m = new Memo;
@@ -88,9 +91,9 @@ EventReturn OnDatabaseReadMetadata(NickCore *nc, const Anope::string &key, const
for (unsigned j = 2; params[j].equals_ci("UNREAD") || params[j].equals_ci("RECEIPT"); ++j)
{
if (params[j].equals_ci("UNREAD"))
- m->SetFlag(MF_UNREAD);
+ m->unread = true;
else if (params[j].equals_ci("RECEIPT"))
- m->SetFlag(MF_RECEIPT);
+ m->receipt = true;
}
m->text = params[params.size() - 1];
nc->memos.memos->push_back(m);
@@ -116,7 +119,8 @@ EventReturn OnDatabaseReadMetadata(NickAlias *na, const Anope::string &key, cons
else if (key.equals_ci("LAST_QUIT"))
na->last_quit = params[0];
else if (key.equals_ci("FLAGS"))
- na->FromVector(params);
+ for (unsigned i = 0; i < params.size(); ++i)
+ na->ExtendMetadata(params[i]);
else if (key.equals_ci("VHOST"))
na->SetVhost(params.size() > 3 ? params[3] : "", params[2], params[0], params[1].is_pos_number_only() ? convertTo<time_t>(params[1]) : 0);
return EVENT_CONTINUE;
@@ -124,9 +128,6 @@ EventReturn OnDatabaseReadMetadata(NickAlias *na, const Anope::string &key, cons
EventReturn OnDatabaseReadMetadata(BotInfo *bi, const Anope::string &key, const std::vector<Anope::string> &params)
{
- if (key.equals_ci("FLAGS"))
- bi->FromVector(params);
-
return EVENT_CONTINUE;
}
@@ -153,7 +154,8 @@ EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const Anope::string &key, co
}
}
else if (key.equals_ci("FLAGS"))
- ci->FromVector(params);
+ for (unsigned i = 0; i < params.size(); ++i)
+ ci->ExtendMetadata(params[i]);
else if (key.equals_ci("DESC"))
ci->desc = params[0];
else if (key.equals_ci("TOPIC"))
@@ -164,8 +166,8 @@ EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const Anope::string &key, co
}
else if (key.equals_ci("SUSPEND"))
{
- ci->Extend("suspend_by", new ExtensibleItemClass<Anope::string>(params[0]));
- ci->Extend("suspend_reason", new ExtensibleItemClass<Anope::string>(params[1]));
+ ci->ExtendMetadata("suspend:by", params[0]);
+ ci->ExtendMetadata("suspend:reason", params[1]);
}
else if (key.equals_ci("ACCESS")) // Older access system, from Anope 1.9.4.
{
@@ -216,8 +218,6 @@ EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const Anope::string &key, co
ak = ci->AddAkick(params[3], nc, params.size() > 6 ? params[6] : "", params[4].is_pos_number_only() ? convertTo<time_t>(params[4]) : 0, params[5].is_pos_number_only() ? convertTo<time_t>(params[5]) : 0);
else
ak = ci->AddAkick(params[3], params[2], params.size() > 6 ? params[6] : "", params[4].is_pos_number_only() ? convertTo<time_t>(params[4]) : 0, params[5].is_pos_number_only() ? convertTo<time_t>(params[5]) : 0);
- if (Nick)
- ak->SetFlag(AK_ISNICK);
}
else if (key.equals_ci("LOG"))
@@ -238,18 +238,11 @@ EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const Anope::string &key, co
else if (key.equals_ci("MLOCK"))
{
bool set = params[0] == "1" ? true : false;
- Anope::string mode_name = params[1];
+ Anope::string mode_name = params[1].substr(6);
Anope::string setter = params[2];
time_t mcreated = params[3].is_pos_number_only() ? convertTo<time_t>(params[3]) : Anope::CurTime;
Anope::string param = params.size() > 4 ? params[4] : "";
- const Anope::string* ChannelModeNameStrings = Flags<ChannelModeName>::GetFlagStrings();
- for (size_t i = CMODE_BEGIN + 1; i < CMODE_END; ++i)
- if (ChannelModeNameStrings[i] == mode_name)
- {
- ChannelModeName n = static_cast<ChannelModeName>(i);
- ci->mode_locks->insert(std::make_pair(n, new ModeLock(ci, set, n, param, setter, mcreated)));
- break;
- }
+ ci->mode_locks->insert(std::make_pair(mode_name, new ModeLock(ci, set, mode_name, param, setter, mcreated)));
}
else if (key.equals_ci("MI"))
{
@@ -259,9 +252,9 @@ EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const Anope::string &key, co
for (unsigned j = 2; params[j].equals_ci("UNREAD") || params[j].equals_ci("RECEIPT"); ++j)
{
if (params[j].equals_ci("UNREAD"))
- m->SetFlag(MF_UNREAD);
+ m->unread = true;
else if (params[j].equals_ci("RECEIPT"))
- m->SetFlag(MF_RECEIPT);
+ m->receipt = true;
}
m->text = params[params.size() - 1];
ci->memos.memos->push_back(m);
@@ -273,7 +266,8 @@ EventReturn OnDatabaseReadMetadata(ChannelInfo *ci, const Anope::string &key, co
if (params[0].equals_ci("NAME"))
ci->bi = BotInfo::Find(params[1]);
else if (params[0].equals_ci("FLAGS"))
- ci->botflags.FromVector(params);
+ for (unsigned i = 0; i < params.size(); ++i)
+ ci->ExtendMetadata(params[i]);
else if (params[0].equals_ci("TTB"))
{
for (unsigned j = 1, end = params.size(); j < end; j += 2)
@@ -476,7 +470,10 @@ static void LoadNickCore(const std::vector<Anope::string> &params)
{
NickCore *nc = new NickCore(params[0]);
/* Clear default flags */
- nc->ClearFlags();
+ std::deque<Anope::string> list;
+ nc->GetExtList(list);
+ for (unsigned i = 0; i < list.size(); ++i)
+ nc->Shrink(list[i]);
nc->pass = params.size() > 1 ? params[1] : "";
@@ -520,8 +517,10 @@ static void LoadChanInfo(const std::vector<Anope::string> &params)
/* CLear default mlock */
ci->ClearMLock();
/* Remove default channel flags */
- ci->ClearFlags();
- ci->botflags.ClearFlags();
+ std::deque<Anope::string> list;
+ ci->GetExtList(list);
+ for (unsigned i = 0; i < list.size(); ++i)
+ ci->Shrink(list[i]);
ci->time_registered = params[1].is_pos_number_only() ? convertTo<time_t>(params[1]) : 0;
@@ -693,16 +692,20 @@ class DBPlain : public Module
for (std::vector<Anope::string>::const_iterator it = nc->cert.begin(), it_end = nc->cert.end(); it != it_end; ++it)
db_buffer << "MD CERT " << *it << endl;
}
- if (nc->FlagCount())
- db_buffer << "MD FLAGS " << nc->ToString() << endl;
+ db_buffer << "MD FLAGS ";
+ std::deque<Anope::string> list;
+ nc->GetExtList(list);
+ for (unsigned i = 0; i < list.size(); ++i)
+ db_buffer << list[i] << " ";
+ db_buffer << std::endl;
const MemoInfo *mi = &nc->memos;
for (unsigned k = 0, end = mi->memos->size(); k < end; ++k)
{
const Memo *m = mi->GetMemo(k);
db_buffer << "MD MI " << m->time << " " << m->sender;
- if (m->HasFlag(MF_UNREAD))
+ if (m->unread)
db_buffer << " UNREAD";
- if (m->HasFlag(MF_RECEIPT))
+ if (m->receipt)
db_buffer << " RECEIPT";
db_buffer << " :" << m->text << endl;
}
@@ -724,8 +727,12 @@ class DBPlain : public Module
db_buffer << "MD LAST_REALNAME :" << na->last_realname << endl;
if (!na->last_quit.empty())
db_buffer << "MD LAST_QUIT :" << na->last_quit << endl;
- if (na->FlagCount())
- db_buffer << "MD FLAGS " << na->ToString() << endl;
+ db_buffer << "MD FLAGS ";
+ std::deque<Anope::string> list;
+ na->GetExtList(list);
+ for (unsigned i = 0; i < list.size(); ++i)
+ db_buffer << list[i] << " ";
+ db_buffer << std::endl;
if (na->HasVhost())
db_buffer << "MD VHOST " << na->GetVhostCreator() << " " << na->GetVhostCreated() << " " << na->GetVhostHost() << " :" << na->GetVhostIdent() << endl;
@@ -736,12 +743,16 @@ class DBPlain : public Module
{
BotInfo *bi = it->second;
- if (bi->HasFlag(BI_CONF))
+ if (bi->HasExt("CONF"))
continue;
db_buffer << "BI " << bi->nick << " " << bi->GetIdent() << " " << bi->host << " " << bi->created << " " << bi->GetChannelCount() << " :" << bi->realname << endl;
- if (bi->FlagCount())
- db_buffer << "MD FLAGS " << bi->ToString() << endl;
+ db_buffer << "MD FLAGS ";
+ std::deque<Anope::string> list;
+ bi->GetExtList(list);
+ for (unsigned i = 0; i < list.size(); ++i)
+ db_buffer << list[i] << " ";
+ db_buffer << std::endl;
}
for (registered_channel_map::const_iterator cit = RegisteredChannelList->begin(), cit_end = RegisteredChannelList->end(); cit != cit_end; ++cit)
@@ -767,9 +778,12 @@ class DBPlain : public Module
db_buffer << p.name << " " << ci->GetLevel(p.name);
}
db_buffer << endl;
- if (ci->FlagCount())
- db_buffer << "MD FLAGS " << ci->ToString() << endl;
- if (ci->HasFlag(CI_SUSPENDED))
+ std::deque<Anope::string> list;
+ ci->GetExtList(list);
+ for (unsigned i = 0; i < list.size(); ++i)
+ db_buffer << list[i];
+ db_buffer << std::endl;
+ if (ci->HasExt("SUSPENDED"))
{
Anope::string *by = ci->GetExt<ExtensibleItemClass<Anope::string> *>("suspend_by"), *reason = ci->GetExt<ExtensibleItemClass<Anope::string> *>("suspend_reason");
if (by && reason)
@@ -782,8 +796,8 @@ class DBPlain : public Module
}
for (unsigned k = 0, end = ci->GetAkickCount(); k < end; ++k)
{
- db_buffer << "MD AKICK 0 " << (ci->GetAkick(k)->HasFlag(AK_ISNICK) ? "NICK " : "MASK ") <<
- (ci->GetAkick(k)->HasFlag(AK_ISNICK) ? ci->GetAkick(k)->nc->display : ci->GetAkick(k)->mask) << " " << ci->GetAkick(k)->creator << " " << ci->GetAkick(k)->addtime << " " << ci->last_used << " :";
+ db_buffer << "MD AKICK 0 " << (ci->GetAkick(k)->nc ? "NICK " : "MASK ") <<
+ (ci->GetAkick(k)->nc ? ci->GetAkick(k)->nc->display : ci->GetAkick(k)->mask) << " " << ci->GetAkick(k)->creator << " " << ci->GetAkick(k)->addtime << " " << ci->last_used << " :";
if (!ci->GetAkick(k)->reason.empty())
db_buffer << ci->GetAkick(k)->reason;
db_buffer << endl;
@@ -799,16 +813,16 @@ class DBPlain : public Module
const ModeLock &ml = *it->second;
ChannelMode *cm = ModeManager::FindChannelModeByName(ml.name);
if (cm != NULL)
- db_buffer << "MD MLOCK " << (ml.set ? 1 : 0) << " " << cm->NameAsString() << " " << ml.setter << " " << ml.created << " " << ml.param << endl;
+ db_buffer << "MD MLOCK " << (ml.set ? 1 : 0) << " " << cm->name << " " << ml.setter << " " << ml.created << " " << ml.param << endl;
}
const MemoInfo *memos = &ci->memos;
for (unsigned k = 0, end = memos->memos->size(); k < end; ++k)
{
const Memo *m = memos->GetMemo(k);
db_buffer << "MD MI " << m->time << " " << m->sender;
- if (m->HasFlag(MF_UNREAD))
+ if (m->unread)
db_buffer << " UNREAD";
- if (m->HasFlag(MF_RECEIPT))
+ if (m->receipt)
db_buffer << " RECEIPT";
db_buffer << " :" << m->text << endl;
}
@@ -816,8 +830,6 @@ class DBPlain : public Module
db_buffer << "MD MIG " << Anope::string(memos->ignores[k]) << endl;
if (ci->bi)
db_buffer << "MD BI NAME " << ci->bi->nick << endl;
- if (ci->botflags.FlagCount())
- db_buffer << "MD BI FLAGS " << ci->botflags.ToString() << endl;
db_buffer << "MD BI TTB BOLDS " << ci->ttb[0] << " COLORS " << ci->ttb[1] << " REVERSES " << ci->ttb[2] << " UNDERLINES " << ci->ttb[3] << " BADWORDS " << ci->ttb[4] << " CAPS " << ci->ttb[5] << " FLOOD " << ci->ttb[6] << " REPEAT " << ci->ttb[7] << " ITALICS " << ci->ttb[8] << " AMSGS " << ci->ttb[9] << endl;
if (ci->capsmin)
db_buffer << "MD BI CAPSMIN " << ci->capsmin << endl;
diff --git a/modules/extra/cs_statusupdate.cpp b/modules/extra/cs_statusupdate.cpp
index 68accac0c..97faae851 100644
--- a/modules/extra/cs_statusupdate.cpp
+++ b/modules/extra/cs_statusupdate.cpp
@@ -10,14 +10,14 @@
static struct ModeInfo
{
Anope::string priv;
- ChannelModeName name;
+ Anope::string name;
} modeInfo[] = {
- { "AUTOOWNER", CMODE_OWNER },
- { "AUTOPROTECT", CMODE_PROTECT },
- { "AUTOOP", CMODE_OP },
- { "AUTOHALFOP", CMODE_HALFOP },
- { "AUTOVOICE", CMODE_VOICE },
- { "", CMODE_END }
+ { "AUTOOWNER", "OWNER" },
+ { "AUTOPROTECT", "PROTECT" },
+ { "AUTOOP", "OP" },
+ { "AUTOHALFOP", "HALFOP" },
+ { "AUTOVOICE", "VOICE" },
+ { "", "" }
};
class StatusUpdate : public Module
diff --git a/modules/extra/m_chanstats.cpp b/modules/extra/m_chanstats.cpp
index 7096b39a5..3c964b55c 100644
--- a/modules/extra/m_chanstats.cpp
+++ b/modules/extra/m_chanstats.cpp
@@ -56,7 +56,7 @@ class MChanstats : public Module
const Anope::string GetDisplay(User *u)
{
- if (u && u->Account() && u->Account()->HasFlag(NI_STATS))
+ if (u && u->Account() && u->Account()->HasExt("STATS"))
return u->Account()->display;
else
return "";
@@ -350,6 +350,7 @@ class MChanstats : public Module
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
this->OnReload();
}
+
void OnReload() anope_override
{
ConfigReader config;
@@ -365,30 +366,34 @@ class MChanstats : public Module
else
Log(this) << "no database connection to " << engine;
}
+
void OnTopicUpdated(Channel *c, const Anope::string &user, const Anope::string &topic) anope_override
{
User *u = User::Find(user);
- if (!u || !u->Account() || !c->ci || !c->ci->HasFlag(CI_STATS))
+ if (!u || !u->Account() || !c->ci || !c->ci->HasExt("STATS"))
return;
query = "CALL " + prefix + "chanstats_proc_update(@channel@, @nick@, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);";
query.SetValue("channel", c->name);
query.SetValue("nick", GetDisplay(u));
this->RunQuery(query);
}
- EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelModeName Name, const Anope::string &param) anope_override
+
+ EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, const Anope::string &, const Anope::string &param) anope_override
{
this->OnModeChange(c, setter.GetUser());
return EVENT_CONTINUE;
}
- EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelModeName Name, const Anope::string &param) anope_override
+
+ EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, const Anope::string &, const Anope::string &param) anope_override
{
this->OnModeChange(c, setter.GetUser());
return EVENT_CONTINUE;
}
+
private:
void OnModeChange(Channel *c, User *u)
{
- if (!u || !u->Account() || !c->ci || !c->ci->HasFlag(CI_STATS))
+ if (!u || !u->Account() || !c->ci || !c->ci->HasExt("STATS"))
return;
query = "CALL " + prefix + "chanstats_proc_update(@channel@, @nick@, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0);";
@@ -399,7 +404,7 @@ class MChanstats : public Module
public:
void OnUserKicked(Channel *c, User *target, MessageSource &source, const Anope::string &kickmsg) anope_override
{
- if (!c->ci || !c->ci->HasFlag(CI_STATS))
+ if (!c->ci || !c->ci->HasExt("STATS"))
return;
query = "CALL " + prefix + "chanstats_proc_update(@channel@, @nick@, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0);";
@@ -414,7 +419,7 @@ class MChanstats : public Module
}
void OnPrivmsg(User *u, Channel *c, Anope::string &msg) anope_override
{
- if (!c->ci || !c->ci->HasFlag(CI_STATS) || (msg[0] == Config->BSFantasyCharacter[0]))
+ if (!c->ci || !c->ci->HasExt("STATS") || (msg[0] == Config->BSFantasyCharacter[0]))
return;
size_t letters = msg.length();
diff --git a/modules/extra/m_dnsbl.cpp b/modules/extra/m_dnsbl.cpp
index 692f1cf2d..c9940eaab 100644
--- a/modules/extra/m_dnsbl.cpp
+++ b/modules/extra/m_dnsbl.cpp
@@ -54,7 +54,7 @@ class DNSBLResolver : public Request
record_reason = this->blacklist.replies[result];
}
- user->Extend("m_dnsbl_akilled", NULL);
+ user->Extend("m_dnsbl_akilled");
Anope::string reason = this->blacklist.reason;
reason = reason.replace_all_cs("%n", user->nick);
diff --git a/modules/extra/m_helpchan.cpp b/modules/extra/m_helpchan.cpp
index 88b2eaee8..32d1859fc 100644
--- a/modules/extra/m_helpchan.cpp
+++ b/modules/extra/m_helpchan.cpp
@@ -22,14 +22,14 @@ class HelpChannel : public Module
OnReload();
}
- EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelModeName Name, const Anope::string &param) anope_override
+ EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, const Anope::string &mname, const Anope::string &param) anope_override
{
- if (Name == CMODE_OP && c && c->ci && c->name.equals_ci(this->HelpChan))
+ if (mname == "OP" && c && c->ci && c->name.equals_ci(this->HelpChan))
{
User *u = User::Find(param);
if (u && c->ci->AccessFor(u).HasPriv("OPDEOPME"))
- u->SetMode(OperServ, UMODE_HELPOP);
+ u->SetMode(OperServ, "HELPOP");
}
return EVENT_CONTINUE;
diff --git a/modules/extra/m_proxyscan.cpp b/modules/extra/m_proxyscan.cpp
index 9fc8b26c9..b43954299 100644
--- a/modules/extra/m_proxyscan.cpp
+++ b/modules/extra/m_proxyscan.cpp
@@ -215,7 +215,7 @@ class ModuleProxyScan : public Module
ProxyConnect *p = *it;
if (p->created + this->GetSecs() < Anope::CurTime)
- p->SetFlag(SF_DEAD);
+ p->flags[SF_DEAD] = true;
}
}
} connectionTimeout;
diff --git a/modules/extra/m_sql_oper.cpp b/modules/extra/m_sql_oper.cpp
index dd1f13b74..f786ad36d 100644
--- a/modules/extra/m_sql_oper.cpp
+++ b/modules/extra/m_sql_oper.cpp
@@ -51,7 +51,7 @@ class SQLOperResult : public SQL::Interface
delete user->Account()->o;
user->Account()->o = NULL;
Log(this->owner) << "m_sql_oper: Removed services operator from " << user->nick << " (" << user->Account()->display << ")";
- user->RemoveMode(OperServ, UMODE_OPER); // Probably not set, just incase
+ user->RemoveMode(OperServ, "OPER"); // Probably not set, just incase
}
return;
}
@@ -70,7 +70,7 @@ class SQLOperResult : public SQL::Interface
Config->Opers.push_back(user->Account()->o);
}
- if (!user->HasMode(UMODE_OPER))
+ if (!user->HasMode("OPER"))
{
IRCD->SendOper(user);
diff --git a/modules/extra/m_ssl.cpp b/modules/extra/m_ssl.cpp
index fdde28919..9929c6f15 100644
--- a/modules/extra/m_ssl.cpp
+++ b/modules/extra/m_ssl.cpp
@@ -256,7 +256,7 @@ ClientSocket *SSLSocketIO::Accept(ListenSocket *s)
if (!SSL_set_fd(io->sslsock, newsocket->GetFD()))
throw SocketException("Unable to set SSL fd");
- newsocket->SetFlag(SF_ACCEPTING);
+ newsocket->flags[SF_ACCEPTING] = true;
this->FinishAccept(newsocket);
return newsocket;
@@ -266,9 +266,9 @@ SocketFlag SSLSocketIO::FinishAccept(ClientSocket *cs)
{
if (cs->io == &NormalSocketIO)
throw SocketException("Attempting to finish connect uninitialized socket with SSL");
- else if (cs->HasFlag(SF_ACCEPTED))
+ else if (cs->flags[SF_ACCEPTED])
return SF_ACCEPTED;
- else if (!cs->HasFlag(SF_ACCEPTING))
+ else if (!cs->flags[SF_ACCEPTING])
throw SocketException("SSLSocketIO::FinishAccept called for a socket not accepted nor accepting?");
SSLSocketIO *io = anope_dynamic_static_cast<SSLSocketIO *>(cs->io);
@@ -286,15 +286,15 @@ SocketFlag SSLSocketIO::FinishAccept(ClientSocket *cs)
else
{
cs->OnError(ERR_error_string(ERR_get_error(), NULL));
- cs->SetFlag(SF_DEAD);
- cs->UnsetFlag(SF_ACCEPTING);
+ cs->flags[SF_DEAD] = true;
+ cs->flags[SF_ACCEPTING] = false;
return SF_DEAD;
}
}
else
{
- cs->SetFlag(SF_ACCEPTED);
- cs->UnsetFlag(SF_ACCEPTING);
+ cs->flags[SF_ACCEPTED] = true;
+ cs->flags[SF_ACCEPTING] = false;
SocketEngine::Change(cs, false, SF_WRITABLE);
SocketEngine::Change(cs, true, SF_READABLE);
cs->OnAccept();
@@ -307,8 +307,7 @@ void SSLSocketIO::Connect(ConnectionSocket *s, const Anope::string &target, int
if (s->io == &NormalSocketIO)
throw SocketException("Attempting to connect uninitialized socket with SSL");
- s->UnsetFlag(SF_CONNECTING);
- s->UnsetFlag(SF_CONNECTED);
+ s->flags[SF_CONNECTING] = s->flags[SF_CONNECTED] = false;
s->conaddr.pton(s->IsIPv6() ? AF_INET6 : AF_INET, target, port);
int c = connect(s->GetFD(), &s->conaddr.sa, s->conaddr.size());
@@ -317,19 +316,19 @@ void SSLSocketIO::Connect(ConnectionSocket *s, const Anope::string &target, int
if (Anope::LastErrorCode() != EINPROGRESS)
{
s->OnError(Anope::LastError());
- s->SetFlag(SF_DEAD);
+ s->flags[SF_DEAD] = true;
return;
}
else
{
SocketEngine::Change(s, true, SF_WRITABLE);
- s->SetFlag(SF_CONNECTING);
+ s->flags[SF_CONNECTING] = true;
return;
}
}
else
{
- s->SetFlag(SF_CONNECTING);
+ s->flags[SF_CONNECTING] = true;
this->FinishConnect(s);
}
}
@@ -338,9 +337,9 @@ SocketFlag SSLSocketIO::FinishConnect(ConnectionSocket *s)
{
if (s->io == &NormalSocketIO)
throw SocketException("Attempting to finish connect uninitialized socket with SSL");
- else if (s->HasFlag(SF_CONNECTED))
+ else if (s->flags[SF_CONNECTED])
return SF_CONNECTED;
- else if (!s->HasFlag(SF_CONNECTING))
+ else if (!s->flags[SF_CONNECTING])
throw SocketException("SSLSocketIO::FinishConnect called for a socket not connected nor connecting?");
SSLSocketIO *io = anope_dynamic_static_cast<SSLSocketIO *>(s->io);
@@ -368,15 +367,15 @@ SocketFlag SSLSocketIO::FinishConnect(ConnectionSocket *s)
else
{
s->OnError(ERR_error_string(ERR_get_error(), NULL));
- s->UnsetFlag(SF_CONNECTING);
- s->SetFlag(SF_DEAD);
+ s->flags[SF_CONNECTING] = false;
+ s->flags[SF_DEAD] = true;
return SF_DEAD;
}
}
else
{
- s->UnsetFlag(SF_CONNECTING);
- s->SetFlag(SF_CONNECTED);
+ s->flags[SF_CONNECTING] = false;
+ s->flags[SF_CONNECTED] = true;
SocketEngine::Change(s, false, SF_WRITABLE);
SocketEngine::Change(s, true, SF_READABLE);
s->OnConnect();
diff --git a/modules/extra/m_xmlrpc_main.cpp b/modules/extra/m_xmlrpc_main.cpp
index 807aa626b..e4b761cc7 100644
--- a/modules/extra/m_xmlrpc_main.cpp
+++ b/modules/extra/m_xmlrpc_main.cpp
@@ -153,21 +153,21 @@ class MyXMLRPCEvent : public XMLRPCEvent
if (c)
{
- request.reply("bancount", stringify(c->HasMode(CMODE_BAN)));
+ request.reply("bancount", stringify(c->HasMode("BAN")));
int count = 0;
- std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> its = c->GetModeList(CMODE_BAN);
+ std::pair<Channel::ModeList::iterator, Channel::ModeList::iterator> its = c->GetModeList("BAN");
for (; its.first != its.second; ++its.first)
request.reply("ban" + stringify(++count), iface->Sanitize(its.first->second));
- request.reply("exceptcount", stringify(c->HasMode(CMODE_EXCEPT)));
+ request.reply("exceptcount", stringify(c->HasMode("EXCEPT")));
count = 0;
- its = c->GetModeList(CMODE_EXCEPT);
+ its = c->GetModeList("EXCEPT");
for (; its.first != its.second; ++its.first)
request.reply("except" + stringify(++count), iface->Sanitize(its.first->second));
- request.reply("invitecount", stringify(c->HasMode(CMODE_INVITEOVERRIDE)));
+ request.reply("invitecount", stringify(c->HasMode("INVITEOVERRIDE")));
count = 0;
- its = c->GetModeList(CMODE_INVITEOVERRIDE);
+ its = c->GetModeList("INVITEOVERRIDE");
for (; its.first != its.second; ++its.first)
request.reply("invite" + stringify(++count), iface->Sanitize(its.first->second));
diff --git a/modules/extra/webcpanel/pages/chanserv/drop.cpp b/modules/extra/webcpanel/pages/chanserv/drop.cpp
index 824b1e58b..0ebb8e7a1 100644
--- a/modules/extra/webcpanel/pages/chanserv/drop.cpp
+++ b/modules/extra/webcpanel/pages/chanserv/drop.cpp
@@ -29,16 +29,16 @@ bool WebCPanel::ChanServ::Drop::OnRequest(HTTPProvider *server, const Anope::str
for (registered_channel_map::const_iterator it = RegisteredChannelList->begin(), it_end = RegisteredChannelList->end(); it != it_end; ++it)
{
ChannelInfo *ci = it->second;
- if ((ci->HasFlag(CI_SECUREFOUNDER) ? ci->AccessFor(na->nc).founder : ci->AccessFor(na->nc).HasPriv("FOUNDER")) || (na->nc->IsServicesOper() && na->nc->o->ot->HasCommand("chanserv/drop")))
+ if ((ci->HasExt("SECUREFOUNDER") ? ci->AccessFor(na->nc).founder : ci->AccessFor(na->nc).HasPriv("FOUNDER")) || (na->nc->IsServicesOper() && na->nc->o->ot->HasCommand("chanserv/drop")))
{
replacements["CHANNEL_NAMES"] = ci->name;
replacements["ESCAPED_CHANNEL_NAMES"] = HTTPUtils::URLEncode(ci->name);
}
}
- if (message.get_data.count("channel") > 0) {
+ if (message.get_data.count("channel") > 0)
replacements["CHANNEL_DROP"] = message.get_data["channel"];
- }
+
TemplateFileServer page("chanserv/drop.html");
page.Serve(server, page_name, client, message, reply, replacements);
return true;
diff --git a/modules/extra/webcpanel/pages/chanserv/set.cpp b/modules/extra/webcpanel/pages/chanserv/set.cpp
index 9cee680eb..af3640e33 100644
--- a/modules/extra/webcpanel/pages/chanserv/set.cpp
+++ b/modules/extra/webcpanel/pages/chanserv/set.cpp
@@ -29,60 +29,60 @@ bool WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::stri
if (message.post_data.empty() == false)
{
- if (ci->HasFlag(CI_KEEPTOPIC) != message.post_data.count("keeptopic"))
+ if (ci->HasExt("KEEPTOPIC") != message.post_data.count("keeptopic"))
{
- if (!ci->HasFlag(CI_KEEPTOPIC))
- ci->SetFlag(CI_KEEPTOPIC);
+ if (!ci->HasExt("KEEPTOPIC"))
+ ci->ExtendMetadata("KEEPTOPIC");
else
- ci->UnsetFlag(CI_KEEPTOPIC);
+ ci->Shrink("KEEPTOPIC");
replacements["MESSAGES"] = "Secure updated";
}
- if (ci->HasFlag(CI_PEACE) != message.post_data.count("peace"))
+ if (ci->HasExt("PEACE") != message.post_data.count("peace"))
{
- if (!ci->HasFlag(CI_PEACE))
- ci->SetFlag(CI_PEACE);
+ if (!ci->HasExt("PEACE"))
+ ci->ExtendMetadata("PEACE");
else
- ci->UnsetFlag(CI_PEACE);
+ ci->Shrink("PEACE");
replacements["MESSAGES"] = "Peace updated";
}
- if (ci->HasFlag(CI_PRIVATE) != message.post_data.count("private"))
+ if (ci->HasExt("PRIVATE") != message.post_data.count("private"))
{
- if (!ci->HasFlag(CI_PRIVATE))
- ci->SetFlag(CI_PRIVATE);
+ if (!ci->HasExt("PRIVATE"))
+ ci->ExtendMetadata("PRIVATE");
else
- ci->UnsetFlag(CI_PRIVATE);
+ ci->Shrink("PRIVATE");
replacements["MESSAGES"] = "Private updated";
}
- if (ci->HasFlag(CI_RESTRICTED) != message.post_data.count("restricted"))
+ if (ci->HasExt("RESTRICTED") != message.post_data.count("restricted"))
{
- if (!ci->HasFlag(CI_RESTRICTED))
- ci->SetFlag(CI_RESTRICTED);
+ if (!ci->HasExt("RESTRICTED"))
+ ci->ExtendMetadata("RESTRICTED");
else
- ci->UnsetFlag(CI_RESTRICTED);
+ ci->Shrink("RESTRICTED");
replacements["MESSAGES"] = "Restricted updated";
}
- if (ci->HasFlag(CI_SECURE) != message.post_data.count("secure"))
+ if (ci->HasExt("SECURE") != message.post_data.count("secure"))
{
- if (!ci->HasFlag(CI_SECURE))
- ci->SetFlag(CI_SECURE);
+ if (!ci->HasExt("SECURE"))
+ ci->ExtendMetadata("SECURE");
else
- ci->UnsetFlag(CI_SECURE);
+ ci->Shrink("SECURE");
replacements["MESSAGES"] = "Secure updated";
}
- if (ci->HasFlag(CI_SECUREOPS) != message.post_data.count("secureops"))
+ if (ci->HasExt("SECUREOPS") != message.post_data.count("secureops"))
{
- if (!ci->HasFlag(CI_SECUREOPS))
- ci->SetFlag(CI_SECUREOPS);
+ if (!ci->HasExt("SECUREOPS"))
+ ci->ExtendMetadata("SECUREOPS");
else
- ci->UnsetFlag(CI_SECUREOPS);
+ ci->Shrink("SECUREOPS");
replacements["MESSAGES"] = "Secureops updated";
}
- if (ci->HasFlag(CI_TOPICLOCK) != message.post_data.count("topiclock"))
+ if (ci->HasExt("TOPICLOCK") != message.post_data.count("topiclock"))
{
- if (!ci->HasFlag(CI_TOPICLOCK))
- ci->SetFlag(CI_TOPICLOCK);
+ if (!ci->HasExt("TOPICLOCK"))
+ ci->ExtendMetadata("TOPICLOCK");
else
- ci->UnsetFlag(CI_TOPICLOCK);
+ ci->Shrink("TOPICLOCK");
replacements["MESSAGES"] = "Topiclock updated";
}
}
@@ -102,25 +102,25 @@ bool WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::stri
replacements["LAST_TOPIC_SETTER"] = HTTPUtils::Escape(ci->last_topic_setter);
}
- if (ci->HasFlag(CI_KEEPTOPIC))
+ if (ci->HasExt("KEEPTOPIC"))
replacements["KEEPTOPIC"];
- if (ci->HasFlag(CI_PEACE))
+ if (ci->HasExt("PEACE"))
replacements["PEACE"];
- if (ci->HasFlag(CI_PRIVATE))
+ if (ci->HasExt("PRIVATE"))
replacements["PRIVATE"];
- if (ci->HasFlag(CI_RESTRICTED))
+ if (ci->HasExt("RESTRICTED"))
replacements["RESTRICTED"];
- if (ci->HasFlag(CI_SECURE))
+ if (ci->HasExt("SECURE"))
replacements["SECURE"];
- if (ci->HasFlag(CI_SECUREOPS))
+ if (ci->HasExt("SECUREOPS"))
replacements["SECUREOPS"];
- if (ci->HasFlag(CI_TOPICLOCK))
+ if (ci->HasExt("TOPICLOCK"))
replacements["TOPICLOCK"];
TemplateFileServer page("chanserv/set.html");
diff --git a/modules/extra/webcpanel/pages/memoserv/memos.cpp b/modules/extra/webcpanel/pages/memoserv/memos.cpp
index 7d0dfcecb..9fa36d3c4 100644
--- a/modules/extra/webcpanel/pages/memoserv/memos.cpp
+++ b/modules/extra/webcpanel/pages/memoserv/memos.cpp
@@ -93,13 +93,9 @@ bool WebCPanel::MemoServ::Memos::OnRequest(HTTPProvider *server, const Anope::st
}
if (!error && message.get_data["read"] == "1")
- {
- m->UnsetFlag(MF_UNREAD);
- }
+ m->unread = false;
else if (!error && message.get_data["read"] == "2")
- {
- m->SetFlag(MF_UNREAD);
- }
+ m->unread = true;
}
for (unsigned i = 0; i < mi->memos->size(); ++i)
@@ -109,7 +105,7 @@ bool WebCPanel::MemoServ::Memos::OnRequest(HTTPProvider *server, const Anope::st
replacements["SENDER"] = m->sender;
replacements["TIME"] = Anope::strftime(m->time);
replacements["TEXT"] = m->text;
- if (m->HasFlag(MF_UNREAD))
+ if (m->unread)
replacements["UNREAD"] = "YES";
else
replacements["UNREAD"] = "NO";
diff --git a/modules/extra/webcpanel/pages/nickserv/alist.cpp b/modules/extra/webcpanel/pages/nickserv/alist.cpp
index e3fe59ff1..0afe2a4f3 100644
--- a/modules/extra/webcpanel/pages/nickserv/alist.cpp
+++ b/modules/extra/webcpanel/pages/nickserv/alist.cpp
@@ -24,7 +24,7 @@ bool WebCPanel::NickServ::Alist::OnRequest(HTTPProvider *server, const Anope::st
++chan_count;
replacements["NUMBERS"] = stringify(chan_count);
- replacements["CHANNELS"] = (ci->HasFlag(CI_NO_EXPIRE) ? "!" : "") + ci->name;
+ replacements["CHANNELS"] = (ci->HasExt("NO_EXPIRE") ? "!" : "") + ci->name;
replacements["ACCESSES"] = "Founder";
continue;
}
@@ -36,7 +36,7 @@ bool WebCPanel::NickServ::Alist::OnRequest(HTTPProvider *server, const Anope::st
++chan_count;
replacements["NUMBERS"] = stringify(chan_count);
- replacements["CHANNELS"] = (ci->HasFlag(CI_NO_EXPIRE) ? "!" : "") + ci->name;
+ replacements["CHANNELS"] = (ci->HasExt("NO_EXPIRE") ? "!" : "") + ci->name;
Anope::string access_str;
for (unsigned i = 0; i < access.size(); ++i)
access_str += ", " + access[i]->AccessSerialize();
diff --git a/modules/extra/webcpanel/pages/nickserv/info.cpp b/modules/extra/webcpanel/pages/nickserv/info.cpp
index e83768387..35a4a8a0a 100644
--- a/modules/extra/webcpanel/pages/nickserv/info.cpp
+++ b/modules/extra/webcpanel/pages/nickserv/info.cpp
@@ -36,46 +36,46 @@ bool WebCPanel::NickServ::Info::OnRequest(HTTPProvider *server, const Anope::str
replacements["MESSAGES"] = "Greet updated";
}
}
- if (na->nc->HasFlag(NI_AUTOOP) != message.post_data.count("autoop"))
+ if (na->nc->HasExt("AUTOOP") != message.post_data.count("autoop"))
{
- if (!na->nc->HasFlag(NI_AUTOOP))
- na->nc->SetFlag(NI_AUTOOP);
+ if (!na->nc->HasExt("AUTOOP"))
+ na->nc->ExtendMetadata("AUTOOP");
else
- na->nc->UnsetFlag(NI_AUTOOP);
+ na->nc->Shrink("AUTOOP");
replacements["MESSAGES"] = "Autoop updated";
}
- if (na->nc->HasFlag(NI_PRIVATE) != message.post_data.count("private"))
+ if (na->nc->HasExt("PRIVATE") != message.post_data.count("private"))
{
- if (!na->nc->HasFlag(NI_PRIVATE))
- na->nc->SetFlag(NI_PRIVATE);
+ if (!na->nc->HasExt("PRIVATE"))
+ na->nc->ExtendMetadata("PRIVATE");
else
- na->nc->UnsetFlag(NI_PRIVATE);
+ na->nc->Shrink("PRIVATE");
replacements["MESSAGES"] = "Private updated";
}
- if (na->nc->HasFlag(NI_SECURE) != message.post_data.count("secure"))
+ if (na->nc->HasExt("SECURE") != message.post_data.count("secure"))
{
- if (!na->nc->HasFlag(NI_SECURE))
- na->nc->SetFlag(NI_SECURE);
+ if (!na->nc->HasExt("SECURE"))
+ na->nc->ExtendMetadata("SECURE");
else
- na->nc->UnsetFlag(NI_SECURE);
+ na->nc->Shrink("SECURE");
replacements["MESSAGES"] = "Secure updated";
}
- if (message.post_data["kill"] == "on" && !na->nc->HasFlag(NI_KILLPROTECT))
+ if (message.post_data["kill"] == "on" && !na->nc->HasExt("KILLPROTECT"))
{
- na->nc->SetFlag(NI_KILLPROTECT);
- na->nc->UnsetFlag(NI_KILL_QUICK);
+ na->nc->ExtendMetadata("KILLPROTECT");
+ na->nc->Shrink("KILL_QUICK");
replacements["MESSAGES"] = "Kill updated";
}
- else if (message.post_data["kill"] == "quick" && !na->nc->HasFlag(NI_KILL_QUICK))
+ else if (message.post_data["kill"] == "quick" && !na->nc->HasExt("KILL_QUICK"))
{
- na->nc->UnsetFlag(NI_KILLPROTECT);
- na->nc->SetFlag(NI_KILL_QUICK);
+ na->nc->Shrink("KILLPROTECT");
+ na->nc->ExtendMetadata("KILL_QUICK");
replacements["MESSAGES"] = "Kill updated";
}
- else if (message.post_data["kill"] == "off" && (na->nc->HasFlag(NI_KILLPROTECT) || na->nc->HasFlag(NI_KILL_QUICK)))
+ else if (message.post_data["kill"] == "off" && (na->nc->HasExt("KILLPROTECT") || na->nc->HasExt("KILL_QUICK")))
{
- na->nc->UnsetFlag(NI_KILLPROTECT);
- na->nc->UnsetFlag(NI_KILL_QUICK);
+ na->nc->Shrink("KILLPROTECT");
+ na->nc->Shrink("KILL_QUICK");
replacements["MESSAGES"] = "Kill updated";
}
}
@@ -92,17 +92,17 @@ bool WebCPanel::NickServ::Info::OnRequest(HTTPProvider *server, const Anope::str
replacements["VHOST"] = na->GetVhostHost();
}
replacements["GREET"] = HTTPUtils::Escape(na->nc->greet);
- if (na->nc->HasFlag(NI_AUTOOP))
+ if (na->nc->HasExt("AUTOOP"))
replacements["AUTOOP"];
- if (na->nc->HasFlag(NI_PRIVATE))
+ if (na->nc->HasExt("PRIVATE"))
replacements["PRIVATE"];
- if (na->nc->HasFlag(NI_SECURE))
+ if (na->nc->HasExt("SECURE"))
replacements["SECURE"];
- if (na->nc->HasFlag(NI_KILLPROTECT))
+ if (na->nc->HasExt("KILLPROTECT"))
replacements["KILL_ON"];
- if (na->nc->HasFlag(NI_KILL_QUICK))
+ if (na->nc->HasExt("KILL_QUICK"))
replacements["KILL_QUICK"];
- if (!na->nc->HasFlag(NI_KILLPROTECT) && !na->nc->HasFlag(NI_KILL_QUICK))
+ if (!na->nc->HasExt("KILLPROTECT") && !na->nc->HasExt("KILL_QUICK"))
replacements["KILL_OFF"];
TemplateFileServer page("nickserv/info.html");
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index 1e0c31831..8c2c131a6 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -16,7 +16,7 @@
class ChannelModeFlood : public ChannelModeParam
{
public:
- ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam(CMODE_FLOOD, modeChar, minusNoArg) { }
+ ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { }
bool IsValid(const Anope::string &value) const anope_override
{
@@ -182,11 +182,11 @@ class BahamutIRCdProto : public IRCDProto
*/
ChanUserContainer *uc = c->FindUser(user);
if (uc != NULL)
- uc->status.ClearFlags();
+ uc->status.modes.clear();
BotInfo *setter = BotInfo::Find(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
- if (cs.HasFlag(ModeManager::ChannelModes[i]->name))
+ if (cs.modes.count(ModeManager::ChannelModes[i]->name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->GetUID(), false);
}
}
@@ -455,7 +455,7 @@ struct IRCDMessageSJoin : IRCDMessage
continue;
}
- sju.first.SetFlag(cm->name);
+ sju.first.modes.insert(cm->name);
}
sju.second = User::Find(buf);
@@ -519,38 +519,38 @@ class ProtoBahamut : public Module
void AddModes()
{
/* Add user modes */
- ModeManager::AddUserMode(new UserMode(UMODE_SERV_ADMIN, 'A'));
- ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, 'R'));
- ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, 'a'));
- ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i'));
- ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o'));
- ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'r'));
- ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, 's'));
- ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w'));
- ModeManager::AddUserMode(new UserMode(UMODE_DEAF, 'd'));
+ ModeManager::AddUserMode(new UserMode("SERV_ADMIN", 'A'));
+ ModeManager::AddUserMode(new UserMode("REGPRIV", 'R'));
+ ModeManager::AddUserMode(new UserMode("ADMIN", 'a'));
+ ModeManager::AddUserMode(new UserMode("INVIS", 'i'));
+ ModeManager::AddUserMode(new UserMode("OPER", 'o'));
+ ModeManager::AddUserMode(new UserMode("REGISTERED", 'r'));
+ ModeManager::AddUserMode(new UserMode("SNOMASK", 's'));
+ ModeManager::AddUserMode(new UserMode("WALLOPS", 'w'));
+ ModeManager::AddUserMode(new UserMode("DEAF", 'd'));
/* b/e/I */
- ModeManager::AddChannelMode(new ChannelModeList(CMODE_BAN, 'b'));
+ ModeManager::AddChannelMode(new ChannelModeList("BAN", 'b'));
/* v/h/o/a/q */
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', '+', 0));
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, 'o', '@', 1));
+ ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', '+', 0));
+ ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@', 1));
/* Add channel modes */
- ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i'));
+ ModeManager::AddChannelMode(new ChannelMode("BLOCKCOLOR", 'c'));
+ ModeManager::AddChannelMode(new ChannelMode("INVITE", 'i'));
ModeManager::AddChannelMode(new ChannelModeFlood('f', false));
ModeManager::AddChannelMode(new ChannelModeKey('k'));
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, 'n'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, 'p'));
+ ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l'));
+ ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm'));
+ ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n'));
+ ModeManager::AddChannelMode(new ChannelMode("PRIVATE", 'p'));
ModeManager::AddChannelMode(new ChannelModeRegistered('r'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, 's'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, 't'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, 'M'));
+ ModeManager::AddChannelMode(new ChannelMode("SECRET", 's'));
+ ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't'));
+ ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M'));
ModeManager::AddChannelMode(new ChannelModeOper('O'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, 'R'));
+ ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R'));
}
public:
@@ -573,7 +573,7 @@ class ProtoBahamut : public Module
void OnUserNickChange(User *u, const Anope::string &) anope_override
{
- u->RemoveModeInternal(ModeManager::FindUserModeByName(UMODE_REGISTERED));
+ u->RemoveModeInternal(ModeManager::FindUserModeByName("REGISTERED"));
IRCD->SendLogout(u);
}
};
diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp
index 6910bfc45..a1e9a89e7 100644
--- a/modules/protocol/hybrid.cpp
+++ b/modules/protocol/hybrid.cpp
@@ -232,7 +232,7 @@ class HybridProto : public IRCDProto
{
ChannelStatus status;
- status.SetFlag(CMODE_OP);
+ status.modes.insert("OP");
bi->Join(c, &status);
}
@@ -255,9 +255,9 @@ struct IRCDMessageBMask : IRCDMessage
if (c)
{
- ChannelMode *ban = ModeManager::FindChannelModeByName(CMODE_BAN),
- *except = ModeManager::FindChannelModeByName(CMODE_EXCEPT),
- *invex = ModeManager::FindChannelModeByName(CMODE_INVITEOVERRIDE);
+ ChannelMode *ban = ModeManager::FindChannelModeByName("BAN"),
+ *except = ModeManager::FindChannelModeByName("EXCEPT"),
+ *invex = ModeManager::FindChannelModeByName("INVITEOVERRIDE");
spacesepstream bans(params[3]);
Anope::string token;
@@ -401,7 +401,7 @@ struct IRCDMessageSJoin : IRCDMessage
continue;
}
- sju.first.SetFlag(cm->name);
+ sju.first.modes.insert(cm->name);
}
sju.second = User::Find(buf);
@@ -554,40 +554,40 @@ class ProtoHybrid : public Module
void AddModes()
{
/* Add user modes */
- ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, 'a'));
- ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i'));
- ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o'));
- ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'r'));
- ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, 's'));
- ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w'));
- ModeManager::AddUserMode(new UserMode(UMODE_HIDEOPER, 'H'));
- ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, 'R'));
+ ModeManager::AddUserMode(new UserMode("ADMIN", 'a'));
+ ModeManager::AddUserMode(new UserMode("INVIS", 'i'));
+ ModeManager::AddUserMode(new UserMode("OPER", 'o'));
+ ModeManager::AddUserMode(new UserMode("REGISTERED", 'r'));
+ ModeManager::AddUserMode(new UserMode("SNOMASK", 's'));
+ ModeManager::AddUserMode(new UserMode("WALLOPS", 'w'));
+ ModeManager::AddUserMode(new UserMode("HIDEOPER", 'H'));
+ ModeManager::AddUserMode(new UserMode("REGPRIV", 'R'));
/* b/e/I */
- ModeManager::AddChannelMode(new ChannelModeList(CMODE_BAN, 'b'));
- ModeManager::AddChannelMode(new ChannelModeList(CMODE_EXCEPT, 'e'));
- ModeManager::AddChannelMode(new ChannelModeList(CMODE_INVITEOVERRIDE, 'I'));
+ ModeManager::AddChannelMode(new ChannelModeList("BAN", 'b'));
+ ModeManager::AddChannelMode(new ChannelModeList("EXCEPT", 'e'));
+ ModeManager::AddChannelMode(new ChannelModeList("INVITEOVERRIDE", 'I'));
/* v/h/o/a/q */
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', '+', 0));
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, 'h', '%', 1));
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, 'o', '@', 2));
+ ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', '+', 0));
+ ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%', 1));
+ ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@', 2));
/* l/k */
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l'));
+ ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l'));
ModeManager::AddChannelMode(new ChannelModeKey('k'));
/* Add channel modes */
- ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, 'n'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, 'p'));
+ ModeManager::AddChannelMode(new ChannelMode("INVITE", 'i'));
+ ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm'));
+ ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n'));
+ ModeManager::AddChannelMode(new ChannelMode("PRIVATE", 'p'));
ModeManager::AddChannelMode(new ChannelModeRegistered('r'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, 's'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, 't'));
+ ModeManager::AddChannelMode(new ChannelMode("SECRET", 's'));
+ ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't'));
ModeManager::AddChannelMode(new ChannelModeOper('O'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, 'R'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, 'S'));
+ ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R'));
+ ModeManager::AddChannelMode(new ChannelMode("SSL", 'S'));
}
public:
@@ -620,7 +620,7 @@ public:
void OnUserNickChange(User *u, const Anope::string &) anope_override
{
- u->RemoveModeInternal(ModeManager::FindUserModeByName(UMODE_REGISTERED));
+ u->RemoveModeInternal(ModeManager::FindUserModeByName("REGISTERED"));
}
};
diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp
index 84ba1b75d..6ff0211d4 100644
--- a/modules/protocol/inspircd11.cpp
+++ b/modules/protocol/inspircd11.cpp
@@ -101,7 +101,7 @@ class InspIRCdProto : public IRCDProto
void SendVhostDel(User *u) anope_override
{
- if (u->HasMode(UMODE_CLOAK))
+ if (u->HasMode("CLOAK"))
inspircd_cmd_chghost(u->nick, u->chost);
else
inspircd_cmd_chghost(u->nick, u->host);
@@ -215,11 +215,11 @@ class InspIRCdProto : public IRCDProto
*/
ChanUserContainer *uc = c->FindUser(user);
if (uc != NULL)
- uc->status.ClearFlags();
+ uc->status.modes.clear();
BotInfo *setter = BotInfo::Find(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
- if (cs.HasFlag(ModeManager::ChannelModes[i]->name))
+ if (cs.modes.count(ModeManager::ChannelModes[i]->name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->GetUID(), false);
}
}
@@ -327,7 +327,7 @@ class InspIRCdProto : public IRCDProto
class ChannelModeFlood : public ChannelModeParam
{
public:
- ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam(CMODE_FLOOD, modeChar, minusNoArg) { }
+ ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { }
bool IsValid(const Anope::string &value) const anope_override
{
@@ -392,16 +392,16 @@ struct IRCDMessageCapab : Message::Capab
switch (modebuf[t])
{
case 'b':
- ModeManager::AddChannelMode(new ChannelModeList(CMODE_BAN, 'b'));
+ ModeManager::AddChannelMode(new ChannelModeList("BAN", 'b'));
continue;
case 'e':
- ModeManager::AddChannelMode(new ChannelModeList(CMODE_EXCEPT, 'e'));
+ ModeManager::AddChannelMode(new ChannelModeList("EXCEPT", 'e'));
continue;
case 'I':
- ModeManager::AddChannelMode(new ChannelModeList(CMODE_INVITEOVERRIDE, 'I'));
+ ModeManager::AddChannelMode(new ChannelModeList("INVITEOVERRIDE", 'I'));
continue;
default:
- ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
+ ModeManager::AddChannelMode(new ChannelModeList("END", modebuf[t]));
}
}
@@ -414,7 +414,7 @@ struct IRCDMessageCapab : Message::Capab
ModeManager::AddChannelMode(new ChannelModeKey('k'));
continue;
default:
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t]));
+ ModeManager::AddChannelMode(new ChannelModeParam("END", modebuf[t]));
}
}
@@ -427,13 +427,13 @@ struct IRCDMessageCapab : Message::Capab
ModeManager::AddChannelMode(new ChannelModeFlood('f', false));
continue;
case 'l':
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l', true));
+ ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true));
continue;
case 'L':
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_REDIRECT, 'L', true));
+ ModeManager::AddChannelMode(new ChannelModeParam("REDIRECT", 'L', true));
continue;
default:
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t], true));
+ ModeManager::AddChannelMode(new ChannelModeParam("END", modebuf[t], true));
}
}
@@ -443,67 +443,67 @@ struct IRCDMessageCapab : Message::Capab
switch (modebuf[t])
{
case 'i':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i'));
+ ModeManager::AddChannelMode(new ChannelMode("INVITE", 'i'));
continue;
case 'm':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm'));
+ ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm'));
continue;
case 'n':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, 'n'));
+ ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n'));
continue;
case 'p':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, 'p'));
+ ModeManager::AddChannelMode(new ChannelMode("PRIVATE", 'p'));
continue;
case 's':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, 's'));
+ ModeManager::AddChannelMode(new ChannelMode("SECRET", 's'));
continue;
case 't':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, 't'));
+ ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't'));
continue;
case 'r':
ModeManager::AddChannelMode(new ChannelModeRegistered('r'));
continue;
case 'c':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c'));
+ ModeManager::AddChannelMode(new ChannelMode("BLOCKCOLOR", 'c'));
continue;
case 'u':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_AUDITORIUM, 'u'));
+ ModeManager::AddChannelMode(new ChannelMode("AUDITORIUM", 'u'));
continue;
case 'z':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, 'z'));
+ ModeManager::AddChannelMode(new ChannelMode("SSL", 'z'));
continue;
case 'A':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_ALLINVITE, 'A'));
+ ModeManager::AddChannelMode(new ChannelMode("ALLINVITE", 'A'));
continue;
case 'C':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOCTCP, 'C'));
+ ModeManager::AddChannelMode(new ChannelMode("NOCTCP", 'C'));
continue;
case 'G':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_FILTER, 'G'));
+ ModeManager::AddChannelMode(new ChannelMode("FILTER", 'G'));
continue;
case 'K':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKNOCK, 'K'));
+ ModeManager::AddChannelMode(new ChannelMode("NOKNOCK", 'K'));
continue;
case 'N':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NONICK, 'N'));
+ ModeManager::AddChannelMode(new ChannelMode("NONICK", 'N'));
continue;
case 'O':
ModeManager::AddChannelMode(new ChannelModeOper('O'));
continue;
case 'Q':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKICK, 'Q'));
+ ModeManager::AddChannelMode(new ChannelMode("NOKICK", 'Q'));
continue;
case 'R':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, 'R'));
+ ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R'));
continue;
case 'S':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_STRIPCOLOR, 'S'));
+ ModeManager::AddChannelMode(new ChannelMode("STRIPCOLOR", 'S'));
continue;
case 'V':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOINVITE, 'V'));
+ ModeManager::AddChannelMode(new ChannelMode("NOINVITE", 'V'));
continue;
default:
- ModeManager::AddChannelMode(new ChannelMode(CMODE_END, modebuf[t]));
+ ModeManager::AddChannelMode(new ChannelMode("END", modebuf[t]));
}
}
}
@@ -518,22 +518,22 @@ struct IRCDMessageCapab : Message::Capab
switch (modes[t])
{
case 'q':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, 'q', '~', level--));
+ ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', '~', level--));
continue;
case 'a':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, 'a', '&', level--));
+ ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', '&', level--));
continue;
case 'o':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, 'o', '@', level--));
+ ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@', level--));
continue;
case 'h':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, 'h', '%', level--));
+ ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%', level--));
continue;
case 'v':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', '+', level--));
+ ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', '+', level--));
continue;
default:
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_END, modes[t], chars[t], level--));
+ ModeManager::AddChannelMode(new ChannelModeStatus("END", modes[t], chars[t], level--));
}
}
}
@@ -653,7 +653,7 @@ struct IRCDMessageFJoin : IRCDMessage
continue;
}
- sju.first.SetFlag(cm->name);
+ sju.first.modes.insert(cm->name);
}
/* Erase the , */
buf.erase(buf.begin());
@@ -785,7 +785,7 @@ struct IRCDMessageOperType : IRCDMessage
/* opertype is equivalent to mode +o because servers
dont do this directly */
User *u = source.GetUser();
- if (!u->HasMode(UMODE_OPER))
+ if (!u->HasMode("OPER"))
u->SetModesInternal("+o");
}
};
@@ -860,13 +860,13 @@ class ProtoInspIRCd : public Module
void AddModes()
{
- ModeManager::AddUserMode(new UserMode(UMODE_CALLERID, 'g'));
- ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, 'h'));
- ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i'));
- ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o'));
- ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'r'));
- ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w'));
- ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, 'x'));
+ ModeManager::AddUserMode(new UserMode("CALLERID", 'g'));
+ ModeManager::AddUserMode(new UserMode("HELPOP", 'h'));
+ ModeManager::AddUserMode(new UserMode("INVIS", 'i'));
+ ModeManager::AddUserMode(new UserMode("OPER", 'o'));
+ ModeManager::AddUserMode(new UserMode("REGISTERED", 'r'));
+ ModeManager::AddUserMode(new UserMode("WALLOPS", 'w'));
+ ModeManager::AddUserMode(new UserMode("CLOAK", 'x'));
}
public:
@@ -893,7 +893,7 @@ class ProtoInspIRCd : public Module
void OnUserNickChange(User *u, const Anope::string &) anope_override
{
- u->RemoveModeInternal(ModeManager::FindUserModeByName(UMODE_REGISTERED));
+ u->RemoveModeInternal(ModeManager::FindUserModeByName("REGISTERED"));
}
};
diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp
index 4fc1f931a..b8c4d88d8 100644
--- a/modules/protocol/inspircd12.cpp
+++ b/modules/protocol/inspircd12.cpp
@@ -16,7 +16,7 @@
class ChannelModeFlood : public ChannelModeParam
{
public:
- ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam(CMODE_FLOOD, modeChar, minusNoArg) { }
+ ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { }
bool IsValid(const Anope::string &value) const anope_override
{
@@ -124,7 +124,7 @@ class InspIRCd12Proto : public IRCDProto
void SendVhostDel(User *u) anope_override
{
- if (u->HasMode(UMODE_CLOAK))
+ if (u->HasMode("CLOAK"))
this->SendChgHostInternal(u->nick, u->chost);
else
this->SendChgHostInternal(u->nick, u->host);
@@ -231,11 +231,11 @@ class InspIRCd12Proto : public IRCDProto
*/
ChanUserContainer *uc = c->FindUser(user);
if (uc != NULL)
- uc->status.ClearFlags();
+ uc->status.modes.clear();
BotInfo *setter = BotInfo::Find(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
- if (cs.HasFlag(ModeManager::ChannelModes[i]->name))
+ if (cs.modes.count(ModeManager::ChannelModes[i]->name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->GetUID(), false);
}
}
@@ -342,7 +342,7 @@ class InspIRCd12Proto : public IRCDProto
void SendLogin(User *u) anope_override
{
- if (!u->Account() || u->Account()->HasFlag(NI_UNCONFIRMED))
+ if (!u->Account() || u->Account()->HasExt("UNCONFIRMED"))
return;
UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :" << u->Account()->display;
@@ -366,7 +366,7 @@ class InspIRCd12Proto : public IRCDProto
class InspIRCdExtBan : public ChannelModeList
{
public:
- InspIRCdExtBan(ChannelModeName mName, char modeChar) : ChannelModeList(mName, modeChar) { }
+ InspIRCdExtBan(const Anope::string &mname, char modeChar) : ChannelModeList(mname, modeChar) { }
bool Matches(const User *u, const Entry *e) anope_override
{
@@ -464,23 +464,23 @@ struct IRCDMessageCapab : Message::Capab
switch (modebuf[t])
{
case 'b':
- ModeManager::AddChannelMode(new InspIRCdExtBan(CMODE_BAN, 'b'));
+ ModeManager::AddChannelMode(new InspIRCdExtBan("BAN", 'b'));
continue;
case 'e':
- ModeManager::AddChannelMode(new InspIRCdExtBan(CMODE_EXCEPT, 'e'));
+ ModeManager::AddChannelMode(new InspIRCdExtBan("EXCEPT", 'e'));
continue;
case 'I':
- ModeManager::AddChannelMode(new InspIRCdExtBan(CMODE_INVITEOVERRIDE, 'I'));
+ ModeManager::AddChannelMode(new InspIRCdExtBan("INVITEOVERRIDE", 'I'));
continue;
/* InspIRCd sends q and a here if they have no prefixes */
case 'q':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, 'q', '@'));
+ ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', '@'));
continue;
case 'a':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT , 'a', '@'));
+ ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT" , 'a', '@'));
continue;
default:
- ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
+ ModeManager::AddChannelMode(new ChannelModeList("END", modebuf[t]));
}
}
@@ -493,7 +493,7 @@ struct IRCDMessageCapab : Message::Capab
ModeManager::AddChannelMode(new ChannelModeKey('k'));
continue;
default:
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t]));
+ ModeManager::AddChannelMode(new ChannelModeParam("END", modebuf[t]));
}
}
@@ -503,25 +503,25 @@ struct IRCDMessageCapab : Message::Capab
switch (modebuf[t])
{
case 'F':
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_NICKFLOOD, 'F', true));
+ ModeManager::AddChannelMode(new ChannelModeParam("NICKFLOOD", 'F', true));
continue;
case 'J':
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_NOREJOIN, 'J', true));
+ ModeManager::AddChannelMode(new ChannelModeParam("NOREJOIN", 'J', true));
continue;
case 'L':
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_REDIRECT, 'L', true));
+ ModeManager::AddChannelMode(new ChannelModeParam("REDIRECT", 'L', true));
continue;
case 'f':
ModeManager::AddChannelMode(new ChannelModeFlood('f', true));
continue;
case 'j':
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_JOINFLOOD, 'j', true));
+ ModeManager::AddChannelMode(new ChannelModeParam("JOINFLOOD", 'j', true));
continue;
case 'l':
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l', true));
+ ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true));
continue;
default:
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t], true));
+ ModeManager::AddChannelMode(new ChannelModeParam("END", modebuf[t], true));
}
}
@@ -531,79 +531,79 @@ struct IRCDMessageCapab : Message::Capab
switch (modebuf[t])
{
case 'A':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_ALLINVITE, 'A'));
+ ModeManager::AddChannelMode(new ChannelMode("ALLINVITE", 'A'));
continue;
case 'B':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCAPS, 'B'));
+ ModeManager::AddChannelMode(new ChannelMode("BLOCKCAPS", 'B'));
continue;
case 'C':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOCTCP, 'C'));
+ ModeManager::AddChannelMode(new ChannelMode("NOCTCP", 'C'));
continue;
case 'D':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_DELAYEDJOIN, 'D'));
+ ModeManager::AddChannelMode(new ChannelMode("DELAYEDJOIN", 'D'));
continue;
case 'G':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_FILTER, 'G'));
+ ModeManager::AddChannelMode(new ChannelMode("FILTER", 'G'));
continue;
case 'K':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKNOCK, 'K'));
+ ModeManager::AddChannelMode(new ChannelMode("NOKNOCK", 'K'));
continue;
case 'M':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, 'M'));
+ ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M'));
continue;
case 'N':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NONICK, 'N'));
+ ModeManager::AddChannelMode(new ChannelMode("NONICK", 'N'));
continue;
case 'O':
ModeManager::AddChannelMode(new ChannelModeOper('O'));
continue;
case 'P':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_PERM, 'P'));
+ ModeManager::AddChannelMode(new ChannelMode("PERM", 'P'));
continue;
case 'Q':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKICK, 'Q'));
+ ModeManager::AddChannelMode(new ChannelMode("NOKICK", 'Q'));
continue;
case 'R':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, 'R'));
+ ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R'));
continue;
case 'S':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_STRIPCOLOR, 'S'));
+ ModeManager::AddChannelMode(new ChannelMode("STRIPCOLOR", 'S'));
continue;
case 'T':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NONOTICE, 'T'));
+ ModeManager::AddChannelMode(new ChannelMode("NONOTICE", 'T'));
continue;
case 'c':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c'));
+ ModeManager::AddChannelMode(new ChannelMode("BLOCKCOLOR", 'c'));
continue;
case 'i':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i'));
+ ModeManager::AddChannelMode(new ChannelMode("INVITE", 'i'));
continue;
case 'm':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm'));
+ ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm'));
continue;
case 'n':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, 'n'));
+ ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n'));
continue;
case 'p':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, 'p'));
+ ModeManager::AddChannelMode(new ChannelMode("PRIVATE", 'p'));
continue;
case 'r':
ModeManager::AddChannelMode(new ChannelModeRegistered('r'));
continue;
case 's':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, 's'));
+ ModeManager::AddChannelMode(new ChannelMode("SECRET", 's'));
continue;
case 't':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, 't'));
+ ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't'));
continue;
case 'u':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_AUDITORIUM, 'u'));
+ ModeManager::AddChannelMode(new ChannelMode("AUDITORIUM", 'u'));
continue;
case 'z':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, 'z'));
+ ModeManager::AddChannelMode(new ChannelMode("SSL", 'z'));
continue;
default:
- ModeManager::AddChannelMode(new ChannelMode(CMODE_END, modebuf[t]));
+ ModeManager::AddChannelMode(new ChannelMode("END", modebuf[t]));
}
}
}
@@ -620,61 +620,61 @@ struct IRCDMessageCapab : Message::Capab
switch (modebuf[t])
{
case 'h':
- ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, 'h'));
+ ModeManager::AddUserMode(new UserMode("HELPOP", 'h'));
continue;
case 'B':
- ModeManager::AddUserMode(new UserMode(UMODE_BOT, 'B'));
+ ModeManager::AddUserMode(new UserMode("BOT", 'B'));
continue;
case 'G':
- ModeManager::AddUserMode(new UserMode(UMODE_FILTER, 'G'));
+ ModeManager::AddUserMode(new UserMode("FILTER", 'G'));
continue;
case 'H':
- ModeManager::AddUserMode(new UserMode(UMODE_HIDEOPER, 'H'));
+ ModeManager::AddUserMode(new UserMode("HIDEOPER", 'H'));
continue;
case 'I':
- ModeManager::AddUserMode(new UserMode(UMODE_PRIV, 'I'));
+ ModeManager::AddUserMode(new UserMode("PRIV", 'I'));
continue;
case 'Q':
- ModeManager::AddUserMode(new UserMode(UMODE_HIDDEN, 'Q'));
+ ModeManager::AddUserMode(new UserMode("HIDDEN", 'Q'));
continue;
case 'R':
- ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, 'R'));
+ ModeManager::AddUserMode(new UserMode("REGPRIV", 'R'));
continue;
case 'S':
- ModeManager::AddUserMode(new UserMode(UMODE_STRIPCOLOR, 'S'));
+ ModeManager::AddUserMode(new UserMode("STRIPCOLOR", 'S'));
continue;
case 'W':
- ModeManager::AddUserMode(new UserMode(UMODE_WHOIS, 'W'));
+ ModeManager::AddUserMode(new UserMode("WHOIS", 'W'));
continue;
case 'c':
- ModeManager::AddUserMode(new UserMode(UMODE_COMMONCHANS, 'c'));
+ ModeManager::AddUserMode(new UserMode("COMMONCHANS", 'c'));
continue;
case 'g':
- ModeManager::AddUserMode(new UserMode(UMODE_CALLERID, 'g'));
+ ModeManager::AddUserMode(new UserMode("CALLERID", 'g'));
continue;
case 'i':
- ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i'));
+ ModeManager::AddUserMode(new UserMode("INVIS", 'i'));
continue;
case 'k':
- ModeManager::AddUserMode(new UserMode(UMODE_PROTECTED, 'k'));
+ ModeManager::AddUserMode(new UserMode("PROTECTED", 'k'));
continue;
case 'o':
- ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o'));
+ ModeManager::AddUserMode(new UserMode("OPER", 'o'));
continue;
case 'r':
- ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'r'));
+ ModeManager::AddUserMode(new UserMode("REGISTERED", 'r'));
continue;
case 'w':
- ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w'));
+ ModeManager::AddUserMode(new UserMode("WALLOPS", 'w'));
continue;
case 'x':
- ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, 'x'));
+ ModeManager::AddUserMode(new UserMode("CLOAK", 'x'));
continue;
case 'd':
- ModeManager::AddUserMode(new UserMode(UMODE_DEAF, 'd'));
+ ModeManager::AddUserMode(new UserMode("DEAF", 'd'));
continue;
default:
- ModeManager::AddUserMode(new UserMode(UMODE_END, modebuf[t]));
+ ModeManager::AddUserMode(new UserMode("END", modebuf[t]));
}
}
}
@@ -690,22 +690,22 @@ struct IRCDMessageCapab : Message::Capab
switch (modes[t])
{
case 'q':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, 'q', chars[t], level--));
+ ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', chars[t], level--));
continue;
case 'a':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, 'a', chars[t], level--));
+ ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', chars[t], level--));
continue;
case 'o':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, 'o', chars[t], level--));
+ ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', chars[t], level--));
continue;
case 'h':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, 'h', chars[t], level--));
+ ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', chars[t], level--));
continue;
case 'v':
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', chars[t], level--));
+ ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', chars[t], level--));
continue;
default:
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_END, modes[t], chars[t], level--));
+ ModeManager::AddChannelMode(new ChannelModeStatus("END", modes[t], chars[t], level--));
}
}
}
@@ -831,7 +831,7 @@ struct IRCDMessageFJoin : IRCDMessage
continue;
}
- sju.first.SetFlag(cm->name);
+ sju.first.modes.insert(cm->name);
}
/* Erase the , */
buf.erase(buf.begin());
@@ -929,8 +929,8 @@ struct IRCDMessageMetadata : IRCDMessage
u->Login(nc);
const NickAlias *user_na = NickAlias::Find(u->nick);
- if (!Config->NoNicknameOwnership && user_na && user_na->nc == nc && user_na->nc->HasFlag(NI_UNCONFIRMED) == false)
- u->SetMode(NickServ, UMODE_REGISTERED);
+ if (!Config->NoNicknameOwnership && user_na && user_na->nc == nc && user_na->nc->HasExt("UNCONFIRMED") == false)
+ u->SetMode(NickServ, "REGISTERED");
/* Sometimes a user connects, we send them the usual "this nickname is registered" mess (if
* their server isn't syncing) and then we receive this.. so tell them about it.
@@ -1072,7 +1072,7 @@ struct IRCDMessageOperType : IRCDMessage
/* opertype is equivalent to mode +o because servers
dont do this directly */
User *u = source.GetUser();
- if (!u->HasMode(UMODE_OPER))
+ if (!u->HasMode("OPER"))
u->SetModesInternal("+o");
}
};
@@ -1088,11 +1088,9 @@ struct IRCDMessageRSQuit : IRCDMessage
return;
/* On InspIRCd we must send a SQUIT when we recieve RSQUIT for a server we have juped */
- if (s->HasFlag(SERVER_JUPED))
+ if (s->IsJuped())
UplinkSocket::Message(Me) << "SQUIT " << s->GetSID() << " :" << (params.size() > 1 ? params[1].c_str() : "");
- FOREACH_MOD(I_OnServerQuit, OnServerQuit(s));
-
s->Delete(s->GetName() + " " + s->GetUplink()->GetName());
}
};
@@ -1240,7 +1238,7 @@ class ProtoInspIRCd : public Module
/* InspIRCd 1.2 doesn't set -r on nick change, remove -r here. Note that if we have to set +r later
* this will cancel out this -r, resulting in no mode changes.
*/
- u->RemoveMode(NickServ, UMODE_REGISTERED);
+ u->RemoveMode(NickServ, "REGISTERED");
}
};
diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp
index ec543ac06..2c6e562f1 100644
--- a/modules/protocol/inspircd20.cpp
+++ b/modules/protocol/inspircd20.cpp
@@ -76,7 +76,7 @@ class InspIRCd20Proto : public IRCDProto
class InspIRCdExtBan : public ChannelModeList
{
public:
- InspIRCdExtBan(ChannelModeName mName, char modeChar) : ChannelModeList(mName, modeChar) { }
+ InspIRCdExtBan(const Anope::string &mname, char modeChar) : ChannelModeList(mname, modeChar) { }
bool Matches(const User *u, const Entry *e) anope_override
{
@@ -109,7 +109,7 @@ class InspIRCdExtBan : public ChannelModeList
{
ChanUserContainer *uc = c->FindUser(u);
if (uc != NULL)
- if (cm == NULL || uc->status.HasFlag(cm->name))
+ if (cm == NULL || uc->status.modes.count(cm->name))
return true;
}
}
@@ -149,7 +149,7 @@ class InspIRCdExtBan : public ChannelModeList
class ChannelModeFlood : public ChannelModeParam
{
public:
- ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam(CMODE_FLOOD, modeChar, minusNoArg) { }
+ ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { }
bool IsValid(const Anope::string &value) const anope_override
{
@@ -203,88 +203,88 @@ struct IRCDMessageCapab : Message::Capab
ChannelMode *cm = NULL;
if (modename.equals_cs("admin"))
- cm = new ChannelModeStatus(CMODE_PROTECT, modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0);
+ cm = new ChannelModeStatus("PROTECT", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0);
else if (modename.equals_cs("allowinvite"))
- cm = new ChannelMode(CMODE_ALLINVITE, modechar[0]);
+ cm = new ChannelMode("ALLINVITE", modechar[0]);
else if (modename.equals_cs("auditorium"))
- cm = new ChannelMode(CMODE_AUDITORIUM, modechar[0]);
+ cm = new ChannelMode("AUDITORIUM", modechar[0]);
else if (modename.equals_cs("ban"))
- cm = new InspIRCdExtBan(CMODE_BAN, modechar[0]);
+ cm = new InspIRCdExtBan("BAN", modechar[0]);
else if (modename.equals_cs("banexception"))
- cm = new InspIRCdExtBan(CMODE_EXCEPT, 'e');
+ cm = new InspIRCdExtBan("EXCEPT", 'e');
else if (modename.equals_cs("blockcaps"))
- cm = new ChannelMode(CMODE_BLOCKCAPS, modechar[0]);
+ cm = new ChannelMode("BLOCKCAPS", modechar[0]);
else if (modename.equals_cs("blockcolor"))
- cm = new ChannelMode(CMODE_BLOCKCOLOR, modechar[0]);
+ cm = new ChannelMode("BLOCKCOLOR", modechar[0]);
else if (modename.equals_cs("c_registered"))
cm = new ChannelModeRegistered(modechar[0]);
else if (modename.equals_cs("censor"))
- cm = new ChannelMode(CMODE_FILTER, modechar[0]);
+ cm = new ChannelMode("FILTER", modechar[0]);
else if (modename.equals_cs("delayjoin"))
- cm = new ChannelMode(CMODE_DELAYEDJOIN, modechar[0]);
+ cm = new ChannelMode("DELAYEDJOIN", modechar[0]);
else if (modename.equals_cs("filter"))
- cm = new ChannelModeList(CMODE_FILTER, modechar[0]);
+ cm = new ChannelModeList("FILTER", modechar[0]);
else if (modename.equals_cs("flood"))
cm = new ChannelModeFlood(modechar[0], true);
else if (modename.equals_cs("founder"))
- cm = new ChannelModeStatus(CMODE_OWNER, modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0);
+ cm = new ChannelModeStatus("OWNER", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0);
else if (modename.equals_cs("halfop"))
- cm = new ChannelModeStatus(CMODE_HALFOP, modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0);
+ cm = new ChannelModeStatus("HALFOP", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0);
else if (modename.equals_cs("invex"))
- cm = new InspIRCdExtBan(CMODE_INVITEOVERRIDE, 'I');
+ cm = new InspIRCdExtBan("INVITEOVERRIDE", 'I');
else if (modename.equals_cs("inviteonly"))
- cm = new ChannelMode(CMODE_INVITE, modechar[0]);
+ cm = new ChannelMode("INVITE", modechar[0]);
else if (modename.equals_cs("joinflood"))
- cm = new ChannelModeParam(CMODE_JOINFLOOD, modechar[0], true);
+ cm = new ChannelModeParam("JOINFLOOD", modechar[0], true);
else if (modename.equals_cs("key"))
cm = new ChannelModeKey(modechar[0]);
else if (modename.equals_cs("kicknorejoin"))
- cm = new ChannelModeParam(CMODE_NOREJOIN, modechar[0], true);
+ cm = new ChannelModeParam("NOREJOIN", modechar[0], true);
else if (modename.equals_cs("limit"))
- cm = new ChannelModeParam(CMODE_LIMIT, modechar[0], true);
+ cm = new ChannelModeParam("LIMIT", modechar[0], true);
else if (modename.equals_cs("moderated"))
- cm = new ChannelMode(CMODE_MODERATED, modechar[0]);
+ cm = new ChannelMode("MODERATED", modechar[0]);
else if (modename.equals_cs("nickflood"))
- cm = new ChannelModeParam(CMODE_NICKFLOOD, modechar[0], true);
+ cm = new ChannelModeParam("NICKFLOOD", modechar[0], true);
else if (modename.equals_cs("noctcp"))
- cm = new ChannelMode(CMODE_NOCTCP, modechar[0]);
+ cm = new ChannelMode("NOCTCP", modechar[0]);
else if (modename.equals_cs("noextmsg"))
- cm = new ChannelMode(CMODE_NOEXTERNAL, modechar[0]);
+ cm = new ChannelMode("NOEXTERNAL", modechar[0]);
else if (modename.equals_cs("nokick"))
- cm = new ChannelMode(CMODE_NOKICK, modechar[0]);
+ cm = new ChannelMode("NOKICK", modechar[0]);
else if (modename.equals_cs("noknock"))
- cm = new ChannelMode(CMODE_NOKNOCK, modechar[0]);
+ cm = new ChannelMode("NOKNOCK", modechar[0]);
else if (modename.equals_cs("nonick"))
- cm = new ChannelMode(CMODE_NONICK, modechar[0]);
+ cm = new ChannelMode("NONICK", modechar[0]);
else if (modename.equals_cs("nonotice"))
- cm = new ChannelMode(CMODE_NONOTICE, modechar[0]);
+ cm = new ChannelMode("NONOTICE", modechar[0]);
else if (modename.equals_cs("op"))
- cm = new ChannelModeStatus(CMODE_OP, modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0);
+ cm = new ChannelModeStatus("OP", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0);
else if (modename.equals_cs("operonly"))
cm = new ChannelModeOper(modechar[0]);
else if (modename.equals_cs("permanent"))
- cm = new ChannelMode(CMODE_PERM, modechar[0]);
+ cm = new ChannelMode("PERM", modechar[0]);
else if (modename.equals_cs("private"))
- cm = new ChannelMode(CMODE_PRIVATE, modechar[0]);
+ cm = new ChannelMode("PRIVATE", modechar[0]);
else if (modename.equals_cs("redirect"))
- cm = new ChannelModeParam(CMODE_REDIRECT, modechar[0], true);
+ cm = new ChannelModeParam("REDIRECT", modechar[0], true);
else if (modename.equals_cs("reginvite"))
- cm = new ChannelMode(CMODE_REGISTEREDONLY, modechar[0]);
+ cm = new ChannelMode("REGISTEREDONLY", modechar[0]);
else if (modename.equals_cs("regmoderated"))
- cm = new ChannelMode(CMODE_REGMODERATED, modechar[0]);
+ cm = new ChannelMode("REGMODERATED", modechar[0]);
else if (modename.equals_cs("secret"))
- cm = new ChannelMode(CMODE_SECRET, modechar[0]);
+ cm = new ChannelMode("SECRET", modechar[0]);
else if (modename.equals_cs("sslonly"))
- cm = new ChannelMode(CMODE_SSL, modechar[0]);
+ cm = new ChannelMode("SSL", modechar[0]);
else if (modename.equals_cs("stripcolor"))
- cm = new ChannelMode(CMODE_STRIPCOLOR, modechar[0]);
+ cm = new ChannelMode("STRIPCOLOR", modechar[0]);
else if (modename.equals_cs("topiclock"))
- cm = new ChannelMode(CMODE_TOPIC, modechar[0]);
+ cm = new ChannelMode("TOPIC", modechar[0]);
else if (modename.equals_cs("voice"))
- cm = new ChannelModeStatus(CMODE_VOICE, modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0);
+ cm = new ChannelModeStatus("VOICE", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0);
/* Unknown status mode, (customprefix) - add it */
else if (modechar.length() == 2)
- cm = new ChannelModeStatus(CMODE_END, modechar[1], modechar[0]);
+ cm = new ChannelModeStatus("END", modechar[1], modechar[0]);
/* else don't do anything here, we will get it in CAPAB CAPABILITIES */
if (cm)
@@ -305,44 +305,44 @@ struct IRCDMessageCapab : Message::Capab
UserMode *um = NULL;
if (modename.equals_cs("bot"))
- um = new UserMode(UMODE_BOT, modechar[0]);
+ um = new UserMode("BOT", modechar[0]);
else if (modename.equals_cs("callerid"))
- um = new UserMode(UMODE_CALLERID, modechar[0]);
+ um = new UserMode("CALLERID", modechar[0]);
else if (modename.equals_cs("cloak"))
- um = new UserMode(UMODE_CLOAK, modechar[0]);
+ um = new UserMode("CLOAK", modechar[0]);
else if (modename.equals_cs("deaf"))
- um = new UserMode(UMODE_DEAF, modechar[0]);
+ um = new UserMode("DEAF", modechar[0]);
else if (modename.equals_cs("deaf_commonchan"))
- um = new UserMode(UMODE_COMMONCHANS, modechar[0]);
+ um = new UserMode("COMMONCHANS", modechar[0]);
else if (modename.equals_cs("helpop"))
- um = new UserMode(UMODE_HELPOP, modechar[0]);
+ um = new UserMode("HELPOP", modechar[0]);
else if (modename.equals_cs("hidechans"))
- um = new UserMode(UMODE_PRIV, modechar[0]);
+ um = new UserMode("PRIV", modechar[0]);
else if (modename.equals_cs("hideoper"))
- um = new UserMode(UMODE_HIDEOPER, modechar[0]);
+ um = new UserMode("HIDEOPER", modechar[0]);
else if (modename.equals_cs("invisible"))
- um = new UserMode(UMODE_INVIS, modechar[0]);
+ um = new UserMode("INVIS", modechar[0]);
else if (modename.equals_cs("invis-oper"))
- um = new UserMode(UMODE_INVISIBLE_OPER, modechar[0]);
+ um = new UserMode("INVISIBLE_OPER", modechar[0]);
else if (modename.equals_cs("oper"))
- um = new UserMode(UMODE_OPER, modechar[0]);
+ um = new UserMode("OPER", modechar[0]);
else if (modename.equals_cs("regdeaf"))
- um = new UserMode(UMODE_REGPRIV, modechar[0]);
+ um = new UserMode("REGPRIV", modechar[0]);
else if (modename.equals_cs("servprotect"))
{
- um = new UserMode(UMODE_PROTECTED, modechar[0]);
+ um = new UserMode("PROTECTED", modechar[0]);
IRCD->DefaultPseudoclientModes += "k";
}
else if (modename.equals_cs("showwhois"))
- um = new UserMode(UMODE_WHOIS, modechar[0]);
+ um = new UserMode("WHOIS", modechar[0]);
else if (modename.equals_cs("u_censor"))
- um = new UserMode(UMODE_FILTER, modechar[0]);
+ um = new UserMode("FILTER", modechar[0]);
else if (modename.equals_cs("u_registered"))
- um = new UserMode(UMODE_REGISTERED, modechar[0]);
+ um = new UserMode("REGISTERED", modechar[0]);
else if (modename.equals_cs("u_stripcolor"))
- um = new UserMode(UMODE_STRIPCOLOR, modechar[0]);
+ um = new UserMode("STRIPCOLOR", modechar[0]);
else if (modename.equals_cs("wallops"))
- um = new UserMode(UMODE_WALLOPS, modechar[0]);
+ um = new UserMode("WALLOPS", modechar[0]);
if (um)
ModeManager::AddUserMode(um);
@@ -401,7 +401,7 @@ struct IRCDMessageCapab : Message::Capab
{
if (ModeManager::FindChannelModeByChar(modebuf[t]))
continue;
- ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
+ ModeManager::AddChannelMode(new ChannelModeList("END", modebuf[t]));
}
sep.GetToken(modebuf);
@@ -409,7 +409,7 @@ struct IRCDMessageCapab : Message::Capab
{
if (ModeManager::FindChannelModeByChar(modebuf[t]))
continue;
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t]));
+ ModeManager::AddChannelMode(new ChannelModeParam("END", modebuf[t]));
}
sep.GetToken(modebuf);
@@ -417,7 +417,7 @@ struct IRCDMessageCapab : Message::Capab
{
if (ModeManager::FindChannelModeByChar(modebuf[t]))
continue;
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, true));
+ ModeManager::AddChannelMode(new ChannelModeParam("END", true));
}
sep.GetToken(modebuf);
@@ -425,7 +425,7 @@ struct IRCDMessageCapab : Message::Capab
{
if (ModeManager::FindChannelModeByChar(modebuf[t]))
continue;
- ModeManager::AddChannelMode(new ChannelMode(CMODE_END, modebuf[t]));
+ ModeManager::AddChannelMode(new ChannelMode("END", modebuf[t]));
}
}
else if (capab.find("USERMODES") != Anope::string::npos)
@@ -439,11 +439,11 @@ struct IRCDMessageCapab : Message::Capab
if (sep.GetToken(modebuf))
for (size_t t = 0, end = modebuf.length(); t < end; ++t)
- ModeManager::AddUserMode(new UserModeParam(UMODE_END, modebuf[t]));
+ ModeManager::AddUserMode(new UserModeParam("END", modebuf[t]));
if (sep.GetToken(modebuf))
for (size_t t = 0, end = modebuf.length(); t < end; ++t)
- ModeManager::AddUserMode(new UserMode(UMODE_END, modebuf[t]));
+ ModeManager::AddUserMode(new UserMode("END", modebuf[t]));
}
else if (capab.find("MAXMODES=") != Anope::string::npos)
{
@@ -480,7 +480,7 @@ struct IRCDMessageCapab : Message::Capab
Anope::Quitting = true;
return;
}
- if (!ModeManager::FindUserModeByName(UMODE_PRIV))
+ if (!ModeManager::FindUserModeByName("PRIV"))
{
UplinkSocket::Message() << "ERROR :m_hidechans.so is not loaded. This is required by Anope";
Anope::QuitReason = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required.";
@@ -690,7 +690,7 @@ class ProtoInspIRCd : public Module
void OnUserNickChange(User *u, const Anope::string &) anope_override
{
- u->RemoveModeInternal(ModeManager::FindUserModeByName(UMODE_REGISTERED));
+ u->RemoveModeInternal(ModeManager::FindUserModeByName("REGISTERED"));
}
void OnServerSync(Server *s) anope_override
@@ -714,7 +714,7 @@ class ProtoInspIRCd : public Module
if (Config->UseServerSideTopicLock && Servers::Capab.count("TOPICLOCK") && ci->c)
{
- Anope::string on = ci->HasFlag(CI_TOPICLOCK) ? "1" : "";
+ Anope::string on = ci->HasExt("TOPICLOCK") ? "1" : "";
SendChannelMetadata(ci->c, "topiclock", on);
}
}
diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp
index 52dc550ab..e54a4f8f7 100644
--- a/modules/protocol/ngircd.cpp
+++ b/modules/protocol/ngircd.cpp
@@ -95,11 +95,11 @@ class ngIRCdProto : public IRCDProto
*/
ChanUserContainer *uc = c->FindUser(user);
if (uc != NULL)
- uc->status.ClearFlags();
+ uc->status.modes.clear();
BotInfo *setter = BotInfo::Find(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
- if (cs.HasFlag(ModeManager::ChannelModes[i]->name))
+ if (cs.modes.count(ModeManager::ChannelModes[i]->name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->GetUID(), false);
}
}
@@ -157,9 +157,9 @@ class ngIRCdProto : public IRCDProto
UplinkSocket::Message(Me) << "METADATA " << u->nick << " user :" << vIdent;
UplinkSocket::Message(Me) << "METADATA " << u->nick << " cloakhost :" << vhost;
- if (!u->HasMode(UMODE_CLOAK))
+ if (!u->HasMode("CLOAK"))
{
- u->SetMode(HostServ, UMODE_CLOAK);
+ u->SetMode(HostServ, "CLOAK");
ModeManager::ProcessModes();
}
}
@@ -478,7 +478,7 @@ struct IRCDMessageNJoin : IRCDMessage
continue;
}
- sju.first.SetFlag(cm->name);
+ sju.first.modes.insert(cm->name);
}
sju.second = User::Find(buf);
@@ -616,46 +616,46 @@ class ProtongIRCd : public Module
void AddModes()
{
/* Add user modes */
- ModeManager::AddUserMode(new UserMode(UMODE_NOCTCP, 'b'));
- ModeManager::AddUserMode(new UserMode(UMODE_BOT, 'B'));
- ModeManager::AddUserMode(new UserMode(UMODE_COMMONCHANS, 'C'));
- ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i'));
- ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o'));
- ModeManager::AddUserMode(new UserMode(UMODE_PROTECTED, 'q'));
- ModeManager::AddUserMode(new UserMode(UMODE_RESTRICTED, 'r'));
- ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'R'));
- ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, 's'));
- ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w'));
- ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, 'x'));
+ ModeManager::AddUserMode(new UserMode("NOCTCP", 'b'));
+ ModeManager::AddUserMode(new UserMode("BOT", 'B'));
+ ModeManager::AddUserMode(new UserMode("COMMONCHANS", 'C'));
+ ModeManager::AddUserMode(new UserMode("INVIS", 'i'));
+ ModeManager::AddUserMode(new UserMode("OPER", 'o'));
+ ModeManager::AddUserMode(new UserMode("PROTECTED", 'q'));
+ ModeManager::AddUserMode(new UserMode("RESTRICTED", 'r'));
+ ModeManager::AddUserMode(new UserMode("REGISTERED", 'R'));
+ ModeManager::AddUserMode(new UserMode("SNOMASK", 's'));
+ ModeManager::AddUserMode(new UserMode("WALLOPS", 'w'));
+ ModeManager::AddUserMode(new UserMode("CLOAK", 'x'));
/* Add modes for ban, exception, and invite lists */
- ModeManager::AddChannelMode(new ChannelModeList(CMODE_BAN, 'b'));
- ModeManager::AddChannelMode(new ChannelModeList(CMODE_EXCEPT, 'e'));
- ModeManager::AddChannelMode(new ChannelModeList(CMODE_INVITEOVERRIDE, 'I'));
+ ModeManager::AddChannelMode(new ChannelModeList("BAN", 'b'));
+ ModeManager::AddChannelMode(new ChannelModeList("EXCEPT", 'e'));
+ ModeManager::AddChannelMode(new ChannelModeList("INVITEOVERRIDE", 'I'));
/* Add channel user modes */
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', '+'));
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, 'h', '%'));
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, 'o', '@'));
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, 'a', '&'));
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, 'q','~'));
+ ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', '+'));
+ ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%'));
+ ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@'));
+ ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', '&'));
+ ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q','~'));
/* Add channel modes */
- ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i'));
+ ModeManager::AddChannelMode(new ChannelMode("INVITE", 'i'));
ModeManager::AddChannelMode(new ChannelModeKey('k'));
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, 'M'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, 'n'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_OPERONLY, 'O'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_PERM, 'P'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKICK, 'Q'));
+ ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l'));
+ ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm'));
+ ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M'));
+ ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n'));
+ ModeManager::AddChannelMode(new ChannelMode("OPERONLY", 'O'));
+ ModeManager::AddChannelMode(new ChannelMode("PERM", 'P'));
+ ModeManager::AddChannelMode(new ChannelMode("NOKICK", 'Q'));
ModeManager::AddChannelMode(new ChannelModeRegistered('r'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, 'R'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, 's'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, 't'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOINVITE, 'V'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, 'z'));
+ ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R'));
+ ModeManager::AddChannelMode(new ChannelMode("SECRET", 's'));
+ ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't'));
+ ModeManager::AddChannelMode(new ChannelMode("NOINVITE", 'V'));
+ ModeManager::AddChannelMode(new ChannelMode("SSL", 'z'));
}
public:
@@ -681,7 +681,7 @@ class ProtongIRCd : public Module
void OnUserNickChange(User *u, const Anope::string &) anope_override
{
- u->RemoveModeInternal(ModeManager::FindUserModeByName(UMODE_REGISTERED));
+ u->RemoveModeInternal(ModeManager::FindUserModeByName("REGISTERED"));
}
};
diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp
index fd571e490..1624aa28e 100644
--- a/modules/protocol/plexus.cpp
+++ b/modules/protocol/plexus.cpp
@@ -58,11 +58,11 @@ class PlexusProto : public IRCDProto
*/
ChanUserContainer *uc = c->FindUser(user);
if (uc != NULL)
- uc->status.ClearFlags();
+ uc->status.modes.clear();
BotInfo *setter = BotInfo::Find(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
- if (cs.HasFlag(ModeManager::ChannelModes[i]->name))
+ if (cs.modes.count(ModeManager::ChannelModes[i]->name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->GetUID(), false);
}
}
@@ -81,8 +81,8 @@ class PlexusProto : public IRCDProto
void SendVhostDel(User *u) anope_override
{
- if (u->HasMode(UMODE_CLOAK))
- u->RemoveMode(HostServ, UMODE_CLOAK);
+ if (u->HasMode("CLOAK"))
+ u->RemoveMode(HostServ, "CLOAK");
else
this->SendVhost(u, u->GetIdent(), u->chost);
}
@@ -185,8 +185,8 @@ struct IRCDMessageEncap : IRCDMessage
if (u && nc)
{
u->Login(nc);
- if (!Config->NoNicknameOwnership && user_na && user_na->nc == nc && user_na->nc->HasFlag(NI_UNCONFIRMED) == false)
- u->SetMode(NickServ, UMODE_REGISTERED);
+ if (!Config->NoNicknameOwnership && user_na && user_na->nc == nc && user_na->nc->HasExt("UNCONFIRMED") == false)
+ u->SetMode(NickServ, "REGISTERED");
}
}
@@ -325,30 +325,30 @@ class ProtoPlexus : public Module
void AddModes()
{
/* Add user modes */
- ModeManager::RemoveUserMode(ModeManager::FindUserModeByName(UMODE_HIDEOPER));
- ModeManager::AddUserMode(new UserMode(UMODE_NOCTCP, 'C'));
- ModeManager::AddUserMode(new UserMode(UMODE_DEAF, 'D'));
- ModeManager::AddUserMode(new UserMode(UMODE_SOFTCALLERID, 'G'));
- ModeManager::AddUserMode(new UserMode(UMODE_NETADMIN, 'N'));
- ModeManager::AddUserMode(new UserMode(UMODE_SSL, 'S'));
- ModeManager::AddUserMode(new UserMode(UMODE_WEBIRC, 'W'));
- ModeManager::AddUserMode(new UserMode(UMODE_CALLERID, 'g'));
- ModeManager::AddUserMode(new UserMode(UMODE_PRIV, 'p'));
- ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, 'x'));
- ModeManager::AddUserMode(new UserMode(UMODE_PROTECTED, 'U'));
+ ModeManager::RemoveUserMode(ModeManager::FindUserModeByName("HIDEOPER"));
+ ModeManager::AddUserMode(new UserMode("NOCTCP", 'C'));
+ ModeManager::AddUserMode(new UserMode("DEAF", 'D'));
+ ModeManager::AddUserMode(new UserMode("SOFTCALLERID", 'G'));
+ ModeManager::AddUserMode(new UserMode("NETADMIN", 'N'));
+ ModeManager::AddUserMode(new UserMode("SSL", 'S'));
+ ModeManager::AddUserMode(new UserMode("WEBIRC", 'W'));
+ ModeManager::AddUserMode(new UserMode("CALLERID", 'g'));
+ ModeManager::AddUserMode(new UserMode("PRIV", 'p'));
+ ModeManager::AddUserMode(new UserMode("CLOAK", 'x'));
+ ModeManager::AddUserMode(new UserMode("PROTECTED", 'U'));
/* v/h/o/a/q */
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, 'a', '&', 3));
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, 'q', '~', 4));
+ ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', '&', 3));
+ ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', '~', 4));
/* Add channel modes */
- ModeManager::RemoveChannelMode(ModeManager::FindChannelModeByName(CMODE_REGISTERED));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_BANDWIDTH, 'B'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOCTCP, 'C'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, 'M'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NONOTICE, 'N'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c'));
- ModeManager::AddChannelMode(new ChannelMode(CMODE_PERM, 'z'));
+ ModeManager::RemoveChannelMode(ModeManager::FindChannelModeByName("REGISTERED"));
+ ModeManager::AddChannelMode(new ChannelMode("BANDWIDTH", 'B'));
+ ModeManager::AddChannelMode(new ChannelMode("NOCTCP", 'C'));
+ ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M'));
+ ModeManager::AddChannelMode(new ChannelMode("NONOTICE", 'N'));
+ ModeManager::AddChannelMode(new ChannelMode("BLOCKCOLOR", 'c'));
+ ModeManager::AddChannelMode(new ChannelMode("PERM", 'z'));
}
public:
diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp
index 6da98596e..247b8777a 100644
--- a/modules/protocol/ratbox.cpp
+++ b/modules/protocol/ratbox.cpp
@@ -107,8 +107,8 @@ struct IRCDMessageEncap : IRCDMessage
u->Login(nc);
const NickAlias *user_na = NickAlias::Find(u->nick);
- if (!Config->NoNicknameOwnership && user_na && user_na->nc == nc && user_na->nc->HasFlag(NI_UNCONFIRMED) == false)
- u->SetMode(NickServ, UMODE_REGISTERED);
+ if (!Config->NoNicknameOwnership && user_na && user_na->nc == nc && user_na->nc->HasExt("UNCONFIRMED") == false)
+ u->SetMode(NickServ, "REGISTERED");
}
}
};
@@ -214,17 +214,17 @@ class ProtoRatbox : public Module
void AddModes()
{
/* user modes */
- ModeManager::RemoveUserMode(ModeManager::FindUserModeByName(UMODE_HIDEOPER));
- ModeManager::RemoveUserMode(ModeManager::FindUserModeByName(UMODE_REGPRIV));
+ ModeManager::RemoveUserMode(ModeManager::FindUserModeByName("HIDEOPER"));
+ ModeManager::RemoveUserMode(ModeManager::FindUserModeByName("REGPRIV"));
/* v/h/o/a/q */
- ModeManager::RemoveChannelMode(ModeManager::FindChannelModeByName(CMODE_HALFOP));
+ ModeManager::RemoveChannelMode(ModeManager::FindChannelModeByName("HALFOP"));
/* channel modes */
- ModeManager::RemoveChannelMode(ModeManager::FindChannelModeByName(CMODE_REGISTERED));
- ModeManager::RemoveChannelMode(ModeManager::FindChannelModeByName(CMODE_OPERONLY));
- ModeManager::RemoveChannelMode(ModeManager::FindChannelModeByName(CMODE_REGISTEREDONLY));
- ModeManager::RemoveChannelMode(ModeManager::FindChannelModeByName(CMODE_SSL));
+ ModeManager::RemoveChannelMode(ModeManager::FindChannelModeByName("REGISTERED"));
+ ModeManager::RemoveChannelMode(ModeManager::FindChannelModeByName("OPERONLY"));
+ ModeManager::RemoveChannelMode(ModeManager::FindChannelModeByName("REGISTEREDONLY"));
+ ModeManager::RemoveChannelMode(ModeManager::FindChannelModeByName("SSL"));
}
public:
diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp
index 2b168dff9..2f5e75747 100644
--- a/modules/protocol/unreal.cpp
+++ b/modules/protocol/unreal.cpp
@@ -75,10 +75,10 @@ class UnrealIRCdProto : public IRCDProto
void SendVhostDel(User *u) anope_override
{
- u->RemoveMode(HostServ, UMODE_CLOAK);
- u->RemoveMode(HostServ, UMODE_VHOST);
+ u->RemoveMode(HostServ, "CLOAK");
+ u->RemoveMode(HostServ, "VHOST");
ModeManager::ProcessModes();
- u->SetMode(HostServ, UMODE_CLOAK);
+ u->SetMode(HostServ, "CLOAK");
}
void SendAkill(User *u, XLine *x) anope_override
@@ -166,11 +166,11 @@ class UnrealIRCdProto : public IRCDProto
*/
ChanUserContainer *uc = c->FindUser(user);
if (uc != NULL)
- uc->status.ClearFlags();
+ uc->status.modes.clear();
BotInfo *setter = BotInfo::Find(user->nick);
for (unsigned i = 0; i < ModeManager::ChannelModes.size(); ++i)
- if (cs.HasFlag(ModeManager::ChannelModes[i]->name))
+ if (cs.modes.count(ModeManager::ChannelModes[i]->name))
c->SetMode(setter, ModeManager::ChannelModes[i], user->GetUID(), false);
}
}
@@ -377,7 +377,7 @@ class UnrealIRCdProto : public IRCDProto
class UnrealExtBan : public ChannelModeList
{
public:
- UnrealExtBan(ChannelModeName mName, char modeChar) : ChannelModeList(mName, modeChar) { }
+ UnrealExtBan(const Anope::string &mname, char modeChar) : ChannelModeList(mname, modeChar) { }
bool Matches(const User *u, const Entry *e) anope_override
{
@@ -402,7 +402,7 @@ class UnrealExtBan : public ChannelModeList
{
ChanUserContainer *uc = c->FindUser(u);
if (uc != NULL)
- if (cm == NULL || uc->status.HasFlag(cm->name))
+ if (cm == NULL || uc->status.modes.count(cm->name))
return true;
}
}
@@ -423,7 +423,7 @@ class UnrealExtBan : public ChannelModeList
}
else if (mask.find("~R:") == 0)
{
- if (u->HasMode(UMODE_REGISTERED) && mask.equals_ci(u->nick))
+ if (u->HasMode("REGISTERED") && mask.equals_ci(u->nick))
return true;
}
else if (mask.find("~a:") == 0)
@@ -441,7 +441,7 @@ class UnrealExtBan : public ChannelModeList
class ChannelModeFlood : public ChannelModeParam
{
public:
- ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam(CMODE_FLOOD, modeChar, minusNoArg) { }
+ ChannelModeFlood(char modeChar, bool minusNoArg) : ChannelModeParam("FLOOD", modeChar, minusNoArg) { }
/* Borrowed part of this check from UnrealIRCd */
bool IsValid(const Anope::string &value) const anope_override
@@ -492,7 +492,7 @@ class ChannelModeFlood : public ChannelModeParam
class ChannelModeUnrealSSL : public ChannelMode
{
public:
- ChannelModeUnrealSSL(ChannelModeName n, char c) : ChannelMode(n, c)
+ ChannelModeUnrealSSL(const Anope::string &n, char c) : ChannelMode(n, c)
{
}
@@ -524,16 +524,16 @@ struct IRCDMessageCapab : Message::Capab
switch (modebuf[t])
{
case 'b':
- ModeManager::AddChannelMode(new UnrealExtBan(CMODE_BAN, 'b'));
+ ModeManager::AddChannelMode(new UnrealExtBan("BAN", 'b'));
continue;
case 'e':
- ModeManager::AddChannelMode(new UnrealExtBan(CMODE_EXCEPT, 'e'));
+ ModeManager::AddChannelMode(new UnrealExtBan("EXCEPT", 'e'));
continue;
case 'I':
- ModeManager::AddChannelMode(new UnrealExtBan(CMODE_INVITEOVERRIDE, 'I'));
+ ModeManager::AddChannelMode(new UnrealExtBan("INVITEOVERRIDE", 'I'));
continue;
default:
- ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t]));
+ ModeManager::AddChannelMode(new ChannelModeList("END", modebuf[t]));
}
}
@@ -549,10 +549,10 @@ struct IRCDMessageCapab : Message::Capab
ModeManager::AddChannelMode(new ChannelModeFlood('f', false));
continue;
case 'L':
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_REDIRECT, 'L'));
+ ModeManager::AddChannelMode(new ChannelModeParam("REDIRECT", 'L'));
continue;
default:
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t]));
+ ModeManager::AddChannelMode(new ChannelModeParam("END", modebuf[t]));
}
}
@@ -562,13 +562,13 @@ struct IRCDMessageCapab : Message::Capab
switch (modebuf[t])
{
case 'l':
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l', true));
+ ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true));
continue;
case 'j':
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_JOINFLOOD, 'j', true));
+ ModeManager::AddChannelMode(new ChannelModeParam("JOINFLOOD", 'j', true));
continue;
default:
- ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t], true));
+ ModeManager::AddChannelMode(new ChannelModeParam("END", modebuf[t], true));
}
}
@@ -578,31 +578,31 @@ struct IRCDMessageCapab : Message::Capab
switch (modebuf[t])
{
case 'p':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, 'p'));
+ ModeManager::AddChannelMode(new ChannelMode("PRIVATE", 'p'));
continue;
case 's':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, 's'));
+ ModeManager::AddChannelMode(new ChannelMode("SECRET", 's'));
continue;
case 'm':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm'));
+ ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm'));
continue;
case 'n':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, 'n'));
+ ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n'));
continue;
case 't':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, 't'));
+ ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't'));
continue;
case 'i':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i'));
+ ModeManager::AddChannelMode(new ChannelMode("INVITE", 'i'));
continue;
case 'r':
ModeManager::AddChannelMode(new ChannelModeRegistered('r'));
continue;
case 'R':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, 'R'));
+ ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R'));
continue;
case 'c':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c'));
+ ModeManager::AddChannelMode(new ChannelMode("BLOCKCOLOR", 'c'));
continue;
case 'O':
ModeManager::AddChannelMode(new ChannelModeOper('O'));
@@ -611,43 +611,43 @@ struct IRCDMessageCapab : Message::Capab
ModeManager::AddChannelMode(new ChannelModeAdmin('A'));
continue;
case 'Q':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKICK, 'Q'));
+ ModeManager::AddChannelMode(new ChannelMode("NOKICK", 'Q'));
continue;
case 'K':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKNOCK, 'K'));
+ ModeManager::AddChannelMode(new ChannelMode("NOKNOCK", 'K'));
continue;
case 'V':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOINVITE, 'V'));
+ ModeManager::AddChannelMode(new ChannelMode("NOINVITE", 'V'));
continue;
case 'C':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NOCTCP, 'C'));
+ ModeManager::AddChannelMode(new ChannelMode("NOCTCP", 'C'));
continue;
case 'u':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_AUDITORIUM, 'u'));
+ ModeManager::AddChannelMode(new ChannelMode("AUDITORIUM", 'u'));
continue;
case 'z':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, 'z'));
+ ModeManager::AddChannelMode(new ChannelMode("SSL", 'z'));
continue;
case 'N':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NONICK, 'N'));
+ ModeManager::AddChannelMode(new ChannelMode("NONICK", 'N'));
continue;
case 'S':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_STRIPCOLOR, 'S'));
+ ModeManager::AddChannelMode(new ChannelMode("STRIPCOLOR", 'S'));
continue;
case 'M':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, 'M'));
+ ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M'));
continue;
case 'T':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_NONOTICE, 'T'));
+ ModeManager::AddChannelMode(new ChannelMode("NONOTICE", 'T'));
continue;
case 'G':
- ModeManager::AddChannelMode(new ChannelMode(CMODE_FILTER, 'G'));
+ ModeManager::AddChannelMode(new ChannelMode("FILTER", 'G'));
continue;
case 'Z':
- ModeManager::AddChannelMode(new ChannelModeUnrealSSL(CMODE_END, 'Z'));
+ ModeManager::AddChannelMode(new ChannelModeUnrealSSL("END", 'Z'));
continue;
default:
- ModeManager::AddChannelMode(new ChannelMode(CMODE_END, modebuf[t]));
+ ModeManager::AddChannelMode(new ChannelMode("END", modebuf[t]));
}
}
}
@@ -940,7 +940,7 @@ struct IRCDMessageSetHost : IRCDMessage
User *u = source.GetUser();
/* When a user sets +x we recieve the new host and then the mode change */
- if (u->HasMode(UMODE_CLOAK))
+ if (u->HasMode("CLOAK"))
u->SetDisplayedHost(params[0]);
else
u->SetCloakedHost(params[0]);
@@ -1045,7 +1045,7 @@ struct IRCDMessageSJoin : IRCDMessage
continue;
}
- sju.first.SetFlag(cm->name);
+ sju.first.modes.insert(cm->name);
}
sju.second = User::Find(buf);
@@ -1069,9 +1069,9 @@ struct IRCDMessageSJoin : IRCDMessage
if (!c || c->creation_time != ts)
return;
- ChannelMode *ban = ModeManager::FindChannelModeByName(CMODE_BAN),
- *except = ModeManager::FindChannelModeByName(CMODE_EXCEPT),
- *invex = ModeManager::FindChannelModeByName(CMODE_INVITEOVERRIDE);
+ ChannelMode *ban = ModeManager::FindChannelModeByName("BAN"),
+ *except = ModeManager::FindChannelModeByName("EXCEPT"),
+ *invex = ModeManager::FindChannelModeByName("INVITEOVERRIDE");
if (ban)
for (std::list<Anope::string>::iterator it = bans.begin(), it_end = bans.end(); it != it_end; ++it)
@@ -1158,40 +1158,40 @@ class ProtoUnreal : public Module
void AddModes()
{
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', '+', 0));
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, 'h', '%', 1));
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, 'o', '@', 2));
+ ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', '+', 0));
+ ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%', 1));
+ ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@', 2));
/* Unreal sends +q as * and +a as ~ */
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, 'a', '~', 3));
- ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, 'q', '*', 4));
+ ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', '~', 3));
+ ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', '*', 4));
/* Add user modes */
- ModeManager::AddUserMode(new UserMode(UMODE_SERV_ADMIN, 'A'));
- ModeManager::AddUserMode(new UserMode(UMODE_BOT, 'B'));
- ModeManager::AddUserMode(new UserMode(UMODE_CO_ADMIN, 'C'));
- ModeManager::AddUserMode(new UserMode(UMODE_FILTER, 'G'));
- ModeManager::AddUserMode(new UserMode(UMODE_HIDEOPER, 'H'));
- ModeManager::AddUserMode(new UserMode(UMODE_HIDEIDLE, 'I'));
- ModeManager::AddUserMode(new UserMode(UMODE_NETADMIN, 'N'));
- ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, 'R'));
- ModeManager::AddUserMode(new UserMode(UMODE_PROTECTED, 'S'));
- ModeManager::AddUserMode(new UserMode(UMODE_NOCTCP, 'T'));
- ModeManager::AddUserMode(new UserMode(UMODE_WEBTV, 'V'));
- ModeManager::AddUserMode(new UserMode(UMODE_WHOIS, 'W'));
- ModeManager::AddUserMode(new UserMode(UMODE_ADMIN, 'a'));
- ModeManager::AddUserMode(new UserMode(UMODE_DEAF, 'd'));
- ModeManager::AddUserMode(new UserMode(UMODE_GLOBOPS, 'g'));
- ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, 'h'));
- ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i'));
- ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o'));
- ModeManager::AddUserMode(new UserMode(UMODE_PRIV, 'p'));
- ModeManager::AddUserMode(new UserMode(UMODE_GOD, 'q'));
- ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'r'));
- ModeManager::AddUserMode(new UserMode(UMODE_SNOMASK, 's'));
- ModeManager::AddUserMode(new UserMode(UMODE_VHOST, 't'));
- ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w'));
- ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, 'x'));
- ModeManager::AddUserMode(new UserMode(UMODE_SSL, 'z'));
+ ModeManager::AddUserMode(new UserMode("SERV_ADMIN", 'A'));
+ ModeManager::AddUserMode(new UserMode("BOT", 'B'));
+ ModeManager::AddUserMode(new UserMode("CO_ADMIN", 'C'));
+ ModeManager::AddUserMode(new UserMode("FILTER", 'G'));
+ ModeManager::AddUserMode(new UserMode("HIDEOPER", 'H'));
+ ModeManager::AddUserMode(new UserMode("HIDEIDLE", 'I'));
+ ModeManager::AddUserMode(new UserMode("NETADMIN", 'N'));
+ ModeManager::AddUserMode(new UserMode("REGPRIV", 'R'));
+ ModeManager::AddUserMode(new UserMode("PROTECTED", 'S'));
+ ModeManager::AddUserMode(new UserMode("NOCTCP", 'T'));
+ ModeManager::AddUserMode(new UserMode("WEBTV", 'V'));
+ ModeManager::AddUserMode(new UserMode("WHOIS", 'W'));
+ ModeManager::AddUserMode(new UserMode("ADMIN", 'a'));
+ ModeManager::AddUserMode(new UserMode("DEAF", 'd'));
+ ModeManager::AddUserMode(new UserMode("GLOBOPS", 'g'));
+ ModeManager::AddUserMode(new UserMode("HELPOP", 'h'));
+ ModeManager::AddUserMode(new UserMode("INVIS", 'i'));
+ ModeManager::AddUserMode(new UserMode("OPER", 'o'));
+ ModeManager::AddUserMode(new UserMode("PRIV", 'p'));
+ ModeManager::AddUserMode(new UserMode("GOD", 'q'));
+ ModeManager::AddUserMode(new UserMode("REGISTERED", 'r'));
+ ModeManager::AddUserMode(new UserMode("SNOMASK", 's'));
+ ModeManager::AddUserMode(new UserMode("VHOST", 't'));
+ ModeManager::AddUserMode(new UserMode("WALLOPS", 'w'));
+ ModeManager::AddUserMode(new UserMode("CLOAK", 'x'));
+ ModeManager::AddUserMode(new UserMode("SSL", 'z'));
}
public:
@@ -1218,7 +1218,7 @@ class ProtoUnreal : public Module
void OnUserNickChange(User *u, const Anope::string &) anope_override
{
- u->RemoveModeInternal(ModeManager::FindUserModeByName(UMODE_REGISTERED));
+ u->RemoveModeInternal(ModeManager::FindUserModeByName("REGISTERED"));
if (Servers::Capab.count("ESVID") == 0)
IRCD->SendLogout(u);
}
diff --git a/modules/pseudoclients/botserv.cpp b/modules/pseudoclients/botserv.cpp
index 040d82613..40b0d502c 100644
--- a/modules/pseudoclients/botserv.cpp
+++ b/modules/pseudoclients/botserv.cpp
@@ -63,7 +63,7 @@ class BotServCore : public Module
return;
}
- if (realbuf.empty() || !c->ci->botflags.HasFlag(BS_FANTASY))
+ if (realbuf.empty() || !c->ci->HasExt("BS_FANTASY"))
return;
std::vector<Anope::string> params;
@@ -119,7 +119,7 @@ class BotServCore : public Module
}
// Command requires registered users only
- if (!cmd->HasFlag(CFLAG_ALLOW_UNREGISTERED) && !u->Account())
+ if (!cmd->AllowUnregistered() && !u->Account())
return;
if (params.size() < cmd->min_params)
@@ -173,7 +173,7 @@ class BotServCore : public Module
* to has synced, or we'll get greet-floods when the net
* recovers from a netsplit. -GD
*/
- if (c->FindUser(c->ci->bi) && c->ci->botflags.HasFlag(BS_GREET) && user->Account() && !user->Account()->greet.empty() && c->ci->AccessFor(user).HasPriv("GREET") && user->server->IsSynced())
+ if (c->FindUser(c->ci->bi) && c->ci->HasExt("BS_GREET") && user->Account() && !user->Account()->greet.empty() && c->ci->AccessFor(user).HasPriv("GREET") && user->server->IsSynced())
{
IRCD->SendPrivmsg(c->ci->bi, c->name, "[%s] %s", user->Account()->display.c_str(), user->Account()->greet.c_str());
c->ci->bi->lastmsg = Anope::CurTime;
@@ -184,26 +184,26 @@ class BotServCore : public Module
void OnLeaveChannel(User *u, Channel *c) anope_override
{
/* Channel is persistent, it shouldn't be deleted and the service bot should stay */
- if (c->HasFlag(CH_PERSIST) || (c->ci && c->ci->HasFlag(CI_PERSIST)))
+ if (c->HasExt("PERSIST") || (c->ci && c->ci->HasExt("PERSIST")))
return;
/* Channel is syncing from a netburst, don't destroy it as more users are probably wanting to join immediatly
* We also don't part the bot here either, if necessary we will part it after the sync
*/
- if (c->HasFlag(CH_SYNCING))
+ if (c->HasExt("SYNCING"))
return;
/* Additionally, do not delete this channel if ChanServ/a BotServ bot is inhabiting it */
- if (c->HasFlag(CH_INHABIT))
+ if (c->HasExt("INHABIT"))
return;
if (c->ci && c->ci->bi && u != *c->ci->bi && c->users.size() - 1 <= Config->BSMinUsers && c->FindUser(c->ci->bi))
{
- bool persist = c->HasFlag(CH_PERSIST);
- c->SetFlag(CH_PERSIST);
+ bool persist = c->Shrink("PERSIST");
+ c->Extend("PERSIST");
c->ci->bi->Part(c->ci->c);
if (!persist)
- c->UnsetFlag(CH_PERSIST);
+ c->Shrink("PERSIST");
}
}
@@ -255,15 +255,15 @@ class BotServCore : public Module
"the following characters: %s"), Config->ChanServ.c_str(), Config->BSFantasyCharacter.c_str());
}
- EventReturn OnChannelModeSet(Channel *c, MessageSource &, ChannelModeName Name, const Anope::string &param) anope_override
+ EventReturn OnChannelModeSet(Channel *c, MessageSource &, const Anope::string &mname, const Anope::string &param) anope_override
{
- if (Config->BSSmartJoin && Name == CMODE_BAN && c->ci && c->ci->bi && c->FindUser(c->ci->bi))
+ if (Config->BSSmartJoin && mname == "BAN" && c->ci && c->ci->bi && c->FindUser(c->ci->bi))
{
BotInfo *bi = c->ci->bi;
- Entry ban(CMODE_BAN, param);
+ Entry ban("BAN", param);
if (ban.Matches(bi))
- c->RemoveMode(bi, CMODE_BAN, param);
+ c->RemoveMode(bi, "BAN", param);
}
return EVENT_CONTINUE;
diff --git a/modules/pseudoclients/chanserv.cpp b/modules/pseudoclients/chanserv.cpp
index 0beb610ee..ee8c08ed6 100644
--- a/modules/pseudoclients/chanserv.cpp
+++ b/modules/pseudoclients/chanserv.cpp
@@ -43,7 +43,7 @@ class ExpireCallback : public CallBack
expire = true;
}
- if (ci->HasFlag(CI_NO_EXPIRE))
+ if (ci->HasExt("NO_EXPIRE"))
expire = false;
FOREACH_MOD(I_OnPreChanExpire, OnPreChanExpire(ci, expire));
@@ -51,7 +51,7 @@ class ExpireCallback : public CallBack
if (expire)
{
Anope::string extra;
- if (ci->HasFlag(CI_SUSPENDED))
+ if (ci->HasExt("SUSPENDED"))
extra = "suspended ";
Log(LOG_NORMAL, "chanserv/expire") << "Expiring " << extra << "channel " << ci->name << " (founder: " << (ci->GetFounder() ? ci->GetFounder()->display : "(none)") << ")";
@@ -92,7 +92,7 @@ class ChanServCore : public Module
EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) anope_override
{
- if (Config->CSOpersOnly && !u->HasMode(UMODE_OPER) && bi->nick == Config->ChanServ)
+ if (Config->CSOpersOnly && bi == ChanServ && !u->HasMode("OPER"))
{
u->SendMessage(bi, ACCESS_DENIED);
return EVENT_STOP;
@@ -164,7 +164,7 @@ class ChanServCore : public Module
for (unsigned j = ci->GetAkickCount(); j > 0; --j)
{
const AutoKick *akick = ci->GetAkick(j - 1);
- if (akick->HasFlag(AK_ISNICK) && akick->nc == nc)
+ if (akick->nc == nc)
ci->EraseAkick(j - 1);
}
}
diff --git a/modules/pseudoclients/global.cpp b/modules/pseudoclients/global.cpp
index 611ef7741..62a3d1609 100644
--- a/modules/pseudoclients/global.cpp
+++ b/modules/pseudoclients/global.cpp
@@ -18,7 +18,7 @@ class MyGlobalService : public GlobalService
{
void ServerGlobal(const BotInfo *sender, Server *s, const Anope::string &message)
{
- if (s != Me && !s->HasFlag(SERVER_JUPED))
+ if (s != Me && !s->IsJuped())
s->Notice(sender, message);
for (unsigned i = 0, j = s->GetLinks().size(); i < j; ++i)
this->ServerGlobal(sender, s->GetLinks()[i], message);
diff --git a/modules/pseudoclients/memoserv.cpp b/modules/pseudoclients/memoserv.cpp
index 536d39e08..17aaaa308 100644
--- a/modules/pseudoclients/memoserv.cpp
+++ b/modules/pseudoclients/memoserv.cpp
@@ -89,7 +89,7 @@ class MyMemoServService : public MemoServService
m->sender = source;
m->time = Anope::CurTime;
m->text = message;
- m->SetFlag(MF_UNREAD);
+ m->unread = true;
FOREACH_MOD(I_OnMemoSend, OnMemoSend(source, target, mi, m));
@@ -105,7 +105,7 @@ class MyMemoServService : public MemoServService
if (ci->AccessFor(cu->user).HasPriv("MEMO"))
{
- if (cu->user->Account() && cu->user->Account()->HasFlag(NI_MEMO_RECEIVE))
+ if (cu->user->Account() && cu->user->Account()->HasExt("MEMO_RECEIVE"))
cu->user->SendMessage(MemoServ, MEMO_NEW_X_MEMO_ARRIVED, ci->name.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->MemoServ.c_str(), ci->name.c_str(), mi->memos->size());
}
}
@@ -115,7 +115,7 @@ class MyMemoServService : public MemoServService
{
NickCore *nc = NickAlias::Find(target)->nc;
- if (nc->HasFlag(NI_MEMO_RECEIVE))
+ if (nc->HasExt("MEMO_RECEIVE"))
{
for (std::list<Serialize::Reference<NickAlias> >::const_iterator it = nc->aliases.begin(), it_end = nc->aliases.end(); it != it_end;)
{
@@ -129,7 +129,7 @@ class MyMemoServService : public MemoServService
}
/* let's get out the mail if set in the nickcore - certus */
- if (nc->HasFlag(NI_MEMO_MAIL))
+ if (nc->HasExt("MEMO_MAIL"))
SendMemoMail(nc, mi, m);
}
@@ -144,7 +144,7 @@ class MyMemoServService : public MemoServService
unsigned i = 0, end = nc->memos.memos->size(), newcnt = 0;
for (; i < end; ++i)
- if (nc->memos.GetMemo(i)->HasFlag(MF_UNREAD))
+ if (nc->memos.GetMemo(i)->unread)
++newcnt;
if (newcnt > 0)
u->SendMessage(MemoServ, newcnt == 1 ? _("You have 1 new memo.") : _("You have %d new memos."), newcnt);
diff --git a/modules/pseudoclients/nickserv.cpp b/modules/pseudoclients/nickserv.cpp
index c2c1e1060..55f8b07cd 100644
--- a/modules/pseudoclients/nickserv.cpp
+++ b/modules/pseudoclients/nickserv.cpp
@@ -74,7 +74,7 @@ class MyNickServService : public NickServService
if (!na)
return;
- if (na->nc->HasFlag(NI_SUSPENDED))
+ if (na->nc->HasExt("SUSPENDED"))
{
u->SendMessage(NickServ, NICK_X_SUSPENDED, u->nick.c_str());
u->Collide(na);
@@ -89,7 +89,7 @@ class MyNickServService : public NickServService
return;
}
- if (!na->nc->HasFlag(NI_SECURE) && u->IsRecognized())
+ if (!na->nc->HasExt("SECURE") && u->IsRecognized())
{
na->last_seen = Anope::CurTime;
Anope::string last_usermask = u->GetIdent() + "@" + u->GetDisplayedHost();
@@ -101,22 +101,22 @@ class MyNickServService : public NickServService
if (Config->NoNicknameOwnership)
return;
- if (u->IsRecognized(false) || !na->nc->HasFlag(NI_KILL_IMMED))
+ if (u->IsRecognized(false) || !na->nc->HasExt("KILL_IMMED"))
{
- if (na->nc->HasFlag(NI_SECURE))
+ if (na->nc->HasExt("SECURE"))
u->SendMessage(NickServ, NICK_IS_SECURE, Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str());
else
u->SendMessage(NickServ, NICK_IS_REGISTERED, Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str());
}
- if (na->nc->HasFlag(NI_KILLPROTECT) && !u->IsRecognized(false))
+ if (na->nc->HasExt("KILLPROTECT") && !u->IsRecognized(false))
{
- if (na->nc->HasFlag(NI_KILL_IMMED))
+ if (na->nc->HasExt("KILL_IMMED"))
{
u->SendMessage(NickServ, FORCENICKCHANGE_NOW);
u->Collide(na);
}
- else if (na->nc->HasFlag(NI_KILL_QUICK))
+ else if (na->nc->HasExt("KILL_QUICK"))
{
u->SendMessage(NickServ, _("If you do not change within %s, I will change your nick."), Anope::Duration(Config->NSKillQuick, u->Account()).c_str());
new NickServCollide(u, Config->NSKillQuick);
@@ -134,8 +134,8 @@ class MyNickServService : public NickServService
{
const NickAlias *u_na = NickAlias::Find(user->nick);
user->Login(na->nc);
- if (u_na && *u_na->nc == *na->nc && !Config->NoNicknameOwnership && na->nc->HasFlag(NI_UNCONFIRMED) == false)
- user->SetMode(NickServ, UMODE_REGISTERED);
+ if (u_na && *u_na->nc == *na->nc && !Config->NoNicknameOwnership && na->nc->HasExt("UNCONFIRMED") == false)
+ user->SetMode(NickServ, "REGISTERED");
}
};
@@ -155,17 +155,17 @@ class ExpireCallback : public CallBack
++it;
User *u = User::Find(na->nick);
- if (u && (na->nc->HasFlag(NI_SECURE) ? u->IsIdentified(true) : u->IsRecognized()))
+ if (u && (na->nc->HasExt("SECURE") ? u->IsIdentified(true) : u->IsRecognized()))
na->last_seen = Anope::CurTime;
bool expire = false;
- if (na->nc->HasFlag(NI_UNCONFIRMED))
+ if (na->nc->HasExt("UNCONFIRMED"))
if (Config->NSUnconfirmedExpire && Anope::CurTime - na->time_registered >= Config->NSUnconfirmedExpire)
expire = true;
if (Config->NSExpire && Anope::CurTime - na->last_seen >= Config->NSExpire)
expire = true;
- if (na->HasFlag(NS_NO_EXPIRE))
+ if (na->HasExt("NO_EXPIRE"))
expire = false;
FOREACH_MOD(I_OnPreNickExpire, OnPreNickExpire(na, expire));
@@ -173,7 +173,7 @@ class ExpireCallback : public CallBack
if (expire)
{
Anope::string extra;
- if (na->nc->HasFlag(NI_SUSPENDED))
+ if (na->nc->HasExt("SUSPENDED"))
extra = "suspended ";
Log(LOG_NORMAL, "expire") << "Expiring " << extra << "nickname " << na->nick << " (group: " << na->nc->display << ") (e-mail: " << (na->nc->email.empty() ? "none" : na->nc->email) << ")";
FOREACH_MOD(I_OnNickExpire, OnNickExpire(na));
@@ -219,7 +219,7 @@ class NickServCore : public Module
if (u && u->Account() == na->nc)
{
IRCD->SendLogout(u);
- u->RemoveMode(NickServ, UMODE_REGISTERED);
+ u->RemoveMode(NickServ, "REGISTERED");
u->Logout();
}
}
@@ -233,7 +233,7 @@ class NickServCore : public Module
{
User *user = *it++;
IRCD->SendLogout(user);
- user->RemoveMode(NickServ, UMODE_REGISTERED);
+ user->RemoveMode(NickServ, "REGISTERED");
user->Logout();
FOREACH_MOD(I_OnNickLogout, OnNickLogout(user));
}
@@ -250,8 +250,8 @@ class NickServCore : public Module
if (!Config->NoNicknameOwnership)
{
const NickAlias *this_na = NickAlias::Find(u->nick);
- if (this_na && this_na->nc == u->Account() && u->Account()->HasFlag(NI_UNCONFIRMED) == false)
- u->SetMode(NickServ, UMODE_REGISTERED);
+ if (this_na && this_na->nc == u->Account() && u->Account()->HasExt("UNCONFIRMED") == false)
+ u->SetMode(NickServ, "REGISTERED");
}
if (Config->NSModeOnID)
@@ -276,7 +276,7 @@ class NickServCore : public Module
"any third-party person."), Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str());
}
- if (u->Account()->HasFlag(NI_UNCONFIRMED))
+ if (u->Account()->HasExt("UNCONFIRMED"))
{
u->SendMessage(NickServ, _("Your email address is not confirmed. To confirm it, follow the instructions that were emailed to you when you registered."));
const NickAlias *this_na = NickAlias::Find(u->Account()->display);
@@ -288,8 +288,8 @@ class NickServCore : public Module
void OnNickGroup(User *u, NickAlias *target) anope_override
{
- if (target->nc->HasFlag(NI_UNCONFIRMED) == false)
- u->SetMode(NickServ, UMODE_REGISTERED);
+ if (target->nc->HasExt("UNCONFIRMED") == false)
+ u->SetMode(NickServ, "REGISTERED");
}
void OnNickUpdate(User *u) anope_override
@@ -339,7 +339,7 @@ class NickServCore : public Module
if (!na || na->nc != u->Account())
{
/* Remove +r, but keep an account associated with the user */
- u->RemoveMode(NickServ, UMODE_REGISTERED);
+ u->RemoveMode(NickServ, "REGISTERED");
this->mynickserv.Validate(u);
}
@@ -347,8 +347,8 @@ class NickServCore : public Module
{
/* Reset +r and re-send account (even though it really should be set at this point) */
IRCD->SendLogin(u);
- if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasFlag(NI_UNCONFIRMED) == false)
- u->SetMode(NickServ, UMODE_REGISTERED);
+ if (!Config->NoNicknameOwnership && na->nc == u->Account() && na->nc->HasExt("UNCONFIRMED") == false)
+ u->SetMode(NickServ, "REGISTERED");
Log(NickServ) << u->GetMask() << " automatically identified for group " << u->Account()->display;
}
@@ -356,10 +356,10 @@ class NickServCore : public Module
old_na->OnCancel(u);
}
- void OnUserModeSet(User *u, UserModeName Name) anope_override
+ void OnUserModeSet(User *u, const Anope::string &mname) anope_override
{
- if (Name == UMODE_REGISTERED && !u->IsIdentified())
- u->RemoveMode(NickServ, Name);
+ if (mname == "REGISTERED" && !u->IsIdentified())
+ u->RemoveMode(NickServ, mname);
}
EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) anope_override
diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp
index 0a7b87ebb..7596ee9d6 100644
--- a/modules/pseudoclients/operserv.cpp
+++ b/modules/pseudoclients/operserv.cpp
@@ -209,7 +209,7 @@ class OperServCore : public Module
EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) anope_override
{
- if (Config->OSOpersOnly && !u->HasMode(UMODE_OPER) && bi->nick == Config->OperServ)
+ if (Config->OSOpersOnly && !u->HasMode("OPER") && bi->nick == Config->OperServ)
{
u->SendMessage(bi, ACCESS_DENIED);
Log(OperServ, "bados") << "Denied access to " << Config->OperServ << " from " << u->GetMask() << " (non-oper)";
@@ -221,19 +221,19 @@ class OperServCore : public Module
void OnServerQuit(Server *server) anope_override
{
- if (server->HasFlag(SERVER_JUPED))
+ if (server->IsJuped())
Log(server, "squit", OperServ) << "Received SQUIT for juped server " << server->GetName();
}
- void OnUserModeSet(User *u, UserModeName Name) anope_override
+ void OnUserModeSet(User *u, const Anope::string &mname) anope_override
{
- if (Name == UMODE_OPER)
+ if (mname == "OPER")
Log(u, "oper", OperServ) << "is now an IRC operator.";
}
- void OnUserModeUnset(User *u, UserModeName Name) anope_override
+ void OnUserModeUnset(User *u, const Anope::string &mname) anope_override
{
- if (Name == UMODE_OPER)
+ if (mname == "OPER")
Log(u, "oper", OperServ) << "is no longer an IRC operator";
}
@@ -245,7 +245,7 @@ class OperServCore : public Module
void OnUserNickChange(User *u, const Anope::string &oldnick) anope_override
{
- if (IRCD->CanSQLine && !u->HasMode(UMODE_OPER))
+ if (IRCD->CanSQLine && !u->HasMode("OPER"))
this->sqlines.CheckAllXLines(u);
}