diff options
-rw-r--r-- | changes/bug_fix-empty-flags | 1 | ||||
-rw-r--r-- | changes/bug_fix-iteration-empty-mailbox | 1 | ||||
-rw-r--r-- | src/leap/mail/imap/server.py | 11 |
3 files changed, 10 insertions, 3 deletions
diff --git a/changes/bug_fix-empty-flags b/changes/bug_fix-empty-flags new file mode 100644 index 0000000..a109ef5 --- /dev/null +++ b/changes/bug_fix-empty-flags @@ -0,0 +1 @@ + o Fix a bug when adding a message with empty flags. Closes: #4496 diff --git a/changes/bug_fix-iteration-empty-mailbox b/changes/bug_fix-iteration-empty-mailbox new file mode 100644 index 0000000..11dd770 --- /dev/null +++ b/changes/bug_fix-iteration-empty-mailbox @@ -0,0 +1 @@ + o Allow to iterate in an empty mailbox during fetch. Closes: #4603 diff --git a/src/leap/mail/imap/server.py b/src/leap/mail/imap/server.py index bb2830d..733944c 100644 --- a/src/leap/mail/imap/server.py +++ b/src/leap/mail/imap/server.py @@ -1438,12 +1438,14 @@ class SoledadMailbox(WithMsgFields): """ # XXX we should treat the message as an IMessage from here uid_next = self.getUIDNext() - flags = tuple(str(flag) for flag in flags) + if flags is None: + flags = tuple() + else: + flags = tuple(str(flag) for flag in flags) self.messages.add_msg(message, flags=flags, date=date, uid=uid_next) - # XXX recent should not include deleted...?? exists = len(self.messages) recent = len(self.messages.get_recent()) for listener in self.listeners: @@ -1512,7 +1514,10 @@ class SoledadMailbox(WithMsgFields): except TypeError: # looks like we cannot iterate last = self.messages.get_last() - uid_last = last.getUID() + if last is None: + uid_last = 1 + else: + uid_last = last.getUID() messages.last = uid_last # for sequence numbers (uid = 0) |