]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/svspart.cpp
Introduce "X" snomask for remote *:line messages [patch by jackmcbarn]
[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 "socket.h"
16 #include "xline.h"
17 #include "../transport.h"
18 #include "socketengine.h"
19
20 #include "main.h"
21 #include "utils.h"
22 #include "treeserver.h"
23 #include "treesocket.h"
24
25 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
26
27 bool TreeSocket::ServicePart(const std::string &prefix, parameterlist &params)
28 {
29         if (params.size() < 2)
30                 return true;
31
32         std::string reason = "Services forced part";
33
34         if (params.size() == 3)
35                 reason = params[2];
36
37         User* u = this->ServerInstance->FindNick(params[0]);
38         Channel* c = this->ServerInstance->FindChan(params[1]);
39
40         if (u)
41         {
42                 /* only part if it's local, otherwise just pass it on! */
43                 if (IS_LOCAL(u))
44                         if (!c->PartUser(u, reason))
45                                 delete c;
46                 Utils->DoOneToAllButSender(prefix,"SVSPART",params,prefix);
47         }
48
49         return true;
50 }
51