summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2015-09-06 16:47:57 -0400
committerAdam <Adam@anope.org>2015-09-06 16:48:25 -0400
commitc6a92296d4175a2d2276c2d5a46894af3d9085f4 (patch)
tree8e6dfe9fd21825f53a1e32641bc71e701e6c853e /modules
parent263dc290d296af2fcdf7f8a9f04735935e9c2580 (diff)
Allow configuring modes
Diffstat (limited to 'modules')
-rw-r--r--modules/commands/bs_bot.cpp7
-rw-r--r--modules/protocol/bahamut.cpp40
-rw-r--r--modules/protocol/charybdis.cpp2
-rw-r--r--modules/protocol/hybrid.cpp49
-rw-r--r--modules/protocol/inspircd20.cpp440
-rw-r--r--modules/protocol/ngircd.cpp47
-rw-r--r--modules/protocol/plexus.cpp60
-rw-r--r--modules/protocol/ratbox.cpp51
-rw-r--r--modules/protocol/unreal.cpp237
9 files changed, 104 insertions, 829 deletions
diff --git a/modules/commands/bs_bot.cpp b/modules/commands/bs_bot.cpp
index c67c5d168..1ba22531e 100644
--- a/modules/commands/bs_bot.cpp
+++ b/modules/commands/bs_bot.cpp
@@ -85,8 +85,6 @@ class CommandBSBot : public Command
targ->Kill(Me, "Nickname is reserved for services");
ServiceBot *bi = new ServiceBot(nick, user, host, real);
- bi->bi = botinfo.Create();
- bi->bi->bot = bi;
Log(LOG_ADMIN, source, this) << "ADD " << bi->GetMask() << " " << bi->realname;
@@ -116,7 +114,7 @@ class CommandBSBot : public Command
return;
}
- if (bi->conf)
+ if (bi->bi->conf)
{
source.Reply(_("Bot \002{0}\002 is not changeable because it is configured in services configuration."), bi->nick.c_str());
return;
@@ -259,7 +257,7 @@ class CommandBSBot : public Command
return;
}
- if (bi->conf)
+ if (bi->bi->conf)
{
source.Reply(_("Bot \002{0}\002 is can not be deleted because it is configured in services configuration."), bi->nick);
return;
@@ -270,7 +268,6 @@ class CommandBSBot : public Command
Log(LOG_ADMIN, source, this) << "DEL " << bi->nick;
source.Reply(_("Bot \002{0}\002 has been deleted."), bi->nick);
- // XXX delete bi->bi?
delete bi;
}
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index cae16dcb9..52786b361 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -507,43 +507,6 @@ class ProtoBahamut : public Module
IRCDMessageSJoin message_sjoin;
IRCDMessageTopic message_topic;
- void AddModes()
- {
- /* Add user modes */
- ModeManager::AddUserMode(new UserModeOperOnly("SERV_ADMIN", 'A'));
- ModeManager::AddUserMode(new UserMode("REGPRIV", 'R'));
- ModeManager::AddUserMode(new UserModeOperOnly("ADMIN", 'a'));
- ModeManager::AddUserMode(new UserMode("INVIS", 'i'));
- ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o'));
- ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r'));
- ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's'));
- ModeManager::AddUserMode(new UserModeOperOnly("WALLOPS", 'w'));
- ModeManager::AddUserMode(new UserMode("DEAF", 'd'));
-
- /* b/e/I */
- ModeManager::AddChannelMode(new ChannelModeList("BAN", 'b'));
-
- /* v/h/o/a/q */
- ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', '+', 0));
- ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@', 1));
-
- /* Add channel modes */
- 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("LIMIT", 'l', true));
- ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm'));
- ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n'));
- ModeManager::AddChannelMode(new ChannelMode("PRIVATE", 'p'));
- ModeManager::AddChannelMode(new ChannelModeNoone("REGISTERED", 'r'));
- ModeManager::AddChannelMode(new ChannelMode("SECRET", 's'));
- ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't'));
- ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M'));
- ModeManager::AddChannelMode(new ChannelModeOperOnly("OPERONLY", 'O'));
- ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R'));
- }
-
public:
ProtoBahamut(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR)
, ircd_proto(this)
@@ -574,9 +537,6 @@ class ProtoBahamut : public Module
, message_sjoin(this)
, message_topic(this)
{
-
- this->AddModes();
-
}
void OnUserNickChange(User *u, const Anope::string &) override
diff --git a/modules/protocol/charybdis.cpp b/modules/protocol/charybdis.cpp
index e80b1d994..8477bc30e 100644
--- a/modules/protocol/charybdis.cpp
+++ b/modules/protocol/charybdis.cpp
@@ -9,6 +9,7 @@
* Based on the original code of Services by Andy Church.
*/
+#if 0
#include "module.h"
#include "modules/cs_mode.h"
#include "modules/sasl.h"
@@ -429,3 +430,4 @@ class ProtoCharybdis : public Module
};
MODULE_INIT(ProtoCharybdis)
+#endif
diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp
index da412623a..772b9e0d9 100644
--- a/modules/protocol/hybrid.cpp
+++ b/modules/protocol/hybrid.cpp
@@ -630,53 +630,6 @@ class ProtoHybrid : public Module
IRCDMessageUID message_uid;
IRCDMessageCertFP message_certfp;
- void AddModes()
- {
- /* Add user modes */
- ModeManager::AddUserMode(new UserModeOperOnly("ADMIN", 'a'));
- ModeManager::AddUserMode(new UserModeOperOnly("CALLERID", 'g'));
- ModeManager::AddUserMode(new UserMode("INVIS", 'i'));
- ModeManager::AddUserMode(new UserModeOperOnly("LOCOPS", 'l'));
- ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o'));
- ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r'));
- ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's'));
- ModeManager::AddUserMode(new UserMode("WALLOPS", 'w'));
- ModeManager::AddUserMode(new UserModeOperOnly("OPERWALLS", 'z'));
- ModeManager::AddUserMode(new UserMode("DEAF", 'D'));
- ModeManager::AddUserMode(new UserModeOperOnly("HIDEOPER", 'H'));
- ModeManager::AddUserMode(new UserMode("REGPRIV", 'R'));
- ModeManager::AddUserMode(new UserModeNoone("SSL", 'S'));
- ModeManager::AddUserMode(new UserMode("CLOAK", 'x'));
-
- /* b/e/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("VOICE", 'v', '+', 0));
- ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%', 1));
- ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@', 2));
-
- /* l/k */
- ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true));
- ModeManager::AddChannelMode(new ChannelModeKey('k'));
-
- /* Add channel modes */
- ModeManager::AddChannelMode(new ChannelMode("BLOCKCOLOR", 'c'));
- 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 ChannelModeNoone("REGISTERED", 'r'));
- ModeManager::AddChannelMode(new ChannelMode("SECRET", 's'));
- ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't'));
- ModeManager::AddChannelMode(new ChannelModeOperOnly("OPERONLY", 'O'));
- ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M'));
- ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R'));
- ModeManager::AddChannelMode(new ChannelMode("SSL", 'S'));
- }
-
public:
ProtoHybrid(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR)
, ircd_proto(this)
@@ -714,8 +667,6 @@ public:
, message_uid(this)
, message_certfp(this)
{
- if (Config->GetModule(this))
- this->AddModes();
}
void OnUserNickChange(User *u, const Anope::string &) override
diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp
index e7a315261..4a74995a2 100644
--- a/modules/protocol/inspircd20.cpp
+++ b/modules/protocol/inspircd20.cpp
@@ -560,10 +560,10 @@ namespace InspIRCdExtban
}
};
- class FinerprintMatcher : public InspIRCdExtBan
+ class FingerprintMatcher : public InspIRCdExtBan
{
public:
- FinerprintMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c)
+ FingerprintMatcher(const Anope::string &mname, const Anope::string &mbase, char c) : InspIRCdExtBan(mname, mbase, c)
{
}
@@ -591,121 +591,8 @@ namespace InspIRCdExtban
};
}
-class ColonDelimitedParamMode : public ChannelModeParam
-{
- public:
- ColonDelimitedParamMode(const Anope::string &modename, char modeChar) : ChannelModeParam(modename, modeChar, true) { }
-
- bool IsValid(Anope::string &value) const override
- {
- return IsValid(value, false);
- }
-
- bool IsValid(const Anope::string &value, bool historymode) const
- {
- if (value.empty())
- return false; // empty param is never valid
-
- Anope::string::size_type pos = value.find(':');
- if ((pos == Anope::string::npos) || (pos == 0))
- return false; // no ':' or it's the first char, both are invalid
-
- Anope::string rest;
- try
- {
- if (convertTo<int>(value, rest, false) <= 0)
- return false; // negative numbers and zero are invalid
-
- rest = rest.substr(1);
- int n;
- if (historymode)
- {
- // For the history mode, the part after the ':' is a duration and it
- // can be in the user friendly "1d3h20m" format, make sure we accept that
- n = Anope::DoTime(rest);
- }
- else
- n = convertTo<int>(rest);
-
- if (n <= 0)
- return false;
- }
- catch (const ConvertException &e)
- {
- // conversion error, invalid
- return false;
- }
-
- return true;
- }
-};
-
-class SimpleNumberParamMode : public ChannelModeParam
-{
- public:
- SimpleNumberParamMode(const Anope::string &modename, char modeChar) : ChannelModeParam(modename, modeChar, true) { }
-
- bool IsValid(Anope::string &value) const override
- {
- if (value.empty())
- return false; // empty param is never valid
-
- try
- {
- if (convertTo<int>(value) <= 0)
- return false;
- }
- catch (const ConvertException &e)
- {
- // conversion error, invalid
- return false;
- }
-
- return true;
- }
-};
-
-class ChannelModeFlood : public ColonDelimitedParamMode
-{
- public:
- ChannelModeFlood(char modeChar) : ColonDelimitedParamMode("FLOOD", modeChar) { }
-
- bool IsValid(Anope::string &value) const override
- {
- // The parameter of this mode is a bit different, it may begin with a '*',
- // ignore it if that's the case
- Anope::string v = value[0] == '*' ? value.substr(1) : value;
- return ((!value.empty()) && (ColonDelimitedParamMode::IsValid(v)));
- }
-};
-
-class ChannelModeHistory : public ColonDelimitedParamMode
-{
- public:
- ChannelModeHistory(char modeChar) : ColonDelimitedParamMode("HISTORY", modeChar) { }
-
- bool IsValid(Anope::string &value) const override
- {
- return (ColonDelimitedParamMode::IsValid(value, true));
- }
-};
-
-class ChannelModeRedirect : public ChannelModeParam
-{
- public:
- ChannelModeRedirect(char modeChar) : ChannelModeParam("REDIRECT", modeChar, true) { }
-
- bool IsValid(Anope::string &value) const override
- {
- // The parameter of this mode is a channel, and channel names start with '#'
- return ((!value.empty()) && (value[0] == '#'));
- }
-};
-
struct IRCDMessageCapab : Message::Capab
{
- std::map<char, Anope::string> chmodes, umodes;
-
IRCDMessageCapab(Module *creator) : Message::Capab(creator, "CAPAB") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) override
@@ -724,8 +611,6 @@ struct IRCDMessageCapab : Message::Capab
}
/* reset CAPAB */
- chmodes.clear();
- umodes.clear();
Servers::Capab.insert("SERVERS");
Servers::Capab.insert("CHGHOST");
Servers::Capab.insert("CHGIDENT");
@@ -739,130 +624,35 @@ struct IRCDMessageCapab : Message::Capab
while (ssep.GetToken(capab))
{
+ if (capab.find('=') == Anope::string::npos)
+ continue;
+
Anope::string modename = capab.substr(0, capab.find('='));
Anope::string modechar = capab.substr(capab.find('=') + 1);
- ChannelMode *cm = NULL;
+ char symbol = 0;
- if (modename.equals_cs("admin"))
- cm = new ChannelModeStatus("PROTECT", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0, 3);
- else if (modename.equals_cs("allowinvite"))
- {
- cm = new ChannelMode("ALLINVITE", modechar[0]);
- ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("INVITEBAN", "BAN", 'A'));
- }
- else if (modename.equals_cs("auditorium"))
- cm = new ChannelMode("AUDITORIUM", modechar[0]);
- else if (modename.equals_cs("ban"))
- cm = new ChannelModeList("BAN", modechar[0]);
- else if (modename.equals_cs("banexception"))
- cm = new ChannelModeList("EXCEPT", modechar[0]);
- else if (modename.equals_cs("blockcaps"))
- {
- cm = new ChannelMode("BLOCKCAPS", modechar[0]);
- ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("BLOCKCAPSBAN", "BAN", 'B'));
- }
- else if (modename.equals_cs("blockcolor"))
- {
- cm = new ChannelMode("BLOCKCOLOR", modechar[0]);
- ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("BLOCKCOLORBAN", "BAN", 'c'));
- }
- else if (modename.equals_cs("c_registered"))
- cm = new ChannelModeNoone("REGISTERED", modechar[0]);
- else if (modename.equals_cs("censor"))
- cm = new ChannelMode("CENSOR", modechar[0]);
- else if (modename.equals_cs("delayjoin"))
- cm = new ChannelMode("DELAYEDJOIN", modechar[0]);
- else if (modename.equals_cs("delaymsg"))
- cm = new SimpleNumberParamMode("DELAYMSG", modechar[0]);
- else if (modename.equals_cs("filter"))
- cm = new ChannelModeList("FILTER", modechar[0]);
- else if (modename.equals_cs("flood"))
- cm = new ChannelModeFlood(modechar[0]);
- else if (modename.equals_cs("founder"))
- cm = new ChannelModeStatus("OWNER", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0, 4);
- else if (modename.equals_cs("halfop"))
- cm = new ChannelModeStatus("HALFOP", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0, 1);
- else if (modename.equals_cs("history"))
- cm = new ChannelModeHistory(modechar[0]);
- else if (modename.equals_cs("invex"))
- cm = new ChannelModeList("INVITEOVERRIDE", modechar[0]);
- else if (modename.equals_cs("inviteonly"))
- cm = new ChannelMode("INVITE", modechar[0]);
- else if (modename.equals_cs("joinflood"))
- cm = new ColonDelimitedParamMode("JOINFLOOD", modechar[0]);
- else if (modename.equals_cs("key"))
- cm = new ChannelModeKey(modechar[0]);
- else if (modename.equals_cs("kicknorejoin"))
- cm = new SimpleNumberParamMode("NOREJOIN", modechar[0]);
- else if (modename.equals_cs("limit"))
- cm = new ChannelModeParam("LIMIT", modechar[0], true);
- else if (modename.equals_cs("moderated"))
- cm = new ChannelMode("MODERATED", modechar[0]);
- else if (modename.equals_cs("nickflood"))
- cm = new ColonDelimitedParamMode("NICKFLOOD", modechar[0]);
- else if (modename.equals_cs("noctcp"))
- {
- cm = new ChannelMode("NOCTCP", modechar[0]);
- ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("NOCTCPBAN", "BAN", 'C'));
- }
- else if (modename.equals_cs("noextmsg"))
- cm = new ChannelMode("NOEXTERNAL", modechar[0]);
- else if (modename.equals_cs("nokick"))
- {
- cm = new ChannelMode("NOKICK", modechar[0]);
- ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("NOKICKBAN", "BAN", 'Q'));
- }
- else if (modename.equals_cs("noknock"))
- cm = new ChannelMode("NOKNOCK", modechar[0]);
- else if (modename.equals_cs("nonick"))
- {
- cm = new ChannelMode("NONICK", modechar[0]);
- ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("NONICKBAN", "BAN", 'N'));
- }
- else if (modename.equals_cs("nonotice"))
+ if (modechar.empty())
+ continue;
+
+ if (modechar.length() == 2)
{
- cm = new ChannelMode("NONOTICE", modechar[0]);
- ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("NONOTICEBAN", "BAN", 'T'));
+ symbol = modechar[0];
+ modechar = modechar.substr(1);
}
- else if (modename.equals_cs("op"))
- cm = new ChannelModeStatus("OP", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0, 2);
- else if (modename.equals_cs("operonly"))
- cm = new ChannelModeOperOnly("OPERONLY", modechar[0]);
- else if (modename.equals_cs("permanent"))
- cm = new ChannelMode("PERM", modechar[0]);
- else if (modename.equals_cs("private"))
- cm = new ChannelMode("PRIVATE", modechar[0]);
- else if (modename.equals_cs("redirect"))
- cm = new ChannelModeRedirect(modechar[0]);
- else if (modename.equals_cs("reginvite"))
- cm = new ChannelMode("REGISTEREDONLY", modechar[0]);
- else if (modename.equals_cs("regmoderated"))
- cm = new ChannelMode("REGMODERATED", modechar[0]);
- else if (modename.equals_cs("secret"))
- cm = new ChannelMode("SECRET", modechar[0]);
- else if (modename.equals_cs("sslonly"))
+
+ ChannelMode *cm = ModeManager::FindChannelModeByChar(modechar[0]);
+ if (cm == nullptr)
{
- cm = new ChannelMode("SSL", modechar[0]);
- ModeManager::AddChannelMode(new InspIRCdExtban::FinerprintMatcher("SSLBAN", "BAN", 'z'));
+ Log(owner) << "Warning: Uplink has unknown channel mode " << modename << "=" << modechar;
+ continue;
}
- else if (modename.equals_cs("stripcolor"))
+
+ char modesymbol = cm->type == MODE_STATUS ? (anope_dynamic_static_cast<ChannelModeStatus *>(cm))->symbol : 0;
+ if (symbol != modesymbol)
{
- cm = new ChannelMode("STRIPCOLOR", modechar[0]);
- ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("STRIPCOLORBAN", "BAN", 'S'));
+ Log(owner) << "Warning: Channel mode " << modename << " has a misconfigured status character";
+ continue;
}
- else if (modename.equals_cs("topiclock"))
- cm = new ChannelMode("TOPIC", modechar[0]);
- else if (modename.equals_cs("voice"))
- cm = new ChannelModeStatus("VOICE", modechar.length() > 1 ? modechar[1] : modechar[0], modechar.length() > 1 ? modechar[0] : 0, 0);
- /* Unknown status mode, (customprefix) - add it */
- else if (modechar.length() == 2)
- cm = new ChannelModeStatus(modename.upper(), modechar[1], modechar[0], -1);
- /* Unknown non status mode, add it to our list for later */
- else
- chmodes[modechar[0]] = modename.upper();
-
- if (cm)
- ModeManager::AddChannelMode(cm);
}
}
if (params[0].equals_cs("USERMODES") && params.size() > 1)
@@ -872,54 +662,21 @@ struct IRCDMessageCapab : Message::Capab
while (ssep.GetToken(capab))
{
+ if (capab.find('=') == Anope::string::npos)
+ continue;
+
Anope::string modename = capab.substr(0, capab.find('='));
Anope::string modechar = capab.substr(capab.find('=') + 1);
- UserMode *um = NULL;
-
- if (modename.equals_cs("bot"))
- um = new UserMode("BOT", modechar[0]);
- else if (modename.equals_cs("callerid"))
- um = new UserMode("CALLERID", modechar[0]);
- else if (modename.equals_cs("cloak"))
- um = new UserMode("CLOAK", modechar[0]);
- else if (modename.equals_cs("deaf"))
- um = new UserMode("DEAF", modechar[0]);
- else if (modename.equals_cs("deaf_commonchan"))
- um = new UserMode("COMMONCHANS", modechar[0]);
- else if (modename.equals_cs("helpop"))
- um = new UserModeOperOnly("HELPOP", modechar[0]);
- else if (modename.equals_cs("hidechans"))
- um = new UserMode("PRIV", modechar[0]);
- else if (modename.equals_cs("hideoper"))
- um = new UserModeOperOnly("HIDEOPER", modechar[0]);
- else if (modename.equals_cs("invisible"))
- um = new UserMode("INVIS", modechar[0]);
- else if (modename.equals_cs("invis-oper"))
- um = new UserModeOperOnly("INVISIBLE_OPER", modechar[0]);
- else if (modename.equals_cs("oper"))
- um = new UserModeOperOnly("OPER", modechar[0]);
- else if (modename.equals_cs("regdeaf"))
- um = new UserMode("REGPRIV", modechar[0]);
- else if (modename.equals_cs("servprotect"))
+
+ if (modechar.empty())
+ continue;
+
+ UserMode *um = ModeManager::FindUserModeByChar(modechar[0]);
+ if (um == nullptr)
{
- um = new UserModeNoone("PROTECTED", modechar[0]);
- IRCD->DefaultPseudoclientModes += modechar;
+ Log(owner) << "Warning: Uplink has unknown user mode " << modename << "=" << modechar;
+ continue;
}
- else if (modename.equals_cs("showwhois"))
- um = new UserMode("WHOIS", modechar[0]);
- else if (modename.equals_cs("u_censor"))
- um = new UserMode("CENSOR", modechar[0]);
- else if (modename.equals_cs("u_registered"))
- um = new UserModeNoone("REGISTERED", modechar[0]);
- else if (modename.equals_cs("u_stripcolor"))
- um = new UserMode("STRIPCOLOR", modechar[0]);
- else if (modename.equals_cs("wallops"))
- um = new UserMode("WALLOPS", modechar[0]);
- else
- umodes[modechar[0]] = modename.upper();
-
- if (um)
- ModeManager::AddUserMode(um);
}
}
else if (params[0].equals_cs("MODULES") && params.size() > 1)
@@ -950,25 +707,11 @@ struct IRCDMessageCapab : Message::Capab
while (ssep.GetToken(module))
{
if (module.equals_cs("m_services_account.so"))
- {
Servers::Capab.insert("SERVICES");
- ModeManager::AddChannelMode(new InspIRCdExtban::AccountMatcher("ACCOUNTBAN", "BAN", 'R'));
- ModeManager::AddChannelMode(new InspIRCdExtban::UnidentifiedMatcher("UNREGISTEREDBAN", "BAN", 'U'));
- }
else if (module.equals_cs("m_chghost.so"))
Servers::Capab.insert("CHGHOST");
else if (module.equals_cs("m_chgident.so"))
Servers::Capab.insert("CHGIDENT");
- else if (module == "m_channelban.so")
- ModeManager::AddChannelMode(new InspIRCdExtban::ChannelMatcher("CHANNELBAN", "BAN", 'j'));
- else if (module == "m_gecosban.so")
- ModeManager::AddChannelMode(new InspIRCdExtban::RealnameMatcher("REALNAMEBAN", "BAN", 'r'));
- else if (module == "m_nopartmessage.so")
- ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("PARTMESSAGEBAN", "BAN", 'p'));
- else if (module == "m_serverban.so")
- ModeManager::AddChannelMode(new InspIRCdExtban::ServerMatcher("SERVERBAN", "BAN", 's'));
- else if (module == "m_muteban.so")
- ModeManager::AddChannelMode(new InspIRCdExtban::EntryMatcher("QUIET", "BAN", 'm'));
}
}
else if (params[0].equals_cs("CAPABILITIES") && params.size() > 1)
@@ -977,89 +720,11 @@ struct IRCDMessageCapab : Message::Capab
Anope::string capab;
while (ssep.GetToken(capab))
{
- if (capab.find("CHANMODES") != Anope::string::npos)
- {
- Anope::string modes(capab.begin() + 10, capab.end());
- commasepstream sep(modes);
- Anope::string modebuf;
-
- sep.GetToken(modebuf);
- for (size_t t = 0, end = modebuf.length(); t < end; ++t)
- {
- if (ModeManager::FindChannelModeByChar(modebuf[t]))
- continue;
- ModeManager::AddChannelMode(new ChannelModeList(chmodes[modebuf[t]], modebuf[t]));
- }
-
- sep.GetToken(modebuf);
- for (size_t t = 0, end = modebuf.length(); t < end; ++t)
- {
- if (ModeManager::FindChannelModeByChar(modebuf[t]))
- continue;
- ModeManager::AddChannelMode(new ChannelModeParam(chmodes[modebuf[t]], modebuf[t]));
- }
-
- sep.GetToken(modebuf);
- for (size_t t = 0, end = modebuf.length(); t < end; ++t)
- {
- if (ModeManager::FindChannelModeByChar(modebuf[t]))
- continue;
- ModeManager::AddChannelMode(new ChannelModeParam(chmodes[modebuf[t]], modebuf[t], true));
- }
-
- sep.GetToken(modebuf);
- for (size_t t = 0, end = modebuf.length(); t < end; ++t)
- {
- if (ModeManager::FindChannelModeByChar(modebuf[t]))
- continue;
- ModeManager::AddChannelMode(new ChannelMode(chmodes[modebuf[t]], modebuf[t]));
- }
- }
- else if (capab.find("USERMODES") != Anope::string::npos)
- {
- Anope::string modes(capab.begin() + 10, capab.end());
- commasepstream sep(modes);
- Anope::string modebuf;
-
- sep.GetToken(modebuf);
- sep.GetToken(modebuf);
-
- if (sep.GetToken(modebuf))
- for (size_t t = 0, end = modebuf.length(); t < end; ++t)
- ModeManager::AddUserMode(new UserModeParam(umodes[modebuf[t]], modebuf[t]));
-
- if (sep.GetToken(modebuf))
- for (size_t t = 0, end = modebuf.length(); t < end; ++t)
- ModeManager::AddUserMode(new UserMode(umodes[modebuf[t]], modebuf[t]));
- }
- else if (capab.find("MAXMODES=") != Anope::string::npos)
+ if (capab.find("MAXMODES=") != Anope::string::npos)
{
Anope::string maxmodes(capab.begin() + 9, capab.end());
IRCD->MaxModes = maxmodes.is_pos_number_only() ? convertTo<unsigned>(maxmodes) : 3;
}
- else if (capab.find("PREFIX=") != Anope::string::npos)
- {
- Anope::string modes(capab.begin() + 8, capab.begin() + capab.find(')'));
- Anope::string chars(capab.begin() + capab.find(')') + 1, capab.end());
- short level = modes.length() - 1;
-
- for (size_t t = 0, end = modes.length(); t < end; ++t)
- {
- ChannelMode *cm = ModeManager::FindChannelModeByChar(modes[t]);
- if (cm == NULL || cm->type != MODE_STATUS)
- {
- Log() << "CAPAB PREFIX gave unknown channel status mode " << modes[t];
- continue;
- }
-
- ChannelModeStatus *cms = anope_dynamic_static_cast<ChannelModeStatus *>(cm);
- cms->level = level--;
-
- Log(LOG_DEBUG) << cms->name << " is now level " << cms->level;
- }
-
- ModeManager::RebuildStatusModes();
- }
else if (capab == "GLOBOPS=1")
Servers::Capab.insert("GLOBOPS");
}
@@ -1086,9 +751,6 @@ struct IRCDMessageCapab : Message::Capab
Log() << "CHGHOST missing, Usage disabled until module is loaded.";
if (!Servers::Capab.count("CHGIDENT"))
Log() << "CHGIDENT missing, Usage disabled until module is loaded.";
-
- chmodes.clear();
- umodes.clear();
}
Message::Capab::Run(source, params);
@@ -1695,6 +1357,40 @@ class ProtoInspIRCd20 : public Module
{
use_server_side_topiclock = conf->GetModule(this)->Get<bool>("use_server_side_topiclock");
use_server_side_mlock = conf->GetModule(this)->Get<bool>("use_server_side_mlock");
+
+ for (int i = 0; i < conf->CountBlock("extban"); ++i)
+ {
+ Configuration::Block *extban = conf->GetBlock("extban", i);
+ Anope::string name = extban->Get<Anope::string>("name"),
+ type = extban->Get<Anope::string>("type"),
+ base = extban->Get<Anope::string>("base"),
+ character = extban->Get<Anope::string>("character");
+
+ ChannelMode *cm;
+
+ if (character.empty())
+ continue;
+
+ if (type == "channel")
+ cm = new InspIRCdExtban::ChannelMatcher(name, base, character[0]);
+ else if (type == "entry")
+ cm = new InspIRCdExtban::EntryMatcher(name, base, character[0]);
+ else if (type == "realname")
+ cm = new InspIRCdExtban::RealnameMatcher(name, base, character[0]);
+ else if (type == "account")
+ cm = new InspIRCdExtban::AccountMatcher(name, base, character[0]);
+ else if (type == "fingerprint")
+ cm = new InspIRCdExtban::FingerprintMatcher(name, base, character[0]);
+ else if (type == "unidentified")
+ cm = new InspIRCdExtban::UnidentifiedMatcher(name, base, character[0]);
+ else if (type == "server")
+ cm = new InspIRCdExtban::ServerMatcher(name, base, character[0]);
+ else
+ continue;
+
+ if (!ModeManager::AddChannelMode(cm))
+ delete cm;
+ }
}
void OnUserNickChange(User *u, const Anope::string &) override
diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp
index 9101a6788..6981e32bc 100644
--- a/modules/protocol/ngircd.cpp
+++ b/modules/protocol/ngircd.cpp
@@ -632,51 +632,6 @@ class ProtongIRCd : public Module
IRCDMessageServer message_server;
IRCDMessageTopic message_topic;
- void AddModes()
- {
- /* Add user modes */
- 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 UserModeOperOnly("OPER", 'o'));
- ModeManager::AddUserMode(new UserModeOperOnly("PROTECTED", 'q'));
- ModeManager::AddUserMode(new UserModeOperOnly("RESTRICTED", 'r'));
- ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'R'));
- ModeManager::AddUserMode(new UserModeOperOnly("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("BAN", 'b'));
- ModeManager::AddChannelMode(new ChannelModeList("EXCEPT", 'e'));
- ModeManager::AddChannelMode(new ChannelModeList("INVITEOVERRIDE", 'I'));
-
- /* Add channel user modes */
- ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', '+', 0));
- ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%', 1));
- ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@', 2));
- ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', '&', 3));
- ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', '~', 4));
-
- /* Add channel modes */
- ModeManager::AddChannelMode(new ChannelMode("INVITE", 'i'));
- ModeManager::AddChannelMode(new ChannelModeKey('k'));
- ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true));
- 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 ChannelModeNoone("REGISTERED", 'r'));
- 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:
ProtongIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR)
, ircd_proto(this)
@@ -713,8 +668,6 @@ class ProtongIRCd : public Module
Servers::Capab.insert("QS");
- this->AddModes();
-
}
void OnUserNickChange(User *u, const Anope::string &) override
diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp
index 32eeaeaba..027fa2a14 100644
--- a/modules/protocol/plexus.cpp
+++ b/modules/protocol/plexus.cpp
@@ -323,64 +323,6 @@ class ProtoPlexus : public Module
IRCDMessageServer message_server;
IRCDMessageUID message_uid;
- void AddModes()
- {
- /* Add user modes */
- ModeManager::AddUserMode(new UserModeOperOnly("ADMIN", 'a'));
- ModeManager::AddUserMode(new UserMode("NOCTCP", 'C'));
- ModeManager::AddUserMode(new UserMode("DEAF", 'D'));
- ModeManager::AddUserMode(new UserMode("SOFTCALLERID", 'G'));
- ModeManager::AddUserMode(new UserMode("CALLERID", 'g'));
- ModeManager::AddUserMode(new UserMode("INVIS", 'i'));
- ModeManager::AddUserMode(new UserModeOperOnly("LOCOPS", 'l'));
- ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o'));
- ModeManager::AddUserMode(new UserModeOperOnly("NETADMIN", 'N'));
- ModeManager::AddUserMode(new UserMode("PRIV", 'p'));
- ModeManager::AddUserMode(new UserModeOperOnly("ROUTING", 'q'));
- ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r'));
- ModeManager::AddUserMode(new UserMode("REGPRIV", 'R'));
- ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's'));
- ModeManager::AddUserMode(new UserModeNoone("SSL", 'S'));
- ModeManager::AddUserMode(new UserModeNoone("PROTECTED", 'U'));
- ModeManager::AddUserMode(new UserMode("WALLOPS", 'w'));
- ModeManager::AddUserMode(new UserModeNoone("WEBIRC", 'W'));
- ModeManager::AddUserMode(new UserMode("CLOAK", 'x'));
- ModeManager::AddUserMode(new UserModeOperOnly("OPERWALLS", 'z'));
-
- /* b/e/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("VOICE", 'v', '+', 0));
- ModeManager::AddChannelMode(new ChannelModeStatus("HALFOP", 'h', '%', 1));
- ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@', 2));
- ModeManager::AddChannelMode(new ChannelModeStatus("PROTECT", 'a', '&', 3));
- ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', '~', 4));
-
- /* l/k */
- ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true));
- ModeManager::AddChannelMode(new ChannelModeKey('k'));
-
- /* Add channel modes */
- ModeManager::AddChannelMode(new ChannelMode("BANDWIDTH", 'B'));
- ModeManager::AddChannelMode(new ChannelMode("NOCTCP", 'C'));
- ModeManager::AddChannelMode(new ChannelMode("BLOCKCOLOR", 'c'));
- ModeManager::AddChannelMode(new ChannelMode("INVITE", 'i'));
- ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm'));
- ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M'));
- ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n'));
- ModeManager::AddChannelMode(new ChannelMode("NONOTICE", 'N'));
- ModeManager::AddChannelMode(new ChannelMode("PRIVATE", 'p'));
- ModeManager::AddChannelMode(new ChannelMode("SECRET", 's'));
- ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't'));
- ModeManager::AddChannelMode(new ChannelModeOperOnly("OPERONLY", 'O'));
- ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R'));
- ModeManager::AddChannelMode(new ChannelMode("SSL", 'S'));
- ModeManager::AddChannelMode(new ChannelMode("PERM", 'z'));
- }
-
public:
ProtoPlexus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR)
, ircd_proto(this)
@@ -426,8 +368,6 @@ class ProtoPlexus : public Module
throw ModuleException("Unable to find hybrid");
if (!hybrid)
throw ModuleException("No protocol interface for hybrid");
-
- this->AddModes();
}
~ProtoPlexus()
diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp
index 4156d1fbf..ec3e406b1 100644
--- a/modules/protocol/ratbox.cpp
+++ b/modules/protocol/ratbox.cpp
@@ -239,55 +239,6 @@ class ProtoRatbox : public Module
IRCDMessageTBurst message_tburst;
IRCDMessageUID message_uid;
- void AddModes()
- {
- /* user modes */
- ModeManager::AddUserMode(new UserModeOperOnly("ADMIN", 'a'));
- ModeManager::AddUserMode(new UserModeOperOnly("BOT", 'b'));
- // c/C = con
- // d = debug?
- ModeManager::AddUserMode(new UserMode("DEAF", 'D'));
- // f = full?
- ModeManager::AddUserMode(new UserMode("CALLERID", 'g'));
- ModeManager::AddUserMode(new UserMode("INVIS", 'i'));
- // k = skill?
- ModeManager::AddUserMode(new UserModeOperOnly("LOCOPS", 'l'));
- // n = nchange
- ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o'));
- // r = rej
- ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's'));
- ModeManager::AddUserMode(new UserModeNoone("PROTECTED", 'S'));
- // u = unauth?
- ModeManager::AddUserMode(new UserMode("WALLOPS", 'w'));
- // x = external?
- // y = spy?
- ModeManager::AddUserMode(new UserModeOperOnly("OPERWALLS", 'z'));
- // Z = spy?
-
- /* b/e/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("VOICE", 'v', '+', 0));
- ModeManager::AddChannelMode(new ChannelModeStatus("OP", 'o', '@', 1));
-
- /* l/k */
- ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true));
- ModeManager::AddChannelMode(new ChannelModeKey('k'));
-
- /* channel modes */
- 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 ChannelMode("REGISTEREDONLY", 'r'));
- ModeManager::AddChannelMode(new ChannelMode("SECRET", 's'));
- ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't'));
- ModeManager::AddChannelMode(new ChannelMode("SSL", 'S'));
- }
-
public:
ProtoRatbox(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR)
, ircd_proto(this)
@@ -333,8 +284,6 @@ class ProtoRatbox : public Module
throw ModuleException("Unable to find hybrid");
if (!hybrid)
throw ModuleException("No protocol interface for hybrid");
-
- this->AddModes();
}
~ProtoRatbox()
diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp
index 6324d18ca..b4b9893d3 100644
--- a/modules/protocol/unreal.cpp
+++ b/modules/protocol/unreal.cpp
@@ -606,169 +606,6 @@ class ChannelModeUnrealSSL : public ChannelMode
}
};
-struct IRCDMessageCapab : Message::Capab
-{
- IRCDMessageCapab(Module *creator) : Message::Capab(creator, "PROTOCTL") { }
-
- void Run(MessageSource &source, const std::vector<Anope::string> &params) override
- {
- for (unsigned i = 0; i < params.size(); ++i)
- {
- Anope::string capab = params[i];
-
- if (capab.find("CHANMODES") != Anope::string::npos)
- {
- Anope::string modes(capab.begin() + 10, capab.end());
- commasepstream sep(modes);
- Anope::string modebuf;
-
- sep.GetToken(modebuf);
- for (size_t t = 0, end = modebuf.length(); t < end; ++t)
- {
- switch (modebuf[t])
- {
- case 'b':
- ModeManager::AddChannelMode(new ChannelModeList("BAN", 'b'));
-
- ModeManager::AddChannelMode(new UnrealExtban::ChannelMatcher("CHANNELBAN", "BAN", 'c'));
- ModeManager::AddChannelMode(new UnrealExtban::EntryMatcher("JOINBAN", "BAN", 'j'));
- ModeManager::AddChannelMode(new UnrealExtban::EntryMatcher("NONICKBAN", "BAN", 'n'));
- ModeManager::AddChannelMode(new UnrealExtban::EntryMatcher("QUIET", "BAN", 'q'));
- ModeManager::AddChannelMode(new UnrealExtban::RealnameMatcher("REALNAMEBAN", "BAN", 'r'));
- ModeManager::AddChannelMode(new UnrealExtban::RegisteredMatcher("REGISTEREDBAN", "BAN", 'R'));
- ModeManager::AddChannelMode(new UnrealExtban::AccountMatcher("ACCOUNTBAN", "BAN", 'a'));
- continue;
- case 'e':
- ModeManager::AddChannelMode(new ChannelModeList("EXCEPT", 'e'));
- continue;
- case 'I':
- ModeManager::AddChannelMode(new ChannelModeList("INVITEOVERRIDE", 'I'));
- continue;
- default:
- ModeManager::AddChannelMode(new ChannelModeList("", modebuf[t]));
- }
- }
-
- sep.GetToken(modebuf);
- for (size_t t = 0, end = modebuf.length(); t < end; ++t)
- {
- switch (modebuf[t])
- {
- case 'k':
- ModeManager::AddChannelMode(new ChannelModeKey('k'));
- continue;
- case 'f':
- ModeManager::AddChannelMode(new ChannelModeFlood('f', false));
- continue;
- case 'L':
- ModeManager::AddChannelMode(new ChannelModeParam("REDIRECT", 'L'));
- continue;
- default:
- ModeManager::AddChannelMode(new ChannelModeParam("", modebuf[t]));
- }
- }
-
- sep.GetToken(modebuf);
- for (size_t t = 0, end = modebuf.length(); t < end; ++t)
- {
- switch (modebuf[t])
- {
- case 'l':
- ModeManager::AddChannelMode(new ChannelModeParam("LIMIT", 'l', true));
- continue;
- case 'j':
- ModeManager::AddChannelMode(new ChannelModeParam("JOINFLOOD", 'j', true));
- continue;
- default:
- ModeManager::AddChannelMode(new ChannelModeParam("", modebuf[t], true));
- }
- }
-
- sep.GetToken(modebuf);
- for (size_t t = 0, end = modebuf.length(); t < end; ++t)
- {
- switch (modebuf[t])
- {
- case 'p':
- ModeManager::AddChannelMode(new ChannelMode("PRIVATE", 'p'));
- continue;
- case 's':
- ModeManager::AddChannelMode(new ChannelMode("SECRET", 's'));
- continue;
- case 'm':
- ModeManager::AddChannelMode(new ChannelMode("MODERATED", 'm'));
- continue;
- case 'n':
- ModeManager::AddChannelMode(new ChannelMode("NOEXTERNAL", 'n'));
- continue;
- case 't':
- ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't'));
- continue;
- case 'i':
- ModeManager::AddChannelMode(new ChannelMode("INVITE", 'i'));
- continue;
- case 'r':
- ModeManager::AddChannelMode(new ChannelModeNoone("REGISTERED", 'r'));
- continue;
- case 'R':
- ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R'));
- continue;
- case 'c':
- ModeManager::AddChannelMode(new ChannelMode("BLOCKCOLOR", 'c'));
- continue;
- case 'O':
- ModeManager::AddChannelMode(new ChannelModeOperOnly("OPERONLY", 'O'));
- continue;
- case 'A':
- ModeManager::AddChannelMode(new ChannelModeOperOnly("ADMINONLY", 'A'));
- continue;
- case 'Q':
- ModeManager::AddChannelMode(new ChannelMode("NOKICK", 'Q'));
- continue;
- case 'K':
- ModeManager::AddChannelMode(new ChannelMode("NOKNOCK", 'K'));
- continue;
- case 'V':
- ModeManager::AddChannelMode(new ChannelMode("NOINVITE", 'V'));
- continue;
- case 'C':
- ModeManager::AddChannelMode(new ChannelMode("NOCTCP", 'C'));
- continue;
- case 'u':
- ModeManager::AddChannelMode(new ChannelMode("AUDITORIUM", 'u'));
- continue;
- case 'z':
- ModeManager::AddChannelMode(new ChannelMode("SSL", 'z'));
- continue;
- case 'N':
- ModeManager::AddChannelMode(new ChannelMode("NONICK", 'N'));
- continue;
- case 'S':
- ModeManager::AddChannelMode(new ChannelMode("STRIPCOLOR", 'S'));
- continue;
- case 'M':
- ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M'));
- continue;
- case 'T':
- ModeManager::AddChannelMode(new ChannelMode("NONOTICE", 'T'));
- continue;
- case 'G':
- ModeManager::AddChannelMode(new ChannelMode("CENSOR", 'G'));
- continue;
- case 'Z':
- ModeManager::AddChannelMode(new ChannelModeUnrealSSL("", 'Z'));
- continue;
- default:
- ModeManager::AddChannelMode(new ChannelMode("", modebuf[t]));
- }
- }
- }
- }
-
- Message::Capab::Run(source, params);
- }
-};
-
struct IRCDMessageChgHost : IRCDMessage
{
IRCDMessageChgHost(Module *creator) : IRCDMessage(creator, "CHGHOST", 2) { }
@@ -1172,6 +1009,7 @@ class ProtoUnreal : public Module
/* Core message handlers */
Message::Away message_away;
+ Message::Capab message_capab;
Message::Error message_error;
Message::Invite message_invite;
Message::Join message_join;
@@ -1190,7 +1028,6 @@ class ProtoUnreal : public Module
Message::Whois message_whois;
/* Our message handlers */
- IRCDMessageCapab message_capab;
IRCDMessageChgHost message_chghost;
IRCDMessageChgIdent message_chgident;
IRCDMessageChgName message_chgname;
@@ -1210,44 +1047,6 @@ class ProtoUnreal : public Module
bool use_server_side_mlock;
- void AddModes()
- {
- 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("PROTECT", 'a', '~', 3));
- ModeManager::AddChannelMode(new ChannelModeStatus("OWNER", 'q', '*', 4));
-
- /* Add user modes */
- ModeManager::AddUserMode(new UserModeOperOnly("SERV_ADMIN", 'A'));
- ModeManager::AddUserMode(new UserMode("BOT", 'B'));
- ModeManager::AddUserMode(new UserModeOperOnly("CO_ADMIN", 'C'));
- ModeManager::AddUserMode(new UserMode("CENSOR", 'G'));
- ModeManager::AddUserMode(new UserModeOperOnly("HIDEOPER", 'H'));
- ModeManager::AddUserMode(new UserMode("HIDEIDLE", 'I'));
- ModeManager::AddUserMode(new UserModeOperOnly("NETADMIN", 'N'));
- ModeManager::AddUserMode(new UserMode("REGPRIV", 'R'));
- ModeManager::AddUserMode(new UserModeOperOnly("PROTECTED", 'S'));
- ModeManager::AddUserMode(new UserMode("NOCTCP", 'T'));
- ModeManager::AddUserMode(new UserMode("WEBTV", 'V'));
- ModeManager::AddUserMode(new UserModeOperOnly("WHOIS", 'W'));
- ModeManager::AddUserMode(new UserModeOperOnly("ADMIN", 'a'));
- ModeManager::AddUserMode(new UserMode("DEAF", 'd'));
- ModeManager::AddUserMode(new UserModeOperOnly("GLOBOPS", 'g'));
- ModeManager::AddUserMode(new UserModeOperOnly("HELPOP", 'h'));
- ModeManager::AddUserMode(new UserMode("INVIS", 'i'));
- ModeManager::AddUserMode(new UserModeOperOnly("OPER", 'o'));
- ModeManager::AddUserMode(new UserMode("PRIV", 'p'));
- ModeManager::AddUserMode(new UserModeOperOnly("GOD", 'q'));
- ModeManager::AddUserMode(new UserModeNoone("REGISTERED", 'r'));
- ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's'));
- ModeManager::AddUserMode(new UserModeNoone("VHOST", 't'));
- ModeManager::AddUserMode(new UserMode("WALLOPS", 'w'));
- ModeManager::AddUserMode(new UserMode("CLOAK", 'x'));
- ModeManager::AddUserMode(new UserModeNoone("SSL", 'z'));
- }
-
public:
ProtoUnreal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR)
, EventHook<Event::UserNickChange>(EventHook<Event::UserNickChange>::Priority::FIRST)
@@ -1257,6 +1056,7 @@ class ProtoUnreal : public Module
, EventHook<Event::MLockEvents>(EventHook<Event::MLockEvents>::Priority::FIRST)
, ircd_proto(this)
, message_away(this)
+ , message_capab(this, "PROTOCTL")
, message_error(this)
, message_invite(this)
, message_join(this)
@@ -1275,7 +1075,6 @@ class ProtoUnreal : public Module
, message_version(this)
, message_whois(this)
- , message_capab(this)
, message_chghost(this)
, message_chgident(this)
, message_chgname(this)
@@ -1295,13 +1094,41 @@ class ProtoUnreal : public Module
, message_topic(this)
, message_umode2(this)
{
-
- this->AddModes();
}
void OnReload(Configuration::Conf *conf) override
{
use_server_side_mlock = conf->GetModule(this)->Get<bool>("use_server_side_mlock");
+
+ for (int i = 0; i < conf->CountBlock("extban"); ++i)
+ {
+ Configuration::Block *extban = conf->GetBlock("extban", i);
+ Anope::string name = extban->Get<Anope::string>("name"),
+ type = extban->Get<Anope::string>("type"),
+ base = extban->Get<Anope::string>("base"),
+ character = extban->Get<Anope::string>("character");
+
+ ChannelMode *cm;
+
+ if (character.empty())
+ continue;
+
+ if (type == "channel")
+ cm = new UnrealExtban::ChannelMatcher(name, base, character[0]);
+ else if (type == "entry")
+ cm = new UnrealExtban::EntryMatcher(name, base, character[0]);
+ else if (type == "realname")
+ cm = new UnrealExtban::RealnameMatcher(name, base, character[0]);
+ else if (type == "registered")
+ cm = new UnrealExtban::RegisteredMatcher(name, base, character[0]);
+ else if (type == "account")
+ cm = new UnrealExtban::AccountMatcher(name, base, character[0]);
+ else
+ continue;
+
+ if (!ModeManager::AddChannelMode(cm))
+ delete cm;
+ }
}
void OnUserNickChange(User *u, const Anope::string &) override