diff options
author | Adam <Adam@anope.org> | 2016-10-07 18:38:37 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2016-10-07 18:38:37 -0400 |
commit | 9ef260388b18db9fab245cbbd292482b437fcd6d (patch) | |
tree | cac1a0da5bfd17cc82a5ee95796bceec686141cc | |
parent | 005434abce2f7f741f92fc81f24fb0a61c38ce56 (diff) |
Move core message handles to protocol/rfc1459
-rw-r--r-- | include/messages.h | 181 | ||||
-rw-r--r-- | include/module.h | 1 | ||||
-rw-r--r-- | include/modules/protocol/hybrid.h | 8 | ||||
-rw-r--r-- | include/modules/protocol/plexus.h | 2 | ||||
-rw-r--r-- | include/modules/protocol/ratbox.h | 6 | ||||
-rw-r--r-- | include/modules/protocol/rfc1459.h | 196 | ||||
-rw-r--r-- | modules/protocol/bahamut.cpp | 47 | ||||
-rw-r--r-- | modules/protocol/charybdis.cpp | 38 | ||||
-rw-r--r-- | modules/protocol/hybrid.cpp | 48 | ||||
-rw-r--r-- | modules/protocol/inspircd20.cpp | 49 | ||||
-rw-r--r-- | modules/protocol/ngircd.cpp | 47 | ||||
-rw-r--r-- | modules/protocol/plexus.cpp | 38 | ||||
-rw-r--r-- | modules/protocol/ratbox.cpp | 42 | ||||
-rw-r--r-- | modules/protocol/rfc1459.cpp (renamed from src/messages.cpp) | 31 | ||||
-rw-r--r-- | modules/protocol/unreal.cpp | 49 |
15 files changed, 407 insertions, 376 deletions
diff --git a/include/messages.h b/include/messages.h deleted file mode 100644 index 9c0b7f862..000000000 --- a/include/messages.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Anope IRC Services - * - * Copyright (C) 2004-2016 Anope Team <team@anope.org> - * - * This file is part of Anope. Anope is free software; you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License as published by the Free Software - * Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see see <http://www.gnu.org/licenses/>. - */ - -#include "protocol.h" - -/* Common IRCD messages. - * Protocol modules may chose to include some, none, or all of these handlers - * as they see fit. - */ - -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); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport Capab : IRCDMessage - { - Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport Error : IRCDMessage - { - Error(Module *creator, const Anope::string &mname = "ERROR") : IRCDMessage(creator, mname, 1) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport Invite : IRCDMessage - { - Invite(Module *creator, const Anope::string &mname = "INVITE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport Join : IRCDMessage - { - Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - - typedef std::pair<ChannelStatus, User *> SJoinUser; - - /** Handle a SJOIN. - * @param source The source of the SJOIN - * @param chan The channel the users are joining to - * @param ts The TS for the channel - * @param modes The modes sent with the SJOIN, if any - * @param users The users and their status, if any - */ - static void SJoin(MessageSource &source, const Anope::string &chan, time_t ts, const Anope::string &modes, const std::list<SJoinUser> &users); - }; - - struct CoreExport Kick : IRCDMessage - { - Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport Kill : IRCDMessage - { - Kill(Module *creator, const Anope::string &mname = "KILL") : IRCDMessage(creator, mname, 2) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport Mode : IRCDMessage - { - Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport MOTD : IRCDMessage - { - MOTD(Module *creator, const Anope::string &mname = "MOTD") : IRCDMessage(creator, mname, 1) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport Notice : IRCDMessage - { - Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport Part : IRCDMessage - { - Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport Ping : IRCDMessage - { - Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport Privmsg : IRCDMessage - { - Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport Quit : IRCDMessage - { - Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport SQuit : IRCDMessage - { - SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport Stats : IRCDMessage - { - Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport Time : IRCDMessage - { - Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport Topic : IRCDMessage - { - Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport Version : IRCDMessage - { - Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - - struct CoreExport Whois : IRCDMessage - { - Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; - }; - -} // namespace Message diff --git a/include/module.h b/include/module.h index e761dd822..490196f9c 100644 --- a/include/module.h +++ b/include/module.h @@ -32,7 +32,6 @@ #include "lists.h" #include "logger.h" #include "mail.h" -#include "messages.h" #include "modes.h" #include "modules.h" #include "opertype.h" diff --git a/include/modules/protocol/hybrid.h b/include/modules/protocol/hybrid.h index 4991ec624..76c84f33c 100644 --- a/include/modules/protocol/hybrid.h +++ b/include/modules/protocol/hybrid.h @@ -19,6 +19,8 @@ #pragma once +#include "modules/protocol/rfc1459.h" + namespace hybrid { @@ -38,10 +40,10 @@ class EOB : public IRCDMessage void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; }; -class Join : public Message::Join +class Join : public rfc1459::Join { public: - Join(Module *creator) : Message::Join(creator, "JOIN") { } + Join(Module *creator) : rfc1459::Join(creator, "JOIN") { } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; }; @@ -126,4 +128,4 @@ class CertFP : public IRCDMessage void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; }; -} // namespace hybrid
\ No newline at end of file +} // namespace hybrid diff --git a/include/modules/protocol/plexus.h b/include/modules/protocol/plexus.h index 1d6f79780..d17725be4 100644 --- a/include/modules/protocol/plexus.h +++ b/include/modules/protocol/plexus.h @@ -46,5 +46,5 @@ class UID : public IRCDMessage void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; }; -} +} // namespace plexus diff --git a/include/modules/protocol/ratbox.h b/include/modules/protocol/ratbox.h index d5101321a..e03846142 100644 --- a/include/modules/protocol/ratbox.h +++ b/include/modules/protocol/ratbox.h @@ -19,6 +19,8 @@ #pragma once +#include "modules/protocol/rfc1459.h" + namespace ratbox { @@ -31,10 +33,10 @@ class Encap : public IRCDMessage void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; }; -class Join : public Message::Join +class Join : public rfc1459::Join { public: - Join(Module *creator) : Message::Join(creator, "JOIN") { } + Join(Module *creator) : rfc1459::Join(creator, "JOIN") { } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; }; diff --git a/include/modules/protocol/rfc1459.h b/include/modules/protocol/rfc1459.h new file mode 100644 index 000000000..635e151c8 --- /dev/null +++ b/include/modules/protocol/rfc1459.h @@ -0,0 +1,196 @@ +/* + * Anope IRC Services + * + * Copyright (C) 2016 Anope Team <team@anope.org> + * + * This file is part of Anope. Anope is free software; you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software + * Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see see <http://www.gnu.org/licenses/>. + */ + +#pragma once + +namespace rfc1459 +{ + +class Away : public IRCDMessage +{ + public: + Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Capab : public IRCDMessage +{ + public: + Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Error : public IRCDMessage +{ + public: + Error(Module *creator, const Anope::string &mname = "ERROR") : IRCDMessage(creator, mname, 1) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Invite : public IRCDMessage +{ + public: + Invite(Module *creator, const Anope::string &mname = "INVITE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Join : public IRCDMessage +{ + public: + Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; + + typedef std::pair<ChannelStatus, User *> SJoinUser; + + /** Handle a SJOIN. + * @param source The source of the SJOIN + * @param chan The channel the users are joining to + * @param ts The TS for the channel + * @param modes The modes sent with the SJOIN, if any + * @param users The users and their status, if any + */ + static void SJoin(MessageSource &source, const Anope::string &chan, time_t ts, const Anope::string &modes, const std::list<SJoinUser> &users); +}; + +class Kick : public IRCDMessage +{ + public: + Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Kill : public IRCDMessage +{ + public: + Kill(Module *creator, const Anope::string &mname = "KILL") : IRCDMessage(creator, mname, 2) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Mode : public IRCDMessage +{ + public: + Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class MOTD : public IRCDMessage +{ + public: + MOTD(Module *creator, const Anope::string &mname = "MOTD") : IRCDMessage(creator, mname, 1) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Notice : public IRCDMessage +{ + public: + Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Part : public IRCDMessage +{ + public: + Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Ping : public IRCDMessage +{ + public: + Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Privmsg : public IRCDMessage +{ + public: + Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Quit : public IRCDMessage +{ + public: + Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class SQuit : public IRCDMessage +{ + public: + SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Stats : public IRCDMessage +{ + public: + Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Time : public IRCDMessage +{ + public: + Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Topic : public IRCDMessage +{ + public: + Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Version : public IRCDMessage +{ + public: + Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Whois : public IRCDMessage +{ + public: + Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +} // namespace rfc1459 diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index a32a7606d..9b0adefb0 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -17,7 +17,10 @@ * along with this program; if not, see see <http://www.gnu.org/licenses/>. */ +/* Dependencies: anope_protocol.rfc1459 */ + #include "module.h" +#include "modules/protocol/rfc1459.h" class ChannelModeFlood : public ChannelModeParam { @@ -435,14 +438,14 @@ struct IRCDMessageSJoin : IRCDMessage if (!modes.empty()) modes.erase(modes.begin()); - std::list<Message::Join::SJoinUser> users; + std::list<rfc1459::Join::SJoinUser> users; /* For some reason, bahamut will send a SJOIN from the user joining a channel * if the channel already existed */ if (source.GetUser()) { - Message::Join::SJoinUser sju; + rfc1459::Join::SJoinUser sju; sju.second = source.GetUser(); users.push_back(sju); } @@ -453,7 +456,7 @@ struct IRCDMessageSJoin : IRCDMessage while (sep.GetToken(buf)) { - Message::Join::SJoinUser sju; + rfc1459::Join::SJoinUser sju; /* Get prefixes from the nick */ for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));) @@ -474,7 +477,7 @@ struct IRCDMessageSJoin : IRCDMessage } time_t ts = Anope::string(params[0]).is_pos_number_only() ? convertTo<time_t>(params[0]) : Anope::CurTime; - Message::Join::SJoin(source, params[1], ts, modes, users); + rfc1459::Join::SJoin(source, params[1], ts, modes, users); } }; @@ -496,24 +499,24 @@ class ProtoBahamut : public Module BahamutIRCdProto ircd_proto; /* Core message handlers */ - Message::Away message_away; - Message::Capab message_capab; - Message::Error message_error; - Message::Invite message_invite; - Message::Join message_join; - Message::Kick message_kick; - Message::Kill message_kill; - Message::MOTD message_motd; - Message::Notice message_notice; - Message::Part message_part; - Message::Ping message_ping; - Message::Privmsg message_privmsg; - Message::Quit message_quit; - Message::SQuit message_squit; - Message::Stats message_stats; - Message::Time message_time; - Message::Version message_version; - Message::Whois message_whois; + rfc1459::Away message_away; + rfc1459::Capab message_capab; + rfc1459::Error message_error; + rfc1459::Invite message_invite; + rfc1459::Join message_join; + rfc1459::Kick message_kick; + rfc1459::Kill message_kill; + rfc1459::MOTD message_motd; + rfc1459::Notice message_notice; + rfc1459::Part message_part; + rfc1459::Ping message_ping; + rfc1459::Privmsg message_privmsg; + rfc1459::Quit message_quit; + rfc1459::SQuit message_squit; + rfc1459::Stats message_stats; + rfc1459::Time message_time; + rfc1459::Version message_version; + rfc1459::Whois message_whois; /* Our message handlers */ IRCDMessageBurst message_burst; diff --git a/modules/protocol/charybdis.cpp b/modules/protocol/charybdis.cpp index c69fbaf5f..105939df2 100644 --- a/modules/protocol/charybdis.cpp +++ b/modules/protocol/charybdis.cpp @@ -259,25 +259,25 @@ class ProtoCharybdis : public Module CharybdisProto ircd_proto; /* Core message handlers */ - Message::Away message_away; - Message::Capab message_capab; - Message::Error message_error; - Message::Invite message_invite; - Message::Kick message_kick; - Message::Kill message_kill; - Message::Mode message_mode; - Message::MOTD message_motd; - Message::Notice message_notice; - Message::Part message_part; - Message::Ping message_ping; - Message::Privmsg message_privmsg; - Message::Quit message_quit; - Message::SQuit message_squit; - Message::Stats message_stats; - Message::Time message_time; - Message::Topic message_topic; - Message::Version message_version; - Message::Whois message_whois; + rfc1459::Away message_away; + rfc1459::Capab message_capab; + rfc1459::Error message_error; + rfc1459::Invite message_invite; + rfc1459::Kick message_kick; + rfc1459::Kill message_kill; + rfc1459::Mode message_mode; + rfc1459::MOTD message_motd; + rfc1459::Notice message_notice; + rfc1459::Part message_part; + rfc1459::Ping message_ping; + rfc1459::Privmsg message_privmsg; + rfc1459::Quit message_quit; + rfc1459::SQuit message_squit; + rfc1459::Stats message_stats; + rfc1459::Time message_time; + rfc1459::Topic message_topic; + rfc1459::Version message_version; + rfc1459::Whois message_whois; /* Our message handlers */ hybrid::BMask message_bmask; diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp index c1d85bcf8..638a4037a 100644 --- a/modules/protocol/hybrid.cpp +++ b/modules/protocol/hybrid.cpp @@ -18,6 +18,8 @@ * along with this program; if not, see see <http://www.gnu.org/licenses/>. */ +/* Dependencies: anope_protocol.rfc1459 */ + #include "module.h" #include "modules/protocol/hybrid.h" @@ -366,7 +368,7 @@ void hybrid::Join::Run(MessageSource &source, const std::vector<Anope::string> & std::vector<Anope::string> p = params; p.erase(p.begin()); - return Message::Join::Run(source, p); + return rfc1459::Join::Run(source, p); } /* 0 1 */ @@ -423,14 +425,14 @@ void hybrid::SJoin::Run(MessageSource &source, const std::vector<Anope::string> if (!modes.empty()) modes.erase(modes.begin()); - std::list<Message::Join::SJoinUser> users; + std::list<rfc1459::Join::SJoinUser> users; spacesepstream sep(params[params.size() - 1]); Anope::string buf; while (sep.GetToken(buf)) { - Message::Join::SJoinUser sju; + rfc1459::Join::SJoinUser sju; /* Get prefixes from the nick */ for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));) @@ -450,7 +452,7 @@ void hybrid::SJoin::Run(MessageSource &source, const std::vector<Anope::string> } time_t ts = Anope::string(params[0]).is_pos_number_only() ? convertTo<time_t>(params[0]) : Anope::CurTime; - Message::Join::SJoin(source, params[1], ts, modes, users); + rfc1459::Join::SJoin(source, params[1], ts, modes, users); } /* @@ -538,25 +540,25 @@ class ProtoHybrid : public Module HybridProto ircd_proto; /* Core message handlers */ - Message::Away message_away; - Message::Capab message_capab; - Message::Error message_error; - Message::Invite message_invite; - Message::Kick message_kick; - Message::Kill message_kill; - Message::Mode message_mode; - Message::MOTD message_motd; - Message::Notice message_notice; - Message::Part message_part; - Message::Ping message_ping; - Message::Privmsg message_privmsg; - Message::Quit message_quit; - Message::SQuit message_squit; - Message::Stats message_stats; - Message::Time message_time; - Message::Topic message_topic; - Message::Version message_version; - Message::Whois message_whois; + rfc1459::Away message_away; + rfc1459::Capab message_capab; + rfc1459::Error message_error; + rfc1459::Invite message_invite; + rfc1459::Kick message_kick; + rfc1459::Kill message_kill; + rfc1459::Mode message_mode; + rfc1459::MOTD message_motd; + rfc1459::Notice message_notice; + rfc1459::Part message_part; + rfc1459::Ping message_ping; + rfc1459::Privmsg message_privmsg; + rfc1459::Quit message_quit; + rfc1459::SQuit message_squit; + rfc1459::Stats message_stats; + rfc1459::Time message_time; + rfc1459::Topic message_topic; + rfc1459::Version message_version; + rfc1459::Whois message_whois; /* Our message handlers */ hybrid::CertFP message_certfp; diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index f8bf9b30e..a0f0e067f 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -17,10 +17,13 @@ * along with this program; if not, see see <http://www.gnu.org/licenses/>. */ +/* Dependencies: anope_protocol.rfc1459 */ + #include "module.h" #include "modules/sasl.h" #include "modules/chanserv/mode.h" #include "modules/chanserv/set.h" +#include "modules/protocol/rfc1459.h" struct SASLUser { @@ -628,9 +631,9 @@ namespace InspIRCdExtban }; } -struct IRCDMessageCapab : Message::Capab +struct IRCDMessageCapab : rfc1459::Capab { - IRCDMessageCapab(Module *creator) : Message::Capab(creator, "CAPAB") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + IRCDMessageCapab(Module *creator) : rfc1459::Capab(creator, "CAPAB") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override { @@ -790,7 +793,7 @@ struct IRCDMessageCapab : Message::Capab Log() << "CHGIDENT missing, Usage disabled until module is loaded."; } - Message::Capab::Run(source, params); + rfc1459::Capab::Run(source, params); } }; @@ -885,13 +888,13 @@ struct IRCDMessageFJoin : IRCDMessage modes.erase(modes.begin()); } - std::list<Message::Join::SJoinUser> users; + std::list<rfc1459::Join::SJoinUser> users; spacesepstream sep(params[params.size() - 1]); Anope::string buf; while (sep.GetToken(buf)) { - Message::Join::SJoinUser sju; + rfc1459::Join::SJoinUser sju; /* Loop through prefixes and find modes for them */ for (char c; (c = buf[0]) != ',' && c;) @@ -914,7 +917,7 @@ struct IRCDMessageFJoin : IRCDMessage } time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime; - Message::Join::SJoin(source, params[0], ts, modes, users); + rfc1459::Join::SJoin(source, params[0], ts, modes, users); } }; @@ -1249,9 +1252,9 @@ struct IRCDMessageServer : IRCDMessage } }; -struct IRCDMessageSQuit : Message::SQuit +struct IRCDMessageSQuit : rfc1459::SQuit { - IRCDMessageSQuit(Module *creator) : Message::SQuit(creator) { } + IRCDMessageSQuit(Module *creator) : rfc1459::SQuit(creator) { } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override { @@ -1267,7 +1270,7 @@ struct IRCDMessageSQuit : Message::SQuit IRCD->SendServer(s); } else - Message::SQuit::Run(source, params); + rfc1459::SQuit::Run(source, params); } }; @@ -1344,20 +1347,20 @@ class ProtoInspIRCd20 : public Module ServiceReference<ModeLocks> mlocks; /* Core message handlers */ - Message::Away message_away; - Message::Error message_error; - Message::Invite message_invite; - Message::Join message_join; - Message::Kick message_kick; - Message::Kill message_kill; - Message::MOTD message_motd; - Message::Notice message_notice; - Message::Part message_part; - Message::Ping message_ping; - Message::Privmsg message_privmsg; - Message::Quit message_quit; - Message::Stats message_stats; - Message::Topic message_topic; + rfc1459::Away message_away; + rfc1459::Error message_error; + rfc1459::Invite message_invite; + rfc1459::Join message_join; + rfc1459::Kick message_kick; + rfc1459::Kill message_kill; + rfc1459::MOTD message_motd; + rfc1459::Notice message_notice; + rfc1459::Part message_part; + rfc1459::Ping message_ping; + rfc1459::Privmsg message_privmsg; + rfc1459::Quit message_quit; + rfc1459::Stats message_stats; + rfc1459::Topic message_topic; /* Our message handlers */ IRCDMessageCapab message_capab; diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp index aa2c23a80..be8225b96 100644 --- a/modules/protocol/ngircd.cpp +++ b/modules/protocol/ngircd.cpp @@ -18,7 +18,10 @@ * along with this program; if not, see see <http://www.gnu.org/licenses/>. */ +/* Dependencies: anope_protocol.rfc1459 */ + #include "module.h" +#include "modules/protocol/rfc1459.h" class ngIRCdProto : public IRCDProto { @@ -291,9 +294,9 @@ struct IRCDMessageChaninfo : IRCDMessage } }; -struct IRCDMessageJoin : Message::Join +struct IRCDMessageJoin : rfc1459::Join { - IRCDMessageJoin(Module *creator) : Message::Join(creator, "JOIN") { } + IRCDMessageJoin(Module *creator) : rfc1459::Join(creator, "JOIN") { } /* * <@po||ux> DukeP: RFC 2813, 4.2.1: the JOIN command on server-server links @@ -320,7 +323,7 @@ struct IRCDMessageJoin : Message::Join std::vector<Anope::string> new_params; new_params.push_back(channel); - Message::Join::Run(source, new_params); + rfc1459::Join::Run(source, new_params); if (!modes.empty()) { @@ -492,14 +495,14 @@ struct IRCDMessageNJoin : IRCDMessage */ void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override { - std::list<Message::Join::SJoinUser> users; + std::list<rfc1459::Join::SJoinUser> users; commasepstream sep(params[1]); Anope::string buf; while (sep.GetToken(buf)) { - Message::Join::SJoinUser sju; + rfc1459::Join::SJoinUser sju; /* Get prefixes from the nick */ for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));) @@ -517,7 +520,7 @@ struct IRCDMessageNJoin : IRCDMessage users.push_back(sju); } - Message::Join::SJoin(source, params[0], 0, "", users); + rfc1459::Join::SJoin(source, params[0], 0, "", users); } }; @@ -613,22 +616,22 @@ class ProtongIRCd : public Module ngIRCdProto ircd_proto; /* Core message handlers */ - Message::Capab message_capab; - Message::Error message_error; - Message::Invite message_invite; - Message::Kick message_kick; - Message::Kill message_kill; - Message::MOTD message_motd; - Message::Notice message_notice; - Message::Part message_part; - Message::Ping message_ping; - Message::Privmsg message_privmsg, message_squery; - Message::Quit message_quit; - Message::SQuit message_squit; - Message::Stats message_stats; - Message::Time message_time; - Message::Version message_version; - Message::Whois message_whois; + rfc1459::Capab message_capab; + rfc1459::Error message_error; + rfc1459::Invite message_invite; + rfc1459::Kick message_kick; + rfc1459::Kill message_kill; + rfc1459::MOTD message_motd; + rfc1459::Notice message_notice; + rfc1459::Part message_part; + rfc1459::Ping message_ping; + rfc1459::Privmsg message_privmsg, message_squery; + rfc1459::Quit message_quit; + rfc1459::SQuit message_squit; + rfc1459::Stats message_stats; + rfc1459::Time message_time; + rfc1459::Version message_version; + rfc1459::Whois message_whois; /* Our message handlers */ IRCDMessage005 message_005; diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index 02d2a4d6e..6a3fff270 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -294,25 +294,25 @@ class ProtoPlexus : public Module PlexusProto ircd_proto; /* Core message handlers */ - Message::Away message_away; - Message::Capab message_capab; - Message::Error message_error; - Message::Invite message_invite; - Message::Kick message_kick; - Message::Kill message_kill; - Message::Mode message_mode; - Message::MOTD message_motd; - Message::Notice message_notice; - Message::Part message_part; - Message::Ping message_ping; - Message::Privmsg message_privmsg; - Message::Quit message_quit; - Message::SQuit message_squit; - Message::Stats message_stats; - Message::Time message_time; - Message::Topic message_topic; - Message::Version message_version; - Message::Whois message_whois; + rfc1459::Away message_away; + rfc1459::Capab message_capab; + rfc1459::Error message_error; + rfc1459::Invite message_invite; + rfc1459::Kick message_kick; + rfc1459::Kill message_kill; + rfc1459::Mode message_mode; + rfc1459::MOTD message_motd; + rfc1459::Notice message_notice; + rfc1459::Part message_part; + rfc1459::Ping message_ping; + rfc1459::Privmsg message_privmsg; + rfc1459::Quit message_quit; + rfc1459::SQuit message_squit; + rfc1459::Stats message_stats; + rfc1459::Time message_time; + rfc1459::Topic message_topic; + rfc1459::Version message_version; + rfc1459::Whois message_whois; /* Our message handlers */ hybrid::BMask message_bmask; diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index 223902457..3620ad4e6 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -152,7 +152,7 @@ void ratbox::Encap::Run(MessageSource &source, const std::vector<Anope::string> void ratbox::Join::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { if (params.size() == 1 && params[0] == "0") - return Message::Join::Run(source, params); + return rfc1459::Join::Run(source, params); if (params.size() < 2) return; @@ -160,7 +160,7 @@ void ratbox::Join::Run(MessageSource &source, const std::vector<Anope::string> & std::vector<Anope::string> p = params; p.erase(p.begin()); - return Message::Join::Run(source, p); + return rfc1459::Join::Run(source, p); } struct IRCDMessagePass : IRCDMessage @@ -215,25 +215,25 @@ class ProtoRatbox : public Module RatboxProto ircd_proto; /* Core message handlers */ - Message::Away message_away; - Message::Capab message_capab; - Message::Error message_error; - Message::Invite message_invite; - Message::Kick message_kick; - Message::Kill message_kill; - Message::Mode message_mode; - Message::MOTD message_motd; - Message::Notice message_notice; - Message::Part message_part; - Message::Ping message_ping; - Message::Privmsg message_privmsg; - Message::Quit message_quit; - Message::SQuit message_squit; - Message::Stats message_stats; - Message::Time message_time; - Message::Topic message_topic; - Message::Version message_version; - Message::Whois message_whois; + rfc1459::Away message_away; + rfc1459::Capab message_capab; + rfc1459::Error message_error; + rfc1459::Invite message_invite; + rfc1459::Kick message_kick; + rfc1459::Kill message_kill; + rfc1459::Mode message_mode; + rfc1459::MOTD message_motd; + rfc1459::Notice message_notice; + rfc1459::Part message_part; + rfc1459::Ping message_ping; + rfc1459::Privmsg message_privmsg; + rfc1459::Quit message_quit; + rfc1459::SQuit message_squit; + rfc1459::Stats message_stats; + rfc1459::Time message_time; + rfc1459::Topic message_topic; + rfc1459::Version message_version; + rfc1459::Whois message_whois; /* Our message handlers */ hybrid::BMask message_bmask; diff --git a/src/messages.cpp b/modules/protocol/rfc1459.cpp index c778de383..22889c682 100644 --- a/src/messages.cpp +++ b/modules/protocol/rfc1459.cpp @@ -1,7 +1,7 @@ /* * Anope IRC Services * - * Copyright (C) 2003-2016 Anope Team <team@anope.org> + * Copyright (C) 2005-2016 Anope Team <team@anope.org> * * This file is part of Anope. Anope is free software; you can * redistribute it and/or modify it under the terms of the GNU @@ -17,21 +17,11 @@ * along with this program; if not, see see <http://www.gnu.org/licenses/>. */ -#include "services.h" -#include "modules.h" -#include "users.h" -#include "protocol.h" -#include "config.h" -#include "uplink.h" -#include "opertype.h" -#include "messages.h" -#include "servers.h" -#include "channels.h" -#include "event.h" -#include "bots.h" +#include "module.h" +#include "modules/protocol/rfc1459.h" #include "modules/operserv/stats.h" -using namespace Message; +using namespace rfc1459; void Away::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { @@ -223,7 +213,7 @@ void Kill::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) u->KillInternal(source, params[1]); } -void Message::Mode::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void rfc1459::Mode::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { Anope::string buf; for (unsigned i = 1; i < params.size(); ++i) @@ -416,7 +406,7 @@ void SQuit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) s->Delete(s->GetName() + " " + s->GetUplink()->GetName()); } -void Message::Stats::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void rfc1459::Stats::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { User *u = source.GetUser(); @@ -508,3 +498,12 @@ void Whois::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) IRCD->SendNumeric(401, source.GetSource(), "%s :No such user.", params[0].c_str()); } +class ProtoRFC1459 : public Module +{ + public: + ProtoRFC1459(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR) + { + } +}; + +MODULE_INIT(ProtoRFC1459) diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index d805e60cb..0f97da8ae 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -17,10 +17,13 @@ * along with this program; if not, see see <http://www.gnu.org/licenses/>. */ +/* Dependencies: anope_protocol.rfc1459 */ + #include "module.h" #include "modules/chanserv/mode.h" #include "modules/sasl.h" #include "modules/operserv/stats.h" +#include "modules/protocol/rfc1459.h" static Anope::string UplinkSID; @@ -842,9 +845,9 @@ struct IRCDMessagePong : IRCDMessage } }; -struct IRCDMessageProtoctl : Message::Capab +struct IRCDMessageProtoctl : rfc1459::Capab { - IRCDMessageProtoctl(Module *creator) : Message::Capab(creator, "PROTOCTL") { } + IRCDMessageProtoctl(Module *creator) : rfc1459::Capab(creator, "PROTOCTL") { } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override { @@ -858,7 +861,7 @@ struct IRCDMessageProtoctl : Message::Capab } } - Message::Capab::Run(source, params); + rfc1459::Capab::Run(source, params); } }; @@ -983,7 +986,7 @@ struct IRCDMessageSJoin : IRCDMessage modes.erase(modes.begin()); std::list<Anope::string> bans, excepts, invites; - std::list<Message::Join::SJoinUser> users; + std::list<rfc1459::Join::SJoinUser> users; spacesepstream sep(params[params.size() - 1]); Anope::string buf; @@ -1009,7 +1012,7 @@ struct IRCDMessageSJoin : IRCDMessage } else { - Message::Join::SJoinUser sju; + rfc1459::Join::SJoinUser sju; /* Get prefixes from the nick */ for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));) @@ -1030,7 +1033,7 @@ struct IRCDMessageSJoin : IRCDMessage } time_t ts = Anope::string(params[0]).is_pos_number_only() ? convertTo<time_t>(params[0]) : Anope::CurTime; - Message::Join::SJoin(source, params[1], ts, modes, users); + rfc1459::Join::SJoin(source, params[1], ts, modes, users); if (!bans.empty() || !excepts.empty() || !invites.empty()) { @@ -1179,23 +1182,23 @@ class ProtoUnreal : public Module ServiceReference<ModeLocks> mlocks; /* Core message handlers */ - Message::Away message_away; - Message::Error message_error; - Message::Invite message_invite; - Message::Join message_join; - Message::Kick message_kick; - Message::Kill message_kill, message_svskill; - Message::MOTD message_motd; - Message::Notice message_notice; - Message::Part message_part; - Message::Ping message_ping; - Message::Privmsg message_privmsg; - Message::Quit message_quit; - Message::SQuit message_squit; - Message::Stats message_stats; - Message::Time message_time; - Message::Version message_version; - Message::Whois message_whois; + rfc1459::Away message_away; + rfc1459::Error message_error; + rfc1459::Invite message_invite; + rfc1459::Join message_join; + rfc1459::Kick message_kick; + rfc1459::Kill message_kill, message_svskill; + rfc1459::MOTD message_motd; + rfc1459::Notice message_notice; + rfc1459::Part message_part; + rfc1459::Ping message_ping; + rfc1459::Privmsg message_privmsg; + rfc1459::Quit message_quit; + rfc1459::SQuit message_squit; + rfc1459::Stats message_stats; + rfc1459::Time message_time; + rfc1459::Version message_version; + rfc1459::Whois message_whois; /* Our message handlers */ IRCDMessageChgHost message_chghost; |