Add MMS sending capacilities #1

Merged
alex merged 12 commits from dev into master 2021-05-21 05:57:05 +00:00
3 changed files with 26 additions and 3 deletions
Showing only changes of commit 1f5e7f37be - Show all commits

View file

@ -40,6 +40,12 @@ systemctl --user enable mms2mail
systemctl --user start 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 ### config
An optional configuration file can be put in the home folder : ```$HOME/.mms/modemmanager/mms2mail.ini```. The default value are : An optional configuration file can be put in the home folder : ```$HOME/.mms/modemmanager/mms2mail.ini```. The default value are :

View file

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

View file

@ -266,6 +266,13 @@ class MMS2Mail:
if self.delete: if self.delete:
self.dbus.delete_mms(dbus_path) 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: class Mail2MMSHandler:
"""The class handling the conversion between mail and MMS format.""" """The class handling the conversion between mail and MMS format."""
@ -426,6 +433,16 @@ class DbusMMSd():
service = self.bus.get('org.ofono.mms', path) service = self.bus.get('org.ofono.mms', path)
return service 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): def get_manager_config(self):
""" """
Ask mmsd its properties. Ask mmsd its properties.
@ -531,7 +548,8 @@ def main():
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', 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', 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,6 +604,7 @@ def main():
log.info("Activating mms to mbox server") log.info("Activating mms to mbox server")
d.set_mms2mail(m) d.set_mms2mail(m)
d.add_signal_receiver() d.add_signal_receiver()
m.convert_stored_mms()
else: else:
parser.print_help() parser.print_help()
return return