Browse Source

explanatory comment for CompileMasks

tags/v2.1.0-rc1
Shivaram Lingamneni 4 years ago
parent
commit
d092f6b330
2 changed files with 3 additions and 6 deletions
  1. 0
    6
      irc/client_lookup_set.go
  2. 3
    0
      irc/utils/glob.go

+ 0
- 6
irc/client_lookup_set.go View File

@@ -432,12 +432,6 @@ func (set *UserMaskSet) Length() int {
432 432
 	return len(set.masks)
433 433
 }
434 434
 
435
-// setRegexp generates a regular expression from the set of user mask
436
-// strings. Masks are split at the two types of wildcards, `*` and
437
-// `?`. All the pieces are meta-escaped. `*` is replaced with `.*`,
438
-// the regexp equivalent. Likewise, `?` is replaced with `.`. The
439
-// parts are re-joined and finally all masks are joined into a big
440
-// or-expression.
441 435
 func (set *UserMaskSet) setRegexp() {
442 436
 	set.RLock()
443 437
 	maskExprs := make([]string, len(set.masks))

+ 3
- 0
irc/utils/glob.go View File

@@ -46,6 +46,9 @@ func CompileGlob(glob string, submatch bool) (result *regexp.Regexp, err error)
46 46
 	return regexp.Compile(buf.String())
47 47
 }
48 48
 
49
+// Compile a list of globs into a single or-expression that matches any one of them.
50
+// This is used for channel ban/invite/exception lists. It's applicable to k-lines
51
+// but we're not using it there yet.
49 52
 func CompileMasks(masks []string) (result *regexp.Regexp, err error) {
50 53
 	var buf bytes.Buffer
51 54
 	buf.WriteString("^(")

Loading…
Cancel
Save