Bläddra i källkod

tweaks to NAMES / WHO privacy

tags/v1.1.0-rc1
Shivaram Lingamneni 5 år sedan
förälder
incheckning
74afeaed55
2 ändrade filer med 11 tillägg och 6 borttagningar
  1. 3
    2
      irc/channel.go
  2. 8
    4
      irc/handlers.go

+ 3
- 2
irc/channel.go Visa fil

@@ -336,13 +336,14 @@ func (channel *Channel) regenerateMembersCache() {
336 336
 // Names sends the list of users joined to the channel to the given client.
337 337
 func (channel *Channel) Names(client *Client, rb *ResponseBuffer) {
338 338
 	isJoined := channel.hasClient(client)
339
+	isOper := client.HasMode(modes.Operator)
339 340
 	isMultiPrefix := rb.session.capabilities.Has(caps.MultiPrefix)
340 341
 	isUserhostInNames := rb.session.capabilities.Has(caps.UserhostInNames)
341 342
 
342 343
 	maxNamLen := 480 - len(client.server.name) - len(client.Nick())
343 344
 	var namesLines []string
344 345
 	var buffer bytes.Buffer
345
-	if isJoined || !channel.flags.HasMode(modes.Secret) {
346
+	if isJoined || !channel.flags.HasMode(modes.Secret) || isOper {
346 347
 		for _, target := range channel.Members() {
347 348
 			var nick string
348 349
 			if isUserhostInNames {
@@ -356,7 +357,7 @@ func (channel *Channel) Names(client *Client, rb *ResponseBuffer) {
356 357
 			if modeSet == nil {
357 358
 				continue
358 359
 			}
359
-			if !isJoined && target.flags.HasMode(modes.Invisible) {
360
+			if !isJoined && target.flags.HasMode(modes.Invisible) && !isOper {
360 361
 				continue
361 362
 			}
362 363
 			prefix := modeSet.Prefixes(isMultiPrefix)

+ 8
- 4
irc/handlers.go Visa fil

@@ -2595,14 +2595,18 @@ func whoHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Respo
2595 2595
 	//	operatorOnly = true
2596 2596
 	//}
2597 2597
 
2598
+	isOper := client.HasMode(modes.Operator)
2598 2599
 	if mask[0] == '#' {
2599 2600
 		// TODO implement wildcard matching
2600 2601
 		//TODO(dan): ^ only for opers
2601 2602
 		channel := server.channels.Get(mask)
2602
-		if channel != nil && channel.hasClient(client) {
2603
-			for _, member := range channel.Members() {
2604
-				if !member.HasMode(modes.Invisible) {
2605
-					client.rplWhoReply(channel, member, rb)
2603
+		if channel != nil {
2604
+			isJoined := channel.hasClient(client)
2605
+			if !channel.flags.HasMode(modes.Secret) || isJoined || isOper {
2606
+				for _, member := range channel.Members() {
2607
+					if !member.HasMode(modes.Invisible) || isJoined || isOper {
2608
+						client.rplWhoReply(channel, member, rb)
2609
+					}
2606 2610
 				}
2607 2611
 			}
2608 2612
 		}

Laddar…
Avbryt
Spara