diff options
author | Duda Dornelles <ddornell@thoughtworks.com> | 2014-09-19 11:49:23 -0300 |
---|---|---|
committer | Duda Dornelles <ddornell@thoughtworks.com> | 2014-09-19 11:49:23 -0300 |
commit | eb59c286605147442ae54005dc59812f4b086662 (patch) | |
tree | 539bded4347fd0dfe5cccf55530103a49947bc4d /service/pixelated/adapter | |
parent | 610d356c0ad2e9ea47946f0212a945ed663d0106 (diff) |
Now it is possible to add_msg with either raw format (for when changing leap messages to different mailboxes) or smtp_format (when adding a brand new draft)
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 |