From b727ab8090790db2854dac191faee702f085ac20 Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Fri, 29 Aug 2014 16:29:22 -0300 Subject: Refactoring into mailboxes and mailsender - less colaborators for mail service --- service/pixelated/adapter/pixelated_mailbox.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'service/pixelated/adapter/pixelated_mailbox.py') diff --git a/service/pixelated/adapter/pixelated_mailbox.py b/service/pixelated/adapter/pixelated_mailbox.py index 280e67c7..2f50c2b4 100644 --- a/service/pixelated/adapter/pixelated_mailbox.py +++ b/service/pixelated/adapter/pixelated_mailbox.py @@ -35,6 +35,9 @@ class PixelatedMailbox: mails = [PixelatedMail.from_leap_mail(mail) for mail in mails] return mails + def mails_by_tags(self, tags): + return [mail for mail in self.mails() if len(mail.tags.intersection(tags)) > 0] + def mail(self, mail_id): for message in self.leap_mailbox.messages: if message.getUID() == int(mail_id): @@ -56,3 +59,7 @@ class PixelatedMailbox: flags = tuple(current_flags.union(new_flags)) self.leap_mailbox.setFlags(flags) + + @classmethod + def create(cls, account, mailbox_name='INBOX'): + return PixelatedMailbox(account.getMailbox(mailbox_name)) -- cgit v1.2.3