]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/svspart.cpp
8d95395ed18555b4d4e9190e191c52f701e627c6
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / svspart.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
6  * See: http://wiki.inspircd.org/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 "xline.h"
19 #include "../transport.h"
20 #include "socketengine.h"
21
22 #include "main.h"
23 #include "utils.h"
24 #include "treeserver.h"
25 #include "treesocket.h"
26
27 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
28
29 bool TreeSocket::ServicePart(const std::string &prefix, std::deque<std::string> &params)
30 {
31         if (params.size() < 2)
32                 return true;
33
34         std::string reason = "Services forced part";
35
36         if (params.size() == 3)
37                 reason = params[2];
38
39         User* u = this->ServerInstance->FindNick(params[0]);
40         Channel* c = this->ServerInstance->FindChan(params[1]);
41
42         if (u)
43         {
44                 /* only part if it's local, otherwise just pass it on! */
45                 if (IS_LOCAL(u))
46                         if (!c->PartUser(u, reason))
47                                 delete c;
48                 Utils->DoOneToAllButSender(prefix,"SVSPART",params,prefix);
49         }
50
51         return true;
52 }
53