]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_setname.cpp
Moved a ton of functions into helperfuncs.h to speed up recompiles
[user/henk/code/inspircd.git] / src / modules / m_setname.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
6  *                       E-mail:
7  *                <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *     
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *            the file COPYING for details.
13  *
14  * ---------------------------------------------------
15  */
16
17 #include <stdio.h>
18 #include <string>
19 #include "users.h"
20 #include "channels.h"
21 #include "modules.h"
22 #include "helperfuncs.h"
23
24 /* $ModDesc: Provides support for the SETNAME command */
25
26 Server *Srv;
27          
28 void handle_setname(char **parameters, int pcnt, userrec *user)
29 {
30         std::string line = "";
31         for (int i = 0; i < pcnt-1; i++)
32         {
33                 line = line + std::string(parameters[i]);
34         }
35         line = line + std::string(parameters[pcnt-1]);
36         Srv->ChangeGECOS(user,line);
37 }
38
39
40 class ModuleSetName : public Module
41 {
42  public:
43         ModuleSetName()
44         {
45                 Srv = new Server;
46                 Srv->AddCommand("SETNAME",handle_setname,0,1,"m_setname.so");
47         }
48         
49         virtual ~ModuleSetName()
50         {
51                 delete Srv;
52         }
53         
54         virtual Version GetVersion()
55         {
56                 return Version(1,0,0,1,VF_VENDOR);
57         }
58         
59 };
60
61 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
62
63 class ModuleSetNameFactory : public ModuleFactory
64 {
65  public:
66         ModuleSetNameFactory()
67         {
68         }
69         
70         ~ModuleSetNameFactory()
71         {
72         }
73         
74         virtual Module * CreateModule()
75         {
76                 return new ModuleSetName;
77         }
78         
79 };
80
81
82 extern "C" void * init_module( void )
83 {
84         return new ModuleSetNameFactory;
85 }
86