]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/commands/cmd_quit.cpp
NEVER use the two-param assign unless you want your string padding to len bytes with \0!
[user/henk/code/inspircd.git] / src / commands / cmd_quit.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_quit.h"
16
17
18
19 extern "C" DllExport Command* init_command(InspIRCd* Instance)
20 {
21         return new CommandQuit(Instance);
22 }
23
24 CmdResult CommandQuit::Handle (const std::vector<std::string>& parameters, User *user)
25 {
26
27         std::string quitmsg;
28
29         if (IS_LOCAL(user))
30         {
31                 if (*ServerInstance->Config->FixedQuit)
32                         quitmsg = ServerInstance->Config->FixedQuit;
33                 else
34                         quitmsg = parameters.size() ?
35                                 ServerInstance->Config->PrefixQuit + std::string(parameters[0]) + ServerInstance->Config->SuffixQuit
36                                 : "Client exited";
37         }
38         else
39                 quitmsg = parameters.size() ? parameters[0] : "Client exited";
40
41         ServerInstance->Users->QuitUser(user, quitmsg);
42
43         return CMD_SUCCESS;
44 }
45