]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_setname.cpp
Added remote rehash (even to a mask)
[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 using namespace std;
18
19 #include <stdio.h>
20 #include <string>
21 #include "users.h"
22 #include "channels.h"
23 #include "modules.h"
24 #include "helperfuncs.h"
25
26 /* $ModDesc: Provides support for the SETNAME command */
27
28 Server *Srv;
29          
30 void handle_setname(char **parameters, int pcnt, userrec *user)
31 {
32         std::string line = "";
33         for (int i = 0; i < pcnt-1; i++)
34         {
35                 line = line + std::string(parameters[i]);
36         }
37         line = line + std::string(parameters[pcnt-1]);
38         Srv->ChangeGECOS(user,line);
39 }
40
41
42 class ModuleSetName : public Module
43 {
44  public:
45         ModuleSetName()
46         {
47                 Srv = new Server;
48                 Srv->AddCommand("SETNAME",handle_setname,0,1,"m_setname.so");
49         }
50         
51         virtual ~ModuleSetName()
52         {
53                 delete Srv;
54         }
55         
56         virtual Version GetVersion()
57         {
58                 return Version(1,0,0,1,VF_VENDOR);
59         }
60         
61 };
62
63 // stuff down here is the module-factory stuff. For basic modules you can ignore this.
64
65 class ModuleSetNameFactory : public ModuleFactory
66 {
67  public:
68         ModuleSetNameFactory()
69         {
70         }
71         
72         ~ModuleSetNameFactory()
73         {
74         }
75         
76         virtual Module * CreateModule()
77         {
78                 return new ModuleSetName;
79         }
80         
81 };
82
83
84 extern "C" void * init_module( void )
85 {
86         return new ModuleSetNameFactory;
87 }
88