summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-08-18 13:48:31 +0200
committerattilamolnar <attilamolnar@hush.com>2013-08-18 13:48:31 +0200
commitb395c59997debe3827a39ec23cba54465d2aaf6a (patch)
tree728da998d74cfa1aa8988ae010224b27874718a4 /src/modules/m_spanningtree
parent02267976f636e3c4fffc8732a949b4777a771ca2 (diff)
m_spanningtree Propagate oper-only quit reason using METADATA, remove OPERQUIT
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/compat.cpp26
-rw-r--r--src/modules/m_spanningtree/main.cpp7
-rw-r--r--src/modules/m_spanningtree/operquit.cpp39
-rw-r--r--src/modules/m_spanningtree/treesocket.h4
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp4
5 files changed, 23 insertions, 57 deletions
diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp
index 41cabbc93..0fc837beb 100644
--- a/src/modules/m_spanningtree/compat.cpp
+++ b/src/modules/m_spanningtree/compat.cpp
@@ -93,7 +93,7 @@ void TreeSocket::WriteLine(std::string line)
return;
else if (command == "METADATA")
{
- // Drop TS for channel METADATA
+ // Drop TS for channel METADATA, translate METADATA operquit into an OPERQUIT command
// :sid METADATA #target TS extname ...
// A B C D
if (b == std::string::npos)
@@ -103,15 +103,20 @@ void TreeSocket::WriteLine(std::string line)
if (c == std::string::npos)
return;
+ std::string::size_type d = line.find(' ', c + 1);
+ if (d == std::string::npos)
+ return;
+
if (line[b + 1] == '#')
{
// We're sending channel metadata
- std::string::size_type d = line.find(' ', c + 1);
- if (d == std::string::npos)
- return;
-
line.erase(c, d-c);
}
+ else if (line.substr(c, d-c) == " operquit")
+ {
+ // ":22D METADATA 22DAAAAAX operquit :message" -> ":22DAAAAAX OPERQUIT :message"
+ line = ":" + line.substr(b+1, c-b) + "OPERQUIT" + line.substr(d);
+ }
}
else if (command == "FTOPIC")
{
@@ -246,6 +251,17 @@ bool TreeSocket::PreProcessOldProtocolMessage(User*& who, std::string& cmd, std:
{
cmd = "MODE";
}
+ else if (cmd == "OPERQUIT")
+ {
+ // Translate OPERQUIT into METADATA
+ if (params.empty())
+ return false;
+
+ cmd = "METADATA";
+ params.insert(params.begin(), who->uuid);
+ params.insert(params.begin()+1, "operquit");
+ who = MyRoot->ServerUser;
+ }
return true; // Passthru
}
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index a49383523..7bbe5fbad 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -597,11 +597,8 @@ void ModuleSpanningTree::OnUserQuit(User* user, const std::string &reason, const
parameterlist params;
if (oper_message != reason)
- {
- params.push_back(":"+oper_message);
- Utils->DoOneToMany(user->uuid,"OPERQUIT",params);
- }
- params.clear();
+ ServerInstance->PI->SendMetaData(user, "operquit", oper_message);
+
params.push_back(":"+reason);
Utils->DoOneToMany(user->uuid,"QUIT",params);
}
diff --git a/src/modules/m_spanningtree/operquit.cpp b/src/modules/m_spanningtree/operquit.cpp
deleted file mode 100644
index 6ef1de25d..000000000
--- a/src/modules/m_spanningtree/operquit.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * InspIRCd -- Internet Relay Chat Daemon
- *
- * Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
- *
- * This file is part of InspIRCd. InspIRCd is free software: you can
- * redistribute it and/or modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation, version 2.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "inspircd.h"
-#include "treesocket.h"
-#include "utils.h"
-
-bool TreeSocket::OperQuit(const std::string &prefix, parameterlist &params)
-{
- if (params.size() < 1)
- return true;
-
- User* u = ServerInstance->FindUUID(prefix);
-
- if ((u) && (!IS_SERVER(u)))
- {
- ServerInstance->OperQuit.set(u, params[0]);
- params[0] = ":" + params[0];
- Utils->DoOneToAllButSender(prefix,"OPERQUIT",params,prefix);
- }
- return true;
-}
-
diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h
index ba22e2841..88204319c 100644
--- a/src/modules/m_spanningtree/treesocket.h
+++ b/src/modules/m_spanningtree/treesocket.h
@@ -255,10 +255,6 @@ class TreeSocket : public BufferedSocket
*/
void Encap(User* who, parameterlist &params);
- /** OPERQUIT command
- */
- bool OperQuit(const std::string &prefix, parameterlist &params);
-
/** PONG
*/
bool LocalPong(const std::string &prefix, parameterlist &params);
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index f2ea0808f..4995f6cb7 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -357,10 +357,6 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command,
{
this->ForceNick(prefix,params);
}
- else if (command == "OPERQUIT")
- {
- this->OperQuit(prefix,params);
- }
else if (command == "IDLE")
{
this->Whois(prefix,params);