1
0
mirror of https://github.com/anope/anope.git synced 2026-07-10 22:03:13 +02:00

Interally quit servers when juped

This commit is contained in:
Adam
2013-07-26 07:36:17 -04:00
parent b48293a632
commit 2450a64bf4
5 changed files with 15 additions and 6 deletions
+3 -1
View File
@@ -33,9 +33,11 @@ class CommandOSJupe : public Command
else
{
Anope::string rbuf = "Juped by " + source.GetNick() + (!reason.empty() ? ": " + reason : "");
/* Generate the new sid before quitting the old server, so they can't collide */
Anope::string sid = Servers::TS6_SID_Retrieve();
if (server)
IRCD->SendSquit(server, rbuf);
Server *juped_server = new Server(Me, jserver, 1, rbuf, Servers::TS6_SID_Retrieve(), true);
Server *juped_server = new Server(Me, jserver, 1, rbuf, sid, true);
IRCD->SendServer(juped_server);
Log(LOG_ADMIN, source, this) << "on " << jserver << " (" << rbuf << ")";
+1 -3
View File
@@ -375,12 +375,10 @@ void SQuit::Run(MessageSource &source, const std::vector<Anope::string> &params)
if (!s)
{
Log() << "SQUIT for nonexistent server " << params[0];
Log(LOG_DEBUG) << "SQUIT for nonexistent server " << params[0];
return;
}
FOREACH_MOD(OnServerQuit, (s));
s->Delete(s->GetName() + " " + s->GetUplink()->GetName());
}
+2 -1
View File
@@ -263,7 +263,8 @@ void IRCDProto::SendGlobops(const BotInfo *source, const char *fmt, ...)
void IRCDProto::SendSquit(Server *s, const Anope::string &message)
{
UplinkSocket::Message() << "SQUIT " << s->GetName() << " :" << message;
UplinkSocket::Message() << "SQUIT " << s->GetSID() << " :" << message;
s->Delete(message);
}
void IRCDProto::SendNickChange(const User *u, const Anope::string &newnick)
+3
View File
@@ -178,7 +178,10 @@ const Anope::string &Server::GetDescription() const
void Server::SetSID(const Anope::string &nsid)
{
if (!this->sid.empty())
throw CoreException("Server already has an id?");
this->sid = nsid;
Servers::ByID[nsid] = this;
}
const Anope::string &Server::GetSID() const
+6 -1
View File
@@ -173,7 +173,12 @@ UplinkSocket::Message::~Message()
}
else if (this->user != NULL)
{
if (this->user->server != Me && !this->user->server->IsJuped())
if (this->user->server == NULL)
{
Log(LOG_DEBUG) << "Attempted to send \"" << this->buffer.str() << "\" from " << this->user->nick << " who has no server (I'm not introduced?)";
return;
}
else if (this->user->server != Me && !this->user->server->IsJuped())
{
Log(LOG_DEBUG) << "Attempted to send \"" << this->buffer.str() << "\" from " << this->user->nick << " who is not from me?";
return;