[feat] Delete MMS is now a config entry

This commit is contained in:
Alex 2021-05-19 08:15:58 +02:00
parent 1f5e7f37be
commit de8dcbe4d4
3 changed files with 5 additions and 9 deletions

View file

@ -55,6 +55,7 @@ mailbox = /var/mail/$USER ; the mailbox where mms are appended
user = $USER ; the user account specified as recipient
domain = $HOSTNAME ; the domain part appended to phone number and user
attach_mms = false ; whether to attach the full mms binary file
delete_from_mmsd = false ; delete mms from mmsd storage upon successful conversion
[smtp]
hostname = localhost

View file

@ -49,7 +49,7 @@ class MMS2Mail:
MMS support is provided by python-messaging
"""
def __init__(self, config, delete=False, force_read=False,
def __init__(self, config, force_read=False,
force_unlock=False):
"""
Return class instance.
@ -57,21 +57,19 @@ class MMS2Mail:
:param config: The module configuration file
:type config: ConfigParser
:param delete: delete MMS after conversion
:type delete: bool
:param force_read: force converting an already read MMS (batch mode)
:type force_read: bool
:param force_unlock: Force mbox unlocking after a few minutes
:type force_unlock: bool
"""
self.delete = delete
self.force_read = force_read
self.force_unlock = force_unlock
cfg = config.get_config()
self.attach_mms = cfg.getboolean('mail', 'attach_mms',
fallback=False)
self.delete = cfg.getboolean('mail', 'delete_from_mmsd',
fallback=False)
self.domain = cfg.get('mail', 'domain',
fallback=socket.getfqdn())
self.user = cfg.get('mail', 'user', fallback=getpass.getuser())
@ -547,9 +545,6 @@ def main():
dest='disable_smtp')
parser.add_argument('--disable-mms-delivery', action='store_true',
dest='disable_mms_delivery')
parser.add_argument('--delete', action='store_true', dest='delete',
help="After procession ask mmsd to delete \
the mms from its storage")
parser.add_argument('--force-read', action='store_true',
dest='force_read', help="Force conversion even if MMS \
is marked as read")
@ -586,7 +581,6 @@ def main():
fallback=2525))
m = MMS2Mail(config=c,
delete=args.delete,
force_read=args.force_read,
force_unlock=args.force_unlock)
m.set_dbus(d)

View file

@ -3,6 +3,7 @@ mailbox = /var/mail/mobian
account = mobian
domain = mobian.lan
attach_mms = false
delete_from_mmsd = false
[smtp]
hostname = localhost