From 38ca8be9a3881a3cb3cf6864e67b779ffbab6874 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 15 Mar 2007 17:37:25 +0000 Subject: Add third parameter to OnUserQuit (quit reason for opers only) - bump api version Add SetOperQuit and GetOperQuit methods to userrec Add OPERQUIT command to protocol - bump protocol version All this is to properly allow hidebans etc to work properly git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6675 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/main.cpp | 9 ++++++++- src/modules/m_spanningtree/main.h | 4 ++-- src/modules/m_spanningtree/treesocket.h | 2 ++ src/modules/m_spanningtree/treesocket2.cpp | 19 +++++++++++++++++++ 4 files changed, 31 insertions(+), 3 deletions(-) (limited to 'src/modules/m_spanningtree') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 31f8a1f10..1f2509d4e 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -904,11 +904,18 @@ void ModuleSpanningTree::OnUserConnect(userrec* user) } } -void ModuleSpanningTree::OnUserQuit(userrec* user, const std::string &reason) +void ModuleSpanningTree::OnUserQuit(userrec* user, const std::string &reason, const std::string &oper_message) { if ((IS_LOCAL(user)) && (user->registered == REG_ALL)) { std::deque params; + + if (oper_message != reason) + { + params.push_back(":"+oper_message); + Utils->DoOneToMany(user->nick,"OPERQUIT",params); + } + params.clear(); params.push_back(":"+reason); Utils->DoOneToMany(user->nick,"QUIT",params); } diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index da0860eac..4bf11ddd7 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -13,7 +13,7 @@ * Failure to document your protocol changes will result in a painfully * painful death by pain. You have been warned. */ -const long ProtocolVersion = 1104; +const long ProtocolVersion = 1105; /** Forward declarations */ @@ -137,7 +137,7 @@ class ModuleSpanningTree : public Module virtual void OnChangeName(userrec* user, const std::string &gecos); virtual void OnUserPart(userrec* user, chanrec* channel, const std::string &partmessage); virtual void OnUserConnect(userrec* user); - virtual void OnUserQuit(userrec* user, const std::string &reason); + virtual void OnUserQuit(userrec* user, const std::string &reason, const std::string &oper_message); virtual void OnUserPostNick(userrec* user, const std::string &oldnick); virtual void OnUserKick(userrec* source, userrec* user, chanrec* chan, const std::string &reason); virtual void OnRemoteKill(userrec* source, userrec* dest, const std::string &reason); diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index 52496a4ef..5a5ec52f8 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -240,6 +240,8 @@ class TreeSocket : public InspSocket */ bool ForceNick(const std::string &prefix, std::deque ¶ms); + bool OperQuit(const std::string &prefix, std::deque ¶ms); + /** 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 diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index fe56ea1bf..8bb404a45 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -207,6 +207,21 @@ bool TreeSocket::ForceNick(const std::string &prefix, std::deque &p return true; } +bool TreeSocket::OperQuit(const std::string &prefix, std::deque ¶ms) +{ + if (params.size() < 1) + return true; + + userrec* u = this->Instance->FindNick(prefix); + + if (u) + { + Utils->DoOneToAllButSender(prefix,"OPERQUIT",params,prefix); + u->SetOperQuit(params[0]); + } + return true; +} + /* * 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: @@ -1157,6 +1172,10 @@ bool TreeSocket::ProcessLine(std::string &line) } return this->ForceNick(prefix,params); } + else if (command == "OPERQUIT") + { + return this->OperQuit(prefix,params); + } else if (command == "RSQUIT") { return this->RemoteSquit(prefix, params); -- cgit v1.2.3