/head: changeset 92
Made several fixes for 2.0.8
This commit is contained in:
parent
f8c2be1df7
commit
120076256f
@ -1,3 +1,16 @@
|
||||
offlineimap (2.0.8) unstable; urgency=low
|
||||
|
||||
* Modified the IMAP folder to use SELECT rather than STATUS more often.
|
||||
Makes the code more robust; handles better with read-only folders;
|
||||
and runs faster, especially for non-threaded useres, where it
|
||||
may eliminate up to 2-3 commands per folder.
|
||||
* Made sure IMAP folder savemessage() does a select. This was a possible
|
||||
bug.
|
||||
* Modified Maildir folder to unlink messages with T flag in
|
||||
cachemessagelist()
|
||||
|
||||
-- John Goerzen <jgoerzen@complete.org> Wed, 10 Jul 2002 12:29:30 -0500
|
||||
|
||||
offlineimap (2.0.7) unstable; urgency=low
|
||||
|
||||
* Fixed imaplib.py to work better with read-only folders.
|
||||
|
@ -45,30 +45,25 @@ class IMAPFolder(BaseFolder):
|
||||
|
||||
def getuidvalidity(self):
|
||||
imapobj = self.imapserver.acquireconnection()
|
||||
x = None
|
||||
readonlysave = imapobj.is_readonly
|
||||
imapobj.is_readonly = 1
|
||||
try:
|
||||
x = imapobj.status(self.getfullname(), '(UIDVALIDITY)')[1][0]
|
||||
# Primes untagged_responses
|
||||
imapobj.select(self.getfullname(), readonly = 1)
|
||||
return long(imapobj.untagged_responses['UIDVALIDITY'][0])
|
||||
finally:
|
||||
self.imapserver.releaseconnection(imapobj)
|
||||
imapobj.is_readonly = readonlysave
|
||||
uidstring = imaputil.imapsplit(x)[1]
|
||||
return long(imaputil.flagsplit(uidstring)[1])
|
||||
|
||||
def cachemessagelist(self):
|
||||
imapobj = self.imapserver.acquireconnection()
|
||||
self.messagelist = {}
|
||||
|
||||
try:
|
||||
self.messagelist = {}
|
||||
response = imapobj.status(self.getfullname(), '(MESSAGES)')[1][0]
|
||||
result = imaputil.imapsplit(response)[1]
|
||||
maxmsgid = long(imaputil.flags2hash(result)['MESSAGES'])
|
||||
if (maxmsgid < 1):
|
||||
# No messages? return.
|
||||
# Primes untagged_responses
|
||||
imapobj.select(self.getfullname(), readonly = 1)
|
||||
maxmsgid = long(imapobj.untagged_responses['EXISTS'][0])
|
||||
if maxmsgid < 1:
|
||||
# No messages; return
|
||||
return
|
||||
|
||||
# Needed for fetch below
|
||||
imapobj.select(self.getfullname(), readonly = 1)
|
||||
# Now, get the flags and UIDs for these.
|
||||
response = imapobj.fetch('1:%d' % maxmsgid, '(FLAGS UID)')[1]
|
||||
finally:
|
||||
@ -98,6 +93,8 @@ class IMAPFolder(BaseFolder):
|
||||
def savemessage(self, uid, content, flags):
|
||||
imapobj = self.imapserver.acquireconnection()
|
||||
try:
|
||||
imapobj.select(self.getfullname()) # Needed for search
|
||||
|
||||
# This backend always assigns a new uid, so the uid arg is ignored.
|
||||
# In order to get the new uid, we need to save off the message ID.
|
||||
|
||||
|
@ -106,9 +106,17 @@ class MaildirFolder(BaseFolder):
|
||||
if flagmatch:
|
||||
flags = [x for x in flagmatch.group(1)]
|
||||
flags.sort()
|
||||
self.messagelist[uid] = {'uid': uid,
|
||||
'flags': flags,
|
||||
'filename': file}
|
||||
if 'T' in flags:
|
||||
# Message is marked for deletion; just delete it now.
|
||||
# Otherwise, the T flag will be propogated to the IMAP
|
||||
# server, and then expunged there, and then deleted here.
|
||||
# Might as well just delete it now, to help make things
|
||||
# more robust.
|
||||
os.unlink(file)
|
||||
else:
|
||||
self.messagelist[uid] = {'uid': uid,
|
||||
'flags': flags,
|
||||
'filename': file}
|
||||
|
||||
def getmessagelist(self):
|
||||
return self.messagelist
|
||||
|
Loading…
Reference in New Issue
Block a user