diff options
| -rw-r--r-- | src/leap/mail/imap/mailbox.py | 7 | ||||
| -rw-r--r-- | src/leap/mail/imap/service/imap-server.tac | 2 | ||||
| -rw-r--r-- | src/leap/mail/imap/service/imap.py | 4 | ||||
| -rw-r--r-- | src/leap/mail/mail.py | 25 | ||||
| -rw-r--r-- | src/leap/mail/outgoing/service.py | 5 | 
5 files changed, 30 insertions, 13 deletions
| diff --git a/src/leap/mail/imap/mailbox.py b/src/leap/mail/imap/mailbox.py index 2f33aa0..499226c 100644 --- a/src/leap/mail/imap/mailbox.py +++ b/src/leap/mail/imap/mailbox.py @@ -463,6 +463,13 @@ class IMAPMailbox(object):          # switch to content-hash based index + local UID table.          is_sequence = True if uid == 0 else False + +        # XXX DEBUG ---  if you attempt to use the `getmail` utility under +        # imap/tests, it will choke until we implement sequence numbers. This +        # is an easy hack meanwhile. +        # is_sequence = False +        # ----------------------------------------------------------------- +          getmsg = self.collection.get_message_by_uid          getimapmsg = self.get_imap_message diff --git a/src/leap/mail/imap/service/imap-server.tac b/src/leap/mail/imap/service/imap-server.tac index 49a29b1..2045757 100644 --- a/src/leap/mail/imap/service/imap-server.tac +++ b/src/leap/mail/imap/service/imap-server.tac @@ -124,8 +124,6 @@ km_kwargs = {  }  keymanager = KeyManager(*km_args, **km_kwargs) -# XXX Do we need to wait until keymanager is properly initialized? -  ##################################################  # Ok, let's expose the application object for the twistd application diff --git a/src/leap/mail/imap/service/imap.py b/src/leap/mail/imap/service/imap.py index cc76e3a..3a6b7b8 100644 --- a/src/leap/mail/imap/service/imap.py +++ b/src/leap/mail/imap/service/imap.py @@ -136,7 +136,9 @@ def run_service(store, **kwargs):      :returns: the port as returned by the reactor when starts listening, and                the factory for the protocol.      """ -    leap_assert_type(store, Soledad) +    leap_check(store, "store cannot be None") +    # XXX this can also be a ProxiedObject, FIXME +    # leap_assert_type(store, Soledad)      port = kwargs.get('port', IMAP_PORT)      userid = kwargs.get('userid', None) diff --git a/src/leap/mail/mail.py b/src/leap/mail/mail.py index b7b0981..47c8cba 100644 --- a/src/leap/mail/mail.py +++ b/src/leap/mail/mail.py @@ -63,7 +63,7 @@ class MessagePart(object):      # TODO support arbitrarily nested multiparts (right now we only support      #      the trivial case) -    def __init__(self, part_map, index=1, cdocs={}): +    def __init__(self, part_map, cdocs={}):          """          :param part_map: a dictionary mapping the subparts for                           this MessagePart (1-indexed). @@ -71,24 +71,29 @@ class MessagePart(object):          The format for the part_map is as follows: -        {u'1': {u'ctype': u'text/plain', +        {u'ctype': u'text/plain',          u'headers': [[u'Content-Type', u'text/plain; charset="utf-8"'],                       [u'Content-Transfer-Encoding', u'8bit']],          u'multi': False,          u'parts': 1,          u'phash': u'02D82B29F6BB0C8612D1C', -        u'size': 132}} +        u'size': 132} -        :param index: which index in the content-doc is this subpart -                      representing.          :param cdocs: optional, a reference to the top-level dict of wrappers                        for content-docs (1-indexed).          """ -        # TODO: Pass only the cdoc wrapper for this part.          self._pmap = part_map -        self._index = index          self._cdocs = cdocs +        index = 1 +        phash = part_map.get('phash', None) +        if phash: +            for i, cdoc_wrapper in self._cdocs.items(): +                if cdoc_wrapper.phash == phash: +                    index = i +                    break +        self._index = index +      def get_size(self):          return self._pmap['size'] @@ -121,7 +126,7 @@ class MessagePart(object):          except KeyError:              logger.debug("getSubpart for %s: KeyError" % (part,))              raise IndexError -        return MessagePart(part_map, cdocs={1: self._cdocs.get(1, {})}) +        return MessagePart(part_map, cdocs={1: self._cdocs.get(part + 1, {})})      def _get_payload(self, index):          cdoc_wrapper = self._cdocs.get(index, None) @@ -245,8 +250,10 @@ class Message(object):          except KeyError:              raise IndexError +        # FIXME instead of passing the index, let the MessagePart figure it out +        # by getting the phash and iterating through the cdocs          return MessagePart( -            subpart_dict, index=part_index, cdocs=self._wrapper.cdocs) +            subpart_dict, cdocs=self._wrapper.cdocs)      # Custom methods. diff --git a/src/leap/mail/outgoing/service.py b/src/leap/mail/outgoing/service.py index c881830..f3c2320 100644 --- a/src/leap/mail/outgoing/service.py +++ b/src/leap/mail/outgoing/service.py @@ -91,7 +91,10 @@ class OutgoingMail:          # assert params          leap_assert_type(from_address, str)          leap_assert('@' in from_address) -        leap_assert_type(keymanager, KeyManager) + +        # XXX it can be a zope.proxy too +        # leap_assert_type(keymanager, KeyManager) +          leap_assert_type(host, str)          leap_assert(host != '')          leap_assert_type(port, int) | 
