diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket.h | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 55 |
3 files changed, 69 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 3fdb26875..c8cda1b04 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -409,8 +409,20 @@ int ModuleSpanningTree::HandleSquit(const char** parameters, int pcnt, userrec* } else { + /* to be removed after 1.1.9 */ + if (IS_LOCAL(user)) + user->WriteServ("NOTICE %s :*** WARNING: Using SQUIT to split remote servers is deprecated and will be removed in a future version. Please use RSQUIT instead.",user->nick); + std::deque<std::string> params; + params.push_back(parameters[0]); + params.push_back(std::string(":Server quit by ") + user->GetFullRealHost()); + Utils->DoOneToOne(user->nick, "RSQUIT2", params, parameters[0]); + /* end to be removed after 1.1.9 */ + /* to be INSERTED after 1.1.9 */ + /* if (IS_LOCAL(user)) user->WriteServ("NOTICE %s :*** WARNING: Using SQUIT to split remote servers is deprecated. Please use RSQUIT instead.",user->nick); + */ + /* end to be INSERTED after 1.1.9 */ } } else diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index e3b177002..4c2e3be95 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -294,11 +294,13 @@ class TreeSocket : public InspSocket bool OperQuit(const std::string &prefix, std::deque<std::string> ¶ms); + /* to be removed after 1.1.9 */ /** Remote SQUIT (RSQUIT). Routing works similar to SVSNICK: Route it to the server that the target is connected to locally, * then let that server do the dirty work (squit it!). Example: * A -> B -> C -> D: oper on A squits D, A routes to B, B routes to C, C notices D connected locally, kills it. -- w00t */ bool RemoteSquit(const std::string &prefix, std::deque<std::string> ¶ms); + /* end to be removed after 1.1.9 */ /** SVSJOIN */ diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index d13ea0d89..fadb1ef9c 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -294,6 +294,55 @@ bool TreeSocket::OperQuit(const std::string &prefix, std::deque<std::string> &pa return true; } +/* to be removed after 1.1.9 */ +/* + * Remote SQUIT (RSQUIT). Routing works similar to SVSNICK: Route it to the server that the target is connected to locally, + * then let that server do the dirty work (squit it!). Example: + * A -> B -> C -> D: oper on A squits D, A routes to B, B routes to C, C notices D connected locally, kills it. -- w00t + */ +bool TreeSocket::RemoteSquit(const std::string &prefix, std::deque<std::string> ¶ms) +{ + /* ok.. :w00t RSQUIT jupe.barafranca.com :reason here */ + if (params.size() < 2) + return true; + + TreeServer* s = Utils->FindServerMask(params[0]); + + if (s) + { + if (s == Utils->TreeRoot) + { + this->Instance->SNO->WriteToSnoMask('l',"What the fuck, I recieved a remote SQUIT for myself? :< (from %s", prefix.c_str()); + return true; + } + + TreeSocket* sock = s->GetSocket(); + + if (sock) + { + /* it's locally connected, KILL IT! */ + Instance->SNO->WriteToSnoMask('l',"RSQUIT: Server \002%s\002 removed from network by %s: %s", params[0].c_str(), prefix.c_str(), params[1].c_str()); + sock->Squit(s,"Server quit by " + prefix + ": " + params[1]); + Instance->SE->DelFd(sock); + sock->Close(); + delete sock; + } + else + { + /* route the rsquit */ + params[1] = ":" + params[1]; + Utils->DoOneToOne(prefix, "RSQUIT2", params, params[0]); + } + } + else + { + /* mother fucker! it doesn't exist */ + } + + return true; +} +/* end to be removed after 1.1.9 */ + bool TreeSocket::ServiceJoin(const std::string &prefix, std::deque<std::string> ¶ms) { if (params.size() < 2) @@ -1280,6 +1329,12 @@ bool TreeSocket::ProcessLine(std::string &line) { return this->OperQuit(prefix,params); } + /* to be removed after 1.1.9 */ + else if (command == "RSQUIT2") + { + return this->RemoteSquit(prefix, params); + } + /* end to be removed after 1.1.9 */ else if (command == "IDLE") { return this->Whois(prefix,params); |