1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
17 #include "configreader.h"
19 #include "commands/cmd_user.h"
23 extern "C" command_t* init_command(InspIRCd* Instance)
25 return new cmd_user(Instance);
28 void cmd_user::Handle (const char** parameters, int pcnt, userrec *user)
30 if (user->registered < REG_NICKUSER)
32 if (!ServerInstance->IsIdent(parameters[0])) {
33 // This kinda Sucks, According to the RFC thou, its either this,
34 // or "You have already registered" :p -- Craig
35 user->WriteServ("461 %s USER :Not enough parameters",user->nick);
38 /* We're not checking ident, but I'm not sure I like the idea of '~' prefixing.. */
39 /* XXX - The ident field is IDENTMAX+2 in size to account for +1 for the optional
40 * ~ character, and +1 for null termination, therefore we can safely use up to
43 strlcpy(user->ident, parameters[0], IDENTMAX);
44 strlcpy(user->fullname,parameters[3],MAXGECOS);
45 user->registered = (user->registered | REG_USER);
50 user->WriteServ("462 %s :You may not reregister",user->nick);
53 /* parameters 2 and 3 are local and remote hosts, ignored when sent by client connection */
54 if (user->registered == REG_NICKUSER)
56 /* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
57 FOREACH_MOD(I_OnUserRegister,OnUserRegister(user));
58 //ConnectUser(user,NULL);