Merge branch 'next'

This commit is contained in:
Sebastian Spaeth 2012-01-09 10:04:54 +01:00
commit 08c21248eb
7 changed files with 45 additions and 12 deletions

View File

@ -10,11 +10,24 @@ others.
`WIP (coming releases)`
=======================
* Gmail "realdelete" is considered harmful and has the potential for data loss. Analysis at http://article.gmane.org/gmane.mail.imap.offlineimap.general/5265
Warnings were added to offlineimap.conf
New Features
------------
Changes
-------
* Rather than to write out the nametrans'lated folder names for mbnames,
we now write out the local untransformed box names. This is generally
what we want. This became relevant since we support nametrans rules on
the local side since only a short time. Reported by Paul Collignan.
* Some sanity checks and improved error messages.
* Revert 6.5.1.1 change to use public imaplib2 function, it was reported to
not always work.
Bug Fixes
---------

View File

@ -11,6 +11,18 @@ ChangeLog
on releases. And because I'm lazy, it will also be used as a draft for the
releases announces.
OfflineIMAP v6.5.2-rc1 (2012-01-09)
===================================
Commits v6.5.1.1 - v6.5.2-rc1:
note: Proper Changelog still in Changelog-draft.rst
d72bb88 Improve error message
3284e01 Revert "use .response() rather _get_untagged_response()"
81f194a mbnames should write out local and not nametransformed box names
7184ec2 Sanity check return value of UIDVALIDTY response
50de217 Allow to pass 'force' arg to selectro() to enforce a new select
ed71805 Changelog entry about "realdelete" option
0a275b9 Add scary warnings about "realdelete" option
OfflineIMAP v6.5.1.2 (2012-01-07) - "Baby steps"
================================================

View File

@ -1,7 +1,7 @@
__all__ = ['OfflineImap']
__productname__ = 'OfflineIMAP'
__version__ = "6.5.1.2"
__version__ = "6.5.2-rc1"
__copyright__ = "Copyright 2002-2012 John Goerzen & contributors"
__author__ = "John Goerzen"
__author_email__= "john@complete.org"

View File

@ -372,7 +372,7 @@ def syncfolder(account, remotefolder, quick):
% localfolder)
return
# Write the mailboxes
mbnames.add(account.name, localfolder.getvisiblename())
mbnames.add(account.name, localfolder.getname())
# Load status folder.
statusfolder = statusrepos.getfolder(remotefolder.getvisiblename().\

View File

@ -42,19 +42,19 @@ class IMAPFolder(BaseFolder):
self.randomgenerator = random.Random()
#self.ui is set in BaseFolder
def selectro(self, imapobj):
def selectro(self, imapobj, force = False):
"""Select this folder when we do not need write access.
Prefer SELECT to EXAMINE if we can, since some servers
(Courier) do not stabilize UID validity until the folder is
selected.
.. todo: Still valid? Needs verification
:param: Enforce new SELECT even if we are on that folder already.
:returns: raises :exc:`OfflineImapError` severity FOLDER on error"""
try:
imapobj.select(self.getfullname())
imapobj.select(self.getfullname(), force = force)
except imapobj.readonly:
imapobj.select(self.getfullname(), readonly = True)
imapobj.select(self.getfullname(), readonly = True, force = force)
def suggeststhreads(self):
return 1
@ -70,8 +70,12 @@ class IMAPFolder(BaseFolder):
try:
# SELECT receives UIDVALIDITY response
self.selectro(imapobj)
typ, uidval = imapobj.response('UIDVALIDITY')
return long(uidval[0])
# note: we would want to use .response() here but that
# often seems to return [None], even though we have
# data. TODO
uidval = imapobj._get_untagged_response('UIDVALIDITY')
assert uidval != [None], "response('UIDVALIDITY') returned [None]!"
return long(uidval[-1])
finally:
self.imapserver.releaseconnection(imapobj)
@ -566,8 +570,11 @@ class IMAPFolder(BaseFolder):
if use_uidplus or imapobj._get_untagged_response('APPENDUID', True):
# get new UID from the APPENDUID response, it could look
# like OK [APPENDUID 38505 3955] APPEND completed with
# 38505 bein folder UIDvalidity and 3955 the new UID
typ, resp = imapobj.response('APPENDUID')
# 38505 bein folder UIDvalidity and 3955 the new UID.
# note: we would want to use .response() here but that
# often seems to return [None], even though we have
# data. TODO
resp = imapobj._get_untagged_response('APPENDUID')
if resp == [None]:
self.ui.warn("Server supports UIDPLUS but got no APPENDUID "
"appending a message.")

View File

@ -191,7 +191,8 @@ class MappedIMAPFolder(IMAPFolder):
newluid = self._mb.savemessage(-1, content, flags, rtime)
if newluid < 1:
raise ValueError("Backend could not find uid for message")
raise ValueError("Backend could not find uid for message, returned "
"%s" % newluid)
self.maplock.acquire()
try:
self.diskl2r[newluid] = uid

View File

@ -40,7 +40,7 @@ class UsefulIMAPMixIn(object):
return self.mailbox
return None
def select(self, mailbox='INBOX', readonly=False, force = 0):
def select(self, mailbox='INBOX', readonly=False, force = False):
"""Selects a mailbox on the IMAP server
:returns: 'OK' on success, nothing if the folder was already