Преглед изворни кода

fix #1516

CS OP should regrant one's stored amode
tags/v2.6.0-rc1
Shivaram Lingamneni пре 3 година
родитељ
комит
7ce396931c
1 измењених фајлова са 22 додато и 6 уклоњено
  1. 22
    6
      irc/chanserv.go

+ 22
- 6
irc/chanserv.go Прегледај датотеку

@@ -288,10 +288,11 @@ func csOpHandler(service *ircService, server *Server, client *Client, command st
288 288
 		return
289 289
 	}
290 290
 	channelName := channelInfo.Name()
291
+	founder := channelInfo.Founder()
291 292
 
292 293
 	clientAccount := client.Account()
293
-	if clientAccount == "" || clientAccount != channelInfo.Founder() {
294
-		service.Notice(rb, client.t("Only the channel founder can do this"))
294
+	if clientAccount == "" {
295
+		service.Notice(rb, client.t("You're not logged into an account"))
295 296
 		return
296 297
 	}
297 298
 
@@ -306,11 +307,26 @@ func csOpHandler(service *ircService, server *Server, client *Client, command st
306 307
 		target = client
307 308
 	}
308 309
 
309
-	// give them privs
310
-	givenMode := modes.ChannelOperator
311
-	if clientAccount == target.Account() {
312
-		givenMode = modes.ChannelFounder
310
+	var givenMode modes.Mode
311
+	if target == client {
312
+		if clientAccount == founder {
313
+			givenMode = modes.ChannelFounder
314
+		} else {
315
+			givenMode = channelInfo.getAmode(clientAccount)
316
+			if givenMode == modes.Mode(0) {
317
+				service.Notice(rb, client.t("You don't have any stored privileges on that channel"))
318
+				return
319
+			}
320
+		}
321
+	} else {
322
+		if clientAccount == founder {
323
+			givenMode = modes.ChannelOperator
324
+		} else {
325
+			service.Notice(rb, client.t("Only the channel founder can do this"))
326
+			return
327
+		}
313 328
 	}
329
+
314 330
 	applied, change := channelInfo.applyModeToMember(client,
315 331
 		modes.ModeChange{Mode: givenMode,
316 332
 			Op:  modes.Add,

Loading…
Откажи
Сачувај