summaryrefslogtreecommitdiff
path: root/src/leap/mail/imap/service
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-01-16 18:55:22 -0300
committerTomás Touceda <chiiph@leap.se>2014-01-16 18:55:22 -0300
commite3692d50ca2fa4110ba37322b1f46d71d93ac135 (patch)
tree951497ce242b3ad165764c295fcd80fe4b253b82 /src/leap/mail/imap/service
parent06eebf54ab572ebaf6730f2095a062cd9549f12e (diff)
parent6c7207a5667d8158572b2a900a3506e3c3ecc6e5 (diff)
Merge remote-tracking branch 'refs/remotes/kali/bug/fix-store-iteration' into develop
Diffstat (limited to 'src/leap/mail/imap/service')
-rw-r--r--src/leap/mail/imap/service/imap.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/leap/mail/imap/service/imap.py b/src/leap/mail/imap/service/imap.py
index e877869..6e03456 100644
--- a/src/leap/mail/imap/service/imap.py
+++ b/src/leap/mail/imap/service/imap.py
@@ -124,7 +124,9 @@ class LeapIMAPServer(imap4.IMAP4Server):
cbFetch = self._IMAP4Server__cbFetch
ebFetch = self._IMAP4Server__ebFetch
- if str(query[0]) == "flags":
+ print "QUERY: ", query
+
+ if len(query) == 1 and str(query[0]) == "flags":
self._oldTimeout = self.setTimeout(None)
# no need to call iter, we get a generator
maybeDeferred(
@@ -144,6 +146,36 @@ class LeapIMAPServer(imap4.IMAP4Server):
select_FETCH = (do_FETCH, imap4.IMAP4Server.arg_seqset,
imap4.IMAP4Server.arg_fetchatt)
+ def _cbSelectWork(self, mbox, cmdName, tag):
+ """
+ Callback for selectWork, patched to avoid conformance errors due to
+ incomplete UIDVALIDITY line.
+ """
+ if mbox is None:
+ self.sendNegativeResponse(tag, 'No such mailbox')
+ return
+ if '\\noselect' in [s.lower() for s in mbox.getFlags()]:
+ self.sendNegativeResponse(tag, 'Mailbox cannot be selected')
+ return
+
+ flags = mbox.getFlags()
+ self.sendUntaggedResponse(str(mbox.getMessageCount()) + ' EXISTS')
+ self.sendUntaggedResponse(str(mbox.getRecentCount()) + ' RECENT')
+ self.sendUntaggedResponse('FLAGS (%s)' % ' '.join(flags))
+
+ # Patched -------------------------------------------------------
+ # imaptest was complaining about the incomplete line, we're adding
+ # "UIDs valid" here.
+ self.sendPositiveResponse(
+ None, '[UIDVALIDITY %d] UIDs valid' % mbox.getUIDValidity())
+ # ----------------------------------------------------------------
+
+ s = mbox.isWriteable() and 'READ-WRITE' or 'READ-ONLY'
+ mbox.addListener(self)
+ self.sendPositiveResponse(tag, '[%s] %s successful' % (s, cmdName))
+ self.state = 'select'
+ self.mbox = mbox
+
class IMAPAuthRealm(object):
"""