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