From 3d5f92655231f9ff46d0eab7f04fbd4be702ed8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Sun, 11 Oct 2020 23:57:17 +0200 Subject: [PATCH 1/3] Changed the doxygen in change_message_uid This patch changes the doxygen and adds the ruid argument. --- offlineimap/folder/UIDMaps.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/offlineimap/folder/UIDMaps.py b/offlineimap/folder/UIDMaps.py index 9014805..fd495d4 100644 --- a/offlineimap/folder/UIDMaps.py +++ b/offlineimap/folder/UIDMaps.py @@ -316,9 +316,14 @@ class MappedIMAPFolder(IMAPFolder): def change_message_uid(self, ruid, new_ruid): """Change the message from existing ruid to new_ruid - :param new_uid: The old remote UID will be changed to a new + The old remote UID will be changed to a new UID. The UIDMaps case handles this efficiently by simply - changing the mappings file.""" + changing the mappings file. + + Args: + ruid: Remote UID + new_ruid: New Remote UID + """ if ruid not in self.r2l: raise OfflineImapError("Cannot change unknown Maildir UID %s" % From 62df6e70c36c2d65123e7208e9ce9c2abbf19649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Mon, 12 Oct 2020 01:35:20 +0200 Subject: [PATCH 2/3] Rigth comparison with err EEXIST This is the right code. The OSError doesn't have the EEXIST variable. --- offlineimap/folder/Maildir.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py index f06217b..ca42e13 100644 --- a/offlineimap/folder/Maildir.py +++ b/offlineimap/folder/Maildir.py @@ -15,6 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +import errno import socket import time import re @@ -311,7 +312,7 @@ class MaildirFolder(BaseFolder): except OSError as e: if not hasattr(e, 'EEXIST'): raise - if e.errno == e.EEXIST: + if e.errno == errno.EEXIST: if tries: time.sleep(0.23) continue From ba6857bc87bb2f159896719a4eafefa9fcf11f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Mon, 12 Oct 2020 12:40:54 +0200 Subject: [PATCH 3/3] Remove email.Parse The Parse funcion was deprecated in python 2.4. We can use this new code. --- offlineimap/folder/Maildir.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py index ca42e13..205feea 100644 --- a/offlineimap/folder/Maildir.py +++ b/offlineimap/folder/Maildir.py @@ -366,9 +366,8 @@ class MaildirFolder(BaseFolder): content, 'Delivery-date') except Exception as e: # This should never happen. - from email.Parser import Parser from offlineimap.ui import getglobalui - datestr = Parser().parsestr(content, True).get("Date") + datestr = emailutil.get_message_date(content) ui = getglobalui() ui.warn("UID %d has invalid date %s: %s\n" "Not using message timestamp as file prefix" % @@ -387,9 +386,8 @@ class MaildirFolder(BaseFolder): # In case date is wrongly so far into the future as to be > max # int32. except Exception as e: - from email.Parser import Parser from offlineimap.ui import getglobalui - datestr = Parser().parsestr(content, True).get("Date") + datestr = emailutil.get_message_date(content) ui = getglobalui() ui.warn("UID %d has invalid date %s: %s\n" "Not changing file modification time" % (uid, datestr, e))