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 if (user->registered < REG_NICKUSER)
29 if (!ServerInstance->IsIdent(parameters[0])) {
30 // This kinda Sucks, According to the RFC thou, its either this,
31 // or "You have already registered" :p -- Craig
32 user->WriteServ("461 %s USER :Not enough parameters",user->nick);
36 /* We're not checking ident, but I'm not sure I like the idea of '~' prefixing.. */
37 /* XXX - The ident field is IDENTMAX+2 in size to account for +1 for the optional
38 * ~ character, and +1 for null termination, therefore we can safely use up to
41 strlcpy(user->ident, parameters[0], IDENTMAX);
42 strlcpy(user->fullname,parameters[3],MAXGECOS);
43 user->registered = (user->registered | REG_USER);
48 user->WriteServ("462 %s :You may not reregister",user->nick);
51 /* parameters 2 and 3 are local and remote hosts, ignored when sent by client connection */
52 if (user->registered == REG_NICKUSER)
55 /* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
56 if (ServerInstance->next_call > ServerInstance->Time() + ServerInstance->Config->dns_timeout)
57 ServerInstance->next_call = ServerInstance->Time() + ServerInstance->Config->dns_timeout;
58 FOREACH_RESULT(I_OnUserRegister,OnUserRegister(user));