make store procedure aware of pretend option
This commit is contained in:
@@ -243,7 +243,6 @@ class ModifyMilter(Milter.Base):
|
|||||||
# pre-filter rules and actions by the host condition, other
|
# pre-filter rules and actions by the host condition, other
|
||||||
# conditions (headers, envelope-from, envelope-to) may get
|
# conditions (headers, envelope-from, envelope-to) may get
|
||||||
# changed by executed actions later on.
|
# changed by executed actions later on.
|
||||||
# rules are copied to preserve the originally configured actions.
|
|
||||||
# also check if the mail body is needed by any upcoming action.
|
# also check if the mail body is needed by any upcoming action.
|
||||||
|
|
||||||
self.rules = []
|
self.rules = []
|
||||||
@@ -260,6 +259,7 @@ class ModifyMilter(Milter.Base):
|
|||||||
self._headersonly = False
|
self._headersonly = False
|
||||||
|
|
||||||
if actions:
|
if actions:
|
||||||
|
# copy needed rules to preserve configured actions
|
||||||
rule = copy(rule)
|
rule = copy(rule)
|
||||||
rule.actions = actions
|
rule.actions = actions
|
||||||
self.rules.append(rule)
|
self.rules.append(rule)
|
||||||
|
|||||||
@@ -324,6 +324,8 @@ def store(milter, directory, original=False, pretend=False,
|
|||||||
datafile = os.path.join(directory, store_id)
|
datafile = os.path.join(directory, store_id)
|
||||||
|
|
||||||
logger.info(f"store message in file {datafile}")
|
logger.info(f"store message in file {datafile}")
|
||||||
|
|
||||||
|
if not pretend:
|
||||||
try:
|
try:
|
||||||
with open(datafile, "wb") as fp:
|
with open(datafile, "wb") as fp:
|
||||||
if original:
|
if original:
|
||||||
|
|||||||
Reference in New Issue
Block a user