Browse Source

SAMODE +f shouldn't require channel privileges

Reported by @Mikaela; normally this requires +o or higher on the
channel that is the target of the forward, but SAMODE should bypass
this check.
tags/v2.8.0
Shivaram Lingamneni 2 years ago
parent
commit
4bffdba610
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      irc/modes.go

+ 3
- 3
irc/modes.go View File

@@ -267,12 +267,12 @@ func (channel *Channel) ApplyChannelModeChanges(client *Client, isSamode bool, c
267 267
 				} else if ch == channel {
268 268
 					rb.Add(nil, client.server.name, ERR_INVALIDMODEPARAM, details.nick, chname, string(change.Mode), utils.SafeErrorParam(change.Arg), fmt.Sprintf(client.t("You can't forward a channel to itself")))
269 269
 				} else {
270
-					if !ch.ClientIsAtLeast(client, modes.ChannelOperator) {
271
-						rb.Add(nil, client.server.name, ERR_CHANOPRIVSNEEDED, details.nick, ch.Name(), client.t("You must be a channel operator in the channel you are forwarding to"))
272
-					} else {
270
+					if isSamode || ch.ClientIsAtLeast(client, modes.ChannelOperator) {
273 271
 						change.Arg = ch.Name()
274 272
 						channel.setForward(change.Arg)
275 273
 						applied = append(applied, change)
274
+					} else {
275
+						rb.Add(nil, client.server.name, ERR_CHANOPRIVSNEEDED, details.nick, ch.Name(), client.t("You must be a channel operator in the channel you are forwarding to"))
276 276
 					}
277 277
 				}
278 278
 			case modes.Remove:

Loading…
Cancel
Save