]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_setname.cpp
Last conversions
[user/henk/code/inspircd.git] / src / modules / m_setname.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 "users.h"
16 #include "channels.h"
17 #include "modules.h"
18
19 /* $ModDesc: Provides support for the SETNAME command */
20
21
22
23 class cmd_setname : public command_t
24 {
25  public:
26         cmd_setname (InspIRCd* Instance) : command_t(Instance,"SETNAME", 0, 1)
27         {
28                 this->source = "m_setname.so";
29                 syntax = "<new-gecos>";
30         }
31
32         CmdResult Handle (const char** parameters, int pcnt, userrec *user)
33         {
34                 std::string line;
35                 for (int i = 0; i < pcnt-1; i++)
36                 {
37                         line = line + std::string(parameters[i]) + " ";
38                 }
39                 line = line + std::string(parameters[pcnt-1]);
40                 user->ChangeName(line.c_str());
41
42                 return CMD_SUCCESS;
43         }
44 };
45
46
47 class ModuleSetName : public Module
48 {
49         cmd_setname*    mycommand;
50  public:
51         ModuleSetName(InspIRCd* Me)
52                 : Module(Me)
53         {
54                 
55                 mycommand = new cmd_setname(ServerInstance);
56                 ServerInstance->AddCommand(mycommand);
57         }
58         
59         virtual ~ModuleSetName()
60         {
61         }
62         
63         virtual Version GetVersion()
64         {
65                 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
66         }
67         
68 };
69
70 MODULE_INIT(ModuleSetName);