1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
14 #include "configreader.h"
16 #include "commands/cmd_user.h"
20 extern "C" command_t* init_command(InspIRCd* Instance)
22 return new cmd_user(Instance);
25 CmdResult cmd_user::Handle (const char** parameters, int pcnt, userrec *user)
27 /* A user may only send the USER command once */
28 if (!(user->registered & REG_USER))
30 if (!ServerInstance->IsIdent(parameters[0])) {
31 // This kinda Sucks, According to the RFC thou, its either this,
32 // or "You have already registered" :p -- Craig
33 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)
57 /* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
58 if (ServerInstance->next_call > ServerInstance->Time() + ServerInstance->Config->dns_timeout)
59 ServerInstance->next_call = ServerInstance->Time() + ServerInstance->Config->dns_timeout;
60 FOREACH_RESULT(I_OnUserRegister,OnUserRegister(user));