add debug
This commit is contained in:
parent
c2a1b76a19
commit
6e4c407912
1 changed files with 12 additions and 0 deletions
|
@ -194,9 +194,21 @@ class ImapFilter:
|
|||
else:
|
||||
field = 'From'
|
||||
if 'regexp' in mfilter:
|
||||
self._log.debug(
|
||||
"Filter look for %s regular expressions",
|
||||
len(mfilter['regexp'])
|
||||
)
|
||||
condition = f'allof (header :contains "{field}" "{mfilter['regexp']}")'
|
||||
else:
|
||||
self._log.debug(
|
||||
"Filter look for %s words",
|
||||
len(mfilter['words'])
|
||||
)
|
||||
condition = f'allof (header :contains "{field}" ["{'", "'.join(mfilter['words'])}"])'
|
||||
self._log.debug(
|
||||
"Condition: '%s'",
|
||||
condition
|
||||
)
|
||||
search = f"^.* # imap_filter: rule name 'imap_filter_INBOX_{mfilter['name']}'$"
|
||||
replacement = f'if {condition} {{ fileinto "{mfilter['destination']}"; stop;}} # imap_filter: rule name \'imap_filter_INBOX_{mfilter['name']}\''
|
||||
match = re.search(search, content, re.MULTILINE)
|
||||
|
|
Loading…
Reference in a new issue