]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/commands/cmd_quit.cpp
Remove now-unused quitmsg/operquitmsg fields from User
[user/henk/code/inspircd.git] / src / commands / cmd_quit.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 "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         std::string* operquit;
42         if (user->GetExt("operquit", operquit))
43         {
44                 ServerInstance->Users->QuitUser(user, quitmsg, operquit->c_str());
45                 delete operquit;
46         }
47         else
48         {
49                 ServerInstance->Users->QuitUser(user, quitmsg);
50         }
51
52         return CMD_SUCCESS;
53 }
54