From 8d395f8c46ca9f61710a6c30e2e24c0b9627d2e8 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 2 Nov 2007 20:13:10 +0000 Subject: Implement DELLINE, allow both DELLINE and ADDLINE to take a server OR client origin git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8468 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/treesocket2.cpp | 31 ++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'src/modules/m_spanningtree/treesocket2.cpp') diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 914de861f..5f3f11fc3 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -532,18 +532,20 @@ bool TreeSocket::AddLine(const std::string &prefix, std::deque &par xl->SetCreateTime(atoi(params[3].c_str())); if (Instance->XLines->AddLine(xl,NULL)) { - if (xl->expiry) + if (xl->duration) { - this->Instance->SNO->WriteToSnoMask('x',"%s Added %s%s on %s to expire on %s (%s).",prefix.c_str(),params[0].c_str(),params[0].length() == 1 ? "LINE" : "", + this->Instance->SNO->WriteToSnoMask('x',"%s added %s%s on %s to expire on %s (%s).",prefix.c_str(),params[0].c_str(),params[0].length() == 1 ? "LINE" : "", params[1].c_str(),Instance->TimeString(xl->expiry).c_str(),params[5].c_str()); } else { - this->Instance->SNO->WriteToSnoMask('x',"%s Added permenant %s%s on %s (%s).",prefix.c_str(),params[0].c_str(),params[0].length() == 1 ? "LINE" : "", + this->Instance->SNO->WriteToSnoMask('x',"%s added permenant %s%s on %s (%s).",prefix.c_str(),params[0].c_str(),params[0].length() == 1 ? "LINE" : "", params[1].c_str(),params[5].c_str()); } params[5] = ":" + params[5]; - Utils->DoOneToAllButSender(prefix,"ADDLINE",params,prefix); + + User* u = Instance->FindNick(prefix); + Utils->DoOneToAllButSender(prefix, "ADDLINE", params, u ? u->server : prefix); } else delete xl; @@ -556,6 +558,23 @@ bool TreeSocket::AddLine(const std::string &prefix, std::deque &par return true; } +bool TreeSocket::DelLine(const std::string &prefix, std::deque ¶ms) +{ + if (params.size() < 2) + return true; + + User* user = Instance->FindNick(prefix); + + /* NOTE: No check needed on 'user', this function safely handles NULL */ + if (Instance->XLines->DelLine(params[0].c_str(), params[1], user)) + { + this->Instance->SNO->WriteToSnoMask('x',"%s removed %s%s on %s.", prefix.c_str(), + params[0].c_str(), params[0].length() == 1 ? "LINE" : "", params[1].c_str()); + Utils->DoOneToAllButSender(prefix,"DELLINE", params, prefix); + } + return true; +} + bool TreeSocket::ChangeName(const std::string &prefix, std::deque ¶ms) { if (params.size() < 1) @@ -1363,6 +1382,10 @@ bool TreeSocket::ProcessLine(std::string &line) Utils->SetRemoteBursting(ServerSource, false); return this->AddLine(prefix,params); } + else if (command == "DELLINE") + { + return this->DelLine(prefix,params); + } else if (command == "SVSNICK") { return this->ForceNick(prefix,params); -- cgit v1.3.1-10-gc9f91