1
0
mirror of https://github.com/osmarks/ngircd.git synced 2024-12-12 09:50:29 +00:00

Implement channel mode 'O': "IRC operators only"

This channel mode is used on DALnet (bahamut), for example.
This commit is contained in:
Alexander Barton 2011-01-10 12:15:05 +01:00
parent 6600ce3445
commit a57748e1a1
4 changed files with 26 additions and 1 deletions

View File

@ -81,7 +81,7 @@
in seconds. */ in seconds. */
#define USERMODES "aciorswx" /* Supported user modes. */ #define USERMODES "aciorswx" /* Supported user modes. */
#define CHANMODES "biIklmnoPstvz" /* Supported channel modes. */ #define CHANMODES "biIklmnoOPstvz" /* Supported channel modes. */
#define CONNECTED true /* Internal status codes. */ #define CONNECTED true /* Internal status codes. */
#define DISCONNECTED false #define DISCONNECTED false

View File

@ -122,6 +122,13 @@ join_allowed(CLIENT *Client, CHANNEL *chan, const char *channame,
return false; return false;
} }
if (strchr(channel_modes, 'O') && !Client_OperByMe(Client)) {
/* Only IRC operators are allowed! */
IRC_WriteStrClient(Client, ERR_OPONLYCHANNEL_MSG,
Client_ID(Client), channame);
return false;
}
return true; return true;
} }

View File

@ -499,6 +499,23 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
goto chan_exit; goto chan_exit;
} }
break; break;
case 'O': /* IRC operators only */
if (modeok) {
/* Only IRC operators are allowed to
* set the 'O' channel mode! */
if (set && !(Client_OperByMe(Client)
|| Client_Type(Client) == CLIENT_SERVER))
connected = IRC_WriteStrClient(Origin,
ERR_NOPRIVILEGES_MSG,
Client_ID(Origin));
else
x[0] = 'O';
} else
connected = IRC_WriteStrClient(Origin,
ERR_CHANOPRIVSNEEDED_MSG,
Client_ID(Origin),
Channel_Name(Channel));
break;
case 'P': /* Persistent channel */ case 'P': /* Persistent channel */
if (modeok) { if (modeok) {
/* Only IRC operators are allowed to /* Only IRC operators are allowed to

View File

@ -117,6 +117,7 @@
#define ERR_PASSWDMISMATCH_MSG "464 %s :Invalid password" #define ERR_PASSWDMISMATCH_MSG "464 %s :Invalid password"
#define ERR_CHANNELISFULL_MSG "471 %s %s :Cannot join channel (+l)" #define ERR_CHANNELISFULL_MSG "471 %s %s :Cannot join channel (+l)"
#define ERR_SECURECHANNEL_MSG "471 %s %s :Cannot join channel (+z)" #define ERR_SECURECHANNEL_MSG "471 %s %s :Cannot join channel (+z)"
#define ERR_OPONLYCHANNEL_MSG "471 %s %s :Cannot join channel (+O)"
#define ERR_UNKNOWNMODE_MSG "472 %s: %c :is unknown mode char for %s" #define ERR_UNKNOWNMODE_MSG "472 %s: %c :is unknown mode char for %s"
#define ERR_INVITEONLYCHAN_MSG "473 %s %s :Cannot join channel (+i)" #define ERR_INVITEONLYCHAN_MSG "473 %s %s :Cannot join channel (+i)"
#define ERR_BANNEDFROMCHAN_MSG "474 %s %s :Cannot join channel (+b)" #define ERR_BANNEDFROMCHAN_MSG "474 %s %s :Cannot join channel (+b)"