IRC_NICK( CLIENT *Client, REQUEST *Req )
{
CLIENT *intr_c, *target, *c;
+ CHANNEL *chan;
char *nick, *user, *hostname, *modes, *info;
int token, hops;
Client_SetType( Client, CLIENT_GOTNICK );
} else {
/* Nickname change */
+
+ /* Check that the user isn't on any channels set +N */
+ chan = Channel_First();
+ while (chan) {
+ if(Channel_IsMemberOf(chan, Client) &&
+ Channel_HasMode(chan, 'N') &&
+ !Client_HasMode(Client, 'o'))
+ return IRC_WriteErrClient(Client,
+ ERR_UNAVAILRESOURCE_MSG,
+ Client_ID(Client),
+ Channel_Name(chan));
+ chan = Channel_Next(chan);
+ }
+
Change_Nick(Client, target, Req->argv[0],
Client_Type(Client) == CLIENT_USER ? true : false);
IRC_SetPenalty(target, 2);
case 'M': /* Only identified nicks can write */
case 'm': /* Moderated */
case 'n': /* Only members can write */
+ case 'N': /* Can't change nick while on this channel */
case 'Q': /* No kicks */
case 't': /* Topic locked */
if(is_oper || is_machine || is_owner ||
#define ERR_NICKNAMETOOLONG_MSG "432 %s %s :Nickname too long, max. %u characters"
#define ERR_FORBIDDENNICKNAME_MSG "432 %s %s :Nickname is forbidden/blocked"
#define ERR_NICKNAMEINUSE_MSG "433 %s %s :Nickname already in use"
+#define ERR_UNAVAILRESOURCE_MSG "437 %s :Cannot change nickname while on %s(+N)"
#define ERR_USERNOTINCHANNEL_MSG "441 %s %s %s :They aren't on that channel"
#define ERR_NOTONCHANNEL_MSG "442 %s %s :You are not on that channel"
#define ERR_USERONCHANNEL_MSG "443 %s %s %s :is already on channel"