diff options
author | Adam <Adam@anope.org> | 2013-07-26 08:45:44 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-07-26 08:45:44 -0400 |
commit | 3dc64bac4d436ba27683270b88c0cc5bfa346acc (patch) | |
tree | aa1dd95d1c5d4618c06cb8662d9d888c0e5793c8 /src/uplink.cpp | |
parent | 2450a64bf4dc55635c9f4c1c829f149dc6621b41 (diff) |
Fix issues with 'Me' related to previous commit
Diffstat (limited to 'src/uplink.cpp')
-rw-r--r-- | src/uplink.cpp | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/src/uplink.cpp b/src/uplink.cpp index 282d8be05..100b58310 100644 --- a/src/uplink.cpp +++ b/src/uplink.cpp @@ -61,42 +61,55 @@ 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() { - if (IRCD && Servers::GetUplink() && Servers::GetUplink()->IsSynced()) + for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it) { - FOREACH_MOD(OnServerDisconnect, ()); + User *u = it->second; - for (user_map::const_iterator it = UserListByNick.begin(); it != UserListByNick.end(); ++it) + if (u->server == Me) { - User *u = it->second; - - if (u->server == Me) + /* 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) { - /* 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; + bi->introduced = false; + bi->Down(); } + else + /* Enforcer client or some other non-service bot */ + u->Quit("Shutting down"); } + } - IRCD->SendSquit(Me, Anope::QuitReason); + User::QuitUsers(); - this->ProcessWrite(); // Write out the last bit - } + FOREACH_MOD(OnServerDisconnect, ()); - if (Me) - 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()); + IRCD->SendSquit(Me, Anope::QuitReason); + Me = NULL; - UplinkSock = NULL; + this->ProcessWrite(); // Write out the last bit - Me->Unsync(); + UplinkSock = NULL; if (Anope::AtTerm()) { |