diff options
author | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-06 13:25:30 +0200 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-11 17:00:33 +0200 |
commit | 08497951fa9aed8d28be8b2dea1aef2135f56769 (patch) | |
tree | 2c11b8c3cc71b47db62fa3cb4dce9dbe3ed22292 /service/pixelated/adapter/mailstore | |
parent | ce86deeed4d4e408ddad294beec7952601345025 (diff) |
Made LeapMail compatible with SearchEngine.
Diffstat (limited to 'service/pixelated/adapter/mailstore')
-rw-r--r-- | service/pixelated/adapter/mailstore/leap_mailstore.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/service/pixelated/adapter/mailstore/leap_mailstore.py b/service/pixelated/adapter/mailstore/leap_mailstore.py index 7ba02519..c3c93cc3 100644 --- a/service/pixelated/adapter/mailstore/leap_mailstore.py +++ b/service/pixelated/adapter/mailstore/leap_mailstore.py @@ -23,12 +23,13 @@ from pixelated.adapter.model.mail import Mail class LeapMail(Mail): - def __init__(self, mail_id, mailbox_name, headers=None, tags=set(), body=None): + def __init__(self, mail_id, mailbox_name, headers=None, tags=set(), flags=set(), body=None): self._mail_id = mail_id self._mailbox_name = mailbox_name self.headers = headers if headers is not None else {} self._body = body self.tags = tags + self._flags = flags @property def mail_id(self): @@ -39,9 +40,24 @@ class LeapMail(Mail): return self._body @property + def flags(self): + return self._flags + + @property def mailbox_name(self): return self._mailbox_name + @property + def raw(self): + result = '' + for k, v in self.headers.items(): + result = result + '%s: %s\n' % (k, v) + result = result + '\n' + if self._body: + result = result + self._body + + return result + def as_dict(self): return { 'header': {k.lower(): v for k, v in self.headers.items()}, |