diff options
Diffstat (limited to 'service/pixelated/adapter')
-rw-r--r-- | service/pixelated/adapter/pixelated_mailbox.py | 9 | ||||
-rw-r--r-- | service/pixelated/adapter/pixelated_mailboxes.py | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/service/pixelated/adapter/pixelated_mailbox.py b/service/pixelated/adapter/pixelated_mailbox.py index a6dc4116..d6bd924b 100644 --- a/service/pixelated/adapter/pixelated_mailbox.py +++ b/service/pixelated/adapter/pixelated_mailbox.py @@ -62,14 +62,15 @@ class PixelatedMailbox: if message.ident == mail_id: return message - def add(self, mail): - leap_id = self._do_add_async(mail) + def add(self, mail, use_smtp_format=False): + leap_id = self._do_add_async(mail, use_smtp_format) new_id = gen_pixelated_uid(self.leap_mailbox.mbox, leap_id) return new_id @wait_for(timeout=3.0) - def _do_add_async(self, mail): - return self.leap_mailbox.messages.add_msg(mail.raw_message()) + def _do_add_async(self, mail, use_smtp_format): + raw = mail.to_smtp_format() if use_smtp_format else mail.raw_message() + return self.leap_mailbox.messages.add_msg(raw) def remove(self, mail): mail.leap_mail.setFlags((Status.PixelatedStatus.DELETED,), 1) diff --git a/service/pixelated/adapter/pixelated_mailboxes.py b/service/pixelated/adapter/pixelated_mailboxes.py index e8d73b24..850db9d9 100644 --- a/service/pixelated/adapter/pixelated_mailboxes.py +++ b/service/pixelated/adapter/pixelated_mailboxes.py @@ -32,7 +32,7 @@ class PixelatedMailBoxes(): def add_draft(self, mail): drafts = self.drafts() - draft_id = drafts.add(mail) + draft_id = drafts.add(mail, use_smtp_format=True) mail.mailbox_name = drafts.mailbox_name mail.uid = draft_id return mail |