]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_setname.cpp
Added new modules m_chghost, m_sethost, m_setname
[user/henk/code/inspircd.git] / src / modules / m_setname.cpp
1 /*
2  *  SETNAME module for InspIRCD
3  *  Author: brain
4  *  Version: 1.0.0.0
5  *
6  *  Syntax: /SETNAME [new name]
7  *  Changes the user's GECOS who issues the command
8  *  
9  */
10
11 #include <stdio.h>
12 #include <string>
13 #include "users.h"
14 #include "channels.h"
15 #include "modules.h"
16
17 /* $ModDesc: Provides support for the SETNAME command */
18
19 Server *Srv;
20          
21 void handle_setname(char **parameters, int pcnt, userrec *user)
22 {
23         std::string = "";
24         for (int i = 0; i < pcnt-1; i++)
25         {
26                 line = line + std::string(parameters[i]);
27         }
28         line = line + std::string(parameters[pcnt-1]);
29         strncpy(user->fullname,parameters[0],127);
30 }
31
32
33 class ModuleSetName : public Module
34 {
35  public:
36         ModuleSetName()
37         {
38                 Srv = new Server;
39                 Srv->AddCommand("SETNAME",handle_setname,0,1);
40         }
41         
42         virtual ~ModuleSetName()
43         {
44                 delete Srv;
45         }
46         
47         virtual Version GetVersion()
48         {
49                 return Version(1,0,0,0);
50         }
51         
52 };
53
54 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
55
56 class ModuleSetNameFactory : public ModuleFactory
57 {
58  public:
59         ModuleSetNameFactory()
60         {
61         }
62         
63         ~ModuleSetNameFactory()
64         {
65         }
66         
67         virtual Module * CreateModule()
68         {
69                 return new ModuleSetName;
70         }
71         
72 };
73
74
75 extern "C" void * init_module( void )
76 {
77         return new ModuleSetNameFactory;
78 }
79