From 3284e010ff12a8c6a80e8ea299af26e80edcd4c0 Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Mon, 9 Jan 2012 09:51:43 +0100 Subject: [PATCH] Revert "use .response() rather _get_untagged_response()" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recently the internal function use of imaplib2's _get_untagged_response() was switched to use the public documented .response() function (which should return the same data). However within a few fays we received reports that both uses of a) the UIDVALIDITY fetching and b) the APPENDUID fetching returned [None] as data although the IMAP log definitely shows that data was returned. Revert to using the undocumented internal imaplib2 function, that seemed to have worked without problems. This needs to be taken up to the imaplib2 developer. Signed-off-by: Sebastian Spaeth --- offlineimap/folder/IMAP.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index f04f871..75c731c 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -70,9 +70,12 @@ class IMAPFolder(BaseFolder): try: # SELECT receives UIDVALIDITY response self.selectro(imapobj) - typ, uidval = imapobj.response('UIDVALIDITY') + # 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[0]) + return long(uidval[-1]) finally: self.imapserver.releaseconnection(imapobj) @@ -567,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.")