Merge pull request #214 from Flupsy/channel-mode-N

Channel mode N (users on this channel can't change their nick)
This commit is contained in:
Alexander Barton 2015-08-01 14:24:20 +02:00
commit 90ea23ab4f
4 changed files with 20 additions and 0 deletions

View File

@ -56,6 +56,7 @@ users to lists (e.g. "invite list", "ban list"), others have parameters
m 0.3.0 Channel is moderated, only "voiced" users can send messages.
M 20 Only registered users (and IRC Ops) can send messages.
n 0.3.0 Channel doesn't allow messages of users not being members.
N ?? Users can't change their nickname while on this channel.
O 18 Only IRC operators are allowed to join this channel.
P 0.5.0 Channel is "persistent".
Q 20 Nobody can be kicked from the channel.

View File

@ -172,6 +172,7 @@ GLOBAL bool
IRC_NICK( CLIENT *Client, REQUEST *Req )
{
CLIENT *intr_c, *target, *c;
CHANNEL *chan;
char *nick, *user, *hostname, *modes, *info;
int token, hops;
@ -259,6 +260,22 @@ IRC_NICK( CLIENT *Client, REQUEST *Req )
Client_SetType( Client, CLIENT_GOTNICK );
} else {
/* Nickname change */
/* Check that the user isn't on any channels set +N */
if(Client_Type(Client) == CLIENT_USER &&
!Client_HasMode(Client, 'o')) {
chan = Channel_First();
while (chan) {
if(Channel_IsMemberOf(chan, Client) &&
Channel_HasMode(chan, 'N'))
return IRC_WriteErrClient(Client,
ERR_NONICKCHANGE_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);

View File

@ -580,6 +580,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
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 ||

View File

@ -127,6 +127,7 @@
#define ERR_USERONCHANNEL_MSG "443 %s %s %s :is already on channel"
#define ERR_SUMMONDISABLED_MSG "445 %s :SUMMON has been disabled"
#define ERR_USERSDISABLED_MSG "446 %s :USERS has been disabled"
#define ERR_NONICKCHANGE_MSG "447 %s :Cannot change nickname while on %s(+N)"
#define ERR_NOTREGISTERED_MSG "451 %s :Connection not registered"
#define ERR_NOTREGISTEREDSERVER_MSG "451 %s :Connection not registered as server link"
#define ERR_NEEDMOREPARAMS_MSG "461 %s %s :Syntax error"