Skip to content

Commit 9a01628

Browse files
committed
add flag for disable ban revoke (default on)
1 parent 45a7b25 commit 9a01628

3 files changed

Lines changed: 32 additions & 26 deletions

File tree

glob.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ var (
1414
serverConfig serverConfigData
1515
serverList serverListData
1616
configPath string
17+
disableBanRevoke bool
1718
ourBanData []banDataType
1819
compositeBanData []minBanDataType
1920

main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func main() {
2222
flag.BoolVar(&forceFetch, "forceFetch", false, "force startup fetching ban lists from remotes")
2323
var verboseLogging bool
2424
flag.BoolVar(&verboseLogging, "verboseLogging", false, "force enable verbose logging")
25+
flag.BoolVar(&disableBanRevoke, "disableBanRevoke", true, "disable processing of ban revocations")
2526
flag.Parse()
2627

2728
//Make config file if requested

update.go

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,23 @@ func fetchBanLists() {
8383
}
8484
}
8585
//Look for names that disappeared
86-
for i, item := range oldList {
87-
found := false
88-
for _, name := range names {
89-
if strings.EqualFold(item.UserName, name) {
90-
found = true
91-
break
86+
if !disableBanRevoke {
87+
for i, item := range oldList {
88+
found := false
89+
for _, name := range names {
90+
if strings.EqualFold(item.UserName, name) {
91+
found = true
92+
break
93+
}
9294
}
93-
}
94-
if !found && !item.Revoked {
95-
gDirty++
96-
lDirty++
97-
serverList.ServerList[spos].LocalData.BanList[i].Revoked = true
98-
if serverConfig.ServerPrefs.VerboseLogging {
99-
log.Println(server.CommunityName + ": Ban for " + item.UserName + " was revoked")
100-
revoked++
95+
if !found && !item.Revoked {
96+
gDirty++
97+
lDirty++
98+
serverList.ServerList[spos].LocalData.BanList[i].Revoked = true
99+
if serverConfig.ServerPrefs.VerboseLogging {
100+
log.Println(server.CommunityName + ": Ban for " + item.UserName + " was revoked")
101+
revoked++
102+
}
101103
}
102104
}
103105
}
@@ -151,20 +153,22 @@ func fetchBanLists() {
151153
}
152154

153155
//Detect bans that were revoked
154-
for ipos, item := range oldList {
155-
found := false
156-
for _, ban := range bans {
157-
if strings.EqualFold(ban.UserName, item.UserName) {
158-
found = true
159-
break
156+
if !disableBanRevoke {
157+
for ipos, item := range oldList {
158+
found := false
159+
for _, ban := range bans {
160+
if strings.EqualFold(ban.UserName, item.UserName) {
161+
found = true
162+
break
163+
}
160164
}
161-
}
162-
if !found && !item.Revoked {
163-
revoked++
164-
if serverConfig.ServerPrefs.VerboseLogging {
165-
log.Println(server.CommunityName + ": Ban for " + item.UserName + " was revoked")
165+
if !found && !item.Revoked {
166+
revoked++
167+
if serverConfig.ServerPrefs.VerboseLogging {
168+
log.Println(server.CommunityName + ": Ban for " + item.UserName + " was revoked")
169+
}
170+
serverList.ServerList[spos].LocalData.BanList[ipos].Revoked = true
166171
}
167-
serverList.ServerList[spos].LocalData.BanList[ipos].Revoked = true
168172
}
169173
}
170174
}

0 commit comments

Comments
 (0)