#include "xline.h"
#include "inspstring.h"
#include "dnsqueue.h"
+#include "dns.h"
#include "helperfuncs.h"
#include "hashcomp.h"
#include "socketengine.h"
void cmd_nick::Handle (char **parameters, int pcnt, userrec *user)
{
+ char oldnick[NICKMAX];
+
if (pcnt < 1)
{
log(DEBUG,"not enough params for handle_nick");
log(DEBUG,"invalid old nick passed to handle_nick");
return;
}
- if (!strcasecmp(user->nick,parameters[0]))
+ if (irc::string(user->nick) == irc::string(parameters[0]))
{
- log(DEBUG,"old nick is new nick, skipping");
+ /* If its exactly the same, even case, dont do anything. */
+ if (!strcmp(user->nick,parameters[0]))
+ return;
+ /* Its a change of case. People insisted that they should be
+ * able to do silly things like this even though the RFC says
+ * the nick AAA is the same as the nick aaa.
+ */
+ log(DEBUG,"old nick is new nick, not updating hash (case change only)");
+ strlcpy(oldnick,user->nick,NICKMAX);
+ int MOD_RESULT = 0;
+ FOREACH_RESULT(OnUserPreNick(user,parameters[0]));
+ if (MOD_RESULT)
+ return;
+ strlcpy(user->nick,parameters[0],NICKMAX);
+ if (user->registered == 7)
+ WriteCommon(user,"NICK %s",parameters[0]);
+ FOREACH_MOD OnUserPostNick(user,oldnick);
return;
}
else
WriteCommon(user,"NICK %s",parameters[0]);
}
-
- char oldnick[NICKMAX];
+
strlcpy(oldnick,user->nick,NICKMAX);
/* change the nick of the user in the users_hash */