]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/cmd_user.cpp
Put some client quit stuff in cmd_quit into the Qq snomasks properly
[user/henk/code/inspircd.git] / src / cmd_user.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd is copyright (C) 2002-2006 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 "configreader.h"
18 #include "users.h"
19 #include "commands/cmd_user.h"
20
21 void cmd_user::Handle (const char** parameters, int pcnt, userrec *user)
22 {
23         if (user->registered < REG_NICKUSER)
24         {
25                 if (!ServerInstance->IsIdent(parameters[0])) {
26                         // This kinda Sucks, According to the RFC thou, its either this,
27                         // or "You have already registered" :p -- Craig
28                         user->WriteServ("461 %s USER :Not enough parameters",user->nick);
29                 }
30                 else {
31                         /* We're not checking ident, but I'm not sure I like the idea of '~' prefixing.. */
32                         /* XXX - The ident field is IDENTMAX+2 in size to account for +1 for the optional
33                          * ~ character, and +1 for null termination, therefore we can safely use up to
34                          * IDENTMAX here.
35                          */
36                         strlcpy(user->ident, parameters[0], IDENTMAX);
37                         strlcpy(user->fullname,parameters[3],MAXGECOS);
38                         user->registered = (user->registered | REG_USER);
39                 }
40         }
41         else
42         {
43                 user->WriteServ("462 %s :You may not reregister",user->nick);
44                 return;
45         }
46         /* parameters 2 and 3 are local and remote hosts, ignored when sent by client connection */
47         if (user->registered == REG_NICKUSER)
48         {
49                 /* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
50                 FOREACH_MOD(I_OnUserRegister,OnUserRegister(user));
51                 //ConnectUser(user,NULL);
52         }
53 }