]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/cmd_away.cpp
In the grand tradition of huge fucking commits:
[user/henk/code/inspircd.git] / src / cmd_away.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2007 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_away.h"
16
17 extern "C" DllExport Command* init_command(InspIRCd* Instance)
18 {
19         return new cmd_away(Instance);
20 }
21
22 /** Handle /AWAY
23  */
24 CmdResult cmd_away::Handle (const char** parameters, int pcnt, User *user)
25 {
26         if ((pcnt) && (*parameters[0]))
27         {
28                 strlcpy(user->awaymsg,parameters[0],MAXAWAY);
29                 user->WriteServ("306 %s :You have been marked as being away",user->nick);
30                 FOREACH_MOD(I_OnSetAway,OnSetAway(user));
31         }
32         else
33         {
34                 *user->awaymsg = 0;
35                 user->WriteServ("305 %s :You are no longer marked as being away",user->nick);
36                 FOREACH_MOD(I_OnCancelAway,OnCancelAway(user));
37         }
38         return CMD_SUCCESS;
39 }