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 | |
parent | d95bc84eda5c131374b7097f9de7f59418bd9b6a (diff) |
Split more protocol module message handler declarations into module headers
-rw-r--r-- | include/modules/protocol/bahamut.h | 73 | ||||
-rw-r--r-- | include/modules/protocol/charybdis.h | 4 | ||||
-rw-r--r-- | include/modules/protocol/hybrid.h | 4 | ||||
-rw-r--r-- | include/modules/protocol/inspircd20.h | 214 | ||||
-rw-r--r-- | include/modules/protocol/ngircd.h | 127 | ||||
-rw-r--r-- | include/modules/protocol/plexus.h | 4 | ||||
-rw-r--r-- | include/modules/protocol/ratbox.h | 4 | ||||
-rw-r--r-- | include/modules/protocol/unreal.h | 187 | ||||
-rw-r--r-- | modules/protocol/bahamut.cpp | 249 | ||||
-rw-r--r-- | modules/protocol/charybdis.cpp | 16 | ||||
-rw-r--r-- | modules/protocol/hybrid.cpp | 70 | ||||
-rw-r--r-- | modules/protocol/inspircd20.cpp | 1094 | ||||
-rw-r--r-- | modules/protocol/ngircd.cpp | 655 | ||||
-rw-r--r-- | modules/protocol/plexus.cpp | 6 | ||||
-rw-r--r-- | modules/protocol/ratbox.cpp | 25 | ||||
-rw-r--r-- | modules/protocol/rfc1459.cpp | 7 | ||||
-rw-r--r-- | modules/protocol/unreal.cpp | 787 |
17 files changed, 1974 insertions, 1552 deletions
diff --git a/include/modules/protocol/bahamut.h b/include/modules/protocol/bahamut.h new file mode 100644 index 000000000..634360f99 --- /dev/null +++ b/include/modules/protocol/bahamut.h @@ -0,0 +1,73 @@ +/* + * 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 +{ + +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
\ No newline at end of file diff --git a/include/modules/protocol/charybdis.h b/include/modules/protocol/charybdis.h index 36de05544..4d525c49d 100644 --- a/include/modules/protocol/charybdis.h +++ b/include/modules/protocol/charybdis.h @@ -40,10 +40,10 @@ class EUID : public IRCDMessage void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; }; -class Server : public IRCDMessage +class ServerMessage : public IRCDMessage { public: - Server(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + ServerMessage(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } // SERVER dev.anope.de 1 :charybdis test server void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; diff --git a/include/modules/protocol/hybrid.h b/include/modules/protocol/hybrid.h index 76c84f33c..9c1444f4d 100644 --- a/include/modules/protocol/hybrid.h +++ b/include/modules/protocol/hybrid.h @@ -64,10 +64,10 @@ class Pong : public IRCDMessage void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; }; -class Server : public IRCDMessage +class ServerMessage : public IRCDMessage { public: - Server(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + ServerMessage(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; }; diff --git a/include/modules/protocol/inspircd20.h b/include/modules/protocol/inspircd20.h new file mode 100644 index 000000000..d65b174f9 --- /dev/null +++ b/include/modules/protocol/inspircd20.h @@ -0,0 +1,214 @@ +/* + * 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 inspircd20 +{ + +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) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; +}; + +class SQuit : public rfc1459::SQuit +{ + public: + SQuit(Module *creator) : rfc1459::SQuit(creator) { } + + 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..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 diff --git a/include/modules/protocol/plexus.h b/include/modules/protocol/plexus.h index d17725be4..b87f3e6c7 100644 --- a/include/modules/protocol/plexus.h +++ b/include/modules/protocol/plexus.h @@ -30,10 +30,10 @@ class Encap : public IRCDMessage void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; }; -class Server : public IRCDMessage +class ServerMessage : public IRCDMessage { public: - Server(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + ServerMessage(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; }; diff --git a/include/modules/protocol/ratbox.h b/include/modules/protocol/ratbox.h index e03846142..32710fbea 100644 --- a/include/modules/protocol/ratbox.h +++ b/include/modules/protocol/ratbox.h @@ -41,10 +41,10 @@ class Join : public rfc1459::Join void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; }; -class Server : public IRCDMessage +class ServerMessage : public IRCDMessage { public: - Server(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + ServerMessage(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override; }; diff --git a/include/modules/protocol/unreal.h b/include/modules/protocol/unreal.h new file mode 100644 index 000000000..305d52bd0 --- /dev/null +++ b/include/modules/protocol/unreal.h @@ -0,0 +1,187 @@ +/* + * 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 +{ + +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) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + + 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 diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index 988cfaead..8e753b443 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -21,6 +21,7 @@ #include "module.h" #include "modules/protocol/rfc1459.h" +#include "modules/protocol/bahamut.h" class ChannelModeFlood : public ChannelModeParam { @@ -317,56 +318,39 @@ class BahamutIRCdProto : public IRCDProto } }; -struct IRCDMessageBurst : IRCDMessage +void bahamut::Burst::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageBurst(Module *creator) : IRCDMessage(creator, "BURST", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + Server *s = source.GetServer(); + s->Sync(true); +} - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - /* If we found a server with the given source, that one just - * finished bursting. If there was no source, then our uplink - * server finished bursting. -GD - */ - Server *s = source.GetServer(); - if (!s) - s = Me->GetLinks().front(); - if (s) - s->Sync(true); - } -}; - -struct IRCDMessageMode : IRCDMessage +void bahamut::Mode::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageMode(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 + if (params.size() > 2 && IRCD->IsChannelValid(params[0])) { - if (params.size() > 2 && IRCD->IsChannelValid(params[0])) - { - Channel *c = Channel::Find(params[0]); - time_t ts = 0; - - try - { - ts = convertTo<time_t>(params[1]); - } - catch (const ConvertException &) { } - - Anope::string modes = params[2]; - for (unsigned int i = 3; i < params.size(); ++i) - modes += " " + params[i]; + Channel *c = Channel::Find(params[0]); + time_t ts = 0; - if (c) - c->SetModesInternal(source, modes, ts); - } - else + try { - User *u = User::Find(params[0]); - if (u) - u->SetModesInternal(source, "%s", params[1].c_str()); + ts = convertTo<time_t>(params[1]); } + catch (const ConvertException &) { } + + Anope::string modes = params[2]; + for (unsigned int i = 3; i < params.size(); ++i) + modes += " " + params[i]; + + if (c) + c->SetModesInternal(source, modes, ts); } -}; + else + { + User *u = User::Find(params[0]); + if (u) + u->SetModesInternal(source, "%s", params[1].c_str()); + } +} /* ** NICK - new @@ -386,117 +370,128 @@ struct IRCDMessageMode : IRCDMessage ** parv[0] = new nickname ** parv[1] = hopcount */ -struct IRCDMessageNick : IRCDMessage +void bahamut::Nick::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + if (params.size() == 10) { - if (params.size() == 10) + Server *s = Server::Find(params[6]); + if (s == nullptr) { - Server *s = Server::Find(params[6]); - if (s == NULL) - { - Log(LOG_DEBUG) << "User " << params[0] << " introduced from non-existent server " << params[6] << "?"; - return; - } + Log(LOG_DEBUG) << "User " << params[0] << " introduced from non-existent server " << params[6] << "?"; + return; + } - NickServ::Nick *na = NULL; - time_t signon = params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, - stamp = params[7].is_pos_number_only() ? convertTo<time_t>(params[7]) : 0; - if (signon && signon == stamp && NickServ::service) - na = NickServ::service->FindNick(params[0]); + NickServ::Nick *na = nullptr; + time_t signon = 0, stamp = 0; - User::OnIntroduce(params[0], params[4], params[5], "", params[8], s, params[9], signon, params[3], "", na ? na->GetAccount() : NULL); + try + { + signon = convertTo<time_t>(params[2]); + stamp = convertTo<time_t>(params[7]); } - else + catch (const ConvertException &) { - User *u = source.GetUser(); - - if (u) - u->ChangeNick(params[0]); } + + if (signon && signon == stamp && NickServ::service) + na = NickServ::service->FindNick(params[0]); + + User::OnIntroduce(params[0], params[4], params[5], "", params[8], s, params[9], signon, params[3], "", na ? na->GetAccount() : nullptr); } -}; + else + { + User *u = source.GetUser(); -struct IRCDMessageServer : IRCDMessage + if (u) + u->ChangeNick(params[0]); + } +} + +void bahamut::ServerMessage::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + unsigned int hops = 0; - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + try { - unsigned int hops = Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0; - new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, params[2]); + hops = convertTo<unsigned>(params[1]); } -}; + catch (const ConvertException &) { } + + new Server(source.GetServer(), params[0], hops, params[2]); +} -struct IRCDMessageSJoin : IRCDMessage +void bahamut::SJoin::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageSJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + Anope::string modes; + if (params.size() >= 4) + for (unsigned i = 2; i < params.size(); ++i) + modes += " " + params[i]; + if (!modes.empty()) + modes.erase(modes.begin()); - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - Anope::string modes; - if (params.size() >= 4) - for (unsigned i = 2; i < params.size(); ++i) - modes += " " + params[i]; - if (!modes.empty()) - modes.erase(modes.begin()); + std::list<rfc1459::Join::SJoinUser> users; - std::list<rfc1459::Join::SJoinUser> users; + /* For some reason, bahamut will send a SJOIN from the user joining a channel + * if the channel already existed + */ + if (source.GetUser()) + { + rfc1459::Join::SJoinUser sju; + sju.second = source.GetUser(); + users.push_back(sju); + } + else + { + spacesepstream sep(params[params.size() - 1]); + Anope::string buf; - /* For some reason, bahamut will send a SJOIN from the user joining a channel - * if the channel already existed - */ - if (source.GetUser()) + while (sep.GetToken(buf)) { rfc1459::Join::SJoinUser sju; - sju.second = source.GetUser(); - users.push_back(sju); - } - else - { - spacesepstream sep(params[params.size() - 1]); - Anope::string buf; - while (sep.GetToken(buf)) + /* Get prefixes from the nick */ + for (char ch; !buf.empty() && (ch = ModeManager::GetStatusChar(buf[0]));) + { + buf.erase(buf.begin()); + sju.first.AddMode(ch); + } + + sju.second = User::Find(buf); + if (!sju.second) { - rfc1459::Join::SJoinUser sju; - - /* Get prefixes from the nick */ - for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));) - { - buf.erase(buf.begin()); - sju.first.AddMode(ch); - } - - sju.second = User::Find(buf); - if (!sju.second) - { - Log(LOG_DEBUG) << "SJOIN for non-existent user " << buf << " on " << params[1]; - continue; - } - - users.push_back(sju); + Log(LOG_DEBUG) << "SJOIN for non-existent user " << buf << " on " << params[1]; + continue; } + + users.push_back(sju); } + } + + time_t ts = Anope::CurTime; - time_t ts = Anope::string(params[0]).is_pos_number_only() ? convertTo<time_t>(params[0]) : Anope::CurTime; - rfc1459::Join::SJoin(source, params[1], ts, modes, users); + try + { + ts = convertTo<time_t>(params[0]); } -}; + catch (const ConvertException &) { } -struct IRCDMessageTopic : IRCDMessage + rfc1459::Join::SJoin(source, params[1], ts, modes, users); +} + +void bahamut::Topic::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageTopic(Module *creator) : IRCDMessage(creator, "TOPIC", 4) { } + Channel *c = Channel::Find(params[0]); + time_t ts = Anope::CurTime; - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + try { - Channel *c = Channel::Find(params[0]); - if (c) - c->ChangeTopicInternal(source.GetUser(), params[1], params[3], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime); + ts = convertTo<time_t>(params[2]); } -}; + catch (const ConvertException &) { } + + if (c) + c->ChangeTopicInternal(source.GetUser(), params[1], params[3], ts); +} class ProtoBahamut : public Module , public EventHook<Event::UserNickChange> @@ -524,12 +519,12 @@ class ProtoBahamut : public Module rfc1459::Whois message_whois; /* Our message handlers */ - IRCDMessageBurst message_burst; - IRCDMessageMode message_mode, message_svsmode; - IRCDMessageNick message_nick; - IRCDMessageServer message_server; - IRCDMessageSJoin message_sjoin; - IRCDMessageTopic message_topic; + bahamut::Burst message_burst; + bahamut::Mode message_mode, message_svsmode; + bahamut::Nick message_nick; + bahamut::ServerMessage message_server; + bahamut::SJoin message_sjoin; + bahamut::Topic message_topic; public: ProtoBahamut(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR) diff --git a/modules/protocol/charybdis.cpp b/modules/protocol/charybdis.cpp index b13dc99fc..5cc9f4c62 100644 --- a/modules/protocol/charybdis.cpp +++ b/modules/protocol/charybdis.cpp @@ -233,17 +233,25 @@ void charybdis::EUID::Run(MessageSource &source, const std::vector<Anope::string if (params[9] != "*") na = NickServ::FindNick(params[9]); - User::OnIntroduce(params[0], params[4], (params[8] != "*" ? params[8] : params[5]), params[5], params[6], source.GetServer(), params[10], params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime, params[3], params[7], na ? na->GetAccount() : NULL); + time_t ts = Anope::CurTime; + + try + { + ts = convertTo<time_t>(params[2]); + } + catch (const ConvertException &) { } + + User::OnIntroduce(params[0], params[4], (params[8] != "*" ? params[8] : params[5]), params[5], params[6], source.GetServer(), params[10], ts, params[3], params[7], na ? na->GetAccount() : NULL); } // we can't use this function from ratbox because we set a local variable here // SERVER dev.anope.de 1 :charybdis test server -void charybdis::Server::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void charybdis::ServerMessage::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { // Servers other then our immediate uplink are introduced via SID if (params[1] != "1") return; - new ::Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], 1, params[2], UplinkSID); + new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], 1, params[2], UplinkSID); IRCD->SendPing(Me->GetName(), params[0]); } @@ -291,7 +299,7 @@ class ProtoCharybdis : public Module hybrid::Nick message_nick; charybdis::Pass message_pass; hybrid::Pong message_pong; - charybdis::Server message_server; + charybdis::ServerMessage message_server; hybrid::SID message_sid; hybrid::SJoin message_sjoin; ratbox::TB message_tb; diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp index 638a4037a..c28c9ebf5 100644 --- a/modules/protocol/hybrid.cpp +++ b/modules/protocol/hybrid.cpp @@ -375,7 +375,15 @@ void hybrid::Join::Run(MessageSource &source, const std::vector<Anope::string> & /* :0MCAAAAAB NICK newnick 1350157102 */ void hybrid::Nick::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - source.GetUser()->ChangeNick(params[0], convertTo<time_t>(params[1])); + time_t ts = Anope::CurTime; + + try + { + ts = convertTo<time_t>(params[1]); + } + catch (const ConvertException &) { } + + source.GetUser()->ChangeNick(params[0], ts); } struct IRCDMessagePass : IRCDMessage @@ -397,21 +405,28 @@ void hybrid::Pong::Run(MessageSource &source, const std::vector<Anope::string> & /* 0 1 2 */ /* SERVER hades.arpa 1 :ircd-hybrid test server */ -void hybrid::Server::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void hybrid::ServerMessage::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { /* Servers other than our immediate uplink are introduced via SID */ if (params[1] != "1") return; - new ::Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], 1, params[2], UplinkSID); + new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], 1, params[2], UplinkSID); IRCD->SendPing(Me->GetName(), params[0]); } void hybrid::SID::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - unsigned int hops = params[1].is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0; - new ::Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, params[3], params[2]); + unsigned int hops = 0; + + try + { + hops = convertTo<unsigned int>(params[1]); + } + catch (const ConvertException &) { } + + new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, params[3], params[2]); IRCD->SendPing(Me->GetName(), params[0]); } @@ -435,7 +450,7 @@ void hybrid::SJoin::Run(MessageSource &source, const std::vector<Anope::string> rfc1459::Join::SJoinUser sju; /* Get prefixes from the nick */ - for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));) + for (char ch; !buf.empty() && (ch = ModeManager::GetStatusChar(buf[0]));) { buf.erase(buf.begin()); sju.first.AddMode(ch); @@ -451,7 +466,14 @@ void hybrid::SJoin::Run(MessageSource &source, const std::vector<Anope::string> users.push_back(sju); } - time_t ts = Anope::string(params[0]).is_pos_number_only() ? convertTo<time_t>(params[0]) : Anope::CurTime; + time_t ts = Anope::CurTime; + + try + { + ts = convertTo<time_t>(params[0]); + } + catch (const ConvertException &) { } + rfc1459::Join::SJoin(source, params[1], ts, modes, users); } @@ -467,7 +489,18 @@ void hybrid::SVSMode::Run(MessageSource &source, const std::vector<Anope::string if (!u) return; - if (!params[1].is_pos_number_only() || convertTo<time_t>(params[1]) != u->timestamp) + time_t ts; + + try + { + ts = convertTo<time_t>(params[1]); + } + catch (const ConvertException &) + { + return; + } + + if (ts != u->timestamp) return; u->SetModesInternal(source, "%s", params[2].c_str()); @@ -477,9 +510,16 @@ void hybrid::TBurst::Run(MessageSource &source, const std::vector<Anope::string> { Anope::string setter; sepstream(params[3], '!').GetToken(setter, 0); - time_t topic_time = Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime; Channel *c = Channel::Find(params[1]); + time_t topic_time = Anope::CurTime; + + try + { + topic_time = convertTo<time_t>(params[2]); + } + catch (const ConvertException &ex) { } + if (c) c->ChangeTopicInternal(NULL, setter, params[4], topic_time); } @@ -517,10 +557,18 @@ void hybrid::UID::Run(MessageSource &source, const std::vector<Anope::string> &p if (params[8] != "0" && params[8] != "*") na = NickServ::FindNick(params[8]); + time_t ts = 0; + + try + { + ts = convertTo<time_t>(params[2]); + } + catch (const ConvertException &) { } + /* Source is always the server */ User::OnIntroduce(params[0], params[4], params[5], "", ip, source.GetServer(), - params[9], params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, + params[9], ts, params[3], params[7], na ? na->GetAccount() : NULL); } @@ -568,7 +616,7 @@ class ProtoHybrid : public Module hybrid::Nick message_nick; IRCDMessagePass message_pass; hybrid::Pong message_pong; - hybrid::Server message_server; + hybrid::ServerMessage message_server; hybrid::SID message_sid; hybrid::SJoin message_sjoin; hybrid::SVSMode message_svsmode; diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index c2c09c95d..0f5469cea 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -24,6 +24,7 @@ #include "modules/chanserv/mode.h" #include "modules/chanserv/set.h" #include "modules/protocol/rfc1459.h" +#include "modules/protocol/inspircd20.h" struct SASLUser { @@ -631,380 +632,328 @@ namespace InspIRCdExtban }; } -struct IRCDMessageCapab : rfc1459::Capab +void inspircd20::Capab::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageCapab(Module *creator) : rfc1459::Capab(creator, "CAPAB") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + if (params[0].equals_cs("START")) { - if (params[0].equals_cs("START")) + if (params.size() >= 2) + spanningtree_proto_ver = (Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0); + + if (spanningtree_proto_ver < 1202) { - if (params.size() >= 2) - spanningtree_proto_ver = (Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0); + Uplink::Send("ERROR", "Protocol mismatch, no or invalid protocol version given in CAPAB START"); + Anope::QuitReason = "Protocol mismatch, no or invalid protocol version given in CAPAB START"; + Anope::Quitting = true; + return; + } - if (spanningtree_proto_ver < 1202) - { - Uplink::Send("ERROR", "Protocol mismatch, no or invalid protocol version given in CAPAB START"); - Anope::QuitReason = "Protocol mismatch, no or invalid protocol version given in CAPAB START"; - Anope::Quitting = true; - return; - } + /* reset CAPAB */ + Servers::Capab.insert("SERVERS"); + Servers::Capab.insert("CHGHOST"); + Servers::Capab.insert("CHGIDENT"); + Servers::Capab.insert("TOPICLOCK"); + IRCD->CanSVSHold = false; + } + else if (params[0].equals_cs("CHANMODES") && params.size() > 1) + { + spacesepstream ssep(params[1]); + Anope::string capab; - /* reset CAPAB */ - Servers::Capab.insert("SERVERS"); - Servers::Capab.insert("CHGHOST"); - Servers::Capab.insert("CHGIDENT"); - Servers::Capab.insert("TOPICLOCK"); - IRCD->CanSVSHold = false; - } - else if (params[0].equals_cs("CHANMODES") && params.size() > 1) + while (ssep.GetToken(capab)) { - spacesepstream ssep(params[1]); - Anope::string capab; + if (capab.find('=') == Anope::string::npos) + continue; + + Anope::string modename = capab.substr(0, capab.find('=')); + Anope::string modechar = capab.substr(capab.find('=') + 1); + char symbol = 0; + + if (modechar.empty()) + continue; - while (ssep.GetToken(capab)) + if (modechar.length() == 2) { - if (capab.find('=') == Anope::string::npos) - continue; - - Anope::string modename = capab.substr(0, capab.find('=')); - Anope::string modechar = capab.substr(capab.find('=') + 1); - char symbol = 0; - - if (modechar.empty()) - continue; - - if (modechar.length() == 2) - { - symbol = modechar[0]; - modechar = modechar.substr(1); - } - - ChannelMode *cm = ModeManager::FindChannelModeByChar(modechar[0]); - if (cm == nullptr) - { - Log(this->GetOwner()) << "Warning: Uplink has unknown channel mode " << modename << "=" << modechar; - continue; - } - - char modesymbol = cm->type == MODE_STATUS ? (anope_dynamic_static_cast<ChannelModeStatus *>(cm))->symbol : 0; - if (symbol != modesymbol) - { - Log(this->GetOwner()) << "Warning: Channel mode " << modename << " has a misconfigured status character"; - continue; - } + symbol = modechar[0]; + modechar = modechar.substr(1); } - } - if (params[0].equals_cs("USERMODES") && params.size() > 1) - { - spacesepstream ssep(params[1]); - Anope::string capab; - while (ssep.GetToken(capab)) + ChannelMode *cm = ModeManager::FindChannelModeByChar(modechar[0]); + if (cm == nullptr) { - if (capab.find('=') == Anope::string::npos) - continue; - - Anope::string modename = capab.substr(0, capab.find('=')); - Anope::string modechar = capab.substr(capab.find('=') + 1); - - if (modechar.empty()) - continue; - - UserMode *um = ModeManager::FindUserModeByChar(modechar[0]); - if (um == nullptr) - { - Log(this->GetOwner()) << "Warning: Uplink has unknown user mode " << modename << "=" << modechar; - continue; - } + Log(this->GetOwner()) << "Warning: Uplink has unknown channel mode " << modename << "=" << modechar; + continue; } - } - else if (params[0].equals_cs("MODULES") && params.size() > 1) - { - spacesepstream ssep(params[1]); - Anope::string module; - while (ssep.GetToken(module)) + char modesymbol = cm->type == MODE_STATUS ? (anope_dynamic_static_cast<ChannelModeStatus *>(cm))->symbol : 0; + if (symbol != modesymbol) { - if (module.equals_cs("m_svshold.so")) - IRCD->CanSVSHold = true; - else if (module.find("m_rline.so") == 0) - { - Servers::Capab.insert("RLINE"); - const Anope::string ®exengine = Config->GetBlock("options")->Get<Anope::string>("regexengine"); - if (!regexengine.empty() && module.length() > 11 && regexengine != module.substr(11)) - Log() << "Warning: InspIRCd is using regex engine " << module.substr(11) << ", but we have " << regexengine << ". This may cause inconsistencies."; - } - else if (module.equals_cs("m_topiclock.so")) - Servers::Capab.insert("TOPICLOCK"); + Log(this->GetOwner()) << "Warning: Channel mode " << modename << " has a misconfigured status character"; + continue; } } - else if (params[0].equals_cs("MODSUPPORT") && params.size() > 1) + } + if (params[0].equals_cs("USERMODES") && params.size() > 1) + { + spacesepstream ssep(params[1]); + Anope::string capab; + + while (ssep.GetToken(capab)) { - spacesepstream ssep(params[1]); - Anope::string module; + if (capab.find('=') == Anope::string::npos) + continue; - while (ssep.GetToken(module)) + Anope::string modename = capab.substr(0, capab.find('=')); + Anope::string modechar = capab.substr(capab.find('=') + 1); + + if (modechar.empty()) + continue; + + UserMode *um = ModeManager::FindUserModeByChar(modechar[0]); + if (um == nullptr) { - if (module.equals_cs("m_services_account.so")) - Servers::Capab.insert("SERVICES"); - else if (module.equals_cs("m_chghost.so")) - Servers::Capab.insert("CHGHOST"); - else if (module.equals_cs("m_chgident.so")) - Servers::Capab.insert("CHGIDENT"); + Log(this->GetOwner()) << "Warning: Uplink has unknown user mode " << modename << "=" << modechar; + continue; } } - else if (params[0].equals_cs("CAPABILITIES") && params.size() > 1) + } + else if (params[0].equals_cs("MODULES") && params.size() > 1) + { + spacesepstream ssep(params[1]); + Anope::string module; + + while (ssep.GetToken(module)) { - spacesepstream ssep(params[1]); - Anope::string capab; - while (ssep.GetToken(capab)) + if (module.equals_cs("m_svshold.so")) + IRCD->CanSVSHold = true; + else if (module.find("m_rline.so") == 0) { - if (capab.find("MAXMODES=") != Anope::string::npos) - { - Anope::string maxmodes(capab.begin() + 9, capab.end()); - IRCD->MaxModes = maxmodes.is_pos_number_only() ? convertTo<unsigned>(maxmodes) : 3; - } - else if (capab == "GLOBOPS=1") - Servers::Capab.insert("GLOBOPS"); + Servers::Capab.insert("RLINE"); + const Anope::string ®exengine = Config->GetBlock("options")->Get<Anope::string>("regexengine"); + if (!regexengine.empty() && module.length() > 11 && regexengine != module.substr(11)) + Log() << "Warning: InspIRCd is using regex engine " << module.substr(11) << ", but we have " << regexengine << ". This may cause inconsistencies."; } + else if (module.equals_cs("m_topiclock.so")) + Servers::Capab.insert("TOPICLOCK"); } - else if (params[0].equals_cs("END")) + } + else if (params[0].equals_cs("MODSUPPORT") && params.size() > 1) + { + spacesepstream ssep(params[1]); + Anope::string module; + + while (ssep.GetToken(module)) { - if (!Servers::Capab.count("SERVICES")) + if (module.equals_cs("m_services_account.so")) + Servers::Capab.insert("SERVICES"); + else if (module.equals_cs("m_chghost.so")) + Servers::Capab.insert("CHGHOST"); + else if (module.equals_cs("m_chgident.so")) + Servers::Capab.insert("CHGIDENT"); + } + } + else if (params[0].equals_cs("CAPABILITIES") && params.size() > 1) + { + spacesepstream ssep(params[1]); + Anope::string capab; + while (ssep.GetToken(capab)) + { + if (capab.find("MAXMODES=") != Anope::string::npos) { - Uplink::Send("ERROR", "m_services_account.so is not loaded. This is required by Anope"); - Anope::QuitReason = "ERROR: Remote server does not have the m_services_account module loaded, and this is required."; - Anope::Quitting = true; - return; + Anope::string maxmodes(capab.begin() + 9, capab.end()); + IRCD->MaxModes = maxmodes.is_pos_number_only() ? convertTo<unsigned>(maxmodes) : 3; } - if (!ModeManager::FindUserModeByName("PRIV")) - { - Uplink::Send("ERROR", "m_hidechans.so is not loaded. This is required by Anope"); - Anope::QuitReason = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required."; - Anope::Quitting = true; - return; - } - if (!IRCD->CanSVSHold) - Log() << "SVSHOLD missing, Usage disabled until module is loaded."; - if (!Servers::Capab.count("CHGHOST")) - Log() << "CHGHOST missing, Usage disabled until module is loaded."; - if (!Servers::Capab.count("CHGIDENT")) - Log() << "CHGIDENT missing, Usage disabled until module is loaded."; + else if (capab == "GLOBOPS=1") + Servers::Capab.insert("GLOBOPS"); } - - rfc1459::Capab::Run(source, params); } -}; - -struct IRCDMessageChgHost : IRCDMessage -{ - IRCDMessageChgHost(Module *creator) : IRCDMessage(creator, "CHGHOST", 2) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + else if (params[0].equals_cs("END")) { - User *u = User::Find(params[0]); - if (!u || u->server != Me) + if (!Servers::Capab.count("SERVICES")) + { + Uplink::Send("ERROR", "m_services_account.so is not loaded. This is required by Anope"); + Anope::QuitReason = "ERROR: Remote server does not have the m_services_account module loaded, and this is required."; + Anope::Quitting = true; return; - - u->SetDisplayedHost(params[1]); - Uplink::Send(u, "FHOST", params[1]); + } + if (!ModeManager::FindUserModeByName("PRIV")) + { + Uplink::Send("ERROR", "m_hidechans.so is not loaded. This is required by Anope"); + Anope::QuitReason = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required."; + Anope::Quitting = true; + return; + } + if (!IRCD->CanSVSHold) + Log() << "SVSHOLD missing, Usage disabled until module is loaded."; + if (!Servers::Capab.count("CHGHOST")) + Log() << "CHGHOST missing, Usage disabled until module is loaded."; + if (!Servers::Capab.count("CHGIDENT")) + Log() << "CHGIDENT missing, Usage disabled until module is loaded."; } -}; -struct IRCDMessageChgIdent : IRCDMessage -{ - IRCDMessageChgIdent(Module *creator) : IRCDMessage(creator, "CHGIDENT", 2) { } + rfc1459::Capab::Run(source, params); +} - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - User *u = User::Find(params[0]); - if (!u || u->server != Me) - return; +void inspircd20::ChgHost::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +{ + User *u = User::Find(params[0]); + if (!u || u->server != Me) + return; - u->SetIdent(params[1]); - Uplink::Send(u, "FIDENT", params[1]); - } -}; + u->SetDisplayedHost(params[1]); + Uplink::Send(u, "FHOST", params[1]); +} -struct IRCDMessageChgName : IRCDMessage +void inspircd20::ChgIdent::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageChgName(Module *creator) : IRCDMessage(creator, "CHGNAME", 2) { } + User *u = User::Find(params[0]); + if (!u || u->server != Me) + return; - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - User *u = User::Find(params[0]); - if (!u || u->server != Me) - return; - - u->SetRealname(params[1]); - Uplink::Send(u, "FNAME", params[1]); - } -}; + u->SetIdent(params[1]); + Uplink::Send(u, "FIDENT", params[1]); +} -struct IRCDMessageEncap : IRCDMessage +void inspircd20::ChgName::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 4) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + User *u = User::Find(params[0]); + if (!u || u->server != Me) + return; - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - if (Anope::Match(Me->GetSID(), params[0]) == false) - return; + u->SetRealname(params[1]); + Uplink::Send(u, "FNAME", params[1]); +} - const Anope::string &command = params[1]; - std::vector<Anope::string> encap_params(params.begin() + 2, params.end()); +void inspircd20::Encap::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +{ + if (Anope::Match(Me->GetSID(), params[0]) == false) + return; - Anope::ProcessCommand(source, command, encap_params); - } -}; + const Anope::string &command = params[1]; + std::vector<Anope::string> encap_params(params.begin() + 2, params.end()); -struct IRCDMessageEndburst : IRCDMessage -{ - IRCDMessageEndburst(Module *creator) : IRCDMessage(creator, "ENDBURST", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + Anope::ProcessCommand(source, command, encap_params); +} - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - Server *s = source.GetServer(); +void inspircd20::Endburst::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +{ + Server *s = source.GetServer(); - Log(LOG_DEBUG) << "Processed ENDBURST for " << s->GetName(); + Log(LOG_DEBUG) << "Processed ENDBURST for " << s->GetName(); - s->Sync(true); - } -}; + s->Sync(true); +} -struct IRCDMessageFHost : IRCDMessage +void inspircd20::FHost::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageFHost(Module *creator) : IRCDMessage(creator, "FHOST", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - User *u = source.GetUser(); - if (u->HasMode("CLOAK")) - u->RemoveModeInternal(source, ModeManager::FindUserModeByName("CLOAK")); - u->SetDisplayedHost(params[0]); - } -}; + User *u = source.GetUser(); + if (u->HasMode("CLOAK")) + u->RemoveModeInternal(source, ModeManager::FindUserModeByName("CLOAK")); + u->SetDisplayedHost(params[0]); +} -struct IRCDMessageFIdent : IRCDMessage +void inspircd20::FIdent::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageFIdent(Module *creator) : IRCDMessage(creator, "FIDENT", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + source.GetUser()->SetIdent(params[0]); +} - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override +void inspircd20::FJoin::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +{ + Anope::string modes; + if (params.size() >= 3) { - source.GetUser()->SetIdent(params[0]); + for (unsigned i = 2; i < params.size() - 1; ++i) + modes += " " + params[i]; + if (!modes.empty()) + modes.erase(modes.begin()); } -}; -struct IRCDMessageFJoin : IRCDMessage -{ - IRCDMessageFJoin(Module *creator) : IRCDMessage(creator, "FJOIN", 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + std::list<rfc1459::Join::SJoinUser> users; - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + spacesepstream sep(params[params.size() - 1]); + Anope::string buf; + while (sep.GetToken(buf)) { - Anope::string modes; - if (params.size() >= 3) + rfc1459::Join::SJoinUser sju; + + /* Loop through prefixes and find modes for them */ + for (char c; !buf.empty() && (c = buf[0]) != ',';) { - for (unsigned i = 2; i < params.size() - 1; ++i) - modes += " " + params[i]; - if (!modes.empty()) - modes.erase(modes.begin()); + buf.erase(buf.begin()); + sju.first.AddMode(c); } + /* Erase the , */ + if (!buf.empty()) + buf.erase(buf.begin()); - std::list<rfc1459::Join::SJoinUser> users; - - spacesepstream sep(params[params.size() - 1]); - Anope::string buf; - while (sep.GetToken(buf)) + sju.second = User::Find(buf); + if (!sju.second) { - rfc1459::Join::SJoinUser sju; - - /* Loop through prefixes and find modes for them */ - for (char c; (c = buf[0]) != ',' && c;) - { - buf.erase(buf.begin()); - sju.first.AddMode(c); - } - /* Erase the , */ - if (!buf.empty()) - buf.erase(buf.begin()); - - sju.second = User::Find(buf); - if (!sju.second) - { - Log(LOG_DEBUG) << "FJOIN for non-existent user " << buf << " on " << params[0]; - continue; - } - - users.push_back(sju); + Log(LOG_DEBUG) << "FJOIN for non-existent user " << buf << " on " << params[0]; + continue; } - time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime; - rfc1459::Join::SJoin(source, params[0], ts, modes, users); + users.push_back(sju); } -}; -struct IRCDMessageFMode : IRCDMessage -{ - IRCDMessageFMode(Module *creator) : IRCDMessage(creator, "FMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - /* :source FMODE #test 12345678 +nto foo */ + time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime; + rfc1459::Join::SJoin(source, params[0], ts, modes, users); +} - Anope::string modes = params[2]; - for (unsigned n = 3; n < params.size(); ++n) - modes += " " + params[n]; +void inspircd20::FMode::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +{ + /* :source FMODE #test 12345678 +nto foo */ - Channel *c = Channel::Find(params[0]); - time_t ts; + Anope::string modes = params[2]; + for (unsigned n = 3; n < params.size(); ++n) + modes += " " + params[n]; - try - { - ts = convertTo<time_t>(params[1]); - } - catch (const ConvertException &) - { - ts = 0; - } + Channel *c = Channel::Find(params[0]); + time_t ts; - if (c) - c->SetModesInternal(source, modes, ts); + try + { + ts = convertTo<time_t>(params[1]); + } + catch (const ConvertException &) + { + ts = 0; } -}; -struct IRCDMessageFTopic : IRCDMessage + if (c) + c->SetModesInternal(source, modes, ts); +} + +void inspircd20::FTopic::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageFTopic(Module *creator) : IRCDMessage(creator, "FTOPIC", 4) { } + /* :source FTOPIC channel topicts setby :topic */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - /* :source FTOPIC channel topicts setby :topic */ + Channel *c = Channel::Find(params[0]); + time_t ts = Anope::CurTime; - Channel *c = Channel::Find(params[0]); - if (c) - c->ChangeTopicInternal(NULL, params[2], params[3], Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime); + try + { + ts = convertTo<time_t>(params[1]); } -}; + catch (const ConvertException &) { } -struct IRCDMessageIdle : IRCDMessage -{ - IRCDMessageIdle(Module *creator) : IRCDMessage(creator, "IDLE", 1) { } + if (c) + c->ChangeTopicInternal(NULL, params[2], params[3], ts); +} - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override +void inspircd20::Idle::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +{ + ServiceBot *bi = ServiceBot::Find(params[0]); + if (bi) { - ServiceBot *bi = ServiceBot::Find(params[0]); - if (bi) - { - Uplink::Send(bi, "IDLE", source.GetSource(), Anope::StartTime, Anope::CurTime - bi->lastmsg); - } - else - { - User *u = User::Find(params[0]); - if (u && u->server == Me) - Uplink::Send(u, "IDLE", source.GetSource(), Anope::StartTime, 0); - } + Uplink::Send(bi, "IDLE", source.GetSource(), Anope::StartTime, Anope::CurTime - bi->lastmsg); } -}; + else + { + User *u = User::Find(params[0]); + if (u && u->server == Me) + Uplink::Send(u, "IDLE", source.GetSource(), Anope::StartTime, 0); + } +} /* * source = numeric of the sending server @@ -1012,349 +961,304 @@ struct IRCDMessageIdle : IRCDMessage * params[1] = metadata name * params[2] = data */ -struct IRCDMessageMetadata : IRCDMessage +void inspircd20::Metadata::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - const bool &do_topiclock, &do_mlock; - - IRCDMessageMetadata(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 + if (isdigit(params[0][0])) { - if (isdigit(params[0][0])) + if (params[1].equals_cs("accountname")) { - if (params[1].equals_cs("accountname")) - { - User *u = User::Find(params[0]); - NickServ::Account *nc = NickServ::FindAccount(params[2]); - if (u && nc) - u->Login(nc); - } + User *u = User::Find(params[0]); + NickServ::Account *nc = NickServ::FindAccount(params[2]); + if (u && nc) + u->Login(nc); + } - /* - * possible incoming ssl_cert messages: - * Received: :409 METADATA 409AAAAAA ssl_cert :vTrSe c38070ce96e41cc144ed6590a68d45a6 <...> <...> - * Received: :409 METADATA 409AAAAAC ssl_cert :vTrSE Could not get peer certificate: error:00000000:lib(0):func(0):reason(0) - */ - else if (params[1].equals_cs("ssl_cert")) + /* + * possible incoming ssl_cert messages: + * Received: :409 METADATA 409AAAAAA ssl_cert :vTrSe c38070ce96e41cc144ed6590a68d45a6 <...> <...> + * Received: :409 METADATA 409AAAAAC ssl_cert :vTrSE Could not get peer certificate: error:00000000:lib(0):func(0):reason(0) + */ + else if (params[1].equals_cs("ssl_cert")) + { + User *u = User::Find(params[0]); + if (!u) + return; + u->Extend<bool>("ssl", true); + Anope::string data = params[2].c_str(); + size_t pos1 = data.find(' ') + 1; + size_t pos2 = data.find(' ', pos1); + if ((pos2 - pos1) >= 32) // inspircd supports md5 and sha1 fingerprint hashes -> size 32 or 40 bytes. { - User *u = User::Find(params[0]); - if (!u) - return; - u->Extend<bool>("ssl", true); - Anope::string data = params[2].c_str(); - size_t pos1 = data.find(' ') + 1; - size_t pos2 = data.find(' ', pos1); - if ((pos2 - pos1) >= 32) // inspircd supports md5 and sha1 fingerprint hashes -> size 32 or 40 bytes. - { - u->fingerprint = data.substr(pos1, pos2 - pos1); - } - EventManager::Get()->Dispatch(&Event::Fingerprint::OnFingerprint, u); + u->fingerprint = data.substr(pos1, pos2 - pos1); } + EventManager::Get()->Dispatch(&Event::Fingerprint::OnFingerprint, u); } - // We deliberately ignore non-bursting servers to avoid pseudoserver fights - else if ((params[0][0] == '#') && (!source.GetServer()->IsSynced())) + } + // We deliberately ignore non-bursting servers to avoid pseudoserver fights + else if ((params[0][0] == '#') && (!source.GetServer()->IsSynced())) + { + Channel *c = Channel::Find(params[0]); + if (c && c->ci) { - Channel *c = Channel::Find(params[0]); - if (c && c->ci) + if ((do_mlock) && (params[1] == "mlock")) + { + ModeLocks *modelocks = c->ci->GetExt<ModeLocks>("modelocks"); + Anope::string modes; + if (modelocks) + modes = modelocks->GetMLockAsString(c->ci, false).replace_all_cs("+", "").replace_all_cs("-", ""); + + // Mode lock string is not what we say it is? + if (modes != params[2]) + Uplink::Send(Me, "METADATA", c->name, "mlock", modes); + } + else if ((do_topiclock) && (params[1] == "topiclock")) { - if ((do_mlock) && (params[1] == "mlock")) - { - ModeLocks *modelocks = c->ci->GetExt<ModeLocks>("modelocks"); - Anope::string modes; - if (modelocks) - modes = modelocks->GetMLockAsString(c->ci, false).replace_all_cs("+", "").replace_all_cs("-", ""); - - // Mode lock string is not what we say it is? - if (modes != params[2]) - Uplink::Send(Me, "METADATA", c->name, "mlock", modes); - } - else if ((do_topiclock) && (params[1] == "topiclock")) - { - bool mystate = c->ci->IsTopicLock(); - bool serverstate = (params[2] == "1"); - if (mystate != serverstate) - Uplink::Send(Me, "METADATA", c->name, "topiclock", mystate ? "1" : ""); - } + bool mystate = c->ci->IsTopicLock(); + bool serverstate = (params[2] == "1"); + if (mystate != serverstate) + Uplink::Send(Me, "METADATA", c->name, "topiclock", mystate ? "1" : ""); } } - else if (params[0] == "*") + } + else if (params[0] == "*") + { + // Wed Oct 3 15:40:27 2012: S[14] O :20D METADATA * modules :-m_svstopic.so + + if (params[1].equals_cs("modules") && !params[2].empty()) { - // Wed Oct 3 15:40:27 2012: S[14] O :20D METADATA * modules :-m_svstopic.so + // only interested when it comes from our uplink + Server* server = source.GetServer(); + if (!server || server->GetUplink() != Me) + return; - if (params[1].equals_cs("modules") && !params[2].empty()) - { - // only interested when it comes from our uplink - Server* server = source.GetServer(); - if (!server || server->GetUplink() != Me) - return; - - bool plus = (params[2][0] == '+'); - if (!plus && params[2][0] != '-') - return; - - bool required = false; - Anope::string capab, module = params[2].substr(1); - - if (module.equals_cs("m_services_account.so")) - required = true; - else if (module.equals_cs("m_hidechans.so")) - required = true; - else if (module.equals_cs("m_chghost.so")) - capab = "CHGHOST"; - else if (module.equals_cs("m_chgident.so")) - capab = "CHGIDENT"; - else if (module.equals_cs("m_svshold.so")) - capab = "SVSHOLD"; - else if (module.equals_cs("m_rline.so")) - capab = "RLINE"; - else if (module.equals_cs("m_topiclock.so")) - capab = "TOPICLOCK"; - else - return; + bool plus = (params[2][0] == '+'); + if (!plus && params[2][0] != '-') + return; - if (required) - { - if (!plus) - Log() << "Warning: InspIRCd unloaded module " << module << ", Anope won't function correctly without it"; - } - else - { - if (plus) - Servers::Capab.insert(capab); - else - Servers::Capab.erase(capab); + bool required = false; + Anope::string capab, module = params[2].substr(1); + + if (module.equals_cs("m_services_account.so")) + required = true; + else if (module.equals_cs("m_hidechans.so")) + required = true; + else if (module.equals_cs("m_chghost.so")) + capab = "CHGHOST"; + else if (module.equals_cs("m_chgident.so")) + capab = "CHGIDENT"; + else if (module.equals_cs("m_svshold.so")) + capab = "SVSHOLD"; + else if (module.equals_cs("m_rline.so")) + capab = "RLINE"; + else if (module.equals_cs("m_topiclock.so")) + capab = "TOPICLOCK"; + else + return; - Log() << "InspIRCd " << (plus ? "loaded" : "unloaded") << " module " << module << ", adjusted functionality"; - } + if (required) + { + if (!plus) + Log() << "Warning: InspIRCd unloaded module " << module << ", Anope won't function correctly without it"; + } + else + { + if (plus) + Servers::Capab.insert(capab); + else + Servers::Capab.erase(capab); + Log() << "InspIRCd " << (plus ? "loaded" : "unloaded") << " module " << module << ", adjusted functionality"; } + } } -}; +} -struct IRCDMessageMode : IRCDMessage +void inspircd20::Mode::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageMode(Module *creator) : IRCDMessage(creator, "MODE", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + if (IRCD->IsChannelValid(params[0])) { - if (IRCD->IsChannelValid(params[0])) - { - Channel *c = Channel::Find(params[0]); + Channel *c = Channel::Find(params[0]); - Anope::string modes = params[1]; - for (unsigned n = 2; n < params.size(); ++n) - modes += " " + params[n]; + Anope::string modes = params[1]; + for (unsigned int n = 2; n < params.size(); ++n) + modes += " " + params[n]; - if (c) - c->SetModesInternal(source, modes); - } - else - { - /* InspIRCd lets opers change another - users modes, we have to kludge this - as it slightly breaks RFC1459 - */ - User *u = source.GetUser(); - // This can happen with server-origin modes. - if (!u) - u = User::Find(params[0]); - // if it's still null, drop it like fire. - // most likely situation was that server introduced a nick which we subsequently akilled - if (u) - u->SetModesInternal(source, "%s", params[1].c_str()); - } + if (c) + c->SetModesInternal(source, modes); } -}; + else + { + /* InspIRCd lets opers change another + users modes, we have to kludge this + as it slightly breaks RFC1459 + */ + User *u = source.GetUser(); + // This can happen with server-origin modes. + if (!u) + u = User::Find(params[0]); + // if it's still null, drop it like fire. + // most likely situation was that server introduced a nick which we subsequently akilled + if (u) + u->SetModesInternal(source, "%s", params[1].c_str()); + } +} -struct IRCDMessageNick : IRCDMessage +void inspircd20::Nick::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + source.GetUser()->ChangeNick(params[0]); +} - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - source.GetUser()->ChangeNick(params[0]); - } -}; +void inspircd20::OperType::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +{ + /* opertype is equivalent to mode +o because servers + dont do this directly */ + User *u = source.GetUser(); + if (!u->HasMode("OPER")) + u->SetModesInternal(source, "+o"); +} -struct IRCDMessageOperType : IRCDMessage +void inspircd20::RSQuit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageOperType(Module *creator) : IRCDMessage(creator, "OPERTYPE", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_USER); } + Server *s = Server::Find(params[0]); + const Anope::string &reason = params.size() > 1 ? params[1] : ""; + if (!s) + return; - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - /* opertype is equivalent to mode +o because servers - dont do this directly */ - User *u = source.GetUser(); - if (!u->HasMode("OPER")) - u->SetModesInternal(source, "+o"); - } -}; + Uplink::Send(Me, "SQUIT", s->GetSID(), reason); + s->Delete(s->GetName() + " " + s->GetUplink()->GetName()); +} -struct IRCDMessageRSQuit : IRCDMessage +void inspircd20::Save::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageRSQuit(Module *creator) : IRCDMessage(creator, "RSQUIT", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + User *targ = User::Find(params[0]); + time_t ts; - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + try { - Server *s = Server::Find(params[0]); - const Anope::string &reason = params.size() > 1 ? params[1] : ""; - if (!s) - return; - - Uplink::Send(Me, "SQUIT", s->GetSID(), reason); - s->Delete(s->GetName() + " " + s->GetUplink()->GetName()); + ts = convertTo<time_t>(params[1]); + } + catch (const ConvertException &) + { + return; } -}; - -struct IRCDMessageSave : IRCDMessage -{ - time_t last_collide; - IRCDMessageSave(Module *creator) : IRCDMessage(creator, "SAVE", 2), last_collide(0) { } + if (!targ || targ->timestamp != ts) + return; - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + BotInfo *bi; + if (targ->server == Me && (bi = dynamic_cast<BotInfo *>(targ))) { - User *targ = User::Find(params[0]); - time_t ts; - - try - { - ts = convertTo<time_t>(params[1]); - } - catch (const ConvertException &) + if (last_collide == Anope::CurTime) { + Anope::QuitReason = "Nick collision fight on " + targ->nick; + Anope::Quitting = true; return; } - if (!targ || targ->timestamp != ts) - return; - - BotInfo *bi; - if (targ->server == Me && (bi = dynamic_cast<BotInfo *>(targ))) - { - if (last_collide == Anope::CurTime) - { - Anope::QuitReason = "Nick collision fight on " + targ->nick; - Anope::Quitting = true; - return; - } - - IRCD->SendKill(Me, targ->nick, "Nick collision"); - IRCD->SendNickChange(targ, targ->nick); - last_collide = Anope::CurTime; - } - else - targ->ChangeNick(targ->GetUID()); + IRCD->SendKill(Me, targ->nick, "Nick collision"); + IRCD->SendNickChange(targ, targ->nick); + last_collide = Anope::CurTime; } -}; + else + targ->ChangeNick(targ->GetUID()); +} -struct IRCDMessageServer : IRCDMessage +/* + * [Nov 04 00:08:46.308435 2009] debug: Received: SERVER irc.inspircd.com pass 0 964 :Testnet Central! + * 0: name + * 1: pass + * 2: hops + * 3: numeric + * 4: desc + */ +void inspircd20::ServerMessage::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 5) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + unsigned int hops = 0; - /* - * [Nov 04 00:08:46.308435 2009] debug: Received: SERVER irc.inspircd.com pass 0 964 :Testnet Central! - * 0: name - * 1: pass - * 2: hops - * 3: numeric - * 4: desc - */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + try { - unsigned int hops = Anope::string(params[2]).is_pos_number_only() ? convertTo<unsigned>(params[2]) : 0; - new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, params[4], params[3]); + hops = convertTo<unsigned int>(params[2]); } -}; + catch (const ConvertException &) { } -struct IRCDMessageSQuit : rfc1459::SQuit -{ - IRCDMessageSQuit(Module *creator) : rfc1459::SQuit(creator) { } + new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, params[4], params[3]); +} - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override +void inspircd20::SQuit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +{ + if (params[0] == rsquit_id || params[0] == rsquit_server) { - if (params[0] == rsquit_id || params[0] == rsquit_server) - { - /* squit for a recently squit server, introduce the juped server now */ - Server *s = Server::Find(rsquit_server); + /* squit for a recently squit server, introduce the juped server now */ + Server *s = Server::Find(rsquit_server); - rsquit_id.clear(); - rsquit_server.clear(); + rsquit_id.clear(); + rsquit_server.clear(); - if (s && s->IsJuped()) - IRCD->SendServer(s); - } - else - rfc1459::SQuit::Run(source, params); + if (s && s->IsJuped()) + IRCD->SendServer(s); } -}; + else + rfc1459::SQuit::Run(source, params); +} -struct IRCDMessageTime : IRCDMessage +void inspircd20::Time::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageTime(Module *creator) : IRCDMessage(creator, "TIME", 2) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - Uplink::Send(Me, "TIME", source.GetSource(), params[1], Anope::CurTime); - } -}; + Uplink::Send(Me, "TIME", source.GetSource(), params[1], Anope::CurTime); +} -struct IRCDMessageUID : IRCDMessage +/* + * [Nov 03 22:09:58.176252 2009] debug: Received: :964 UID 964AAAAAC 1225746297 w00t2 localhost testnet.user w00t 127.0.0.1 1225746302 +iosw +ACGJKLNOQcdfgjklnoqtx :Robin Burchell <w00t@inspircd.org> + * 0: uid + * 1: ts + * 2: nick + * 3: host + * 4: dhost + * 5: ident + * 6: ip + * 7: signon + * 8+: modes and params -- IMPORTANT, some modes (e.g. +s) may have parameters. So don't assume a fixed position of realname! + * last: realname + */ +void inspircd20::UID::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - ServiceReference<SASL::Service> sasl; - - IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 8) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - /* - * [Nov 03 22:09:58.176252 2009] debug: Received: :964 UID 964AAAAAC 1225746297 w00t2 localhost testnet.user w00t 127.0.0.1 1225746302 +iosw +ACGJKLNOQcdfgjklnoqtx :Robin Burchell <w00t@inspircd.org> - * 0: uid - * 1: ts - * 2: nick - * 3: host - * 4: dhost - * 5: ident - * 6: ip - * 7: signon - * 8+: modes and params -- IMPORTANT, some modes (e.g. +s) may have parameters. So don't assume a fixed position of realname! - * last: realname - */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - time_t ts = convertTo<time_t>(params[1]); - - Anope::string modes = params[8]; - for (unsigned i = 9; i < params.size() - 1; ++i) - modes += " " + params[i]; + time_t ts = convertTo<time_t>(params[1]); + + Anope::string modes = params[8]; + for (unsigned i = 9; i < params.size() - 1; ++i) + modes += " " + params[i]; + + NickServ::Nick *na = NULL; + if (sasl) + for (std::list<SASLUser>::iterator it = saslusers.begin(); it != saslusers.end();) + { + SASLUser &u = *it; - NickServ::Nick *na = NULL; - if (sasl) - for (std::list<SASLUser>::iterator it = saslusers.begin(); it != saslusers.end();) + if (u.created + 30 < Anope::CurTime) + it = saslusers.erase(it); + else if (u.uid == params[0]) { - SASLUser &u = *it; - - if (u.created + 30 < Anope::CurTime) - it = saslusers.erase(it); - else if (u.uid == params[0]) - { - na = NickServ::FindNick(u.acc); - it = saslusers.erase(it); - } - else - ++it; + na = NickServ::FindNick(u.acc); + it = saslusers.erase(it); } + else + ++it; + } - User *u = User::OnIntroduce(params[2], params[5], params[3], params[4], params[6], source.GetServer(), params[params.size() - 1], ts, modes, params[0], na ? na->GetAccount() : NULL); - if (u) - u->signon = convertTo<time_t>(params[7]); + User *u = User::OnIntroduce(params[2], params[5], params[3], params[4], params[6], source.GetServer(), params[params.size() - 1], ts, modes, params[0], na ? na->GetAccount() : NULL); + if (u) + { + time_t signon = Anope::CurTime; + + try + { + signon = convertTo<time_t>(params[7]); + } + catch (const ConvertException &) { } + + u->signon = signon; } -}; +} class ProtoInspIRCd20 : public Module , public EventHook<Event::UserNickChange> @@ -1385,28 +1289,28 @@ class ProtoInspIRCd20 : public Module rfc1459::Topic message_topic; /* Our message handlers */ - IRCDMessageCapab message_capab; - IRCDMessageChgHost message_chghost; - IRCDMessageChgIdent message_chgident; - IRCDMessageChgName message_chgname; - IRCDMessageEncap message_encap; - IRCDMessageEndburst message_endburst; - IRCDMessageFHost message_fhost; - IRCDMessageFIdent message_fident; - IRCDMessageFJoin message_fjoin; - IRCDMessageFMode message_fmode; - IRCDMessageFTopic message_ftopic; - IRCDMessageIdle message_idle; - IRCDMessageMetadata message_metadata; - IRCDMessageMode message_mode; - IRCDMessageNick message_nick; - IRCDMessageOperType message_opertype; - IRCDMessageRSQuit message_rsquit; - IRCDMessageSave message_save; - IRCDMessageServer message_server; - IRCDMessageSQuit message_squit; - IRCDMessageTime message_time; - IRCDMessageUID message_uid; + inspircd20::Capab message_capab; + inspircd20::ChgHost message_chghost; + inspircd20::ChgIdent message_chgident; + inspircd20::ChgName message_chgname; + inspircd20::Encap message_encap; + inspircd20::Endburst message_endburst; + inspircd20::FHost message_fhost; + inspircd20::FIdent message_fident; + inspircd20::FJoin message_fjoin; + inspircd20::FMode message_fmode; + inspircd20::FTopic message_ftopic; + inspircd20::Idle message_idle; + inspircd20::Metadata message_metadata; + inspircd20::Mode message_mode; + inspircd20::Nick message_nick; + inspircd20::OperType message_opertype; + inspircd20::RSQuit message_rsquit; + inspircd20::Save message_save; + inspircd20::ServerMessage message_server; + inspircd20::SQuit message_squit; + inspircd20::Time message_time; + inspircd20::UID message_uid; bool use_server_side_topiclock, use_server_side_mlock; diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp index 2c03ed434..6ce997e2a 100644 --- a/modules/protocol/ngircd.cpp +++ b/modules/protocol/ngircd.cpp @@ -22,6 +22,7 @@ #include "module.h" #include "modules/protocol/rfc1459.h" +#include "modules/protocol/ngircd.h" class ngIRCdProto : public IRCDProto { @@ -190,428 +191,352 @@ class ngIRCdProto : public IRCDProto } }; -struct IRCDMessage005 : IRCDMessage +// Please see <http://www.irc.org/tech_docs/005.html> for details. +void ngircd::Numeric005::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessage005(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 + size_t pos; + Anope::string parameter, data; + for (unsigned i = 0, end = params.size(); i < end; ++i) { - size_t pos; - Anope::string parameter, data; - for (unsigned i = 0, end = params.size(); i < end; ++i) + pos = params[i].find('='); + if (pos != Anope::string::npos) { - pos = params[i].find('='); - if (pos != Anope::string::npos) + parameter = params[i].substr(0, pos); + data = params[i].substr(pos+1, params[i].length()); + if (parameter == "MODES") { - parameter = params[i].substr(0, pos); - data = params[i].substr(pos+1, params[i].length()); - if (parameter == "MODES") - { - unsigned maxmodes = convertTo<unsigned>(data); - IRCD->MaxModes = maxmodes; - } - else if (parameter == "NICKLEN") + unsigned maxmodes = convertTo<unsigned>(data); + IRCD->MaxModes = maxmodes; + } + else if (parameter == "NICKLEN") + { + unsigned newlen = convertTo<unsigned>(data), len = Config->GetBlock("networkinfo")->Get<unsigned>("nicklen"); + if (len != newlen) { - unsigned newlen = convertTo<unsigned>(data), len = Config->GetBlock("networkinfo")->Get<unsigned>("nicklen"); - if (len != newlen) - { - Log() << "Warning: NICKLEN is " << newlen << " but networkinfo:nicklen is " << len; - } + Log() << "Warning: NICKLEN is " << newlen << " but networkinfo:nicklen is " << len; } } } } -}; +} -struct IRCDMessage376 : IRCDMessage +/* + * 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 ngircd::ChanInfo::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessage376(Module *creator) : IRCDMessage(creator, "376", 2) { } + bool created; + Channel *c = Channel::FindOrCreate(params[0], created); - /* - * :ngircd.dev.anope.de 376 services.anope.de :End of MOTD command - * - * we do nothing here, this function exists only to - * avoid the "unknown message from server" message. - * - */ + Anope::string modes = params[1]; - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + if (params.size() == 3) { + c->ChangeTopicInternal(NULL, source.GetName(), params[2], Anope::CurTime); } -}; - -struct IRCDMessageChaninfo : IRCDMessage -{ - IRCDMessageChaninfo(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) override + else if (params.size() == 5) { - bool created; - Channel *c = Channel::FindOrCreate(params[0], created); - - Anope::string modes = params[1]; - - if (params.size() == 3) - { - c->ChangeTopicInternal(NULL, source.GetName(), params[2], Anope::CurTime); - } - else if (params.size() == 5) + for (size_t i = 0, end = params[1].length(); i < end; ++i) { - for (size_t i = 0, end = params[1].length(); i < end; ++i) + switch(params[1][i]) { - switch(params[1][i]) - { - case 'k': - modes += " " + params[2]; - continue; - case 'l': - modes += " " + params[3]; - continue; - } + case 'k': + modes += " " + params[2]; + continue; + case 'l': + modes += " " + params[3]; + continue; } - c->ChangeTopicInternal(NULL, source.GetName(), params[4], Anope::CurTime); } - - c->SetModesInternal(source, modes); + c->ChangeTopicInternal(NULL, source.GetName(), params[4], Anope::CurTime); } -}; -struct IRCDMessageJoin : rfc1459::Join + c->SetModesInternal(source, modes); +} + +/* + * <@po||ux> DukeP: RFC 2813, 4.2.1: the JOIN command on server-server links + * separates the modes ("o") with ASCII 7, not space. And you can't see ASCII 7. + * + * if a user joins a new channel, the ircd sends <channelname>\7<umode> + */ +void ngircd::Join::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageJoin(Module *creator) : rfc1459::Join(creator, "JOIN") { } + User *user = source.GetUser(); + size_t pos = params[0].find('\7'); + Anope::string channel, modes; - /* - * <@po||ux> DukeP: RFC 2813, 4.2.1: the JOIN command on server-server links - * separates the modes ("o") with ASCII 7, not space. And you can't see ASCII 7. - * - * if a user joins a new channel, the ircd sends <channelname>\7<umode> - */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + if (pos != Anope::string::npos) { - User *user = source.GetUser(); - size_t pos = params[0].find('\7'); - Anope::string channel, modes; - - if (pos != Anope::string::npos) - { - channel = params[0].substr(0, pos); - modes = '+' + params[0].substr(pos+1, params[0].length()) + " " + user->nick; - } - else - { - channel = params[0]; - } + channel = params[0].substr(0, pos); + modes = '+' + params[0].substr(pos+1, params[0].length()) + " " + user->nick; + } + else + { + channel = params[0]; + } - std::vector<Anope::string> new_params; - new_params.push_back(channel); + std::vector<Anope::string> new_params; + new_params.push_back(channel); - rfc1459::Join::Run(source, new_params); + rfc1459::Join::Run(source, new_params); - if (!modes.empty()) - { - Channel *c = Channel::Find(channel); - if (c) - c->SetModesInternal(source, modes); - } + if (!modes.empty()) + { + Channel *c = Channel::Find(channel); + if (c) + c->SetModesInternal(source, modes); } -}; +} -struct IRCDMessageMetadata : IRCDMessage +/* + * Received: :ngircd.dev.anope.de METADATA DukePyrolator host :anope-e2ee5c7d + * + * params[0] = nick of the user + * params[1] = command + * params[2] = data + * + * following commands are supported: + * - "accountname": the account name of a client (can't be empty) + * - "certfp": the certificate fingerprint of a client (can't be empty) + * - "cloakhost" : the cloaked hostname of a client + * - "host": the hostname of a client (can't be empty) + * - "info": info text ("real name") of a client + * - "user": the user name (ident) of a client (can't be empty) + */ +void ngircd::Metadata::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageMetadata(Module *creator) : IRCDMessage(creator, "METADATA", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - - /* - * Received: :ngircd.dev.anope.de METADATA DukePyrolator host :anope-e2ee5c7d - * - * params[0] = nick of the user - * params[1] = command - * params[2] = data - * - * following commands are supported: - * - "accountname": the account name of a client (can't be empty) - * - "certfp": the certificate fingerprint of a client (can't be empty) - * - "cloakhost" : the cloaked hostname of a client - * - "host": the hostname of a client (can't be empty) - * - "info": info text ("real name") of a client - * - "user": the user name (ident) of a client (can't be empty) - */ - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + User *u = User::Find(params[0]); + if (!u) { - User *u = User::Find(params[0]); - if (!u) - { - Log() << "received METADATA for non-existent user " << params[0]; - return; - } - if (params[1].equals_cs("accountname")) - { - NickServ::Account *nc = NickServ::FindAccount(params[2]); - if (nc) - u->Login(nc); - } - else if (params[1].equals_cs("certfp")) - { - u->fingerprint = params[2]; - EventManager::Get()->Dispatch(&Event::Fingerprint::OnFingerprint, u); - } - else if (params[1].equals_cs("cloakhost")) - { - if (!params[2].empty()) - u->SetDisplayedHost(params[2]); - } - else if (params[1].equals_cs("host")) - { - u->SetCloakedHost(params[2]); - } - else if (params[1].equals_cs("info")) - { - u->SetRealname(params[2]); - } - else if (params[1].equals_cs("user")) - { - u->SetVIdent(params[2]); - } + Log() << "received METADATA for non-existent user " << params[0]; + return; } -}; + if (params[1].equals_cs("accountname")) + { + NickServ::Account *nc = NickServ::FindAccount(params[2]); + if (nc) + u->Login(nc); + } + else if (params[1].equals_cs("certfp")) + { + u->fingerprint = params[2]; + EventManager::Get()->Dispatch(&Event::Fingerprint::OnFingerprint, u); + } + else if (params[1].equals_cs("cloakhost")) + { + if (!params[2].empty()) + u->SetDisplayedHost(params[2]); + } + else if (params[1].equals_cs("host")) + { + u->SetCloakedHost(params[2]); + } + else if (params[1].equals_cs("info")) + { + u->SetRealname(params[2]); + } + else if (params[1].equals_cs("user")) + { + u->SetVIdent(params[2]); + } +} -struct IRCDMessageMode : IRCDMessage +/* + * Received: :DukeP MODE #anope +b *!*@*.aol.com + * Received: :DukeP MODE #anope +h DukeP + * params[0] = channel or nick + * params[1] = modes + * params[n] = parameters + */ +void ngircd::Mode::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageMode(Module *creator) : IRCDMessage(creator, "MODE", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + Anope::string modes = params[1]; - /* - * Received: :DukeP MODE #anope +b *!*@*.aol.com - * Received: :DukeP MODE #anope +h DukeP - * params[0] = channel or nick - * params[1] = modes - * params[n] = parameters - */ + for (size_t i = 2; i < params.size(); ++i) + modes += " " + params[i]; - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + if (IRCD->IsChannelValid(params[0])) { - Anope::string modes = params[1]; - - for (size_t i = 2; i < params.size(); ++i) - modes += " " + params[i]; - - if (IRCD->IsChannelValid(params[0])) - { - Channel *c = Channel::Find(params[0]); - - if (c) - c->SetModesInternal(source, modes); - } - else - { - User *u = User::Find(params[0]); + Channel *c = Channel::Find(params[0]); - if (u) - u->SetModesInternal(source, "%s", params[1].c_str()); - } + if (c) + c->SetModesInternal(source, modes); } -}; - -struct IRCDMessageNick : IRCDMessage -{ - IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - /* - * NICK - NEW - * Received: :dev.anope.de NICK DukeP_ 1 ~DukePyro ip-2-201-236-154.web.vodafone.de 1 + :DukePyrolator - * Parameters: <nickname> <hopcount> <username> <host> <servertoken> <umode> :<realname> - * source = server - * params[0] = nick - * params[1] = hopcount - * params[2] = username/ident - * params[3] = host - * params[4] = servertoken - * params[5] = modes - * params[6] = info - * - * NICK - change - * Received: :DukeP_ NICK :test2 - * source = oldnick - * params[0] = newnick - * - */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + else { - if (params.size() == 1) - { - // we have a nickchange - User *u = source.GetUser(); + User *u = User::Find(params[0]); - if (u) - u->ChangeNick(params[0]); - } - else if (params.size() == 7) - { - // a new user is connecting to the network - Server *s = Server::Find(params[4]); - if (s == NULL) - { - Log(LOG_DEBUG) << "User " << params[0] << " introduced from non-existent server " << params[4] << "?"; - return; - } - User::OnIntroduce(params[0], params[2], params[3], "", "", s, params[6], Anope::CurTime, params[5], "", NULL); - Log(LOG_DEBUG) << "Registered nick \"" << params[0] << "\" on server " << s->GetName() << "."; - } - else - { - Log(LOG_DEBUG) << "Received NICK with invalid number of parameters. source = " << source.GetName() << "params[0] = " << params[0] << "params.size() = " << params.size(); - } + if (u) + u->SetModesInternal(source, "%s", params[1].c_str()); } -}; +} -struct IRCDMessageNJoin : IRCDMessage +/* + * NICK - NEW + * Received: :dev.anope.de NICK DukeP_ 1 ~DukePyro ip-2-201-236-154.web.vodafone.de 1 + :DukePyrolator + * Parameters: <nickname> <hopcount> <username> <host> <servertoken> <umode> :<realname> + * source = server + * params[0] = nick + * params[1] = hopcount + * params[2] = username/ident + * params[3] = host + * params[4] = servertoken + * params[5] = modes + * params[6] = info + * + * NICK - change + * Received: :DukeP_ NICK :test2 + * source = oldnick + * params[0] = newnick + * + */ +void ngircd::Nick::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageNJoin(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 + if (params.size() == 1) { - std::list<rfc1459::Join::SJoinUser> users; + // we have a nickchange + User *u = source.GetUser(); - commasepstream sep(params[1]); - Anope::string buf; - while (sep.GetToken(buf)) + if (u) + u->ChangeNick(params[0]); + } + else if (params.size() == 7) + { + // a new user is connecting to the network + Server *s = Server::Find(params[4]); + if (s == nullptr) { - - rfc1459::Join::SJoinUser sju; - - /* Get prefixes from the nick */ - for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));) - { - buf.erase(buf.begin()); - sju.first.AddMode(ch); - } - - sju.second = User::Find(buf); - if (!sju.second) - { - Log(LOG_DEBUG) << "NJOIN for non-existent user " << buf << " on " << params[0]; - continue; - } - users.push_back(sju); + Log(LOG_DEBUG) << "User " << params[0] << " introduced from non-existent server " << params[4] << "?"; + return; } - - rfc1459::Join::SJoin(source, params[0], 0, "", users); + User::OnIntroduce(params[0], params[2], params[3], "", "", s, params[6], Anope::CurTime, params[5], "", NULL); + Log(LOG_DEBUG) << "Registered nick \"" << params[0] << "\" on server " << s->GetName() << "."; } -}; - -struct IRCDMessagePong : IRCDMessage -{ - IRCDMessagePong(Module *creator) : IRCDMessage(creator, "PONG", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - - /* - * ngIRCd does not send an EOB, so we send a PING immediately - * when receiving a new server and then finish sync once we - * get a pong back from that server. - */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + else { - if (!source.GetServer()->IsSynced()) - source.GetServer()->Sync(false); + Log(LOG_DEBUG) << "Received NICK with invalid number of parameters. source = " << source.GetName() << "params[0] = " << params[0] << "params.size() = " << params.size(); } -}; +} -struct IRCDMessageServer : IRCDMessage +/* + * 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 ngircd::NJoin::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + std::list<rfc1459::Join::SJoinUser> users; - /* - * New directly linked server: - * - * SERVER tolsun.oulu.fi 1 :Experimental server - * New server tolsun.oulu.fi introducing itself - * and attempting to register. - * - * params[0] = servername - * params[1] = hop count - * params[2] = server description - * - * New remote server in the network: - * - * :tolsun.oulu.fi SERVER csd.bu.edu 5 34 :BU Central Server - * Server tolsun.oulu.fi is our uplink for csd.bu.edu - * which is 5 hops away. The token "34" will be used - * by tolsun.oulu.fi when introducing new users or - * services connected to csd.bu.edu. - * - * params[0] = servername - * params[1] = hop count - * params[2] = server numeric - * params[3] = server description - */ - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + commasepstream sep(params[1]); + Anope::string buf; + while (sep.GetToken(buf)) { - if (params.size() == 3) + + rfc1459::Join::SJoinUser sju; + + /* Get prefixes from the nick */ + for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));) { - // our uplink is introducing itself - new Server(Me, params[0], 1, params[2], "1"); + buf.erase(buf.begin()); + sju.first.AddMode(ch); } - else + + sju.second = User::Find(buf); + if (!sju.second) { - // our uplink is introducing a new server - unsigned int hops = params[1].is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0; - new Server(source.GetServer(), params[0], hops, params[3], params[2]); + Log(LOG_DEBUG) << "NJOIN for non-existent user " << buf << " on " << params[0]; + continue; } - /* - * ngIRCd does not send an EOB, so we send a PING immediately - * when receiving a new server and then finish sync once we - * get a pong back from that server. - */ - IRCD->SendPing(Me->GetName(), params[0]); + users.push_back(sju); } -}; -struct IRCDMessageTopic : IRCDMessage + rfc1459::Join::SJoin(source, params[0], 0, "", users); +} + +/* + * ngIRCd does not send an EOB, so we send a PING immediately + * when receiving a new server and then finish sync once we + * get a pong back from that server. + */ +void ngircd::Pong::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageTopic(Module *creator) : IRCDMessage(creator, "TOPIC", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + if (!source.GetServer()->IsSynced()) + source.GetServer()->Sync(false); +} - // Received: :DukeP TOPIC #anope :test - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override +/* + * New directly linked server: + * + * SERVER tolsun.oulu.fi 1 :Experimental server + * New server tolsun.oulu.fi introducing itself + * and attempting to register. + * + * params[0] = servername + * params[1] = hop count + * params[2] = server description + * + * New remote server in the network: + * + * :tolsun.oulu.fi SERVER csd.bu.edu 5 34 :BU Central Server + * Server tolsun.oulu.fi is our uplink for csd.bu.edu + * which is 5 hops away. The token "34" will be used + * by tolsun.oulu.fi when introducing new users or + * services connected to csd.bu.edu. + * + * params[0] = servername + * params[1] = hop count + * params[2] = server numeric + * params[3] = server description + */ + +void ngircd::ServerMessage::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +{ + if (params.size() == 3) { - Channel *c = Channel::Find(params[0]); - if (!c) - { - Log(LOG_DEBUG) << "TOPIC for non-existent channel " << params[0]; - return; - } - c->ChangeTopicInternal(source.GetUser(), source.GetName(), params[1], Anope::CurTime); + // our uplink is introducing itself + new Server(Me, params[0], 1, params[2], "1"); } -}; + else + { + // our uplink is introducing a new server + unsigned int hops = 0; + try + { + hops = convertTo<unsigned>(params[1]); + } + catch (const ConvertException &) { } + new Server(source.GetServer(), params[0], hops, params[3], params[2]); + } + /* + * ngIRCd does not send an EOB, so we send a PING immediately + * when receiving a new server and then finish sync once we + * get a pong back from that server. + */ + IRCD->SendPing(Me->GetName(), params[0]); +} class ProtongIRCd : public Module , public EventHook<Event::UserNickChange> @@ -633,21 +558,20 @@ class ProtongIRCd : public Module rfc1459::SQuit message_squit; rfc1459::Stats message_stats; rfc1459::Time message_time; + rfc1459::Topic message_topic; rfc1459::Version message_version; rfc1459::Whois message_whois; /* Our message handlers */ - IRCDMessage005 message_005; - IRCDMessage376 message_376; - IRCDMessageChaninfo message_chaninfo; - IRCDMessageJoin message_join; - IRCDMessageMetadata message_metadata; - IRCDMessageMode message_mode; - IRCDMessageNick message_nick; - IRCDMessageNJoin message_njoin; - IRCDMessagePong message_pong; - IRCDMessageServer message_server; - IRCDMessageTopic message_topic; + ngircd::Numeric005 message_005; + ngircd::ChanInfo message_chaninfo; + ngircd::Join message_join; + ngircd::Metadata message_metadata; + ngircd::Mode message_mode; + ngircd::Nick message_nick; + ngircd::NJoin message_njoin; + ngircd::Pong message_pong; + ngircd::ServerMessage message_server; public: ProtongIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR) @@ -672,7 +596,6 @@ class ProtongIRCd : public Module , message_whois(this) , message_005(this) - , message_376(this) , message_chaninfo(this) , message_join(this) , message_metadata(this) diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index 6a3fff270..f3d147be8 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -234,13 +234,13 @@ struct IRCDMessagePass : IRCDMessage /* 0 1 2 */ /* SERVER hades.arpa 1 :ircd-hybrid test server */ -void plexus::Server::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void plexus::ServerMessage::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { /* Servers other than our immediate uplink are introduced via SID */ if (params[1] != "1") return; - new ::Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], 1, params[2], UplinkSID); + new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], 1, params[2], UplinkSID); } /* @@ -321,7 +321,7 @@ class ProtoPlexus : public Module hybrid::Join message_join; hybrid::Nick message_nick; IRCDMessagePass message_pass; - plexus::Server message_server; + plexus::ServerMessage message_server; hybrid::SID message_sid; hybrid::SJoin message_sjoin; hybrid::TBurst message_tburst; diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index b316964c5..6d4c29f03 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -211,12 +211,12 @@ struct IRCDMessagePass : IRCDMessage }; // SERVER hades.arpa 1 :ircd-ratbox test server -void ratbox::Server::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +void ratbox::ServerMessage::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { // Servers other then our immediate uplink are introduced via SID if (params[1] != "1") return; - new ::Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], 1, params[2], UplinkSID); + new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], 1, params[2], UplinkSID); IRCD->SendPing(Me->GetName(), params[0]); } @@ -228,14 +228,19 @@ void ratbox::Server::Run(MessageSource &source, const std::vector<Anope::string> */ void ratbox::TB::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - time_t topic_time = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime; Channel *c = Channel::Find(params[0]); + time_t topic_time = Anope::CurTime; if (!c) return; + try + { + topic_time = convertTo<time_t>(params[1]); + } + catch (const ConvertException &) { } const Anope::string &setter = params.size() == 4 ? params[2] : "", - topic = params.size() == 4 ? params[3] : params[2]; + &topic = params.size() == 4 ? params[3] : params[2]; c->ChangeTopicInternal(NULL, setter, topic, topic_time); } @@ -243,8 +248,16 @@ void ratbox::TB::Run(MessageSource &source, const std::vector<Anope::string> &pa // :42X UID Adam 1 1348535644 +aow Adam 192.168.0.5 192.168.0.5 42XAAAAAB :Adam void ratbox::UID::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { + time_t ts = 0; + + try + { + ts = convertTo<time_t>(params[2]); + } + catch (const ConvertException &) { } + /* Source is always the server */ - User::OnIntroduce(params[0], params[4], params[5], "", params[6], source.GetServer(), params[8], params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, params[3], params[7], NULL); + User::OnIntroduce(params[0], params[4], params[5], "", params[6], source.GetServer(), params[8], ts, params[3], params[7], NULL); } class ProtoRatbox : public Module @@ -279,7 +292,7 @@ class ProtoRatbox : public Module hybrid::Nick message_nick; IRCDMessagePass message_pass; hybrid::Pong message_pong; - ratbox::Server message_server; + ratbox::ServerMessage message_server; hybrid::SID message_sid; hybrid::SJoin message_sjoin; ratbox::TB message_tb; diff --git a/modules/protocol/rfc1459.cpp b/modules/protocol/rfc1459.cpp index 22889c682..5d48691dc 100644 --- a/modules/protocol/rfc1459.cpp +++ b/modules/protocol/rfc1459.cpp @@ -371,8 +371,6 @@ void Privmsg::Run(MessageSource &source, const std::vector<Anope::string> ¶m bi->OnMessage(u, message); } } - - return; } void Quit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) @@ -449,8 +447,6 @@ void rfc1459::Stats::Run(MessageSource &source, const std::vector<Anope::string> default: IRCD->SendNumeric(219, source.GetSource(), "%c :End of /STATS report.", params[0][0]); } - - return; } void Time::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) @@ -461,7 +457,6 @@ void Time::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) char buf[64]; strftime(buf, sizeof(buf), "%a %b %d %H:%M:%S %Y %Z", tm); IRCD->SendNumeric(391, source.GetSource(), "%s :%s", Me->GetName().c_str(), buf); - return; } void Topic::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) @@ -469,8 +464,6 @@ void Topic::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) Channel *c = Channel::Find(params[0]); if (c) c->ChangeTopicInternal(source.GetUser(), source.GetSource(), params[1], Anope::CurTime); - - return; } void Version::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index 8035e3987..d601b0479 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -24,6 +24,7 @@ #include "modules/sasl.h" #include "modules/operserv/stats.h" #include "modules/protocol/rfc1459.h" +#include "modules/protocol/unreal.h" static Anope::string UplinkSID; @@ -632,104 +633,79 @@ class ChannelModeUnrealSSL : public ChannelMode } }; -struct IRCDMessageChgHost : IRCDMessage +void unreal::ChgHost::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageChgHost(Module *creator) : IRCDMessage(creator, "CHGHOST", 2) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - User *u = User::Find(params[0]); - if (u) - u->SetDisplayedHost(params[1]); - } -}; + User *u = User::Find(params[0]); + if (u) + u->SetDisplayedHost(params[1]); +} -struct IRCDMessageChgIdent : IRCDMessage +void unreal::ChgIdent::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageChgIdent(Module *creator) : IRCDMessage(creator, "CHGIDENT", 2) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - User *u = User::Find(params[0]); - if (u) - u->SetVIdent(params[1]); - } -}; + User *u = User::Find(params[0]); + if (u) + u->SetVIdent(params[1]); +} -struct IRCDMessageChgName : IRCDMessage +void unreal::ChgName::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageChgName(Module *creator) : IRCDMessage(creator, "CHGNAME", 2) { } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - User *u = User::Find(params[0]); - if (u) - u->SetRealname(params[1]); - } -}; + User *u = User::Find(params[0]); + if (u) + u->SetRealname(params[1]); +} -struct IRCDMessageMD : IRCDMessage +void unreal::MD::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageMD(Module *creator) : IRCDMessage(creator, "MD", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + const Anope::string &mdtype = params[0], + &obj = params[1], + &var = params[2], + &value = params.size() > 3 ? params[3] : ""; - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + if (mdtype == "client") { - const Anope::string &mdtype = params[0], - &obj = params[1], - &var = params[2], - &value = params.size() > 3 ? params[3] : ""; - - if (mdtype == "client") - { - User *u = User::Find(obj); + User *u = User::Find(obj); - if (u == nullptr) - return; + if (u == nullptr) + return; - if (var == "certfp" && !value.empty()) - { - u->Extend<bool>("ssl", true); - u->fingerprint = value; - EventManager::Get()->Dispatch(&Event::Fingerprint::OnFingerprint, u); - } + if (var == "certfp" && !value.empty()) + { + u->Extend<bool>("ssl", true); + u->fingerprint = value; + EventManager::Get()->Dispatch(&Event::Fingerprint::OnFingerprint, u); } } -}; +} -struct IRCDMessageMode : IRCDMessage +void unreal::Mode::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageMode(Module *creator, const Anope::string &mname) : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + bool server_source = source.GetServer() != NULL; + Anope::string modes = params[1]; + for (unsigned i = 2; i < params.size() - (server_source ? 1 : 0); ++i) + modes += " " + params[i]; - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + if (IRCD->IsChannelValid(params[0])) { - bool server_source = source.GetServer() != NULL; - Anope::string modes = params[1]; - for (unsigned i = 2; i < params.size() - (server_source ? 1 : 0); ++i) - modes += " " + params[i]; - - if (IRCD->IsChannelValid(params[0])) - { - Channel *c = Channel::Find(params[0]); - time_t ts = 0; - - try - { - if (server_source) - ts = convertTo<time_t>(params[params.size() - 1]); - } - catch (const ConvertException &) { } + Channel *c = Channel::Find(params[0]); + time_t ts = 0; - if (c) - c->SetModesInternal(source, modes, ts); - } - else + try { - User *u = User::Find(params[0]); - if (u) - u->SetModesInternal(source, "%s", params[1].c_str()); + if (server_source) + ts = convertTo<time_t>(params[params.size() - 1]); } + catch (const ConvertException &) { } + + if (c) + c->SetModesInternal(source, modes, ts); } -}; + else + { + User *u = User::Find(params[0]); + if (u) + u->SetModesInternal(source, "%s", params[1].c_str()); + } +} /* netinfo * argv[0] = max global count @@ -741,347 +717,314 @@ struct IRCDMessageMode : IRCDMessage * argv[6] = free(**) * argv[7] = ircnet */ -struct IRCDMessageNetInfo : IRCDMessage +void unreal::NetInfo::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageNetInfo(Module *creator) : IRCDMessage(creator, "NETINFO", 8) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - Stats *stats = Serialize::GetObject<Stats *>(); - Uplink::Send("NETINFO", stats ? stats->GetMaxUserCount() : 0, Anope::CurTime, params[2], params[3], "0", "0", "0", params[7]); - } -}; + Stats *stats = Serialize::GetObject<Stats *>(); + Uplink::Send("NETINFO", stats ? stats->GetMaxUserCount() : 0, Anope::CurTime, params[2], params[3], "0", "0", "0", params[7]); +} -struct IRCDMessageNick : IRCDMessage +/* +** NICK - new +** source = NULL +** parv[0] = nickname +** parv[1] = hopcount +** parv[2] = timestamp +** parv[3] = username +** parv[4] = hostname +** parv[5] = servername +** parv[6] = servicestamp +** parv[7] = umodes +** parv[8] = virthost, * if none +** parv[9] = ip +** parv[10] = info +** +** NICK - change +** source = oldnick +** parv[0] = new nickname +** parv[1] = hopcount +*/ +void unreal::Nick::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } - - /* - ** NICK - new - ** source = NULL - ** parv[0] = nickname - ** parv[1] = hopcount - ** parv[2] = timestamp - ** parv[3] = username - ** parv[4] = hostname - ** parv[5] = servername - ** parv[6] = servicestamp - ** parv[7] = umodes - ** parv[8] = virthost, * if none - ** parv[9] = ip - ** parv[10] = info - ** - ** NICK - change - ** source = oldnick - ** parv[0] = new nickname - ** parv[1] = hopcount - */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + if (params.size() == 11) { - if (params.size() == 11) + Anope::string ip; + if (params[9] != "*") { - Anope::string ip; - if (params[9] != "*") - { - Anope::string decoded_ip; - Anope::B64Decode(params[9], decoded_ip); + Anope::string decoded_ip; + Anope::B64Decode(params[9], decoded_ip); - sockaddrs ip_addr; - ip_addr.ntop(params[9].length() == 8 ? AF_INET : AF_INET6, decoded_ip.c_str()); - ip = ip_addr.addr(); - } + sockaddrs ip_addr; + ip_addr.ntop(params[9].length() == 8 ? AF_INET : AF_INET6, decoded_ip.c_str()); + ip = ip_addr.addr(); + } - Anope::string vhost = params[8]; - if (vhost.equals_cs("*")) - vhost.clear(); + Anope::string vhost = params[8]; + if (vhost.equals_cs("*")) + vhost.clear(); - time_t user_ts = params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime; + time_t user_ts = Anope::CurTime; - Server *s = Server::Find(params[5]); - if (s == NULL) - { - Log(LOG_DEBUG) << "User " << params[0] << " introduced from non-existent server " << params[5] << "?"; - return; - } + try + { + user_ts = convertTo<time_t>(params[2]); + } + catch (const ConvertException &) { } - NickServ::Nick *na = NULL; + Server *s = Server::Find(params[5]); + if (s == NULL) + { + Log(LOG_DEBUG) << "User " << params[0] << " introduced from non-existent server " << params[5] << "?"; + return; + } + + NickServ::Nick *na = NULL; - if (params[6] == "0") - ; - else if (params[6].is_pos_number_only()) + if (params[6] == "0") + ; + else if (params[6].is_pos_number_only()) + { + try { if (convertTo<time_t>(params[6]) == user_ts) na = NickServ::FindNick(params[0]); } - else - { - na = NickServ::FindNick(params[6]); - } - - User::OnIntroduce(params[0], params[3], params[4], vhost, ip, s, params[10], user_ts, params[7], "", na ? na->GetAccount() : NULL); + catch (const ConvertException &) { } } else { - User *u = source.GetUser(); - - if (u) - u->ChangeNick(params[0]); + na = NickServ::FindNick(params[6]); } - } -}; - -/** This is here because: - * - * If we had three servers, A, B & C linked like so: A<->B<->C - * If Anope is linked to A and B splits from A and then reconnects - * B introduces itself, introduces C, sends EOS for C, introduces Bs clients - * introduces Cs clients, sends EOS for B. This causes all of Cs clients to be introduced - * with their server "not syncing". We now send a PING immediately when receiving a new server - * and then finish sync once we get a pong back from that server. - */ -struct IRCDMessagePong : IRCDMessage -{ - IRCDMessagePong(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 + User::OnIntroduce(params[0], params[3], params[4], vhost, ip, s, params[10], user_ts, params[7], "", na ? na->GetAccount() : NULL); + } + else { - if (!source.GetServer()->IsSynced()) - source.GetServer()->Sync(false); + User *u = source.GetUser(); + + if (u) + u->ChangeNick(params[0]); } -}; +} -struct IRCDMessageProtoctl : rfc1459::Capab +/* We ping servers to detect EOB instead of handling the EOS message + * because Unreal sends EOS for servers on link prior to the majority + * of the burst. + */ +void unreal::Pong::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageProtoctl(Module *creator) : rfc1459::Capab(creator, "PROTOCTL") { } + if (!source.GetServer()->IsSynced()) + source.GetServer()->Sync(false); +} - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override +void unreal::Protoctl::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +{ + for (unsigned int i = 0; i < params.size(); ++i) { - for (unsigned int i = 0; i < params.size(); ++i) - { - Anope::string capab = params[i]; + Anope::string capab = params[i]; - if (!capab.find("SID=")) - { - UplinkSID = capab.substr(4); - } + if (!capab.find("SID=")) + { + UplinkSID = capab.substr(4); } - - rfc1459::Capab::Run(source, params); } -}; -struct IRCDMessageSASL : IRCDMessage + rfc1459::Capab::Run(source, params); +} + +void unreal::SASL::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - ServiceReference<SASL::Service> sasl; - - IRCDMessageSASL(Module *creator) : IRCDMessage(creator, "SASL", 4) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + size_t p = params[1].find('!'); + if (!sasl || p == Anope::string::npos) + return; + + ::SASL::Message m; + m.source = params[1]; + m.target = params[0]; + m.type = params[2]; + m.data = params[3]; + m.ext = params.size() > 4 ? params[4] : ""; + + sasl->ProcessMessage(m); +} - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - size_t p = params[1].find('!'); - if (!sasl || p == Anope::string::npos) - return; +void unreal::SDesc::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +{ + source.GetServer()->SetDescription(params[0]); +} - SASL::Message m; - m.source = params[1]; - m.target = params[0]; - m.type = params[2]; - m.data = params[3]; - m.ext = params.size() > 4 ? params[4] : ""; +void unreal::SetHost::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +{ + User *u = source.GetUser(); - sasl->ProcessMessage(m); - } -}; + /* When a user sets +x we receive the new host and then the mode change */ + if (u->HasMode("CLOAK")) + u->SetDisplayedHost(params[0]); + else + u->SetCloakedHost(params[0]); +} -struct IRCDMessageSDesc : IRCDMessage +void unreal::SetIdent::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageSDesc(Module *creator) : IRCDMessage(creator, "SDESC", 1) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + User *u = source.GetUser(); + u->SetVIdent(params[0]); +} - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - source.GetServer()->SetDescription(params[0]); - } -}; +void unreal::SetName::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) +{ + User *u = source.GetUser(); + u->SetRealname(params[0]); +} -struct IRCDMessageSetHost : IRCDMessage +void unreal::ServerMessage::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageSetHost(Module *creator) : IRCDMessage(creator, "SETHOST", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + unsigned int hops = 0; - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + try { - User *u = source.GetUser(); - - /* When a user sets +x we receive the new host and then the mode change */ - if (u->HasMode("CLOAK")) - u->SetDisplayedHost(params[0]); - else - u->SetCloakedHost(params[0]); + hops = convertTo<unsigned>(params[1]); } -}; + catch (const ConvertException &) { } -struct IRCDMessageSetIdent : IRCDMessage -{ - IRCDMessageSetIdent(Module *creator) : IRCDMessage(creator, "SETIDENT", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + if (params[1].equals_cs("1")) + { + Anope::string desc; + spacesepstream(params[2]).GetTokenRemainder(desc, 1); - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, desc, UplinkSID); + } + else { - User *u = source.GetUser(); - u->SetVIdent(params[0]); + new Server(source.GetServer(), params[0], hops, params[2]); } -}; -struct IRCDMessageSetName : IRCDMessage + IRCD->SendPing(Me->GetName(), params[0]); +} + +void unreal::SID::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageSetName(Module *creator) : IRCDMessage(creator, "SETNAME", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } + unsigned int hops = 0; - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + try { - User *u = source.GetUser(); - u->SetRealname(params[0]); + hops = convertTo<unsigned>(params[1]); } -}; + catch (const ConvertException &) { } -struct IRCDMessageServer : IRCDMessage + new Server(source.GetServer(), params[0], hops, params[3], params[2]); + + IRCD->SendPing(Me->GetName(), params[0]); +} + +void unreal::SJoin::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + Anope::string modes; + if (params.size() >= 4) + for (unsigned i = 2; i < params.size() - 1; ++i) + modes += " " + params[i]; + if (!modes.empty()) + modes.erase(modes.begin()); - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - unsigned int hops = Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0; + std::list<Anope::string> bans, excepts, invites; + std::list<rfc1459::Join::SJoinUser> users; - if (params[1].equals_cs("1")) + spacesepstream sep(params[params.size() - 1]); + Anope::string buf; + while (sep.GetToken(buf)) + { + /* Ban */ + if (buf[0] == '&') { - Anope::string desc; - spacesepstream(params[2]).GetTokenRemainder(desc, 1); - - new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, desc, UplinkSID); + buf.erase(buf.begin()); + bans.push_back(buf); + } + /* Except */ + else if (buf[0] == '"') + { + buf.erase(buf.begin()); + excepts.push_back(buf); + } + /* Invex */ + else if (buf[0] == '\'') + { + buf.erase(buf.begin()); + invites.push_back(buf); } else - new Server(source.GetServer(), params[0], hops, params[2]); - - IRCD->SendPing(Me->GetName(), params[0]); - } -}; - -struct IRCDMessageSID : IRCDMessage -{ - IRCDMessageSID(Module *creator) : IRCDMessage(creator, "SID", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } + { + rfc1459::Join::SJoinUser sju; - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - unsigned int hops = Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0; + /* Get prefixes from the nick */ + for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));) + { + sju.first.AddMode(ch); + buf.erase(buf.begin()); + } - new Server(source.GetServer(), params[0], hops, params[3], params[2]); + sju.second = User::Find(buf); + if (!sju.second) + { + Log(LOG_DEBUG) << "SJOIN for non-existent user " << buf << " on " << params[1]; + continue; + } - IRCD->SendPing(Me->GetName(), params[0]); + users.push_back(sju); + } } -}; -struct IRCDMessageSJoin : IRCDMessage -{ - IRCDMessageSJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); } + time_t ts = Anope::CurTime; - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + try { - Anope::string modes; - if (params.size() >= 4) - for (unsigned i = 2; i < params.size() - 1; ++i) - modes += " " + params[i]; - if (!modes.empty()) - modes.erase(modes.begin()); + ts = convertTo<time_t>(params[0]); + } + catch (const ConvertException &) { } - std::list<Anope::string> bans, excepts, invites; - std::list<rfc1459::Join::SJoinUser> users; + rfc1459::Join::SJoin(source, params[1], ts, modes, users); - spacesepstream sep(params[params.size() - 1]); - Anope::string buf; - while (sep.GetToken(buf)) - { - /* Ban */ - if (buf[0] == '&') - { - buf.erase(buf.begin()); - bans.push_back(buf); - } - /* Except */ - else if (buf[0] == '"') - { - buf.erase(buf.begin()); - excepts.push_back(buf); - } - /* Invex */ - else if (buf[0] == '\'') - { - buf.erase(buf.begin()); - invites.push_back(buf); - } - else - { - rfc1459::Join::SJoinUser sju; - - /* Get prefixes from the nick */ - for (char ch; (ch = ModeManager::GetStatusChar(buf[0]));) - { - sju.first.AddMode(ch); - buf.erase(buf.begin()); - } - - sju.second = User::Find(buf); - if (!sju.second) - { - Log(LOG_DEBUG) << "SJOIN for non-existent user " << buf << " on " << params[1]; - continue; - } - - users.push_back(sju); - } - } - - time_t ts = Anope::string(params[0]).is_pos_number_only() ? convertTo<time_t>(params[0]) : Anope::CurTime; - rfc1459::Join::SJoin(source, params[1], ts, modes, users); + if (!bans.empty() || !excepts.empty() || !invites.empty()) + { + Channel *c = Channel::Find(params[1]); - if (!bans.empty() || !excepts.empty() || !invites.empty()) - { - Channel *c = Channel::Find(params[1]); + if (!c || c->creation_time != ts) + return; - if (!c || c->creation_time != ts) - return; + ChannelMode *ban = ModeManager::FindChannelModeByName("BAN"), + *except = ModeManager::FindChannelModeByName("EXCEPT"), + *invex = ModeManager::FindChannelModeByName("INVITEOVERRIDE"); - ChannelMode *ban = ModeManager::FindChannelModeByName("BAN"), - *except = ModeManager::FindChannelModeByName("EXCEPT"), - *invex = ModeManager::FindChannelModeByName("INVITEOVERRIDE"); - - if (ban) - for (std::list<Anope::string>::iterator it = bans.begin(), it_end = bans.end(); it != it_end; ++it) - c->SetModeInternal(source, ban, *it); - if (except) - for (std::list<Anope::string>::iterator it = excepts.begin(), it_end = excepts.end(); it != it_end; ++it) - c->SetModeInternal(source, except, *it); - if (invex) - for (std::list<Anope::string>::iterator it = invites.begin(), it_end = invites.end(); it != it_end; ++it) - c->SetModeInternal(source, invex, *it); - } + if (ban) + for (std::list<Anope::string>::iterator it = bans.begin(), it_end = bans.end(); it != it_end; ++it) + c->SetModeInternal(source, ban, *it); + if (except) + for (std::list<Anope::string>::iterator it = excepts.begin(), it_end = excepts.end(); it != it_end; ++it) + c->SetModeInternal(source, except, *it); + if (invex) + for (std::list<Anope::string>::iterator it = invites.begin(), it_end = invites.end(); it != it_end; ++it) + c->SetModeInternal(source, invex, *it); } -}; +} -struct IRCDMessageTopic : IRCDMessage +/* +** source = sender prefix +** parv[0] = channel name +** parv[1] = topic nickname +** parv[2] = topic time +** parv[3] = topic text +*/ +void unreal::Topic::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageTopic(Module *creator) : IRCDMessage(creator, "TOPIC", 4) { } + Channel *c = Channel::Find(params[0]); + time_t ts = Anope::CurTime; - /* - ** source = sender prefix - ** parv[0] = channel name - ** parv[1] = topic nickname - ** parv[2] = topic time - ** parv[3] = topic text - */ - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override + try { - Channel *c = Channel::Find(params[0]); - if (c) - c->ChangeTopicInternal(source.GetUser(), params[1], params[3], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime); + ts = convertTo<time_t>(params[2]); } -}; + catch (const ConvertException &) { } + + if (c) + c->ChangeTopicInternal(source.GetUser(), params[1], params[3], ts); +} /* * parv[0] = nickname @@ -1097,84 +1040,78 @@ struct IRCDMessageTopic : IRCDMessage * parv[10] = ip * parv[11] = info */ -struct IRCDMessageUID : IRCDMessage +void unreal::UID::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 12) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - Anope::string - nickname = params[0], - hopcount = params[1], - timestamp = params[2], - username = params[3], - hostname = params[4], - uid = params[5], - account = params[6], - umodes = params[7], - vhost = params[8], - chost = params[9], - ip = params[10], - info = params[11]; - - if (ip != "*") - { - Anope::string decoded_ip; - Anope::B64Decode(ip, decoded_ip); + Anope::string + nickname = params[0], + hopcount = params[1], + timestamp = params[2], + username = params[3], + hostname = params[4], + uid = params[5], + account = params[6], + umodes = params[7], + vhost = params[8], + chost = params[9], + ip = params[10], + info = params[11]; - sockaddrs ip_addr; - ip_addr.ntop(ip.length() == 8 ? AF_INET : AF_INET6, decoded_ip.c_str()); - ip = ip_addr.addr(); - } + if (ip != "*") + { + Anope::string decoded_ip; + Anope::B64Decode(ip, decoded_ip); - if (vhost == "*") - vhost.clear(); + sockaddrs ip_addr; + ip_addr.ntop(ip.length() == 8 ? AF_INET : AF_INET6, decoded_ip.c_str()); + ip = ip_addr.addr(); + } - if (chost == "*") - chost.clear(); + if (vhost == "*") + vhost.clear(); - time_t user_ts; - try - { - user_ts = convertTo<time_t>(timestamp); - } - catch (const ConvertException &) - { - user_ts = Anope::CurTime; - } + if (chost == "*") + chost.clear(); - NickServ::Nick *na = NULL; + time_t user_ts; + try + { + user_ts = convertTo<time_t>(timestamp); + } + catch (const ConvertException &) + { + user_ts = Anope::CurTime; + } - if (account == "0") - { - /* nothing */ - } - else if (account.is_pos_number_only()) + NickServ::Nick *na = NULL; + + if (account == "0") + { + /* nothing */ + } + else if (account.is_pos_number_only()) + { + try { if (convertTo<time_t>(account) == user_ts) na = NickServ::FindNick(nickname); } - else - { - na = NickServ::FindNick(account); - } + catch (const ConvertException &) { } + } + else + { + na = NickServ::FindNick(account); + } - User *u = User::OnIntroduce(nickname, username, hostname, vhost, ip, source.GetServer(), info, user_ts, umodes, uid, na ? na->GetAccount() : NULL); + User *u = User::OnIntroduce(nickname, username, hostname, vhost, ip, source.GetServer(), info, user_ts, umodes, uid, na ? na->GetAccount() : NULL); - if (u && !chost.empty() && chost != u->GetCloakedHost()) - u->SetCloakedHost(chost); - } -}; + if (u && !chost.empty() && chost != u->GetCloakedHost()) + u->SetCloakedHost(chost); +} -struct IRCDMessageUmode2 : IRCDMessage +void unreal::Umode2::Run(MessageSource &source, const std::vector<Anope::string> ¶ms) { - IRCDMessageUmode2(Module *creator) : IRCDMessage(creator, "UMODE2", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); } - - void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) override - { - source.GetUser()->SetModesInternal(source, "%s", params[0].c_str()); - } -}; + source.GetUser()->SetModesInternal(source, "%s", params[0].c_str()); +} class ProtoUnreal : public Module , public EventHook<Event::UserNickChange> @@ -1206,26 +1143,26 @@ class ProtoUnreal : public Module rfc1459::Whois message_whois; /* Our message handlers */ - IRCDMessageChgHost message_chghost; - IRCDMessageChgIdent message_chgident; - IRCDMessageChgName message_chgname; - IRCDMessageMD message_md; - IRCDMessageMode message_mode, message_svsmode, message_svs2mode; - IRCDMessageNetInfo message_netinfo; - IRCDMessageNick message_nick; - IRCDMessagePong message_pong; - IRCDMessageProtoctl message_protoctl; - IRCDMessageSASL message_sasl; - IRCDMessageSDesc message_sdesc; - IRCDMessageSetHost message_sethost; - IRCDMessageSetIdent message_setident; - IRCDMessageSetName message_setname; - IRCDMessageServer message_server; - IRCDMessageSID message_sid; - IRCDMessageSJoin message_sjoin; - IRCDMessageTopic message_topic; - IRCDMessageUID message_uid; - IRCDMessageUmode2 message_umode2; + unreal::ChgHost message_chghost; + unreal::ChgIdent message_chgident; + unreal::ChgName message_chgname; + unreal::MD message_md; + unreal::Mode message_mode, message_svsmode, message_svs2mode; + unreal::NetInfo message_netinfo; + unreal::Nick message_nick; + unreal::Pong message_pong; + unreal::Protoctl message_protoctl; + unreal::SASL message_sasl; + unreal::SDesc message_sdesc; + unreal::SetHost message_sethost; + unreal::SetIdent message_setident; + unreal::SetName message_setname; + unreal::ServerMessage message_server; + unreal::SID message_sid; + unreal::SJoin message_sjoin; + unreal::Topic message_topic; + unreal::UID message_uid; + unreal::Umode2 message_umode2; bool use_server_side_mlock; |