]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/kill.cpp
Fix m_chanlog crashing.
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / kill.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #include "inspircd.h"
15 #include "commands/cmd_whois.h"
16 #include "commands/cmd_stats.h"
17 #include "socket.h"
18 #include "wildcard.h"
19 #include "xline.h"
20 #include "transport.h"
21 #include "socketengine.h"
22
23 #include "m_spanningtree/main.h"
24 #include "m_spanningtree/utils.h"
25 #include "m_spanningtree/treeserver.h"
26 #include "m_spanningtree/link.h"
27 #include "m_spanningtree/treesocket.h"
28 #include "m_spanningtree/resolvers.h"
29 #include "m_spanningtree/handshaketimer.h"
30
31 /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */
32
33 bool TreeSocket::RemoteKill(const std::string &prefix, std::deque<std::string> &params)
34 {        
35         if (params.size() != 2)
36                 return true;
37
38         User* who = this->Instance->FindNick(params[0]);
39
40         if (who)
41         {
42                 /* Prepend kill source, if we don't have one */          
43                 if (*(params[1].c_str()) != '[')
44                 {
45                         params[1] = "[" + prefix + "] Killed (" + params[1] +")";
46                 }
47                 std::string reason = params[1];
48                 params[1] = ":" + params[1];
49                 Utils->DoOneToAllButSender(prefix,"KILL",params,prefix);
50                 // NOTE: This is safe with kill hiding on, as RemoteKill is only reached if we have a server prefix.
51                 // in short this is not executed for USERS.
52                 who->Write(":%s KILL %s :%s (%s)", prefix.c_str(), who->nick, prefix.c_str(), reason.c_str());
53                 User::QuitUser(this->Instance,who,reason);
54         }
55         return true;
56 }
57