summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree/away.cpp46
-rw-r--r--src/modules/m_spanningtree/compat.cpp8
-rw-r--r--src/modules/m_spanningtree/main.cpp2
-rw-r--r--src/modules/m_spanningtree/netburst.cpp2
-rw-r--r--src/modules/m_spanningtree/treesocket.h3
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp4
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 &params)
+{
+ 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 &params);
+ /** Remote AWAY */
+ bool Away(const std::string &prefix, parameterlist &params);
+
/** 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);