all repos — honk @ ecb128359cc8ba608aad7ae1ae7a09a2a6b2b212

my fork of honk

strings are hard
Ted Unangst tedu@tedunangst.com
Sun, 30 Jul 2023 21:31:53 -0400
commit

ecb128359cc8ba608aad7ae1ae7a09a2a6b2b212

parent

95a9708de43dfd6cf3f303512d360d8fb1a2a116

1 files changed, 4 insertions(+), 5 deletions(-)

jump to
M honk.gohonk.go

@@ -145,15 +145,14 @@ return strings.Contains(noise, ">@"+nick) || strings.Contains(noise, "@<span>"+nick)

} func OntIsPresent(ont, noise string) bool { - ont = strings.ToLower(ont[1:] + "<") + ont = strings.ToLower(ont[1:]) idx := strings.IndexByte(noise, '#') for idx >= 0 { if strings.HasPrefix(noise[idx:], "#<span>") { - idx += 5 - } else { - idx += 1 + idx += 6 } - if idx + len(ont) + 1 > len(noise) { + idx += 1 + if idx + len(ont) >= len(noise) { return false } test := noise[idx:idx+len(ont)]