summaryrefslogtreecommitdiff
path: root/include/messages.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/messages.h')
-rw-r--r--include/messages.h277
1 files changed, 156 insertions, 121 deletions
diff --git a/include/messages.h b/include/messages.h
index 1a577ae85..1ef9638ff 100644
--- a/include/messages.h
+++ b/include/messages.h
@@ -1,126 +1,161 @@
+/*
+ *
+ * (C) 2003-2012 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ *
+ * Based on the original code of Epona by Lara.
+ * Based on the original code of Services by Andy Church.
+ *
+ */
+
#include "protocol.h"
-
+
/* Common IRCD messages.
* Protocol modules may chose to include some, none, or all of these handlers
* as they see fit.
*/
-
-struct CoreExport CoreIRCDMessageAway : IRCDMessage
-{
- CoreIRCDMessageAway(const Anope::string &mname = "AWAY") : IRCDMessage(mname, 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
-struct CoreExport CoreIRCDMessageCapab : IRCDMessage
-{
- CoreIRCDMessageCapab(const Anope::string &mname = "CAPAB") : IRCDMessage(mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
-struct CoreExport CoreIRCDMessageError : IRCDMessage
-{
- CoreIRCDMessageError(const Anope::string &mname = "ERROR") : IRCDMessage(mname, 1) { }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
-struct CoreExport CoreIRCDMessageJoin : IRCDMessage
-{
- CoreIRCDMessageJoin(const Anope::string &mname = "JOIN") : IRCDMessage(mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
-struct CoreExport CoreIRCDMessageKick : IRCDMessage
-{
- CoreIRCDMessageKick(const Anope::string &mname = "KICK") : IRCDMessage(mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
-struct CoreExport CoreIRCDMessageKill : IRCDMessage
-{
- CoreIRCDMessageKill(const Anope::string &mname = "KILL") : IRCDMessage(mname, 2) { }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
-struct CoreExport CoreIRCDMessageMOTD : IRCDMessage
-{
- CoreIRCDMessageMOTD(const Anope::string &mname = "MOTD") : IRCDMessage(mname, 1) { }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
-struct CoreExport CoreIRCDMessagePart : IRCDMessage
-{
- CoreIRCDMessagePart(const Anope::string &mname = "PART") : IRCDMessage(mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
-struct CoreExport CoreIRCDMessagePing : IRCDMessage
-{
- CoreIRCDMessagePing(const Anope::string &mname = "PING") : IRCDMessage(mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
-struct CoreExport CoreIRCDMessagePrivmsg : IRCDMessage
-{
- CoreIRCDMessagePrivmsg(const Anope::string &mname = "PRIVMSG") : IRCDMessage(mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
-struct CoreExport CoreIRCDMessageQuit : IRCDMessage
-{
- CoreIRCDMessageQuit(const Anope::string &mname = "QUIT") : IRCDMessage(mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
-struct CoreExport CoreIRCDMessageSQuit : IRCDMessage
-{
- CoreIRCDMessageSQuit(const Anope::string &mname = "SQUIT") : IRCDMessage(mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
-struct CoreExport CoreIRCDMessageStats : IRCDMessage
-{
- CoreIRCDMessageStats(const Anope::string &mname = "STATS") : IRCDMessage(mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
-struct CoreExport CoreIRCDMessageTime : IRCDMessage
-{
- CoreIRCDMessageTime(const Anope::string &mname = "TIME") : IRCDMessage(mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
-struct CoreExport CoreIRCDMessageTopic : IRCDMessage
-{
- CoreIRCDMessageTopic(const Anope::string &mname = "TOPIC") : IRCDMessage(mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
-struct CoreExport CoreIRCDMessageVersion : IRCDMessage
-{
- CoreIRCDMessageVersion(const Anope::string &mname = "VERSION") : IRCDMessage(mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
-struct CoreExport CoreIRCDMessageWhois : IRCDMessage
-{
- CoreIRCDMessageWhois(const Anope::string &mname = "WHOIS") : IRCDMessage(mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
-
- bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
-};
-
+
+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); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+ };
+
+ struct CoreExport Capab : IRCDMessage
+ {
+ Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+ };
+
+ struct CoreExport Error : IRCDMessage
+ {
+ Error(Module *creator, const Anope::string &mname = "ERROR") : IRCDMessage(creator, mname, 1) { }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_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); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_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); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+ };
+
+ struct CoreExport Kill : IRCDMessage
+ {
+ Kill(Module *creator, const Anope::string &mname = "KILL") : IRCDMessage(creator, mname, 2) { }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+ };
+
+ struct CoreExport Mode : IRCDMessage
+ {
+ Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+ };
+
+ struct CoreExport MOTD : IRCDMessage
+ {
+ MOTD(Module *creator, const Anope::string &mname = "MOTD") : IRCDMessage(creator, mname, 1) { }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_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); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+ };
+
+ struct CoreExport Ping : IRCDMessage
+ {
+ Ping(Module *creator, const Anope::string &mname = "PPING") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+ };
+
+ struct CoreExport Privmsg : IRCDMessage
+ {
+ Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+ };
+
+ struct CoreExport Quit : IRCDMessage
+ {
+ Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+ };
+
+ struct CoreExport SQuit : IRCDMessage
+ {
+ SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_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); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+ };
+
+ struct CoreExport Time : IRCDMessage
+ {
+ Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+ };
+
+ struct CoreExport Topic : IRCDMessage
+ {
+ Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+ };
+
+ struct CoreExport Version : IRCDMessage
+ {
+ Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+ };
+
+ struct CoreExport Whois : IRCDMessage
+ {
+ Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+ };
+
+} // namespace Message
+