diff options
Diffstat (limited to 'modules/protocol')
-rw-r--r-- | modules/protocol/bahamut.cpp | 54 | ||||
-rw-r--r-- | modules/protocol/hybrid.cpp | 58 | ||||
-rw-r--r-- | modules/protocol/inspircd11.cpp | 94 | ||||
-rw-r--r-- | modules/protocol/inspircd12.cpp | 148 | ||||
-rw-r--r-- | modules/protocol/inspircd20.cpp | 134 | ||||
-rw-r--r-- | modules/protocol/ngircd.cpp | 76 | ||||
-rw-r--r-- | modules/protocol/plexus.cpp | 52 | ||||
-rw-r--r-- | modules/protocol/ratbox.cpp | 18 | ||||
-rw-r--r-- | modules/protocol/unreal.cpp | 154 |
9 files changed, 393 insertions, 395 deletions
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); } |