Browse Source

[feat] Convert stored mms on init

dev
Alex 2 years ago
parent
commit
1f5e7f37be
  1. 6
      README.md
  2. 2
      TODO.md
  3. 21
      mms2mail

6
README.md

@ -39,6 +39,12 @@ systemctl --user daemon-reload
systemctl --user enable mms2mail
systemctl --user start mms2mail
```
Depending on your distribution, you might have to add your account to the ```mail``` group to be able to lock and use the system mbox.
On Debian based distribution :
```
sudo addgroup $(whoami) mail
```
### config
An optional configuration file can be put in the home folder : ```$HOME/.mms/modemmanager/mms2mail.ini```. The default value are :

2
TODO.md

@ -2,8 +2,6 @@
## To Do
* Convert all previously received mms on start
* HTML message
* mms2mail : add as HTML body, currently added as attachments
* mail2mms : convert to text plain in case of html only mail

21
mms2mail

@ -266,6 +266,13 @@ class MMS2Mail:
if self.delete:
self.dbus.delete_mms(dbus_path)
def convert_stored_mms(self):
"""Convert all mms from mmsd storage."""
log.info('INIT : Converting MMs from storage')
messages = self.dbus.get_messages()
for m in messages:
self.message_added(name=m[0], value=m[1])
class Mail2MMSHandler:
"""The class handling the conversion between mail and MMS format."""
@ -426,6 +433,16 @@ class DbusMMSd():
service = self.bus.get('org.ofono.mms', path)
return service
def get_messages(self):
"""
Ask mmsd all stored mms.
:return all mms from mmsd storage
:rtype Array
"""
service = self.get_service()
return service.GetMessages()
def get_manager_config(self):
"""
Ask mmsd its properties.
@ -531,7 +548,8 @@ def main():
parser.add_argument('--disable-mms-delivery', action='store_true',
dest='disable_mms_delivery')
parser.add_argument('--delete', action='store_true', dest='delete',
help="Ask mmsd to delete the converted MMS")
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,6 +604,7 @@ def main():
log.info("Activating mms to mbox server")
d.set_mms2mail(m)
d.add_signal_receiver()
m.convert_stored_mms()
else:
parser.print_help()
return

Loading…
Cancel
Save