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 * ---------------------------------------------------
19 #include "inspircd_config.h"
21 #include "inspircd_io.h"
25 #include <ext/hash_map>
43 #include "inspstring.h"
45 #include "helperfuncs.h"
47 #include "socketengine.h"
49 #include "command_parse.h"
52 extern ServerConfig* Config;
53 extern InspIRCd* ServerInstance;
55 extern std::vector<Module*> modules;
56 extern std::vector<ircd_module*> factory;
58 extern user_hash clientlist;
59 extern chan_hash chanlist;
60 extern std::vector<userrec*> all_opers;
61 extern std::vector<userrec*> local_users;
62 extern userrec* fd_ref_table[MAX_DESCRIPTORS];
64 void cmd_user::Handle (char **parameters, int pcnt, userrec *user)
66 if (user->registered < 3)
68 if (!isident(parameters[0])) {
69 // This kinda Sucks, According to the RFC thou, its either this,
70 // or "You have already registered" :p -- Craig
71 WriteServ(user->fd,"461 %s USER :Not enough parameters",user->nick);
74 /* We're not checking ident, but I'm not sure I like the idea of '~' prefixing.. */
75 /* XXX - Should this IDENTMAX + 1 be IDENTMAX - 1? Ok, users.h has it defined as
76 * char ident[IDENTMAX+2]; - WTF?
78 snprintf(user->ident, IDENTMAX+1, "~%s", parameters[0]);
79 strlcpy(user->fullname,parameters[3],MAXGECOS);
80 user->registered = (user->registered | 1);
85 WriteServ(user->fd,"462 %s :You may not reregister",user->nick);
88 /* parameters 2 and 3 are local and remote hosts, ignored when sent by client connection */
89 if (user->registered == 3)
91 /* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
92 FOREACH_MOD(I_OnUserRegister,OnUserRegister(user));
93 //ConnectUser(user,NULL);