Allow IRC operators to use MODE command on any channel (closes: #100)
This allows IRC operators to change channel modes of ANY channel, even without joining these channels first.
This commit is contained in:
parent
63a304755a
commit
acb66d6463
|
@ -297,7 +297,8 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
|
||||||
{
|
{
|
||||||
char the_modes[COMMAND_LEN], the_args[COMMAND_LEN], x[2],
|
char the_modes[COMMAND_LEN], the_args[COMMAND_LEN], x[2],
|
||||||
argadd[CLIENT_PASS_LEN], *mode_ptr;
|
argadd[CLIENT_PASS_LEN], *mode_ptr;
|
||||||
bool connected, set, modeok = true, skiponce, use_servermode = false, retval;
|
bool connected, set, skiponce, retval, onchannel;
|
||||||
|
bool modeok = true, use_servermode = false;
|
||||||
int mode_arg, arg_arg;
|
int mode_arg, arg_arg;
|
||||||
CLIENT *client;
|
CLIENT *client;
|
||||||
long l;
|
long l;
|
||||||
|
@ -314,14 +315,13 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
|
||||||
/* Is the user allowed to change modes? */
|
/* Is the user allowed to change modes? */
|
||||||
if (Client_Type(Client) == CLIENT_USER) {
|
if (Client_Type(Client) == CLIENT_USER) {
|
||||||
/* Is the originating user on that channel? */
|
/* Is the originating user on that channel? */
|
||||||
if (!Channel_IsMemberOf(Channel, Origin))
|
onchannel = Channel_IsMemberOf(Channel, Origin);
|
||||||
return IRC_WriteStrClient(Origin, ERR_NOTONCHANNEL_MSG,
|
|
||||||
Client_ID(Origin), Channel_Name(Channel));
|
|
||||||
modeok = false;
|
modeok = false;
|
||||||
/* channel operator? */
|
/* channel operator? */
|
||||||
if (strchr(Channel_UserModes(Channel, Origin), 'o'))
|
if (onchannel &&
|
||||||
|
strchr(Channel_UserModes(Channel, Origin), 'o')) {
|
||||||
modeok = true;
|
modeok = true;
|
||||||
else if (Conf_OperCanMode) {
|
} else if (Conf_OperCanMode) {
|
||||||
/* IRC-Operators can use MODE as well */
|
/* IRC-Operators can use MODE as well */
|
||||||
if (Client_OperByMe(Origin)) {
|
if (Client_OperByMe(Origin)) {
|
||||||
modeok = true;
|
modeok = true;
|
||||||
|
@ -329,6 +329,10 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
|
||||||
use_servermode = true; /* Change Origin to Server */
|
use_servermode = true; /* Change Origin to Server */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!onchannel && !use_servermode)
|
||||||
|
return IRC_WriteStrClient(Origin, ERR_NOTONCHANNEL_MSG,
|
||||||
|
Client_ID(Origin), Channel_Name(Channel));
|
||||||
}
|
}
|
||||||
|
|
||||||
mode_arg = 1;
|
mode_arg = 1;
|
||||||
|
|
Loading…
Reference in New Issue