]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/svspart.cpp
Always deny invite to users below halfop status, move OnUserPreInvite up to above...
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / svspart.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/treesocket.h"
27
28 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
29
30 bool TreeSocket::ServicePart(const std::string &prefix, std::deque<std::string> &params)
31 {
32         if (params.size() < 2)
33                 return true;
34
35         std::string reason = "Services forced part";
36
37         if (params.size() == 3)
38                 reason = params[2];
39
40         User* u = this->Instance->FindNick(params[0]);
41         Channel* c = this->Instance->FindChan(params[1]);
42
43         if (u)
44         {
45                 /* only part if it's local, otherwise just pass it on! */
46                 if (IS_LOCAL(u))
47                         if (!c->PartUser(u, reason))
48                                 delete c;
49                 Utils->DoOneToAllButSender(prefix,"SVSPART",params,prefix);
50         }
51
52         return true;
53 }
54