Improve global filtering

main
Bob Mottram 2020-12-19 13:00:35 +00:00
parent dfffd4e296
commit c7051f191f
1 changed files with 6 additions and 2 deletions

View File

@ -93,8 +93,12 @@ def isFiltered(baseDir: str, nickname: str, domain: str, content: str) -> bool:
"""
globalFiltersFilename = baseDir + '/accounts/filters.txt'
if os.path.isfile(globalFiltersFilename):
if content + '\n' in open(globalFiltersFilename).read():
return True
wordsFile = open(globalFiltersFilename, 'r')
if wordsFile:
wordsList = wordsFile.read().split('\n')
for word in wordsList:
if word in content:
return True
if not nickname or not domain:
return False