summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree/save.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 15:37:16 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-02 15:37:16 +0000
commit789fc05c20bf4a088194075c43c606c6a3a40696 (patch)
tree5bbc5a900b014c2b5516a26acfd59bfeb9c31aa0 /src/modules/m_spanningtree/save.cpp
parentbec20ca4531c5a6634a8deb991396ecd22aeb644 (diff)
Add SAVE s2s protocol command
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11660 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree/save.cpp')
-rw-r--r--src/modules/m_spanningtree/save.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree/save.cpp b/src/modules/m_spanningtree/save.cpp
new file mode 100644
index 000000000..25f811267
--- /dev/null
+++ b/src/modules/m_spanningtree/save.cpp
@@ -0,0 +1,52 @@
+/* +------------------------------------+
+ * | 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 "commands/cmd_whois.h"
+#include "commands/cmd_stats.h"
+#include "socket.h"
+#include "xline.h"
+#include "../transport.h"
+#include "socketengine.h"
+
+#include "main.h"
+#include "utils.h"
+#include "treeserver.h"
+#include "treesocket.h"
+
+/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
+
+/**
+ * SAVE command - force nick change to UID on timestamp match
+ */
+bool TreeSocket::ForceNick(const std::string &prefix, parameterlist &params)
+{
+ if (params.size() < 2)
+ return true;
+
+ User* u = this->ServerInstance->FindNick(params[0]);
+ time_t ts = atol(params[1].c_str());
+
+ if (u && u->age == ts)
+ {
+ Utils->DoOneToAllButSender(prefix,"SAVE",params,prefix);
+
+ if (!u->ForceNickChange(u->uuid.c_str()))
+ {
+ this->ServerInstance->Users->QuitUser(u, "Nickname collision");
+ }
+ }
+
+ return true;
+}
+