Browse Source

fix #1669

Sort snomasks for display rather than displaying them in hash order
tags/v2.7.0-rc1
Shivaram Lingamneni 2 years ago
parent
commit
33e3b0ce1b
2 changed files with 6 additions and 0 deletions
  1. 5
    0
      irc/sno/utils.go
  2. 1
    0
      irc/snomanager.go

+ 5
- 0
irc/sno/utils.go View File

@@ -4,6 +4,7 @@
4 4
 package sno
5 5
 
6 6
 import (
7
+	"sort"
7 8
 	"strings"
8 9
 )
9 10
 
@@ -34,6 +35,10 @@ func (masks Masks) Contains(mask Mask) bool {
34 35
 	return false
35 36
 }
36 37
 
38
+func (masks Masks) Sort() {
39
+	sort.Slice(masks, func(i, j int) bool { return masks[i] < masks[j] })
40
+}
41
+
37 42
 // Evaluate changes to snomasks made with MODE. There are several cases:
38 43
 // adding snomasks with `/mode +s a` or `/mode +s +a`, removing them with `/mode +s -a`,
39 44
 // adding all with `/mode +s *` or `/mode +s +*`, removing all with `/mode +s -*` or `/mode -s`

+ 1
- 0
irc/snomanager.go View File

@@ -109,6 +109,7 @@ func (m *SnoManager) MasksEnabled(client *Client) (result sno.Masks) {
109 109
 			}
110 110
 		}
111 111
 	}
112
+	result.Sort()
112 113
 	return
113 114
 }
114 115
 

Loading…
Cancel
Save