diff options
| -rw-r--r-- | include/messages.h | 32 | ||||
| -rw-r--r-- | include/protocol.h | 59 | ||||
| -rw-r--r-- | modules/protocol/bahamut.cpp | 10 | ||||
| -rw-r--r-- | modules/protocol/hybrid.cpp | 30 | ||||
| -rw-r--r-- | modules/protocol/inspircd.cpp | 38 | ||||
| -rw-r--r-- | modules/protocol/ngircd.cpp | 20 | ||||
| -rw-r--r-- | modules/protocol/plexus.cpp | 8 | ||||
| -rw-r--r-- | modules/protocol/ratbox.cpp | 10 | ||||
| -rw-r--r-- | modules/protocol/solanum.cpp | 8 | ||||
| -rw-r--r-- | modules/protocol/unrealircd.cpp | 32 | ||||
| -rw-r--r-- | src/process.cpp | 6 | ||||
| -rw-r--r-- | src/protocol.cpp | 10 |
12 files changed, 146 insertions, 117 deletions
diff --git a/include/messages.h b/include/messages.h index 206570940..59e483923 100644 --- a/include/messages.h +++ b/include/messages.h @@ -24,7 +24,7 @@ namespace Message struct CoreExport Away : IRCDMessage { - Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(FLAG_REQUIRE_USER); SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override; }; @@ -32,7 +32,7 @@ namespace Message struct CoreExport Capab : IRCDMessage { - Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override; }; @@ -48,7 +48,7 @@ namespace Message struct CoreExport Invite : IRCDMessage { - Invite(Module *creator, const Anope::string &mname = "INVITE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + Invite(Module *creator, const Anope::string &mname = "INVITE") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_REQUIRE_USER); SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override; }; @@ -56,7 +56,7 @@ namespace Message struct CoreExport Join : IRCDMessage { - Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_REQUIRE_USER); SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override; @@ -75,7 +75,7 @@ namespace Message struct CoreExport Kick : IRCDMessage { - Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override; }; @@ -91,7 +91,7 @@ namespace Message struct CoreExport Mode : IRCDMessage { - Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override; }; @@ -107,7 +107,7 @@ namespace Message struct CoreExport Notice : IRCDMessage { - Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_REQUIRE_USER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override; }; @@ -115,7 +115,7 @@ namespace Message struct CoreExport Part : IRCDMessage { - Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_REQUIRE_USER); SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override; }; @@ -123,7 +123,7 @@ namespace Message struct CoreExport Ping : IRCDMessage { - Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override; }; @@ -131,7 +131,7 @@ namespace Message struct CoreExport Privmsg : IRCDMessage { - Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_REQUIRE_USER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override; }; @@ -139,7 +139,7 @@ namespace Message struct CoreExport Quit : IRCDMessage { - Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_REQUIRE_USER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override; }; @@ -155,7 +155,7 @@ namespace Message struct CoreExport Stats : IRCDMessage { - Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_REQUIRE_USER); SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override; }; @@ -163,7 +163,7 @@ namespace Message struct CoreExport Time : IRCDMessage { - Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override; }; @@ -171,7 +171,7 @@ namespace Message struct CoreExport Topic : IRCDMessage { - Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(FLAG_REQUIRE_USER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override; }; @@ -179,7 +179,7 @@ namespace Message struct CoreExport Version : IRCDMessage { - Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override; }; @@ -187,7 +187,7 @@ namespace Message struct CoreExport Whois : IRCDMessage { - Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override; }; diff --git a/include/protocol.h b/include/protocol.h index 4c9f5afd0..728988195 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -319,26 +319,57 @@ public: Server *GetServer() const; }; -enum IRCDMessageFlag -{ - IRCDMESSAGE_SOFT_LIMIT, - IRCDMESSAGE_REQUIRE_SERVER, - IRCDMESSAGE_REQUIRE_USER -}; +/** Base class for protocol module message handlers. */ class CoreExport IRCDMessage : public Service { - Anope::string name; - unsigned param_count; - std::set<IRCDMessageFlag> flags; public: - IRCDMessage(Module *owner, const Anope::string &n, unsigned p = 0); - unsigned GetParamCount() const; - virtual void Run(MessageSource &, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) = 0; + /** An enumeration of potential flags a command can have. */ + enum Flag + : uint8_t + { + /** The parameter count is a minimum instead of an exact limit. */ + FLAG_SOFT_LIMIT, + + /** The message must come from a server. */ + FLAG_REQUIRE_SERVER, + + /** The message must come from a user. */ + FLAG_REQUIRE_USER, + + /** The highest flag possible. */ + FLAG_MAX, + }; + +private: + /** The name of the message (e.g. PRIVMSG). */ + const Anope::string name; + + /** The number of parameters this command takes. */ + const size_t param_count; + + /** The flags that are set on the command. */ + std::bitset<FLAG_MAX> flags; + +public: + IRCDMessage(Module *o, const Anope::string &n, size_t pc = 0); + + /** Retrieves the parameter count. */ + inline size_t GetParamCount() const { return param_count; } + + /** Runs the handler for this message. + * @param source Entity that sent the message. + * @param params Message parameters + * @param tags Message tags + */ + virtual void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) = 0; + + /** Sets the flags for this message. */ + inline void SetFlag(Flag flag, bool value = true) { flags.set(flag, value); } - void SetFlag(IRCDMessageFlag f) { flags.insert(f); } - bool HasFlag(IRCDMessageFlag f) const { return flags.count(f); } + /** Determines if a flag is set. */ + inline bool HasFlag(Flag flag) const { return flags[flag]; } }; /** MessageTokenizer allows tokens in the IRC wire format to be read from a string */ diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index f8d7f3dc4..91b806671 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -297,7 +297,7 @@ public: struct IRCDMessageBurst final : IRCDMessage { - IRCDMessageBurst(Module *creator) : IRCDMessage(creator, "BURST", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageBurst(Module *creator) : IRCDMessage(creator, "BURST", 0) { SetFlag(FLAG_REQUIRE_SERVER); SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -316,7 +316,7 @@ struct IRCDMessageBurst final struct IRCDMessageMode final : IRCDMessage { - IRCDMessageMode(Module *creator, const Anope::string &sname) : IRCDMessage(creator, sname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageMode(Module *creator, const Anope::string &sname) : IRCDMessage(creator, sname, 2) { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -368,7 +368,7 @@ struct IRCDMessageMode final struct IRCDMessageNick final : IRCDMessage { - IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -402,7 +402,7 @@ struct IRCDMessageNick final struct IRCDMessageServer final : IRCDMessage { - IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(FLAG_REQUIRE_SERVER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -414,7 +414,7 @@ struct IRCDMessageServer final struct IRCDMessageSJoin final : IRCDMessage { - IRCDMessageSJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageSJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 2) { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp index ed86b29f7..a1aa63ec7 100644 --- a/modules/protocol/hybrid.cpp +++ b/modules/protocol/hybrid.cpp @@ -317,7 +317,7 @@ public: struct IRCDMessageBMask final : IRCDMessage { - IRCDMessageBMask(Module *creator) : IRCDMessage(creator, "BMASK", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + IRCDMessageBMask(Module *creator) : IRCDMessage(creator, "BMASK", 4) { SetFlag(FLAG_REQUIRE_SERVER); } /* 0 1 2 3 */ /* :0MC BMASK 1350157102 #channel b :*!*@*.test.com */ @@ -340,7 +340,7 @@ struct IRCDMessageBMask final struct IRCDMessageCapab final : Message::Capab { - IRCDMessageCapab(Module *creator) : Message::Capab(creator, "CAPAB") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageCapab(Module *creator) : Message::Capab(creator, "CAPAB") { SetFlag(FLAG_SOFT_LIMIT); } /* 0 */ /* CAPAB :TBURST EOB MLOCK */ @@ -365,7 +365,7 @@ struct IRCDMessageCapab final struct IRCDMessageCertFP: IRCDMessage { - IRCDMessageCertFP(Module *creator) : IRCDMessage(creator, "CERTFP", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + IRCDMessageCertFP(Module *creator) : IRCDMessage(creator, "CERTFP", 1) { SetFlag(FLAG_REQUIRE_USER); } /* 0 */ /* :0MCAAAAAB CERTFP 4C62287BA6776A89CD4F8FF10A62FFB35E79319F51AF6C62C674984974FCCB1D */ @@ -381,7 +381,7 @@ struct IRCDMessageCertFP: IRCDMessage struct IRCDMessageEOB final : IRCDMessage { - IRCDMessageEOB(Module *creator) : IRCDMessage(creator, "EOB", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + IRCDMessageEOB(Module *creator) : IRCDMessage(creator, "EOB", 0) { SetFlag(FLAG_REQUIRE_SERVER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -409,7 +409,7 @@ struct IRCDMessageJoin final struct IRCDMessageMetadata final : IRCDMessage { - IRCDMessageMetadata(Module *creator) : IRCDMessage(creator, "METADATA", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + IRCDMessageMetadata(Module *creator) : IRCDMessage(creator, "METADATA", 3) { SetFlag(FLAG_REQUIRE_SERVER); } /* 0 1 2 3 */ /* :0MC METADATA client 0MCAAAAAB certfp :4C62287BA6776A89CD4F8FF10A62FFB35E79319F51AF6C62C674984974FCCB1D */ @@ -436,7 +436,7 @@ struct IRCDMessageMetadata final struct IRCDMessageMLock final : IRCDMessage { - IRCDMessageMLock(Module *creator) : IRCDMessage(creator, "MLOCK", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + IRCDMessageMLock(Module *creator) : IRCDMessage(creator, "MLOCK", 4) { SetFlag(FLAG_REQUIRE_SERVER); } /* 0 1 2 3 */ /* :0MC MLOCK 1350157102 #channel 1350158923 :nt */ @@ -462,7 +462,7 @@ struct IRCDMessageMLock final struct IRCDMessageNick final : IRCDMessage { - IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(FLAG_REQUIRE_USER); } /* 0 1 */ /* :0MCAAAAAB NICK newnick 1350157102 */ @@ -475,7 +475,7 @@ struct IRCDMessageNick final struct IRCDMessagePass final : IRCDMessage { - IRCDMessagePass(Module *creator) : IRCDMessage(creator, "PASS", 1) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessagePass(Module *creator) : IRCDMessage(creator, "PASS", 1) { SetFlag(FLAG_REQUIRE_SERVER); SetFlag(FLAG_SOFT_LIMIT); } /* 0 */ /* PASS password */ @@ -489,7 +489,7 @@ struct IRCDMessagePass final struct IRCDMessagePong final : IRCDMessage { - IRCDMessagePong(Module *creator) : IRCDMessage(creator, "PONG", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessagePong(Module *creator) : IRCDMessage(creator, "PONG", 0) { SetFlag(FLAG_REQUIRE_SERVER); SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -500,7 +500,7 @@ struct IRCDMessagePong final struct IRCDMessageServer final : IRCDMessage { - IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(FLAG_REQUIRE_SERVER); SetFlag(FLAG_SOFT_LIMIT); } /* 0 1 2 3 4 */ /* SERVER hades.arpa 1 4XY + :ircd-hybrid test server */ @@ -525,7 +525,7 @@ struct IRCDMessageServer final struct IRCDMessageSID final : IRCDMessage { - IRCDMessageSID(Module *creator) : IRCDMessage(creator, "SID", 5) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageSID(Module *creator) : IRCDMessage(creator, "SID", 5) { SetFlag(FLAG_REQUIRE_SERVER); SetFlag(FLAG_SOFT_LIMIT); } /* 0 1 2 3 4 */ /* :0MC SID hades.arpa 2 4XY + :ircd-hybrid test server */ @@ -541,7 +541,7 @@ struct IRCDMessageSID final struct IRCDMessageSJoin final : IRCDMessage { - IRCDMessageSJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageSJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 4) { SetFlag(FLAG_REQUIRE_SERVER); SetFlag(FLAG_SOFT_LIMIT); } /* 0 1 2 3 */ /* :0MC SJOIN 1654877335 #nether +nt :@0MCAAAAAB +0MCAAAAAC */ @@ -589,7 +589,7 @@ struct IRCDMessageSJoin final struct IRCDMessageSVSMode final : IRCDMessage { - IRCDMessageSVSMode(Module *creator) : IRCDMessage(creator, "SVSMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageSVSMode(Module *creator) : IRCDMessage(creator, "SVSMODE", 3) { SetFlag(FLAG_SOFT_LIMIT); } /* 0 1 2 */ /* :0MC SVSMODE 0MCAAAAAB 1350157102 +r */ @@ -629,7 +629,7 @@ struct IRCDMessageTBurst final struct IRCDMessageTMode final : IRCDMessage { - IRCDMessageTMode(Module *creator) : IRCDMessage(creator, "TMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageTMode(Module *creator) : IRCDMessage(creator, "TMODE", 3) { SetFlag(FLAG_SOFT_LIMIT); } /* 0 1 2 */ /* :0MC TMODE 1654867975 #nether +ntR */ @@ -657,7 +657,7 @@ struct IRCDMessageTMode final struct IRCDMessageUID final : IRCDMessage { - IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 11) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 11) { SetFlag(FLAG_REQUIRE_SERVER); SetFlag(FLAG_SOFT_LIMIT); } /* 0 1 2 3 4 5 6 7 8 9 10 */ /* :0MC UID Steve 1 1350157102 +oi ~steve virtual.host real.host 10.0.0.1 0MCAAAAAB Steve :Mining all the time */ diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp index 917934401..710277fcb 100644 --- a/modules/protocol/inspircd.cpp +++ b/modules/protocol/inspircd.cpp @@ -890,7 +890,7 @@ public: struct IRCDMessageAway final : Message::Away { - IRCDMessageAway(Module *creator) : Message::Away(creator, "AWAY") { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + IRCDMessageAway(Module *creator) : Message::Away(creator, "AWAY") { SetFlag(FLAG_REQUIRE_USER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -980,7 +980,7 @@ struct IRCDMessageCapab final return true; } - IRCDMessageCapab(Module *creator) : Message::Capab(creator, "CAPAB") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageCapab(Module *creator) : Message::Capab(creator, "CAPAB") { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1317,7 +1317,7 @@ struct IRCDMessageCapab final struct IRCDMessageEncap final : IRCDMessage { - IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 4) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 4) { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1368,7 +1368,7 @@ struct IRCDMessageEncap final struct IRCDMessageFHost final : IRCDMessage { - IRCDMessageFHost(Module *creator) : IRCDMessage(creator, "FHOST", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + IRCDMessageFHost(Module *creator) : IRCDMessage(creator, "FHOST", 1) { SetFlag(FLAG_REQUIRE_USER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1382,7 +1382,7 @@ struct IRCDMessageFHost final struct IRCDMessageFIdent final : IRCDMessage { - IRCDMessageFIdent(Module *creator) : IRCDMessage(creator, "FIDENT", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + IRCDMessageFIdent(Module *creator) : IRCDMessage(creator, "FIDENT", 1) { SetFlag(FLAG_REQUIRE_USER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1393,7 +1393,7 @@ struct IRCDMessageFIdent final struct IRCDMessageKick final : IRCDMessage { - IRCDMessageKick(Module *creator) : IRCDMessage(creator, "KICK", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageKick(Module *creator) : IRCDMessage(creator, "KICK", 3) { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1459,7 +1459,7 @@ class IRCDMessageMetadata final PrimitiveExtensibleItem<ListLimits> &maxlist; public: - IRCDMessageMetadata(Module *creator, const bool &handle_topiclock, const bool &handle_mlock, PrimitiveExtensibleItem<ListLimits> &listlimits) : IRCDMessage(creator, "METADATA", 3), do_topiclock(handle_topiclock), do_mlock(handle_mlock), maxlist(listlimits) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageMetadata(Module *creator, const bool &handle_topiclock, const bool &handle_mlock, PrimitiveExtensibleItem<ListLimits> &listlimits) : IRCDMessage(creator, "METADATA", 3), do_topiclock(handle_topiclock), do_mlock(handle_mlock), maxlist(listlimits) { SetFlag(FLAG_REQUIRE_SERVER); SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1606,7 +1606,7 @@ public: struct IRCDMessageEndburst final : IRCDMessage { - IRCDMessageEndburst(Module *creator) : IRCDMessage(creator, "ENDBURST", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + IRCDMessageEndburst(Module *creator) : IRCDMessage(creator, "ENDBURST", 0) { SetFlag(FLAG_REQUIRE_SERVER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1621,7 +1621,7 @@ struct IRCDMessageEndburst final struct IRCDMessageFJoin final : IRCDMessage { - IRCDMessageFJoin(Module *creator) : IRCDMessage(creator, "FJOIN", 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageFJoin(Module *creator) : IRCDMessage(creator, "FJOIN", 2) { SetFlag(FLAG_REQUIRE_SERVER); SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1678,7 +1678,7 @@ struct IRCDMessageFJoin final struct IRCDMessageFMode final : IRCDMessage { - IRCDMessageFMode(Module *creator) : IRCDMessage(creator, "FMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageFMode(Module *creator) : IRCDMessage(creator, "FMODE", 3) { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1708,7 +1708,7 @@ struct IRCDMessageFMode final struct IRCDMessageFTopic final : IRCDMessage { - IRCDMessageFTopic(Module *creator) : IRCDMessage(creator, "FTOPIC", 4) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageFTopic(Module *creator) : IRCDMessage(creator, "FTOPIC", 4) { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1746,7 +1746,7 @@ struct IRCDMessageIdle final struct IRCDMessageIJoin final : IRCDMessage { - IRCDMessageIJoin(Module *creator) : IRCDMessage(creator, "IJOIN", 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageIJoin(Module *creator) : IRCDMessage(creator, "IJOIN", 2) { SetFlag(FLAG_REQUIRE_USER); SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1783,7 +1783,7 @@ struct IRCDMessageIJoin final struct IRCDMessageMode final : IRCDMessage { - IRCDMessageMode(Module *creator) : IRCDMessage(creator, "MODE", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageMode(Module *creator) : IRCDMessage(creator, "MODE", 2) { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1814,7 +1814,7 @@ struct IRCDMessageMode final struct IRCDMessageNick final : IRCDMessage { - IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(FLAG_REQUIRE_USER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1825,7 +1825,7 @@ struct IRCDMessageNick final struct IRCDMessageOperType final : IRCDMessage { - IRCDMessageOperType(Module *creator) : IRCDMessage(creator, "OPERTYPE", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_USER); } + IRCDMessageOperType(Module *creator) : IRCDMessage(creator, "OPERTYPE", 0) { SetFlag(FLAG_SOFT_LIMIT); SetFlag(FLAG_REQUIRE_USER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1840,7 +1840,7 @@ struct IRCDMessageOperType final struct IRCDMessagePing final : IRCDMessage { - IRCDMessagePing(Module *creator) : IRCDMessage(creator, "PING", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + IRCDMessagePing(Module *creator) : IRCDMessage(creator, "PING", 1) { SetFlag(FLAG_SOFT_LIMIT); SetFlag(FLAG_REQUIRE_SERVER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1852,7 +1852,7 @@ struct IRCDMessagePing final struct IRCDMessageRSQuit final : IRCDMessage { - IRCDMessageRSQuit(Module *creator) : IRCDMessage(creator, "RSQUIT", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageRSQuit(Module *creator) : IRCDMessage(creator, "RSQUIT", 1) { SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1869,7 +1869,7 @@ struct IRCDMessageRSQuit final struct IRCDMessageServer final : IRCDMessage { - IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(FLAG_REQUIRE_SERVER); SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -1937,7 +1937,7 @@ struct IRCDMessageTime final struct IRCDMessageUID final : IRCDMessage { - IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 8) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 8) { SetFlag(FLAG_REQUIRE_SERVER); SetFlag(FLAG_SOFT_LIMIT); } /* * [Nov 03 22:09:58.176252 2009] debug: Received: :964 UID 964AAAAAC 1225746297 w00t2 localhost testnet.user w00t 127.0.0.1 1225746302 +iosw +ACGJKLNOQcdfgjklnoqtx :Robin Burchell <w00t@inspircd.org> diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp index 5d65f49ab..90c5bb252 100644 --- a/modules/protocol/ngircd.cpp +++ b/modules/protocol/ngircd.cpp @@ -161,7 +161,7 @@ public: struct IRCDMessage005 final : IRCDMessage { - IRCDMessage005(Module *creator) : IRCDMessage(creator, "005", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessage005(Module *creator) : IRCDMessage(creator, "005", 1) { SetFlag(FLAG_SOFT_LIMIT); } // Please see <http://www.irc.org/tech_docs/005.html> for details. void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override @@ -210,7 +210,7 @@ struct IRCDMessage376 final struct IRCDMessageChaninfo final : IRCDMessage { - IRCDMessageChaninfo(Module *creator) : IRCDMessage(creator, "CHANINFO", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + IRCDMessageChaninfo(Module *creator) : IRCDMessage(creator, "CHANINFO", 2) { SetFlag(FLAG_SOFT_LIMIT); SetFlag(FLAG_REQUIRE_SERVER); } /* * CHANINFO is used by servers to inform each other about a channel: its @@ -264,7 +264,7 @@ struct IRCDMessageChaninfo final struct IRCDMessageJoin final : Message::Join { - IRCDMessageJoin(Module *creator) : Message::Join(creator, "JOIN") { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + IRCDMessageJoin(Module *creator) : Message::Join(creator, "JOIN") { SetFlag(FLAG_REQUIRE_USER); } /* * <@po||ux> DukeP: RFC 2813, 4.2.1: the JOIN command on server-server links @@ -305,7 +305,7 @@ struct IRCDMessageJoin final struct IRCDMessageMetadata final : IRCDMessage { - IRCDMessageMetadata(Module *creator) : IRCDMessage(creator, "METADATA", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + IRCDMessageMetadata(Module *creator) : IRCDMessage(creator, "METADATA", 3) { SetFlag(FLAG_REQUIRE_SERVER); } /* * Received: :ngircd.dev.anope.de METADATA DukePyrolator host :anope-e2ee5c7d @@ -365,7 +365,7 @@ struct IRCDMessageMetadata final struct IRCDMessageMode final : IRCDMessage { - IRCDMessageMode(Module *creator) : IRCDMessage(creator, "MODE", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageMode(Module *creator) : IRCDMessage(creator, "MODE", 2) { SetFlag(FLAG_SOFT_LIMIT); } /* * Received: :DukeP MODE #anope +b *!*@*.aol.com @@ -402,7 +402,7 @@ struct IRCDMessageMode final struct IRCDMessageNick final : IRCDMessage { - IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 1) { SetFlag(FLAG_SOFT_LIMIT); } /* * NICK - NEW @@ -455,7 +455,7 @@ struct IRCDMessageNick final struct IRCDMessageNJoin final : IRCDMessage { - IRCDMessageNJoin(Module *creator) : IRCDMessage(creator, "NJOIN",2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }; + IRCDMessageNJoin(Module *creator) : IRCDMessage(creator, "NJOIN",2) { SetFlag(FLAG_REQUIRE_SERVER); }; /* * RFC 2813, 4.2.2: Njoin Message: @@ -502,7 +502,7 @@ struct IRCDMessageNJoin final struct IRCDMessagePong final : IRCDMessage { - IRCDMessagePong(Module *creator) : IRCDMessage(creator, "PONG", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + IRCDMessagePong(Module *creator) : IRCDMessage(creator, "PONG", 0) { SetFlag(FLAG_SOFT_LIMIT); SetFlag(FLAG_REQUIRE_SERVER); } /* * ngIRCd does not send an EOB, so we send a PING immediately @@ -519,7 +519,7 @@ struct IRCDMessagePong final struct IRCDMessageServer final : IRCDMessage { - IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(FLAG_SOFT_LIMIT); } /* * New directly linked server: @@ -571,7 +571,7 @@ struct IRCDMessageServer final struct IRCDMessageTopic final : IRCDMessage { - IRCDMessageTopic(Module *creator) : IRCDMessage(creator, "TOPIC", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageTopic(Module *creator) : IRCDMessage(creator, "TOPIC", 2) { SetFlag(FLAG_SOFT_LIMIT); } // Received: :DukeP TOPIC #anope :test void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index 7e3a7a2e6..c3a245b49 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -198,7 +198,7 @@ public: struct IRCDMessageEncap final : IRCDMessage { - IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 4) { SetFlag(FLAG_REQUIRE_SERVER); SetFlag(FLAG_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -255,7 +255,7 @@ struct IRCDMessageEncap final struct IRCDMessagePass final : IRCDMessage { - IRCDMessagePass(Module *creator) : IRCDMessage(creator, "PASS", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + IRCDMessagePass(Module *creator) : IRCDMessage(creator, "PASS", 4) { SetFlag(FLAG_REQUIRE_SERVER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -266,7 +266,7 @@ struct IRCDMessagePass final struct IRCDMessageServer final : IRCDMessage { - IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(FLAG_REQUIRE_SERVER); } /* 0 1 2 */ /* SERVER hades.arpa 1 :ircd-hybrid test server */ @@ -283,7 +283,7 @@ struct IRCDMessageServer final struct IRCDMessageUID final : IRCDMessage { - IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 11) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 11) { SetFlag(FLAG_REQUIRE_SERVER); } /* params[0] = nick diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index dc2da1161..47cf69f94 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -145,7 +145,7 @@ public: struct IRCDMessageEncap final : IRCDMessage { - IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 3) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 3) { SetFlag(FLAG_REQUIRE_USER); } // Debug: Received: :00BAAAAAB ENCAP * LOGIN Adam void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override @@ -191,7 +191,7 @@ struct IRCDMessageJoin final struct IRCDMessagePass final : IRCDMessage { - IRCDMessagePass(Module *creator) : IRCDMessage(creator, "PASS", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + IRCDMessagePass(Module *creator) : IRCDMessage(creator, "PASS", 4) { SetFlag(FLAG_REQUIRE_SERVER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms, const Anope::map<Anope::string> &tags) override { @@ -202,7 +202,7 @@ struct IRCDMessagePass final struct IRCDMessageServer final : IRCDMessage { - IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(FLAG_REQUIRE_SERVER); } |
