[feat] Delete MMS is now a config entry
This commit is contained in:
parent
1f5e7f37be
commit
de8dcbe4d4
3 changed files with 5 additions and 9 deletions
|
@ -55,6 +55,7 @@ mailbox = /var/mail/$USER ; the mailbox where mms are appended
|
||||||
user = $USER ; the user account specified as recipient
|
user = $USER ; the user account specified as recipient
|
||||||
domain = $HOSTNAME ; the domain part appended to phone number and user
|
domain = $HOSTNAME ; the domain part appended to phone number and user
|
||||||
attach_mms = false ; whether to attach the full mms binary file
|
attach_mms = false ; whether to attach the full mms binary file
|
||||||
|
delete_from_mmsd = false ; delete mms from mmsd storage upon successful conversion
|
||||||
|
|
||||||
[smtp]
|
[smtp]
|
||||||
hostname = localhost
|
hostname = localhost
|
||||||
|
|
12
mms2mail
12
mms2mail
|
@ -49,7 +49,7 @@ class MMS2Mail:
|
||||||
MMS support is provided by python-messaging
|
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):
|
force_unlock=False):
|
||||||
"""
|
"""
|
||||||
Return class instance.
|
Return class instance.
|
||||||
|
@ -57,21 +57,19 @@ class MMS2Mail:
|
||||||
:param config: The module configuration file
|
:param config: The module configuration file
|
||||||
:type config: ConfigParser
|
:type config: ConfigParser
|
||||||
|
|
||||||
:param delete: delete MMS after conversion
|
|
||||||
:type delete: bool
|
|
||||||
|
|
||||||
:param force_read: force converting an already read MMS (batch mode)
|
:param force_read: force converting an already read MMS (batch mode)
|
||||||
:type force_read: bool
|
:type force_read: bool
|
||||||
|
|
||||||
:param force_unlock: Force mbox unlocking after a few minutes
|
:param force_unlock: Force mbox unlocking after a few minutes
|
||||||
:type force_unlock: bool
|
:type force_unlock: bool
|
||||||
"""
|
"""
|
||||||
self.delete = delete
|
|
||||||
self.force_read = force_read
|
self.force_read = force_read
|
||||||
self.force_unlock = force_unlock
|
self.force_unlock = force_unlock
|
||||||
cfg = config.get_config()
|
cfg = config.get_config()
|
||||||
self.attach_mms = cfg.getboolean('mail', 'attach_mms',
|
self.attach_mms = cfg.getboolean('mail', 'attach_mms',
|
||||||
fallback=False)
|
fallback=False)
|
||||||
|
self.delete = cfg.getboolean('mail', 'delete_from_mmsd',
|
||||||
|
fallback=False)
|
||||||
self.domain = cfg.get('mail', 'domain',
|
self.domain = cfg.get('mail', 'domain',
|
||||||
fallback=socket.getfqdn())
|
fallback=socket.getfqdn())
|
||||||
self.user = cfg.get('mail', 'user', fallback=getpass.getuser())
|
self.user = cfg.get('mail', 'user', fallback=getpass.getuser())
|
||||||
|
@ -547,9 +545,6 @@ def main():
|
||||||
dest='disable_smtp')
|
dest='disable_smtp')
|
||||||
parser.add_argument('--disable-mms-delivery', action='store_true',
|
parser.add_argument('--disable-mms-delivery', action='store_true',
|
||||||
dest='disable_mms_delivery')
|
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',
|
parser.add_argument('--force-read', action='store_true',
|
||||||
dest='force_read', help="Force conversion even if MMS \
|
dest='force_read', help="Force conversion even if MMS \
|
||||||
is marked as read")
|
is marked as read")
|
||||||
|
@ -586,7 +581,6 @@ def main():
|
||||||
fallback=2525))
|
fallback=2525))
|
||||||
|
|
||||||
m = MMS2Mail(config=c,
|
m = MMS2Mail(config=c,
|
||||||
delete=args.delete,
|
|
||||||
force_read=args.force_read,
|
force_read=args.force_read,
|
||||||
force_unlock=args.force_unlock)
|
force_unlock=args.force_unlock)
|
||||||
m.set_dbus(d)
|
m.set_dbus(d)
|
||||||
|
|
|
@ -3,6 +3,7 @@ mailbox = /var/mail/mobian
|
||||||
account = mobian
|
account = mobian
|
||||||
domain = mobian.lan
|
domain = mobian.lan
|
||||||
attach_mms = false
|
attach_mms = false
|
||||||
|
delete_from_mmsd = false
|
||||||
|
|
||||||
[smtp]
|
[smtp]
|
||||||
hostname = localhost
|
hostname = localhost
|
||||||
|
|
Loading…
Reference in a new issue