Implement channel mode "M"
Only the server, identified users and IRC operators are able to talk.
This commit is contained in:
parent
360a254be0
commit
1aaf54ac24
|
@ -845,6 +845,22 @@ Can_Send_To_Channel(CHANNEL *Chan, CLIENT *From)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
Can_Send_To_Channel_Identified(CHANNEL *Chan, CLIENT *From)
|
||||||
|
{
|
||||||
|
if ((Client_ThisServer() == From) || Client_HasMode(From, 'o'))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (strchr(Channel_Modes(Chan), 'M') && !Client_HasMode(From, 'R'))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (Lists_Check(&Chan->list_excepts, From))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return !Lists_Check(&Chan->list_bans, From);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
GLOBAL bool
|
GLOBAL bool
|
||||||
Channel_Write(CHANNEL *Chan, CLIENT *From, CLIENT *Client, const char *Command,
|
Channel_Write(CHANNEL *Chan, CLIENT *From, CLIENT *Client, const char *Command,
|
||||||
bool SendErrors, const char *Text)
|
bool SendErrors, const char *Text)
|
||||||
|
@ -856,6 +872,13 @@ Channel_Write(CHANNEL *Chan, CLIENT *From, CLIENT *Client, const char *Command,
|
||||||
Client_ID(From), Channel_Name(Chan));
|
Client_ID(From), Channel_Name(Chan));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Can_Send_To_Channel_Identified(Chan, From)) {
|
||||||
|
if (! SendErrors)
|
||||||
|
return CONNECTED;
|
||||||
|
return IRC_WriteStrClient(From, ERR_CANNOTSENDTOCHAN_MSG,
|
||||||
|
Client_ID(From), Channel_Name(Chan));
|
||||||
|
}
|
||||||
|
|
||||||
if (Client_Conn(From) > NONE)
|
if (Client_Conn(From) > NONE)
|
||||||
Conn_UpdateIdle(Client_Conn(From));
|
Conn_UpdateIdle(Client_Conn(From));
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@
|
||||||
#define USERMODES "acCiorRswx"
|
#define USERMODES "acCiorRswx"
|
||||||
|
|
||||||
/** Supported channel modes. */
|
/** Supported channel modes. */
|
||||||
#define CHANMODES "beiIklmnoOPrRstvz"
|
#define CHANMODES "beiIklmMnoOPrRstvz"
|
||||||
|
|
||||||
/** Away message for users connected to linked servers. */
|
/** Away message for users connected to linked servers. */
|
||||||
#define DEFAULT_AWAY_MSG "Away"
|
#define DEFAULT_AWAY_MSG "Away"
|
||||||
|
|
|
@ -500,6 +500,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
|
||||||
switch (*mode_ptr) {
|
switch (*mode_ptr) {
|
||||||
/* --- Channel modes --- */
|
/* --- Channel modes --- */
|
||||||
case 'i': /* Invite only */
|
case 'i': /* Invite only */
|
||||||
|
case 'M': /* Only identified nicks can write */
|
||||||
case 'm': /* Moderated */
|
case 'm': /* Moderated */
|
||||||
case 'n': /* Only members can write */
|
case 'n': /* Only members can write */
|
||||||
case 'R': /* Registered users only */
|
case 'R': /* Registered users only */
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#define RPL_YOURHOST_MSG "002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)"
|
#define RPL_YOURHOST_MSG "002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)"
|
||||||
#define RPL_CREATED_MSG "003 %s :This server has been started %s"
|
#define RPL_CREATED_MSG "003 %s :This server has been started %s"
|
||||||
#define RPL_MYINFO_MSG "004 %s %s ngircd-%s %s %s"
|
#define RPL_MYINFO_MSG "004 %s %s ngircd-%s %s %s"
|
||||||
#define RPL_ISUPPORT1_MSG "005 %s RFC2812 IRCD=ngIRCd CASEMAPPING=ascii PREFIX=(ov)@+ CHANTYPES=#&+ CHANMODES=beI,k,l,imnOPRstz CHANLIMIT=#&+:%d :are supported on this server"
|
#define RPL_ISUPPORT1_MSG "005 %s RFC2812 IRCD=ngIRCd CASEMAPPING=ascii PREFIX=(ov)@+ CHANTYPES=#&+ CHANMODES=beI,k,l,imMnOPRstz CHANLIMIT=#&+:%d :are supported on this server"
|
||||||
#define RPL_ISUPPORT2_MSG "005 %s CHANNELLEN=%d NICKLEN=%d TOPICLEN=%d AWAYLEN=%d KICKLEN=%d MODES=%d MAXLIST=beI:%d EXCEPTS=e INVEX=I PENALTY :are supported on this server"
|
#define RPL_ISUPPORT2_MSG "005 %s CHANNELLEN=%d NICKLEN=%d TOPICLEN=%d AWAYLEN=%d KICKLEN=%d MODES=%d MAXLIST=beI:%d EXCEPTS=e INVEX=I PENALTY :are supported on this server"
|
||||||
|
|
||||||
#define RPL_TRACELINK_MSG "200 %s Link %s-%s %s %s V%s %ld %d %d"
|
#define RPL_TRACELINK_MSG "200 %s Link %s-%s %s %s V%s %ld %d %d"
|
||||||
|
|
Loading…
Reference in New Issue