filter characters in upstream nicks, to just alphanumeric
This commit is contained in:
parent
f4025ad513
commit
3752fce714
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"html"
|
"html"
|
||||||
"log"
|
"log"
|
||||||
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@ -545,6 +546,9 @@ func (this *NTFServer) HandleDirectMessage(update telegram.Update) error {
|
|||||||
} else if strings.HasPrefix(msg, "/join ") {
|
} else if strings.HasPrefix(msg, "/join ") {
|
||||||
requestedHubNick := msg[6:]
|
requestedHubNick := msg[6:]
|
||||||
|
|
||||||
|
// Some users take the [] in the message literally. A-Za-z0-9 are the only supported characters
|
||||||
|
requestedHubNick = regexp.MustCompile(`[^a-zA-Z0-9]`).ReplaceAllString(requestedHubNick, "")
|
||||||
|
|
||||||
// Minimum nick lengths
|
// Minimum nick lengths
|
||||||
if len(requestedHubNick) < this.config.HubNickMinChars {
|
if len(requestedHubNick) < this.config.HubNickMinChars {
|
||||||
return respond(fmt.Sprintf("Upstream nickname '%s' should be at least %d characters long", requestedHubNick, this.config.HubNickMinChars))
|
return respond(fmt.Sprintf("Upstream nickname '%s' should be at least %d characters long", requestedHubNick, this.config.HubNickMinChars))
|
||||||
|
Loading…
Reference in New Issue
Block a user