]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/away.cpp
Merge remote/local MODULES output
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / away.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
16 #include "main.h"
17 #include "utils.h"
18 #include "treeserver.h"
19 #include "treesocket.h"
20
21 bool TreeSocket::Away(const std::string &prefix, parameterlist &params)
22 {
23         User* u = ServerInstance->FindNick(prefix);
24         if (!u)
25                 return true;
26         if (params.size())
27         {
28                 FOREACH_MOD(I_OnSetAway, OnSetAway(u, params[params.size() - 1]));
29
30                 if (params.size() > 1)
31                         u->awaytime = atoi(params[0].c_str());
32                 else
33                         u->awaytime = ServerInstance->Time();
34
35                 u->awaymsg = params[params.size() - 1];
36
37                 params[params.size() - 1] = ":" + params[params.size() - 1];
38         }
39         else
40         {
41                 FOREACH_MOD(I_OnSetAway, OnSetAway(u, ""));
42                 u->awaymsg.clear();
43         }
44         Utils->DoOneToAllButSender(prefix,"AWAY",params,u->server);
45         return true;
46 }