Browse Source

[feat] Delete MMS is now a config entry

tags/1.0.0
Alex 6 months ago
parent
commit
de8dcbe4d4
3 changed files with 5 additions and 9 deletions
  1. +1
    -0
      README.md
  2. +3
    -9
      mms2mail
  3. +1
    -0
      mms2mail.ini

+ 1
- 0
README.md 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


+ 3
- 9
mms2mail 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)


+ 1
- 0
mms2mail.ini 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


Loading…
Cancel
Save