1
0
mirror of https://github.com/anope/anope.git synced 2026-06-26 13:36:38 +02:00

Rethink jupe/squit thing somewhat. Workaround for the inspircd rsquit/squit mess

This commit is contained in:
Adam
2013-07-26 21:40:16 -04:00
parent f0f43cf426
commit fde83f6564
11 changed files with 182 additions and 157 deletions
+21 -40
View File
@@ -61,56 +61,42 @@ void Uplink::Connect()
UplinkSocket::UplinkSocket() : Socket(-1, Config->Uplinks[Anope::CurrentUplink].ipv6), ConnectionSocket(), BufferedSocket()
{
/* Create me */
Configuration::Block *block = Config->GetBlock("serverinfo");
Anope::string id = block->Get<const Anope::string>("id");
if (id.empty())
/* Defalt to a valid ts6 sid if this ircd is ts6 */
id = Servers::TS6_SID_Retrieve();
Me = new Server(NULL, block->Get<const Anope::string>("name"), 0, block->Get<const Anope::string>("description"), id);
for (botinfo_map::const_iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it)
{
BotInfo *bi = it->second;
bi->Up();
}
UplinkSock = this;
}
UplinkSocket::~UplinkSocket()
{
for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
if (IRCD && Servers::GetUplink() && Servers::GetUplink()->IsSynced())
{
User *u = it->second;
FOREACH_MOD(OnServerDisconnect, ());
if (u->server == Me)
for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it)
{
/* Don't use quitmsg here, it may contain information you don't want people to see */
IRCD->SendQuit(u, "Shutting down");
BotInfo* bi = BotInfo::Find(u->nick);
if (bi != NULL)
User *u = it->second;
if (u->server == Me)
{
bi->introduced = false;
bi->Down();
/* Don't use quitmsg here, it may contain information you don't want people to see */
IRCD->SendQuit(u, "Shutting down");
BotInfo* bi = BotInfo::Find(u->nick);
if (bi != NULL)
bi->introduced = false;
}
else
/* Enforcer client or some other non-service bot */
u->Quit("Shutting down");
}
IRCD->SendSquit(Me, Anope::QuitReason);
this->ProcessWrite(); // Write out the last bit
}
User::QuitUsers();
FOREACH_MOD(OnServerDisconnect, ());
IRCD->SendSquit(Me, Anope::QuitReason);
Me = NULL;
this->ProcessWrite(); // Write out the last bit
for (unsigned i = Me->GetLinks().size(); i > 0; --i)
if (!Me->GetLinks()[i - 1]->IsJuped())
Me->GetLinks()[i - 1]->Delete(Me->GetName() + " " + Me->GetLinks()[i - 1]->GetName());
UplinkSock = NULL;
Me->Unsync();
if (Anope::AtTerm())
{
if (static_cast<unsigned>(Anope::CurrentUplink + 1) == Config->Uplinks.size())
@@ -186,12 +172,7 @@ UplinkSocket::Message::~Message()
}
else if (this->user != NULL)
{
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())
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;