3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-01 16:39:26 +01:00
This commit is contained in:
Shivaram Lingamneni 2020-10-16 00:58:12 -04:00
parent a412870514
commit 4b2a094921
2 changed files with 2 additions and 0 deletions

View File

@ -222,6 +222,7 @@ func realSkeleton(name string) (string, error) {
// Shivaram@good-fortune -> *!shivaram@good-fortune // Shivaram@good-fortune -> *!shivaram@good-fortune
// EDMUND -> edmund!*@* // EDMUND -> edmund!*@*
func CanonicalizeMaskWildcard(userhost string) (expanded string, err error) { func CanonicalizeMaskWildcard(userhost string) (expanded string, err error) {
userhost = strings.TrimSpace(userhost)
var nick, user, host string var nick, user, host string
bangIndex := strings.IndexByte(userhost, '!') bangIndex := strings.IndexByte(userhost, '!')
strudelIndex := strings.IndexByte(userhost, '@') strudelIndex := strings.IndexByte(userhost, '@')

View File

@ -215,6 +215,7 @@ func TestCanonicalizeMaskWildcard(t *testing.T) {
tester("shivaram*", "shivaram*!*@*", nil) tester("shivaram*", "shivaram*!*@*", nil)
tester("Shivaram*", "shivaram*!*@*", nil) tester("Shivaram*", "shivaram*!*@*", nil)
tester("*SHIVARAM*", "*shivaram*!*@*", nil) tester("*SHIVARAM*", "*shivaram*!*@*", nil)
tester("*SHIVARAM* ", "*shivaram*!*@*", nil)
} }
func validFoldTester(first, second string, equal bool, folder func(string) (string, error), t *testing.T) { func validFoldTester(first, second string, equal bool, folder func(string) (string, error), t *testing.T) {