From b10d7a72cb96df2d563d90ab1811e24aa2fa84ab Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 26 Nov 2013 16:46:58 -0200 Subject: Fix fetch iteration on empty folder --- mail/src/leap/mail/imap/server.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'mail/src/leap') diff --git a/mail/src/leap/mail/imap/server.py b/mail/src/leap/mail/imap/server.py index bb2830d9..abe1dfa2 100644 --- a/mail/src/leap/mail/imap/server.py +++ b/mail/src/leap/mail/imap/server.py @@ -1512,7 +1512,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) -- cgit v1.2.3 From 61e84cee60ef1490ddf3bd82eec1d20e8e294ceb Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 26 Nov 2013 16:50:10 -0200 Subject: fix adding msg with empty flags --- mail/src/leap/mail/imap/server.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'mail/src/leap') diff --git a/mail/src/leap/mail/imap/server.py b/mail/src/leap/mail/imap/server.py index abe1dfa2..733944c6 100644 --- a/mail/src/leap/mail/imap/server.py +++ b/mail/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: -- cgit v1.2.3