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)` `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 New Features
------------ ------------
Changes 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 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 on releases. And because I'm lazy, it will also be used as a draft for the
releases announces. 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" OfflineIMAP v6.5.1.2 (2012-01-07) - "Baby steps"
================================================ ================================================

View File

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

View File

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

View File

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

View File

@ -191,7 +191,8 @@ class MappedIMAPFolder(IMAPFolder):
newluid = self._mb.savemessage(-1, content, flags, rtime) newluid = self._mb.savemessage(-1, content, flags, rtime)
if newluid < 1: 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() self.maplock.acquire()
try: try:
self.diskl2r[newluid] = uid self.diskl2r[newluid] = uid

View File

@ -40,7 +40,7 @@ class UsefulIMAPMixIn(object):
return self.mailbox return self.mailbox
return None 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 """Selects a mailbox on the IMAP server
:returns: 'OK' on success, nothing if the folder was already :returns: 'OK' on success, nothing if the folder was already