diff options
author | Adam <Adam@anope.org> | 2010-08-28 23:17:33 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-08-28 23:17:33 -0400 |
commit | 4319319f979c3b288f8f355915aa33541721810c (patch) | |
tree | d13a91175ad1e0ca9ce56a1f0338e6e5e1cfe875 | |
parent | e820e1af0d01011dbe9d91d2971cc3518f7f3d42 (diff) |
Burst back our juped servers if we disconnect
-rw-r--r-- | include/servers.h | 4 | ||||
-rw-r--r-- | modules/core/os_jupe.cpp | 3 | ||||
-rw-r--r-- | src/init.cpp | 10 | ||||
-rw-r--r-- | src/main.cpp | 4 | ||||
-rw-r--r-- | src/servers.cpp | 8 |
5 files changed, 22 insertions, 7 deletions
diff --git a/include/servers.h b/include/servers.h index 4abe168db..514660286 100644 --- a/include/servers.h +++ b/include/servers.h @@ -66,6 +66,7 @@ extern CoreExport CapabInfo Capab_Info[]; */ enum ServerFlag { + SERVER_NONE, /* Server is syncing */ SERVER_SYNCING, /* This server was juped */ @@ -100,8 +101,9 @@ class CoreExport Server : public virtual Base, public Flags<ServerFlag> * @param hops Hops from services server * @param description Server rdescription * @param sid Server sid/numeric + * @param flag An optional server flag */ - Server(Server *uplink, const Anope::string &name, unsigned hops, const Anope::string &description, const Anope::string &sid); + Server(Server *uplink, const Anope::string &name, unsigned hops, const Anope::string &description, const Anope::string &sid, ServerFlag flag = SERVER_NONE); /** Destructor */ diff --git a/modules/core/os_jupe.cpp b/modules/core/os_jupe.cpp index 8cb78cfd5..59ba88179 100644 --- a/modules/core/os_jupe.cpp +++ b/modules/core/os_jupe.cpp @@ -35,8 +35,7 @@ class CommandOSJupe : public Command Anope::string rbuf = "Juped by " + u->nick + (!reason.empty() ? ": " + reason : ""); if (server) ircdproto->SendSquit(jserver, rbuf); - Server *juped_server = new Server(Me, jserver, 1, rbuf, ircd->ts6 ? ts6_sid_retrieve() : ""); - juped_server->SetFlag(SERVER_JUPED); + Server *juped_server = new Server(Me, jserver, 1, rbuf, ircd->ts6 ? ts6_sid_retrieve() : "", SERVER_JUPED); ircdproto->SendServer(juped_server); if (Config->WallOSJupe) diff --git a/src/init.cpp b/src/init.cpp index da3c30587..aae8e9eb2 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -30,6 +30,16 @@ void introduce_user(const Anope::string &user) if (user.empty()) ircdproto->SendBOB(); + + for (unsigned i = 0; i < Me->GetLinks().size(); ++i) + { + Server *s = Me->GetLinks()[i]; + + if (s->HasFlag(SERVER_JUPED)) + { + ircdproto->SendServer(s); + } + } /* We make the bots go online */ for (botinfo_map::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it) diff --git a/src/main.cpp b/src/main.cpp index 79dcd3b00..64e755b7c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -541,7 +541,9 @@ int main(int ac, char **av, char **envp) } Me->SetFlag(SERVER_SYNCING); - Me->ClearLinks(); + for (unsigned i = Me->GetLinks().size(); i > 0; --i) + if (!Me->GetLinks()[i - 1]->HasFlag(SERVER_JUPED)) + delete Me->GetLinks()[i - 1]; unsigned j = 0; for (; j < (Config->MaxRetries ? Config->MaxRetries : j + 1); ++j) diff --git a/src/servers.cpp b/src/servers.cpp index d817ee94f..4b843411c 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -55,10 +55,12 @@ Flags<CapabType, CAPAB_END> Capab; * @param hops Hops from services server * @param description Server rdescription * @param sid Server sid/numeric + * @param flag An optional server flag */ -Server::Server(Server *uplink, const Anope::string &name, unsigned hops, const Anope::string &description, const Anope::string &sid) : Name(name), Hops(hops), Description(description), SID(sid), UplinkServer(uplink) +Server::Server(Server *uplink, const Anope::string &name, unsigned hops, const Anope::string &description, const Anope::string &sid, ServerFlag flag) : Name(name), Hops(hops), Description(description), SID(sid), UplinkServer(uplink) { - SetFlag(SERVER_SYNCING); + this->SetFlag(SERVER_SYNCING); + this->SetFlag(flag); Log(this, "connect") << "uplinked to " << (this->UplinkServer ? this->UplinkServer->GetName() : "no uplink") << " connected to the network"; @@ -68,7 +70,7 @@ Server::Server(Server *uplink, const Anope::string &name, unsigned hops, const A this->UplinkServer->AddLink(this); /* Check to be sure the uplink server only has one uplink, otherwise we introduce our clients if we jupe servers */ - if (Me == this->UplinkServer && this->UplinkServer->GetLinks().size() == 1) + if (Me == this->UplinkServer && !this->HasFlag(SERVER_JUPED)) { /* Bring in our pseudo-clients */ introduce_user(""); |