if we kill a word, we should probably kill the whole thread too
This commit is contained in:
parent
eab34a6104
commit
5aeaf45cad
1 changed files with 16 additions and 1 deletions
17
fun.go
17
fun.go
|
|
@ -108,18 +108,33 @@ func unsee(zilences []*regexp.Regexp, precis string, noise string) string {
|
||||||
|
|
||||||
func osmosis(honks []*Honk, userid int64) []*Honk {
|
func osmosis(honks []*Honk, userid int64) []*Honk {
|
||||||
zords := getzords(userid)
|
zords := getzords(userid)
|
||||||
|
for i, j := 0, len(honks)-1; i < j; i, j = i+1, j-1 {
|
||||||
|
honks[i], honks[j] = honks[j], honks[i]
|
||||||
|
}
|
||||||
|
|
||||||
j := 0
|
j := 0
|
||||||
|
filtered := make(map[string]bool)
|
||||||
outer:
|
outer:
|
||||||
for _, h := range honks {
|
for _, h := range honks {
|
||||||
|
if h.RID != "" && filtered[h.RID] {
|
||||||
|
filtered[h.XID] = true
|
||||||
|
continue outer
|
||||||
|
}
|
||||||
|
|
||||||
for _, z := range zords {
|
for _, z := range zords {
|
||||||
if z.MatchString(h.Precis) || z.MatchString(h.Noise) {
|
if z.MatchString(h.Precis) || z.MatchString(h.Noise) {
|
||||||
|
filtered[h.XID] = true
|
||||||
continue outer
|
continue outer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
honks[j] = h
|
honks[j] = h
|
||||||
j++
|
j++
|
||||||
}
|
}
|
||||||
return honks[0:j]
|
honks = honks[0:j]
|
||||||
|
for i, j := 0, len(honks)-1; i < j; i, j = i+1, j-1 {
|
||||||
|
honks[i], honks[j] = honks[j], honks[i]
|
||||||
|
}
|
||||||
|
return honks
|
||||||
}
|
}
|
||||||
|
|
||||||
func shortxid(xid string) string {
|
func shortxid(xid string) string {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue