Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
only check for non account ids
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsupermanhd committed Sep 14, 2024
1 parent b1fcfa9 commit 21e0ae7
Showing 1 changed file with 27 additions and 25 deletions.
52 changes: 27 additions & 25 deletions connfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,36 +160,38 @@ where g.game_time < 60000 and g.time_started + $1::interval > now() and (i.pkey
}

// stage 7 ip based mute
ipmutes := map[string]bool{}
for i := len(inst.cfgs) - 1; i >= 0; i-- {
o, ok := inst.cfgs[i].GetKeys("ipmute")
if !ok {
continue
}
for _, k := range o {
s, ok := inst.cfgs[i].GetBool("ipmute", k)
if account == nil {
ipmutes := map[string]bool{}
for i := len(inst.cfgs) - 1; i >= 0; i-- {
o, ok := inst.cfgs[i].GetKeys("ipmute")
if !ok {
continue
}
if !s {
delete(ipmutes, k)
} else {
ipmutes[k] = s
for _, k := range o {
s, ok := inst.cfgs[i].GetBool("ipmute", k)
if !ok {
continue
}
if !s {
delete(ipmutes, k)
} else {
ipmutes[k] = s
}
}
}
}
for kip, v := range ipmutes {
if !v {
continue
}
reg, err := regexp.Compile(kip)
if err != nil {
inst.logger.Printf("Failed to compile regexp %q: %s", kip, err.Error())
continue
}
if reg.Match([]byte(ip)) {
if jd.AllowChat {
jd.AllowChat = false
for kip, v := range ipmutes {
if !v {
continue
}
reg, err := regexp.Compile(kip)
if err != nil {
inst.logger.Printf("Failed to compile regexp %q: %s", kip, err.Error())
continue
}
if reg.Match([]byte(ip)) {
if jd.AllowChat {
jd.AllowChat = false
}
}
}
}
Expand Down

0 comments on commit 21e0ae7

Please sign in to comment.