diff options
Diffstat (limited to 'service/pixelated/adapter')
-rw-r--r-- | service/pixelated/adapter/mail_service.py | 4 | ||||
-rw-r--r-- | service/pixelated/adapter/pixelated_mail.py | 16 | ||||
-rw-r--r-- | service/pixelated/adapter/pixelated_mailboxes.py | 3 |
3 files changed, 19 insertions, 4 deletions
diff --git a/service/pixelated/adapter/mail_service.py b/service/pixelated/adapter/mail_service.py index c4b0c0e5..0d3e00f7 100644 --- a/service/pixelated/adapter/mail_service.py +++ b/service/pixelated/adapter/mail_service.py @@ -41,8 +41,10 @@ class MailService: def mail(self, mail_id): return self.mailboxes.mail(mail_id) - def send(self, mail): + def send(self, last_draft_ident, mail): self.mail_sender.sendmail(mail) + self.mailboxes.drafts().remove(last_draft_ident) + self.mailboxes.sent().add(mail) def create_draft(self, mail): return self.mailboxes.add_draft(mail) diff --git a/service/pixelated/adapter/pixelated_mail.py b/service/pixelated/adapter/pixelated_mail.py index ee2666c3..2f00e6e8 100644 --- a/service/pixelated/adapter/pixelated_mail.py +++ b/service/pixelated/adapter/pixelated_mail.py @@ -35,6 +35,7 @@ class InputMail: self._hd = None self._bd = None self._mime = None + self._chash = None def as_dict(self): statuses = [status.name for status in self.status] @@ -94,7 +95,7 @@ class InputMail: fd[fields.MULTIPART_KEY] = True fd[fields.RECENT_KEY] = True fd[fields.TYPE_KEY] = fields.TYPE_FLAGS_VAL - fd[fields.FLAGS_KEY] = [] + fd[fields.FLAGS_KEY] = ["\\Recent"] self._fd = fd return fd @@ -122,6 +123,15 @@ class InputMail: def _cdocs(self): return walk.get_raw_docs(self._mime_multipart, self._mime_multipart.walk()) + def get_to(self): + return self.headers['To'] + + def get_cc(self): + return self.headers['Cc'] + + def get_bcc(self): + return self.headers['Bcc'] + def to_mime_multipart(self): mime_multipart = MIMEMultipart() @@ -231,12 +241,12 @@ class PixelatedMail: def mark_as_read(self): self.fdoc.content['flags'].append(Status.PixelatedStatus.SEEN) - #self.status = self._extract_status() + self.save() return self def mark_as_not_recent(self): self.fdoc.content['flags'].remove(Status.PixelatedStatus.RECENT) - #self.status = self._extract_status() + self.save() return self def _persist_mail_tags(self, current_tags): diff --git a/service/pixelated/adapter/pixelated_mailboxes.py b/service/pixelated/adapter/pixelated_mailboxes.py index 1f9662fb..9180dd8d 100644 --- a/service/pixelated/adapter/pixelated_mailboxes.py +++ b/service/pixelated/adapter/pixelated_mailboxes.py @@ -33,6 +33,9 @@ class PixelatedMailBoxes(): def trash(self): return self._create_or_get('TRASH') + def sent(self): + return self._create_or_get('TRASH') + @property def mailboxes(self): return [PixelatedMailbox.create(leap_mailbox_name) for leap_mailbox_name in |