diff options
Diffstat (limited to 'include/modules/protocol')
-rw-r--r-- | include/modules/protocol/bahamut.h | 270 | ||||
-rw-r--r-- | include/modules/protocol/charybdis.h | 144 | ||||
-rw-r--r-- | include/modules/protocol/hybrid.h | 367 | ||||
-rw-r--r-- | include/modules/protocol/inspircd20.h | 506 | ||||
-rw-r--r-- | include/modules/protocol/ngircd.h | 213 | ||||
-rw-r--r-- | include/modules/protocol/plexus.h | 139 | ||||
-rw-r--r-- | include/modules/protocol/ratbox.h | 152 | ||||
-rw-r--r-- | include/modules/protocol/rfc1459.h | 355 | ||||
-rw-r--r-- | include/modules/protocol/ts6.h | 37 | ||||
-rw-r--r-- | include/modules/protocol/unreal.h | 422 |
10 files changed, 2605 insertions, 0 deletions
diff --git a/include/modules/protocol/bahamut.h b/include/modules/protocol/bahamut.h new file mode 100644 index 000000000..fd0d47c87 --- /dev/null +++ b/include/modules/protocol/bahamut.h @@ -0,0 +1,270 @@ +/* + * Anope IRC Services + * + * Copyright (C) 2003-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 bahamut +{ + +namespace senders +{ + +class Akill : public messages::Akill +{ + public: + using messages::Akill::Akill; + + void Send(User *, XLine *) override; +}; + +class AkillDel : public messages::AkillDel +{ + public: + using messages::AkillDel::AkillDel; + + void Send(XLine *) override; +}; + +class MessageChannel : public messages::MessageChannel +{ + public: + using messages::MessageChannel::MessageChannel; + + void Send(Channel *) override; +}; + +class Join : public messages::Join +{ + public: + using messages::Join::Join; + + void Send(User *u, Channel *c, const ChannelStatus *status) override; +}; + +class Kill : public messages::Kill +{ + public: + using messages::Kill::Kill; + + void Send(const MessageSource &source, const Anope::string &target, const Anope::string &reason) override; + + void Send(const MessageSource &source, User *user, const Anope::string &reason) override; +}; + +class Login : public messages::Login +{ + public: + using messages::Login::Login; + + void Send(User *u, NickServ::Nick *na) override; +}; + +class Logout : public messages::Logout +{ + public: + using messages::Logout::Logout; + + void Send(User *u) override; +}; + +class ModeChannel : public messages::ModeChannel +{ + public: + using messages::ModeChannel::ModeChannel; + + void Send(const MessageSource &source, Channel *channel, const Anope::string &modes) override; +}; + +class ModeUser : public messages::ModeUser +{ + public: + using messages::ModeUser::ModeUser; + + void Send(const MessageSource &source, User *user, const Anope::string &modes) override; +}; + +class NickIntroduction : public messages::NickIntroduction +{ + public: + using messages::NickIntroduction::NickIntroduction; + + void Send(User *user) override; +}; + +class NOOP : public messages::NOOP +{ + public: + static constexpr const char *NAME = "noop"; + + using messages::NOOP::NOOP; + + void Send(Server *s, bool mode) override; +}; + +class SGLine : public messages::SGLine +{ + public: + using messages::SGLine::SGLine; + + void Send(User *, XLine *) override; +}; + +class SGLineDel : public messages::SGLineDel +{ + public: + using messages::SGLineDel::SGLineDel; + + void Send(XLine *) override; +}; + +class SQLine : public messages::SQLine +{ + public: + using messages::SQLine::SQLine; + + void Send(User *, XLine *) override; +}; + +class SQLineDel : public messages::SQLineDel +{ + public: + using messages::SQLineDel::SQLineDel; + + void Send(XLine *) override; +}; + +class SZLine : public messages::SZLine +{ + public: + using messages::SZLine::SZLine; + + void Send(User *, XLine *) override; +}; + +class SZLineDel : public messages::SZLineDel +{ + public: + using messages::SZLineDel::SZLineDel; + + void Send(XLine *) override; +}; + +class SVSHold : public messages::SVSHold +{ + public: + using messages::SVSHold::SVSHold; + + void Send(const Anope::string &, time_t) override; +}; + +class SVSHoldDel : public messages::SVSHoldDel +{ + public: + using messages::SVSHoldDel::SVSHoldDel; + + void Send(const Anope::string &) override; +}; + +class SVSNick : public messages::SVSNick +{ + public: + using messages::SVSNick::SVSNick; + + void Send(User *u, const Anope::string &newnick, time_t ts) override; +}; + +class Topic : public messages::Topic +{ + public: + using messages::Topic::Topic; + + void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override; +}; + +class Wallops : public messages::Wallops +{ + public: + using messages::Wallops::Wallops; + + void Send(const MessageSource &source, const Anope::string &msg) override; +}; + +} // namespace senders + +class Proto : public IRCDProto +{ + public: + Proto(Module *creator); + + void SendBOB() override; + + void SendEOB() override; + + void Handshake() override; +}; + +class Burst : public IRCDMessage +{ + public: + Burst(Module *creator) : IRCDMessage(creator, "BURST", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Mode : public IRCDMessage +{ + public: + Mode(Module *creator, const Anope::string &sname) : IRCDMessage(creator, sname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Nick : public IRCDMessage +{ + public: + Nick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + 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_REQUIRE_SERVER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class SJoin : public IRCDMessage +{ + public: + SJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Topic : public IRCDMessage +{ + public: + Topic(Module *creator) : IRCDMessage(creator, "TOPIC", 4) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +} // namespace bahamut diff --git a/include/modules/protocol/charybdis.h b/include/modules/protocol/charybdis.h new file mode 100644 index 000000000..f3c06bfeb --- /dev/null +++ b/include/modules/protocol/charybdis.h @@ -0,0 +1,144 @@ +/* + * 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 + +#include "modules/protocol/ts6.h" +#include "modules/protocol/ratbox.h" + +namespace charybdis +{ + +namespace senders +{ + +class NickIntroduction : public messages::NickIntroduction +{ + public: + using messages::NickIntroduction::NickIntroduction; + + void Send(User *user) override; +}; + +class SASL : public messages::SASL +{ + public: + using messages::SASL::SASL; + + void Send(const ::SASL::Message &) override; +}; + +class SASLMechanisms : public messages::SASLMechanisms +{ + public: + using messages::SASLMechanisms::SASLMechanisms; + + void Send(const std::vector<Anope::string> &mechanisms) override; +}; + +class SVSHold : public messages::SVSHold +{ + public: + using messages::SVSHold::SVSHold; + + void Send(const Anope::string &, time_t) override; +}; + +class SVSHoldDel : public messages::SVSHoldDel +{ + public: + using messages::SVSHoldDel::SVSHoldDel; + + void Send(const Anope::string &) override; +}; + +class SVSLogin : public messages::SVSLogin +{ + public: + using messages::SVSLogin::SVSLogin; + + void Send(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) override; +}; + +class VhostDel : public messages::VhostDel +{ + public: + using messages::VhostDel::VhostDel; + + void Send(User *u) override; +}; + +class VhostSet : public messages::VhostSet +{ + public: + using messages::VhostSet::VhostSet; + + void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override; +}; + +} // namespace senders + +class Proto : public ts6::Proto +{ + ratbox::Proto ratbox; + + public: + Proto(Module *creator); + + bool IsIdentValid(const Anope::string &ident) override { return ratbox.IsIdentValid(ident); } + + void Handshake() override; +}; + +class Encap : public IRCDMessage +{ + ServiceReference<SASL::Service> sasl; + + public: + Encap(Module *creator) : IRCDMessage(creator, "ENCAP", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT);} + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class EUID : public IRCDMessage +{ + public: + EUID(Module *creator) : IRCDMessage(creator, "EUID", 11) { 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) { } + + // SERVER dev.anope.de 1 :charybdis test server + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Pass : public IRCDMessage +{ + public: + Pass(Module *creator) : IRCDMessage(creator, "PASS", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +} // namespace charybdis diff --git a/include/modules/protocol/hybrid.h b/include/modules/protocol/hybrid.h new file mode 100644 index 000000000..7843859c0 --- /dev/null +++ b/include/modules/protocol/hybrid.h @@ -0,0 +1,367 @@ +/* + * 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 + +#include "modules/protocol/rfc1459.h" +#include "modules/protocol/ts6.h" + +namespace hybrid +{ + +namespace senders +{ + +class Akill : public messages::Akill +{ + public: + using messages::Akill::Akill; + + void Send(User *, XLine *) override; +}; + +class AkillDel : public messages::AkillDel +{ + public: + using messages::AkillDel::AkillDel; + + void Send(XLine *) override; +}; + +class MessageChannel : public messages::MessageChannel +{ + public: + using messages::MessageChannel::MessageChannel; + + void Send(Channel *) override; +}; + +class GlobalNotice : public messages::GlobalNotice +{ + public: + using messages::GlobalNotice::GlobalNotice; + + void Send(const MessageSource &, Server *dest, const Anope::string &msg) override; +}; + +class GlobalPrivmsg : public messages::GlobalPrivmsg +{ + public: + using messages::GlobalPrivmsg::GlobalPrivmsg; + + void Send(const MessageSource &, Server *dest, const Anope::string &msg) override; +}; + +class Invite : public messages::Invite +{ + public: + using messages::Invite::Invite; + + void Send(const MessageSource &source, Channel *chan, User *user) override; +}; + +class Join : public messages::Join +{ + public: + using messages::Join::Join; + + void Send(User *u, Channel *c, const ChannelStatus *status) override; +}; + +class Login : public messages::Login +{ + public: + using messages::Login::Login; + + void Send(User *u, NickServ::Nick *na) override; +}; + +class Logout : public messages::Logout +{ + public: + using messages::Logout::Logout; + + void Send(User *u) override; +}; + +class ModeUser : public messages::ModeUser +{ + public: + using messages::ModeUser::ModeUser; + + void Send(const MessageSource &source, User *user, const Anope::string &modes) override; +}; + +class NickIntroduction : public messages::NickIntroduction +{ + public: + using messages::NickIntroduction::NickIntroduction; + + void Send(User *user) override; +}; + +class MessageServer : public messages::MessageServer +{ + public: + using messages::MessageServer::MessageServer; + + void Send(Server *server) override; +}; + +class SGLine : public messages::SGLine +{ + public: + using messages::SGLine::SGLine; + + void Send(User *, XLine *) override; +}; + +class SGLineDel : public messages::SGLineDel +{ + public: + using messages::SGLineDel::SGLineDel; + + void Send(XLine *) override; +}; + +class SQLine : public messages::SQLine +{ + public: + using messages::SQLine::SQLine; + + void Send(User *, XLine *) override; +}; + +class SQLineDel : public messages::SQLineDel +{ + public: + using messages::SQLineDel::SQLineDel; + + void Send(XLine *) override; +}; + +class SZLine : public messages::SZLine +{ + public: + using messages::SZLine::SZLine; + + void Send(User *, XLine *) override; +}; + +class SZLineDel : public messages::SZLineDel +{ + public: + using messages::SZLineDel::SZLineDel; + + void Send(XLine *) override; +}; + +class SVSHold : public messages::SVSHold +{ + public: + using messages::SVSHold::SVSHold; + + void Send(const Anope::string &, time_t) override; +}; + +class SVSHoldDel : public messages::SVSHoldDel +{ + public: + using messages::SVSHoldDel::SVSHoldDel; + + void Send(const Anope::string &) override; +}; + +class SVSJoin : public messages::SVSJoin +{ + public: + using messages::SVSJoin::SVSJoin; + + void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &key) override; +}; + +class SVSNick : public messages::SVSNick +{ + public: + using messages::SVSNick::SVSNick; + + void Send(User *u, const Anope::string &newnick, time_t ts) override; +}; + +class SVSPart : public messages::SVSPart +{ + public: + using messages::SVSPart::SVSPart; + + void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &reason) override; +}; + +class Topic : public messages::Topic +{ + public: + using messages::Topic::Topic; + + void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override; +}; + +class VhostDel : public messages::VhostDel +{ + public: + using messages::VhostDel::VhostDel; + + void Send(User *u) override; +}; + +class VhostSet : public messages::VhostSet +{ + public: + using messages::VhostSet::VhostSet; + + void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override; +}; + +class Wallops : public messages::Wallops +{ + public: + using messages::Wallops::Wallops; + + void Send(const MessageSource &source, const Anope::string &msg) override; +}; + +} // namespace senders + +class Proto : public ts6::Proto +{ + ServiceBot *FindIntroduced(); + + public: + Proto(Module *creator); + + void Handshake() override; + + void SendEOB() override; + + bool IsIdentValid(const Anope::string &ident) override; +}; + +class BMask : public IRCDMessage +{ + public: + BMask(Module *creator) : IRCDMessage(creator, "BMASK", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class EOB : public IRCDMessage +{ + public: + EOB(Module *craetor) : IRCDMessage(craetor, "EOB", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +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 Nick : public IRCDMessage +{ + public: + Nick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + 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) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class SID : public IRCDMessage +{ + public: + SID(Module *creator) : IRCDMessage(creator, "SID", 4) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class SJoin : public IRCDMessage +{ + public: + SJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class SVSMode : public IRCDMessage +{ + public: + SVSMode(Module *creator) : IRCDMessage(creator, "SVSMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class TBurst : public IRCDMessage +{ + public: + TBurst(Module *creator) : IRCDMessage(creator, "TBURST", 5) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class TMode : public IRCDMessage +{ + public: + TMode(Module *creator) : IRCDMessage(creator, "TMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class UID : public IRCDMessage +{ + public: + UID(Module *creator) : IRCDMessage(creator, "UID", 10) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class CertFP : public IRCDMessage +{ + public: + CertFP(Module *creator) : IRCDMessage(creator, "CERTFP", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +} // namespace hybrid diff --git a/include/modules/protocol/inspircd20.h b/include/modules/protocol/inspircd20.h new file mode 100644 index 000000000..efaec22a5 --- /dev/null +++ b/include/modules/protocol/inspircd20.h @@ -0,0 +1,506 @@ +/* + * 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 + +#include "modules/protocol/ts6.h" + +namespace inspircd20 +{ + +class Proto; + +namespace senders +{ + +class Akill : public messages::Akill +{ + Proto *proto = nullptr; + + public: + Akill(Module *creator, Proto *p) : messages::Akill(creator), + proto(p) + { + } + + void Send(User *, XLine *) override; +}; + +class AkillDel : public messages::AkillDel +{ + Proto *proto = nullptr; + + public: + AkillDel(Module *creator, Proto *p) : messages::AkillDel(creator), + proto(p) + { + } + + void Send(XLine *) override; +}; + +class MessageChannel : public messages::MessageChannel +{ + public: + using messages::MessageChannel::MessageChannel; + + void Send(Channel *) override; +}; + +class Join : public messages::Join +{ + public: + using messages::Join::Join; + + void Send(User *u, Channel *c, const ChannelStatus *status) override; +}; + +class Login : public messages::Login +{ + public: + using messages::Login::Login; + + void Send(User *u, NickServ::Nick *na) override; +}; + +class Logout : public messages::Logout +{ + public: + using messages::Logout::Logout; + + void Send(User *u) override; +}; + +class ModeChannel : public messages::ModeChannel +{ + public: + using messages::ModeChannel::ModeChannel; + + void Send(const MessageSource &source, Channel *channel, const Anope::string &modes) override; +}; + +class NickIntroduction : public messages::NickIntroduction +{ + public: + using messages::NickIntroduction::NickIntroduction; + + void Send(User *user) override; +}; + +class MessageServer : public messages::MessageServer +{ + public: + using messages::MessageServer::MessageServer; + + void Send(Server *server) override; +}; + +class SASL : public messages::SASL +{ + public: + using messages::SASL::SASL; + + void Send(const ::SASL::Message &) override; +}; + +class SASLMechanisms : public messages::SASLMechanisms +{ + public: + using messages::SASLMechanisms::SASLMechanisms; + + void Send(const std::vector<Anope::string> &mechanisms) override; +}; + +class SQLine : public messages::SQLine +{ + Proto *proto = nullptr; + + public: + SQLine(Module *creator, Proto *p) : messages::SQLine(creator), + proto(p) + { + } + + void Send(User *, XLine *) override; +}; + +class SQLineDel : public messages::SQLineDel +{ + Proto *proto = nullptr; + + public: + SQLineDel(Module *creator, Proto *p) : messages::SQLineDel(creator), + proto(p) + { + } + + void Send(XLine *) override; +}; + +class SQuit : public messages::SQuit +{ + public: + using messages::SQuit::SQuit; + + void Send(Server *s, const Anope::string &message) override; +}; + +class SZLine : public messages::SZLine +{ + Proto *proto = nullptr; + + public: + SZLine(Module *creator, Proto *p) : messages::SZLine(creator), + proto(p) + { + } + + void Send(User *, XLine *) override; +}; + +class SZLineDel : public messages::SZLineDel +{ + Proto *proto = nullptr; + + public: + SZLineDel(Module *creator, Proto *p) : messages::SZLineDel(creator), + proto(p) + { + } + + void Send(XLine *) override; +}; + +class SVSHold : public messages::SVSHold +{ + public: + using messages::SVSHold::SVSHold; + + void Send(const Anope::string &, time_t) override; +}; + +class SVSHoldDel : public messages::SVSHoldDel +{ + public: + using messages::SVSHoldDel::SVSHoldDel; + + void Send(const Anope::string &) override; +}; + +class SVSJoin : public messages::SVSJoin +{ + public: + using messages::SVSJoin::SVSJoin; + + void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &key) override; +}; + +class SVSLogin : public messages::SVSLogin +{ + public: + using messages::SVSLogin::SVSLogin; + + void Send(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) override; +}; + + +class SVSNick : public messages::SVSNick +{ + public: + using messages::SVSNick::SVSNick; + + void Send(User *u, const Anope::string &newnick, time_t ts) override; +}; + +class SVSPart : public messages::SVSPart +{ + public: + using messages::SVSPart::SVSPart; + + void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &reason) override; +}; + +class SWhois : public messages::SWhois +{ + public: + using messages::SWhois::SWhois; + + void Send(const MessageSource &, User *user, const Anope::string &) override; +}; + +class Topic : public messages::Topic +{ + public: + using messages::Topic::Topic; + + void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override; +}; + +class VhostDel : public messages::VhostDel +{ + Proto *proto = nullptr; + + public: + VhostDel(Module *creator, Proto *p) : messages::VhostDel(creator), + proto(p) + { + } + + void Send(User *u) override; +}; + +class VhostSet : public messages::VhostSet +{ + Proto *proto = nullptr; + + public: + VhostSet(Module *creator, Proto *p) : messages::VhostSet(creator), + proto(p) + { + } + + void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override; +}; + +class Wallops : public messages::Wallops +{ + public: + using messages::Wallops::Wallops; + + void Send(const MessageSource &source, const Anope::string &msg) override; +}; + +} // namespace senders + +class Proto : public ts6::Proto +{ + public: + Proto(Module *creator); + + void SendChgIdentInternal(const Anope::string &nick, const Anope::string &vIdent); + + void SendChgHostInternal(const Anope::string &nick, const Anope::string &vhost); + + void SendAddLine(const Anope::string &xtype, const Anope::string &mask, time_t duration, const Anope::string &addedby, const Anope::string &reason); + + void SendDelLine(const Anope::string &xtype, const Anope::string &mask); + + void Handshake() override; + + void SendNumeric(int numeric, User *dest, IRCMessage &message) override; + + void SendBOB() override; + + void SendEOB() override; + + bool IsExtbanValid(const Anope::string &mask) override; + + bool IsIdentValid(const Anope::string &ident) override; +}; + +class Capab : public rfc1459::Capab +{ + public: + Capab(Module *creator) : rfc1459::Capab(creator, "CAPAB") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class ChgHost : public IRCDMessage +{ + public: + ChgHost(Module *creator) : IRCDMessage(creator, "CHGHOST", 2) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class ChgIdent : public IRCDMessage +{ + public: + ChgIdent(Module *creator) : IRCDMessage(creator, "CHGIDENT", 2) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class ChgName : public IRCDMessage +{ + public: + ChgName(Module *creator) : IRCDMessage(creator, "CHGNAME", 2) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Encap : public IRCDMessage +{ + public: + Encap(Module *creator) : IRCDMessage(creator, "ENCAP", 4) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Endburst : public IRCDMessage +{ + public: + Endburst(Module *creator) : IRCDMessage(creator, "ENDBURST", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class FHost : public IRCDMessage +{ + public: + FHost(Module *creator) : IRCDMessage(creator, "FHOST", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class FIdent : public IRCDMessage +{ + public: + FIdent(Module *creator) : IRCDMessage(creator, "FIDENT", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class FJoin : public IRCDMessage +{ + public: + FJoin(Module *creator) : IRCDMessage(creator, "FJOIN", 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class FMode : public IRCDMessage +{ + public: + FMode(Module *creator) : IRCDMessage(creator, "FMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class FTopic : public IRCDMessage +{ + public: + FTopic(Module *creator) : IRCDMessage(creator, "FTOPIC", 4) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Idle : public IRCDMessage +{ + public: + Idle(Module *creator) : IRCDMessage(creator, "IDLE", 1) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Metadata : public IRCDMessage +{ + public: + const bool &do_topiclock, &do_mlock; + + Metadata(Module *creator, const bool &handle_topiclock, const bool &handle_mlock) + : IRCDMessage(creator, "METADATA", 3) + , do_topiclock(handle_topiclock) + , do_mlock(handle_mlock) + { + 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; +}; + +class Nick : public IRCDMessage +{ + public: + Nick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class OperType : public IRCDMessage +{ + public: + OperType(Module *creator) : IRCDMessage(creator, "OPERTYPE", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class RSQuit : public IRCDMessage +{ + public: + RSQuit(Module *creator) : IRCDMessage(creator, "RSQUIT", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Save : public IRCDMessage +{ + time_t last_collide = 0; + + public: + Save(Module *creator) : IRCDMessage(creator, "SAVE", 2) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class ServerMessage : public IRCDMessage +{ + public: + ServerMessage(Module *creator) : IRCDMessage(creator, "SERVER", 5) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class SQuit : public rfc1459::SQuit +{ + public: + using rfc1459::SQuit::SQuit; + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Time : public IRCDMessage +{ + public: + Time(Module *creator) : IRCDMessage(creator, "TIME", 2) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class UID : public IRCDMessage +{ + ServiceReference<SASL::Service> sasl; + + public: + UID(Module *creator) : IRCDMessage(creator, "UID", 8) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +} // namespace inspircd20 + diff --git a/include/modules/protocol/ngircd.h b/include/modules/protocol/ngircd.h new file mode 100644 index 000000000..072dfb0f6 --- /dev/null +++ b/include/modules/protocol/ngircd.h @@ -0,0 +1,213 @@ +/* + * 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 +{ + +namespace senders +{ + +class Akill : public messages::Akill +{ + public: + using messages::Akill::Akill; + + void Send(User *, XLine *) override; +}; + +class AkillDel : public messages::AkillDel +{ + public: + using messages::AkillDel::AkillDel; + + void Send(XLine *) override; +}; + +class MessageChannel : public messages::MessageChannel +{ + public: + using messages::MessageChannel::MessageChannel; + + void Send(Channel *) override; +}; + +class NickIntroduction : public messages::NickIntroduction +{ + public: + using messages::NickIntroduction::NickIntroduction; + + void Send(User *user) override; +}; + +class Login : public messages::Login +{ + public: + using messages::Login::Login; + + void Send(User *u, NickServ::Nick *na) override; +}; + +class Logout : public messages::Logout +{ + public: + using messages::Logout::Logout; + + void Send(User *u) override; +}; + +class SVSNick : public messages::SVSNick +{ + public: + using messages::SVSNick::SVSNick; + + void Send(User *u, const Anope::string &newnick, time_t ts) override; +}; + +class VhostDel : public messages::VhostDel +{ + public: + using messages::VhostDel::VhostDel; + + void Send(User *u) override; +}; + +class VhostSet : public messages::VhostSet +{ + public: + using messages::VhostSet::VhostSet; + + void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override; +}; + +} + +class Proto : public IRCDProto +{ + public: + Proto(Module *creator); + + void Handshake() override; + + Anope::string Format(IRCMessage &message) override; +}; + +class Numeric005 : public IRCDMessage +{ + public: + Numeric005(Module *creator) : IRCDMessage(creator, "005", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + 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 diff --git a/include/modules/protocol/plexus.h b/include/modules/protocol/plexus.h new file mode 100644 index 000000000..4afbc391e --- /dev/null +++ b/include/modules/protocol/plexus.h @@ -0,0 +1,139 @@ +/* + * 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 + +#include "modules/protocol/ts6.h" + +namespace plexus +{ + +namespace senders +{ + +class ModeUser : public messages::ModeUser +{ + public: + using messages::ModeUser::ModeUser; + + void Send(const MessageSource &source, User *user, const Anope::string &modes) override; +}; + +class NickIntroduction : public messages::NickIntroduction +{ + public: + using messages::NickIntroduction::NickIntroduction; + + void Send(User *user) override; +}; + +class NOOP : public messages::NOOP +{ + public: + static constexpr const char *NAME = "noop"; + + using messages::NOOP::NOOP; + + void Send(Server *s, bool mode) override; +}; + +class Topic : public messages::Topic +{ + public: + using messages::Topic::Topic; + + void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override; +}; + +class SVSJoin : public messages::SVSJoin +{ + public: + using messages::SVSJoin::SVSJoin; + + void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &key) override; +}; + +class SVSNick : public messages::SVSNick +{ + public: + using messages::SVSNick::SVSNick; + + void Send(User *u, const Anope::string &newnick, time_t ts) override; +}; + +class SVSPart : public messages::SVSPart +{ + public: + using messages::SVSPart::SVSPart; + + void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &reason) override; +}; + +class VhostDel : public messages::VhostDel +{ + public: + using messages::VhostDel::VhostDel; + + void Send(User *u) override; +}; + +class VhostSet : public messages::VhostSet +{ + public: + using messages::VhostSet::VhostSet; + + void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override; +}; + +} // namespace senders + +class Proto : public ts6::Proto +{ + public: + Proto(Module *creator); + + void Handshake() override; +}; + +class Encap : public IRCDMessage +{ + public: + Encap(Module *creator) : IRCDMessage(creator, "ENCAP", 4) { 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) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class UID : public IRCDMessage +{ + public: + UID(Module *creator) : IRCDMessage(creator, "UID", 11) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + 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 new file mode 100644 index 000000000..475b368cc --- /dev/null +++ b/include/modules/protocol/ratbox.h @@ -0,0 +1,152 @@ +/* + * 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 + +#include "modules/protocol/rfc1459.h" +#include "modules/protocol/ts6.h" + +namespace ratbox +{ + +namespace senders +{ + +class Login : public messages::Login +{ + public: + using messages::Login::Login; + + void Send(User *u, NickServ::Nick *na) override; +}; + +class Logout : public messages::Logout +{ + public: + using messages::Logout::Logout; + + void Send(User *u) override; +}; + +class NickIntroduction : public messages::NickIntroduction +{ + public: + using messages::NickIntroduction::NickIntroduction; + + void Send(User *user) override; +}; + +class SQLine : public messages::SQLine +{ + public: + using messages::SQLine::SQLine; + + void Send(User *, XLine *) override; +}; + +class SQLineDel : public messages::SQLineDel +{ + public: + using messages::SQLineDel::SQLineDel; + + void Send(XLine *) override; +}; + +class SVSNick : public messages::SVSNick +{ + public: + using messages::SVSNick::SVSNick; + + void Send(User *u, const Anope::string &newnick, time_t ts) override; +}; + +class Topic : public rfc1459::senders::Topic +{ + public: + using rfc1459::senders::Topic::Topic; + + void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override; +}; + +class Wallops : public messages::Wallops +{ + public: + using messages::Wallops::Wallops; + + void Send(const MessageSource &source, const Anope::string &msg) override; +}; + +} // senders + +class Proto : public ts6::Proto +{ + hybrid::Proto hybrid; + + ServiceBot *FindIntroduced(); + + public: + Proto(Module *creator); + + bool IsIdentValid(const Anope::string &ident) override { return hybrid.IsIdentValid(ident); } + + void Handshake() override; +}; + +class Encap : public IRCDMessage +{ + public: + Encap(Module *creator) : IRCDMessage(creator, "ENCAP", 3) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + // Debug: Received: :00BAAAAAB ENCAP * LOGIN Adam + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +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 ServerMessage : public IRCDMessage +{ + public: + ServerMessage(Module *creator) : IRCDMessage(creator, "SERVER", 3) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class TB : public IRCDMessage +{ + public: + TB(Module *creator) : IRCDMessage(creator, "TB", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class UID : public IRCDMessage +{ + public: + UID(Module *creator) : IRCDMessage(creator, "UID", 9) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +} // namespace ratbox diff --git a/include/modules/protocol/rfc1459.h b/include/modules/protocol/rfc1459.h new file mode 100644 index 000000000..54c4bada5 --- /dev/null +++ b/include/modules/protocol/rfc1459.h @@ -0,0 +1,355 @@ +/* + * 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 +{ + +namespace senders +{ + +class GlobalNotice : public messages::GlobalNotice +{ + public: + using messages::GlobalNotice::GlobalNotice; + + void Send(const MessageSource &, Server *dest, const Anope::string &msg) override; +}; + +class GlobalPrivmsg : public messages::GlobalPrivmsg +{ + public: + using messages::GlobalPrivmsg::GlobalPrivmsg; + + void Send(const MessageSource &, Server *dest, const Anope::string &msg) override; +}; + +class Invite : public messages::Invite +{ + public: + using messages::Invite::Invite; + + void Send(const MessageSource &source, Channel *chan, User *user) override; +}; + +class Join : public messages::Join +{ + public: + using messages::Join::Join; + + void Send(User *u, Channel *c, const ChannelStatus *status) override; +}; + +class Kick : public messages::Kick +{ + public: + using messages::Kick::Kick; + + void Send(const MessageSource &source, Channel *chan, User *user, const Anope::string &reason) override; +}; + +class Kill : public messages::Kill +{ + public: + using messages::Kill::Kill; + + void Send(const MessageSource &source, const Anope::string &target, const Anope::string &reason) override; + + void Send(const MessageSource &source, User *user, const Anope::string &reason) override; +}; + +class ModeChannel : public messages::ModeChannel +{ + public: + using messages::ModeChannel::ModeChannel; + + void Send(const MessageSource &source, Channel *channel, const Anope::string &modes) override; +}; + +class ModeUser : public messages::ModeUser +{ + public: + using messages::ModeUser::ModeUser; + + void Send(const MessageSource &source, User *user, const Anope::string &modes) override; +}; + +class NickChange : public messages::NickChange +{ + public: + using messages::NickChange::NickChange; + + void Send(User *u, const Anope::string &newnick, time_t ts) override; +}; + +class Notice : public messages::Notice +{ + public: + using messages::Notice::Notice; + + void Send(const MessageSource &source, const Anope::string &dest, const Anope::string &msg) override; +}; + +class Part : public messages::Part +{ + public: + using messages::Part::Part; + + void Send(User *, Channel *chan, const Anope::string &reason) override; +}; + +class Ping : public messages::Ping +{ + public: + using messages::Ping::Ping; + + void Send(const Anope::string &servname, const Anope::string &who) override; +}; + +class Pong : public messages::Pong +{ + public: + using messages::Pong::Pong; + + void Send(const Anope::string &servname, const Anope::string &who) override; +}; + +class Privmsg : public messages::Privmsg +{ + public: + using messages::Privmsg::Privmsg; + + void Send(const MessageSource &source, const Anope::string &dest, const Anope::string &msg) override; +}; + +class Quit : public messages::Quit +{ + public: + using messages::Quit::Quit; + + void Send(User *user, const Anope::string &reason) override; +}; + +class MessageServer : public messages::MessageServer +{ + public: + using messages::MessageServer::MessageServer; + + void Send(Server *server) override; +}; + +class SQuit : public messages::SQuit +{ + public: + using messages::SQuit::SQuit; + + void Send(Server *s, const Anope::string &message) override; +}; + +class Topic : public messages::Topic +{ + public: + using messages::Topic::Topic; + + void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override; +}; + +class Wallops : public messages::Wallops +{ + public: + using messages::Wallops::Wallops; + + void Send(const MessageSource &, const Anope::string &msg) override; +}; + +} // namespace senders + +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); SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + 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); SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + 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); SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +} // namespace rfc1459 diff --git a/include/modules/protocol/ts6.h b/include/modules/protocol/ts6.h new file mode 100644 index 000000000..71748b5b7 --- /dev/null +++ b/include/modules/protocol/ts6.h @@ -0,0 +1,37 @@ +/* + * 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 ts6 +{ + +class Proto : public IRCDProto +{ + public: + Proto(Module *creator, const Anope::string &proto_name) : IRCDProto(creator, proto_name) + { + } + + /* Retrieves the next free UID or SID */ + Anope::string UID_Retrieve() override; + Anope::string SID_Retrieve() override; +}; + +} // namespace ts6 diff --git a/include/modules/protocol/unreal.h b/include/modules/protocol/unreal.h new file mode 100644 index 000000000..9039cc2cd --- /dev/null +++ b/include/modules/protocol/unreal.h @@ -0,0 +1,422 @@ +/* + * Anope IRC Services + * + * Copyright (C) 2003-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 unreal +{ + +namespace senders +{ + +class Akill : public messages::Akill +{ + public: + using messages::Akill::Akill; + + void Send(User *, XLine *) override; +}; + +class AkillDel : public messages::AkillDel +{ + public: + using messages::AkillDel::AkillDel; + + void Send(XLine *) override; +}; + +class MessageChannel : public messages::MessageChannel +{ + public: + using messages::MessageChannel::MessageChannel; + + void Send(Channel *) override; +}; + +class Join : public messages::Join +{ + public: + using messages::Join::Join; + + void Send(User *u, Channel *c, const ChannelStatus *status) override; +}; + +class Login : public messages::Login +{ + public: + using messages::Login::Login; + + void Send(User *u, NickServ::Nick *na) override; +}; + +class Logout : public messages::Logout +{ + public: + using messages::Logout::Logout; + + void Send(User *u) override; +}; + +class Kill : public messages::Kill +{ + public: + using messages::Kill::Kill; + + void Send(const MessageSource &source, const Anope::string &target, const Anope::string &reason) override; + + void Send(const MessageSource &source, User *user, const Anope::string &reason) override; +}; + +class ModeUser : public messages::ModeUser +{ + public: + using messages::ModeUser::ModeUser; + + void Send(const MessageSource &source, User *user, const Anope::string &modes) override; +}; + +class NickIntroduction : public messages::NickIntroduction +{ + public: + using messages::NickIntroduction::NickIntroduction; + + void Send(User *user) override; +}; + +class SASL : public messages::SASL +{ + public: + using messages::SASL::SASL; + + void Send(const ::SASL::Message &) override; +}; + +class MessageServer : public messages::MessageServer +{ + public: + using messages::MessageServer::MessageServer; + + void Send(Server *server) override; +}; + +class SGLine : public messages::SGLine +{ + public: + using messages::SGLine::SGLine; + + void Send(User *, XLine *) override; +}; + +class SGLineDel : public messages::SGLineDel +{ + public: + using messages::SGLineDel::SGLineDel; + + void Send(XLine *) override; +}; + +class SQLine : public messages::SQLine +{ + public: + using messages::SQLine::SQLine; + + void Send(User *, XLine *) override; +}; + +class SQLineDel : public messages::SQLineDel +{ + public: + using messages::SQLineDel::SQLineDel; + + void Send(XLine *) override; +}; + +class SZLine : public messages::SZLine +{ + public: + using messages::SZLine::SZLine; + + void Send(User *, XLine *) override; +}; + +class SZLineDel : public messages::SZLineDel +{ + public: + using messages::SZLineDel::SZLineDel; + + void Send(XLine *) override; +}; + +class SVSHold : public messages::SVSHold +{ + public: + using messages::SVSHold::SVSHold; + + void Send(const Anope::string &, time_t) override; +}; + +class SVSHoldDel : public messages::SVSHoldDel +{ + public: + using messages::SVSHoldDel::SVSHoldDel; + + void Send(const Anope::string &) override; +}; + +class SVSJoin : public messages::SVSJoin +{ + public: + using messages::SVSJoin::SVSJoin; + + void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &key) override; +}; + +class SVSLogin : public messages::SVSLogin +{ + public: + using messages::SVSLogin::SVSLogin; + + void Send(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) override; +}; + +class SVSPart : public messages::SVSPart +{ + public: + using messages::SVSPart::SVSPart; + + void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &reason) override; +}; + +class SWhois : public messages::SWhois +{ + public: + using messages::SWhois::SWhois; + + void Send(const MessageSource &, User *user, const Anope::string &) override; +}; + +class Topic : public messages::Topic +{ + public: + using messages::Topic::Topic; + + void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override; +}; + +class VhostDel : public messages::VhostDel +{ + public: + using messages::VhostDel::VhostDel; + + void Send(User *u) override; +}; + +class VhostSet : public messages::VhostSet +{ + public: + using messages::VhostSet::VhostSet; + + void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override; +}; + +} // namespace senders + +class Proto : public IRCDProto +{ + public: + Proto(Module *creator); + + private: + + void Handshake() override; + + void SendEOB() override; + + bool IsNickValid(const Anope::string &nick) override; + + bool IsChannelValid(const Anope::string &chan) override; + + bool IsExtbanValid(const Anope::string &mask) override; + + bool IsIdentValid(const Anope::string &ident) override; +}; + +class ChgHost : public IRCDMessage +{ + public: + ChgHost(Module *creator) : IRCDMessage(creator, "CHGHOST", 2) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class ChgIdent : public IRCDMessage +{ + public: + ChgIdent(Module *creator) : IRCDMessage(creator, "CHGIDENT", 2) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class ChgName : public IRCDMessage +{ + public: + ChgName(Module *creator) : IRCDMessage(creator, "CHGNAME", 2) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class MD : public IRCDMessage +{ + public: + MD(Module *creator) : IRCDMessage(creator, "MD", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Mode : public IRCDMessage +{ + public: + Mode(Module *creator, const Anope::string &mname) : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class NetInfo : public IRCDMessage +{ + public: + NetInfo(Module *creator) : IRCDMessage(creator, "NETINFO", 8) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Nick : public IRCDMessage +{ + public: + Nick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + 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 Protoctl : public rfc1459::Capab +{ + public: + Protoctl(Module *creator) : rfc1459::Capab(creator, "PROTOCTL") { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class SASL : public IRCDMessage +{ + ServiceReference<::SASL::Service> sasl; + + public: + SASL(Module *creator) : IRCDMessage(creator, "SASL", 4) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class SDesc : public IRCDMessage +{ + public: + SDesc(Module *creator) : IRCDMessage(creator, "SDESC", 1) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class SetHost : public IRCDMessage +{ + public: + SetHost(Module *creator) : IRCDMessage(creator, "SETHOST", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class SetIdent : public IRCDMessage +{ + public: + SetIdent(Module *creator) : IRCDMessage(creator, "SETIDENT", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +struct SetName : IRCDMessage +{ + public: + SetName(Module *creator) : IRCDMessage(creator, "SETNAME", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class ServerMessage : public IRCDMessage +{ + public: + ServerMessage(Module *creator) : IRCDMessage(creator, "SERVER", 3) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class SID : public IRCDMessage +{ + public: + SID(Module *creator) : IRCDMessage(creator, "SID", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class SJoin : public IRCDMessage +{ + public: + SJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Topic : public IRCDMessage +{ + public: + Topic(Module *creator) : IRCDMessage(creator, "TOPIC", 4) { } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class UID : public IRCDMessage +{ + public: + UID(Module *creator) : IRCDMessage(creator, "UID", 12) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class Umode2 : public IRCDMessage +{ + public: + Umode2(Module *creator) : IRCDMessage(creator, "UMODE2", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +} // namespace unreal |