main
Bob Mottram 2024-01-17 20:02:35 +00:00
parent 9b69ad2897
commit ecd29b6d54
1 changed files with 6 additions and 3 deletions

View File

@ -2262,7 +2262,7 @@ def _load_auto_cw(base_dir: str, nickname: str, domain: str) -> []:
return [] return []
try: try:
with open(auto_cw_filename, 'r', encoding='utf-8') as fp_auto: with open(auto_cw_filename, 'r', encoding='utf-8') as fp_auto:
return fp_auto.readlines() return fp_auto.read().split('\n')
except OSError: except OSError:
print('EX: unable to load auto cw file ' + auto_cw_filename) print('EX: unable to load auto cw file ' + auto_cw_filename)
return [] return []
@ -2278,10 +2278,13 @@ def add_auto_cw(base_dir: str, nickname: str, domain: str,
for cw_rule in auto_cw_list: for cw_rule in auto_cw_list:
if '->' not in cw_rule: if '->' not in cw_rule:
continue continue
rulematch = cw_rule.split('->')[0].strip() sections = cw_rule.split('->')
rulematch = sections[0].strip()
if rulematch not in content: if rulematch not in content:
continue continue
cw_str = cw_rule.split('->')[1].strip() cw_str = sections[1].strip()
if not cw_str:
continue
if new_subject: if new_subject:
if cw_str not in new_subject: if cw_str not in new_subject:
new_subject += ', ' + cw_str new_subject += ', ' + cw_str