* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * InspIRCd: (C) 2002-2008 InspIRCd Development Team
* See: http://www.inspircd.org/wiki/index.php/Credits
*
* This program is free but copyrighted software; see
* for the client introduction code in here, youre in the wrong place.
* You need to look in the spanningtree module for this!
*/
-CmdResult CommandNick::Handle (const char** parameters, int, User *user)
+CmdResult CommandNick::Handle (const char* const* parameters, int, User *user)
{
char oldnick[NICKMAX];
if (!*parameters[0] || !*user->nick)
{
/* We cant put blanks in the parameters, so for this (extremely rare) issue we just put '*' here. */
- user->WriteServ("432 %s * :Erroneous Nickname", *user->nick ? user->nick : "*");
+ user->WriteNumeric(432, "%s * :Erroneous Nickname", *user->nick ? user->nick : "*");
return CMD_FAILURE;
}
}
else
{
- QLine* mq = ServerInstance->XLines->matches_qline(parameters[0]);
- if (mq)
+ /*
+ * Don't check Q:Lines if it's a server-enforced change, just on the off-chance some fucking *moron*
+ * tries to Q:Line SIDs, also, this means we just get our way period, as it really should be.
+ * Thanks Kein for finding this. -- w00t
+ *
+ * Also don't check Q:Lines for remote nickchanges, they should have our Q:Lines anyway to enforce themselves.
+ * -- w00t
+ */
+ if (!allowinvalid || !IS_LOCAL(user))
{
- ServerInstance->SNO->WriteToSnoMask('x', "Q-Lined nickname %s from %s!%s@%s: %s", parameters[0], user->nick, user->ident, user->host, mq->reason);
- user->WriteServ("432 %s %s :Invalid nickname: %s",user->nick,parameters[0], mq->reason);
- return CMD_FAILURE;
+ XLine* mq = ServerInstance->XLines->MatchesLine("Q",parameters[0]);
+ if (mq)
+ {
+ ServerInstance->SNO->WriteToSnoMask('x', "Q-Lined nickname %s from %s!%s@%s: %s", parameters[0], user->nick, user->ident, user->host, mq->reason);
+ user->WriteNumeric(432, "%s %s :Invalid nickname: %s",user->nick,parameters[0], mq->reason);
+ return CMD_FAILURE;
+ }
}
/*
{
/* force the camper to their UUID, and ask them to re-send a NICK. */
InUse->WriteTo(InUse, "NICK %s", InUse->uuid);
- InUse->WriteServ("433 %s %s :Nickname overruled.", InUse->nick, InUse->nick);
+ InUse->WriteNumeric(433, "%s %s :Nickname overruled.", InUse->nick, InUse->nick);
InUse->UpdateNickHash(InUse->uuid);
strlcpy(InUse->nick, InUse->uuid, NICKMAX - 1);
InUse->InvalidateCache();
else
{
/* No camping, tell the incoming user to stop trying to change nick ;p */
- user->WriteServ("433 %s %s :Nickname is already in use.", user->registered >= REG_NICK ? user->nick : "*", parameters[0]);
+ user->WriteNumeric(433, "%s %s :Nickname is already in use.", user->registered >= REG_NICK ? user->nick : "*", parameters[0]);
return CMD_FAILURE;
}
}
{
if (!allowinvalid)
{
- user->WriteServ("432 %s %s :Erroneous Nickname",user->nick,parameters[0]);
+ user->WriteNumeric(432, "%s %s :Erroneous Nickname",user->nick,parameters[0]);
return CMD_FAILURE;
}
}
{
user->registered = (user->registered | REG_NICK);
}
- else if (user->registered == REG_NICKUSER)
+ if (user->registered == REG_NICKUSER)
{
/* user is registered now, bit 0 = USER command, bit 1 = sent a NICK command */
- int MOD_RESULT = 0;
+ MOD_RESULT = 0;
FOREACH_RESULT(I_OnUserRegister,OnUserRegister(user));
if (MOD_RESULT > 0)
return CMD_FAILURE;
}
- else if (user->registered == REG_ALL)
+ if (user->registered == REG_ALL)
{
+ user->IncreasePenalty(10);
FOREACH_MOD(I_OnUserPostNick,OnUserPostNick(user,oldnick));
}