From 08497951fa9aed8d28be8b2dea1aef2135f56769 Mon Sep 17 00:00:00 2001 From: Folker Bernitt Date: Thu, 6 Aug 2015 13:25:30 +0200 Subject: Made LeapMail compatible with SearchEngine. --- service/pixelated/adapter/mailstore/leap_mailstore.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'service/pixelated/adapter/mailstore') 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): @@ -38,10 +39,25 @@ class LeapMail(Mail): def body(self): 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()}, -- cgit v1.2.3