Browse Source

fix #1516

CS OP should regrant one's stored amode
tags/v2.6.0-rc1
Shivaram Lingamneni 3 years ago
parent
commit
7ce396931c
1 changed files with 22 additions and 6 deletions
  1. 22
    6
      irc/chanserv.go

+ 22
- 6
irc/chanserv.go View File

288
 		return
288
 		return
289
 	}
289
 	}
290
 	channelName := channelInfo.Name()
290
 	channelName := channelInfo.Name()
291
+	founder := channelInfo.Founder()
291
 
292
 
292
 	clientAccount := client.Account()
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
 		return
296
 		return
296
 	}
297
 	}
297
 
298
 
306
 		target = client
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
 	applied, change := channelInfo.applyModeToMember(client,
330
 	applied, change := channelInfo.applyModeToMember(client,
315
 		modes.ModeChange{Mode: givenMode,
331
 		modes.ModeChange{Mode: givenMode,
316
 			Op:  modes.Add,
332
 			Op:  modes.Add,

Loading…
Cancel
Save