extern std::vector<ircd_module*> factory;
extern time_t TIME;
-void cmd_nick::Handle (char **parameters, int pcnt, userrec *user)
+void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
{
char oldnick[NICKMAX];
FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0]));
if (MOD_RESULT)
return;
- if (user->registered == 7)
+ if (user->registered == REG_ALL)
WriteCommon(user,"NICK %s",parameters[0]);
strlcpy(user->nick, parameters[0], NICKMAX - 1);
FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(user,oldnick));
return;
}
}
- if (isnick(parameters[0]) == 0)
+ if ((isnick(parameters[0]) == 0) && (IS_LOCAL(user)))
{
WriteServ(user->fd,"432 %s %s :Erroneous Nickname",user->nick,parameters[0]);
return;
}
- if (user->registered == 7)
+ if (user->registered == REG_ALL)
{
int MOD_RESULT = 0;
FOREACH_RESULT(I_OnUserPreNick,OnUserPreNick(user,parameters[0]));
log(DEBUG,"new nick set: %s",user->nick);
- if (user->registered < 3)
+ if (user->registered < REG_NICKUSER)
{
- user->registered = (user->registered | 2);
+ user->registered = (user->registered | REG_NICK);
// dont attempt to look up the dns until they pick a nick... because otherwise their pointer WILL change
// and unless we're lucky we'll get a duff one later on.
//user->dns_done = (!lookup_dns(user->nick));
{
#ifdef THREADED_DNS
// initialize their dns lookup thread
- if (pthread_create(&user->dnsthread, NULL, dns_task, (void *)user) != 0)
+ pthread_attr_t attribs;
+ pthread_attr_init(&attribs);
+ pthread_attr_setdetachstate(&attribs, PTHREAD_CREATE_DETACHED);
+ if (pthread_create(&user->dnsthread, &attribs, dns_task, (void *)user) != 0)
{
- log(DEBUG,"Failed to create DNS lookup thread for user %s",user->nick);
+ log(DEBUG,"Failed to create DNS lookup thread for user %s: %s",user->nick, strerror(errno));
}
#else
user->dns_done = (!lookup_dns(user->nick));
#endif
}
}
- if (user->registered == 3)
+ if (user->registered == REG_NICKUSER)
{
/* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
FOREACH_MOD(I_OnUserRegister,OnUserRegister(user));
//ConnectUser(user,NULL);
}
- if (user->registered == 7)
+ if (user->registered == REG_ALL)
{
FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(user,oldnick));
}