Skip to content

Commit

Permalink
Merge pull request #115 from khinsen/quoted-folder-names-in-movemail
Browse files Browse the repository at this point in the history
Allow quoted folder names in MoveMail settings
  • Loading branch information
GuillaumeSeren committed Apr 26, 2017
2 parents 522fa42 + d0a189a commit cacf4b4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions afew/Settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def get_filter_chain(database):
return filter_chain

def get_mail_move_rules():
rule_pattern = re.compile(r"'(.+?)':(\S+)")
rule_pattern = re.compile(r"'(.+?)':((?P<quote>['\"])(.*?)(?P=quote)|\S+)")
if settings.has_option(mail_mover_section, 'folders'):
all_rules = collections.OrderedDict()

Expand All @@ -87,7 +87,9 @@ def get_mail_move_rules():
raw_rules = re.findall(rule_pattern,
settings.get(mail_mover_section, folder))
for rule in raw_rules:
rules[rule[0]] = rule[1]
query = rule[0]
destination = rule[3] or rule[1]
rules[query] = destination
all_rules[folder] = rules
else:
raise NameError("No rules specified for maildir '{}'.".format(folder))
Expand Down

0 comments on commit cacf4b4

Please sign in to comment.