diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 15:37:46 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 15:37:46 +0000 |
commit | b1002b7df55f1aec5bfce48ecd07d6d326174c95 (patch) | |
tree | 51ff3df20ce75f2829a636702952188690f5c78a /src/modules/m_spanningtree | |
parent | 62e2d693436a1f0bf96754a61cbc662c198e92bd (diff) |
Add away timestamp to the AWAY message sent server-server
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11664 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r-- | src/modules/m_spanningtree/away.cpp | 46 | ||||
-rw-r--r-- | src/modules/m_spanningtree/compat.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/netburst.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket.h | 3 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 4 |
6 files changed, 63 insertions, 2 deletions
diff --git a/src/modules/m_spanningtree/away.cpp b/src/modules/m_spanningtree/away.cpp new file mode 100644 index 000000000..2aac26bbd --- /dev/null +++ b/src/modules/m_spanningtree/away.cpp @@ -0,0 +1,46 @@ +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * See: http://wiki.inspircd.org/Credits + * + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ + +#include "inspircd.h" + +#include "main.h" +#include "utils.h" +#include "treeserver.h" +#include "treesocket.h" + +bool TreeSocket::Away(const std::string &prefix, parameterlist ¶ms) +{ + User* u = this->ServerInstance->FindNick(prefix); + if (!u) + return true; + if (params.size()) + { + FOREACH_MOD(I_OnSetAway, OnSetAway(u, params[params.size() - 1])); + + if (params.size() > 1) + u->awaytime = atoi(params[0].c_str()); + else + u->awaytime = ServerInstance->Time(); + + u->awaymsg = params[params.size() - 1]; + + params[params.size() - 1] = ":" + params[params.size() - 1]; + } + else + { + FOREACH_MOD(I_OnSetAway, OnSetAway(u, "")); + u->awaymsg.clear(); + } + Utils->DoOneToAllButSender(prefix,"AWAY",params,u->server); + return true; +} diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index b23cf5c02..8a6e6855f 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -69,6 +69,14 @@ void TreeSocket::WriteLine(std::string line) std::string uid = line.substr(b, c - b); line = ":" + ServerInstance->Config->GetSID() + " SVSNICK " + uid + line.substr(b); } + else if (proto_version < 1202 && command == "AWAY") + { + if (b != std::string::npos) + { + std::string::size_type c = line.find(' ', b + 1); + line.erase(b,c-b); + } + } } } diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 9bba4b0d3..7f152a0f5 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -881,12 +881,12 @@ ModResult ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg) if (awaymsg.empty()) { parameterlist params; - params.clear(); Utils->DoOneToMany(user->uuid,"AWAY",params); } else { parameterlist params; + params.push_back(ConvToStr(user->awaytime)); params.push_back(":" + awaymsg); Utils->DoOneToMany(user->uuid,"AWAY",params); } diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index 93e698dd4..951d019ef 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -254,7 +254,7 @@ void TreeSocket::SendUsers(TreeServer* Current) } if (IS_AWAY(u->second)) { - snprintf(data,MAXBUF,":%s AWAY :%s", u->second->uuid.c_str(), u->second->awaymsg.c_str()); + snprintf(data,MAXBUF,":%s AWAY %ld :%s", u->second->uuid.c_str(), (long)u->second->awaytime, u->second->awaymsg.c_str()); this->WriteLine(data); } } diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index 390978791..34d042432 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -291,6 +291,9 @@ class TreeSocket : public BufferedSocket */ bool OperType(const std::string &prefix, parameterlist ¶ms); + /** Remote AWAY */ + bool Away(const std::string &prefix, parameterlist ¶ms); + /** Because Andy insists that services-compatible servers must * implement SVSNICK and SVSJOIN, that's exactly what we do :p */ diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index e76b98568..922e6f784 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -361,6 +361,10 @@ bool TreeSocket::ProcessLine(std::string &line) { return this->OperType(prefix,params); } + else if (command == "AWAY") + { + return this->Away(prefix,params); + } else if (command == "FMODE") { return this->ForceMode(prefix,params); |