diff options
author | Adam <Adam@anope.org> | 2013-08-07 15:03:11 +0000 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-08-07 15:03:11 +0000 |
commit | 1efd289488ca16c895f833cded995d34b95daae1 (patch) | |
tree | a5c3832cb2e7400c8e34344702db6d7373d20dac | |
parent | 83e4b183eafdcf7cef1eba4dadf1d1de86c59457 (diff) |
Fix inspircd jupe mess again, it wasn't working when juping servers that didn't already exist
-rw-r--r-- | modules/commands/os_jupe.cpp | 5 | ||||
-rw-r--r-- | modules/protocol/inspircd12.cpp | 34 |
2 files changed, 22 insertions, 17 deletions
diff --git a/modules/commands/os_jupe.cpp b/modules/commands/os_jupe.cpp index de6fa76f4..f631bac41 100644 --- a/modules/commands/os_jupe.cpp +++ b/modules/commands/os_jupe.cpp @@ -28,8 +28,10 @@ class CommandOSJupe : public Command if (!IRCD->IsHostValid(jserver) || jserver.find('.') == Anope::string::npos) source.Reply(_("Please use a valid server name when juping.")); - else if (server && (server == Me || server == Me->GetLinks().front())) + else if (server == Me || server == Servers::GetUplink()) source.Reply(_("You can not jupe your Services' pseudoserver or your uplink server.")); + else if (server && server->IsJuped()) + source.Reply(_("You can not jupe an already juped server.")); else { Anope::string rbuf = "Juped by " + source.GetNick() + (!reason.empty() ? ": " + reason : ""); @@ -45,7 +47,6 @@ class CommandOSJupe : public Command Log(LOG_ADMIN, source, this) << "on " << jserver << " (" << rbuf << ")"; } - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp index c4254537a..2c9103702 100644 --- a/modules/protocol/inspircd12.cpp +++ b/modules/protocol/inspircd12.cpp @@ -21,6 +21,8 @@ struct SASLUser static bool sasl = true; static std::list<SASLUser> saslusers; +static Anope::string rsquit_server, rsquit_id; + class ChannelModeFlood : public ChannelModeParam { public: @@ -220,14 +222,19 @@ class InspIRCd12Proto : public IRCDProto /* SERVER services-dev.chatspike.net password 0 :Description here */ void SendServer(const Server *server) anope_override { - if (!server->IsJuped()) + /* if rsquit is set then we are waiting on a squit */ + if (rsquit_id.empty() && rsquit_server.empty()) UplinkSocket::Message() << "SERVER " << server->GetName() << " " << Config->Uplinks[Anope::CurrentUplink].password << " " << server->GetHops() << " " << server->GetSID() << " :" << server->GetDescription(); } void SendSquit(Server *s, const Anope::string &message) anope_override { if (s != Me) + { + rsquit_id = s->GetSID(); + rsquit_server = s->GetName(); UplinkSocket::Message() << "RSQUIT " << s->GetName() << " :" << message; + } else UplinkSocket::Message() << "SQUIT " << s->GetName() << " :" << message; } @@ -1176,18 +1183,16 @@ struct IRCDMessageOperType : IRCDMessage struct IRCDMessageRSQuit : IRCDMessage { - IRCDMessageRSQuit(Module *creator) : IRCDMessage(creator, "RSQUIT", 1) { } + IRCDMessageRSQuit(Module *creator) : IRCDMessage(creator, "RSQUIT", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); } void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override { Server *s = Server::Find(params[0]); + const Anope::string &reason = params.size() > 1 ? params[1] : ""; if (!s) return; - /* On InspIRCd we must send a SQUIT when we recieve RSQUIT for a server we have juped */ - if (s->IsJuped()) - UplinkSocket::Message(Me) << "SQUIT " << s->GetSID() << " :" << (params.size() > 1 ? params[1].c_str() : ""); - + UplinkSocket::Message(Me) << "SQUIT " << s->GetSID() << " :" << reason; s->Delete(s->GetName() + " " + s->GetUplink()->GetName()); } }; @@ -1227,17 +1232,16 @@ struct IRCDMessageSQuit : Message::SQuit void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override { - Server *server = Server::Find(params[0]); - if (server && server->IsJuped()) + if (params[0] == rsquit_id || params[0] == rsquit_server) { - /* It is not possible to recieve a SQUIT for a server we have juped - * unless we have recently sent a RSQUIT. So, this SQUIT is a response - * to the server we just SQUIT off and is not meant for our juped server. - * - * Send the juped server now. - */ + /* squit for a recently squit server, introduce the juped server now */ + Server *s = Server::Find(rsquit_server); + + rsquit_id.clear(); + rsquit_server.clear(); - UplinkSocket::Message() << "SERVER " << server->GetName() << " jupe " << server->GetHops() << " " << server->GetSID() << " :" << server->GetDescription(); + if (s && s->IsJuped()) + IRCD->SendServer(s); } else Message::SQuit::Run(source, params); |