diff options
author | Adam <Adam@anope.org> | 2016-12-01 19:46:06 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2016-12-01 19:46:06 -0500 |
commit | 76771aa05f7168ca02c217d3c6de36e84381eb5d (patch) | |
tree | 2a6efe527c1178903e24bf920e047c07f539d040 /include/modules/protocol/ngircd.h | |
parent | d95bc84eda5c131374b7097f9de7f59418bd9b6a (diff) |
Split more protocol module message handler declarations into module headers
Diffstat (limited to 'include/modules/protocol/ngircd.h')
-rw-r--r-- | include/modules/protocol/ngircd.h | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/include/modules/protocol/ngircd.h b/include/modules/protocol/ngircd.h new file mode 100644 index 000000000..0bfebea9f --- /dev/null +++ b/include/modules/protocol/ngircd.h @@ -0,0 +1,127 @@ +/* + * Anope IRC Services + * + * Copyright (C) 2011-2016 Anope Team <team@anope.org> + * Copyright (C) 2011-2012, 2014 Alexander Barton <alex@barton.de> + * + * 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 ngircd +{ + +class Numeric005 : public IRCDMessage +{ + public: + Numeric005(Module *creator) : IRCDMessage(creator, "005", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + // Please see <http://www.irc.org/tech_docs/005.html> for details. + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class ChanInfo : public IRCDMessage +{ + public: + ChanInfo(Module *creator) : IRCDMessage(creator, "CHANINFO", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + /* + * CHANINFO is used by servers to inform each other about a channel: its + * modes, channel key, user limits and its topic. The parameter combination + * <key> and <limit> is optional, as well as the <topic> parameter, so that + * there are three possible forms of this command: + * + * CHANINFO <chan> +<modes> + * CHANINFO <chan> +<modes> :<topic> + * CHANINFO <chan> +<modes> <key> <limit> :<topic> + * + * The parameter <key> must be ignored if a channel has no key (the parameter + * <modes> doesn't list the "k" channel mode). In this case <key> should + * contain "*" because the parameter <key> is required by the CHANINFO syntax + * and therefore can't be omitted. The parameter <limit> must be ignored when + * a channel has no user limit (the parameter <modes> doesn't list the "l" + * channel mode). In this case <limit> should be "0". + */ + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms); +}; + +class Join : public rfc1459::Join +{ + public: + Join(Module *creator) : rfc1459::Join(creator, "JOIN") { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Metadata : public IRCDMessage +{ + public: + Metadata(Module *creator) : IRCDMessage(creator, "METADATA", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Mode : public IRCDMessage +{ + public: + Mode(Module *creator) : IRCDMessage(creator, "MODE", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +struct Nick : public IRCDMessage +{ + public: + Nick(Module *creator) : IRCDMessage(creator, "NICK", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class NJoin : public IRCDMessage +{ + public: + NJoin(Module *creator) : IRCDMessage(creator, "NJOIN",2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }; + + /* + * RFC 2813, 4.2.2: Njoin Message: + * The NJOIN message is used between servers only. + * It is used when two servers connect to each other to exchange + * the list of channel members for each channel. + * + * Even though the same function can be performed by using a succession + * of JOIN, this message SHOULD be used instead as it is more efficient. + * + * Received: :dev.anope.de NJOIN #test :DukeP2,@DukeP,%test,+test2 + */ + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Pong : public IRCDMessage +{ + public: + Pong(Module *creator) : IRCDMessage(creator, "PONG", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class ServerMessage : public IRCDMessage +{ + public: + ServerMessage(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +} // namespace ngircd
\ No newline at end of file |