diff options
Diffstat (limited to 'include')
-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 |
6 files changed, 206 insertions, 188 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 |