1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 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 * ---------------------------------------------------
15 #include "commands/cmd_user.h"
17 extern "C" DllExport Command* init_command(InspIRCd* Instance)
19 return new CommandUser(Instance);
22 CmdResult CommandUser::Handle (const char* const* parameters, int, User *user)
24 /* A user may only send the USER command once */
25 if (!(user->registered & REG_USER))
27 if (!ServerInstance->IsIdent(parameters[0]))
30 * RFC says we must use this numeric, so we do. Let's make it a little more nub friendly though. :)
31 * -- Craig, and then w00t.
33 user->WriteNumeric(461, "%s USER :Your username is not valid",user->nick);
39 * 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] ? parameters[3] : "No info", MAXGECOS);
45 user->registered = (user->registered | REG_USER);
50 user->WriteNumeric(462, "%s :You may not reregister",user->nick);
54 /* parameters 2 and 3 are local and remote hosts, and are ignored */
55 if (user->registered == REG_NICKUSER)
59 /* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
60 FOREACH_RESULT(I_OnUserRegister,OnUserRegister(user));