From 7fcd1609118c3225be769a6b2b15538fc3d66d10 Mon Sep 17 00:00:00 2001 From: Nicolas Sebrecht Date: Wed, 8 Jun 2016 19:02:04 +0200 Subject: [PATCH] GmailMaildir: quick mode is not compatible with utime_from_header Signed-off-by: Nicolas Sebrecht --- offlineimap.conf | 3 ++- offlineimap/folder/Base.py | 4 ---- offlineimap/folder/GmailMaildir.py | 12 ++++++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/offlineimap.conf b/offlineimap.conf index 1958632..bdd622f 100644 --- a/offlineimap.conf +++ b/offlineimap.conf @@ -494,7 +494,8 @@ localfolders = ~/Test # example, finding messages older than 3 months), without parsing each # file/message content. # -# If enabled, this prevents the -q (quick mode) CLI option to work correctly. +# This option is not compatible with -q (quick mode) CLI option for GmailMaildir +# types. # # Default: no. # diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py index 60cf431..7819616 100644 --- a/offlineimap/folder/Base.py +++ b/offlineimap/folder/Base.py @@ -123,10 +123,6 @@ class BaseFolder(object): Should be implemented only for folders that suggest threads.""" raise NotImplementedError - # XXX: we may need someting like supports_quickstatus() to check - # XXX: if user specifies 'quick' flag for folder that doesn't - # XXX: support quick status queries, so one believes that quick - # XXX: status checks will be done, but it won't really be so. def quickchanged(self, statusfolder): """ Runs quick check for folder changes and returns changed status: True -- changed, False -- not changed. diff --git a/offlineimap/folder/GmailMaildir.py b/offlineimap/folder/GmailMaildir.py index 71624a2..65626ea 100644 --- a/offlineimap/folder/GmailMaildir.py +++ b/offlineimap/folder/GmailMaildir.py @@ -1,5 +1,5 @@ # Maildir folder support with labels -# Copyright (C) 2002 - 2011 John Goerzen & contributors +# Copyright (C) 2002 - 2016 John Goerzen & contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,14 +17,14 @@ import os +import six from sys import exc_info + from .Maildir import MaildirFolder from offlineimap import OfflineImapError import offlineimap.accounts from offlineimap import imaputil -import six - class GmailMaildirFolder(MaildirFolder): """Folder implementation to support adding labels to messages in a Maildir. """ @@ -44,6 +44,10 @@ class GmailMaildirFolder(MaildirFolder): def quickchanged(self, statusfolder): """Returns True if the Maildir has changed. Checks uids, flags and mtimes""" + if self._utime_from_header is True: + raise Exception("GmailMaildir does not support quick mode" + " when 'utime_from_header' is enabled.") + self.cachemessagelist() # Folder has different uids than statusfolder => TRUE if sorted(self.getmessageuidlist()) != \ @@ -57,7 +61,7 @@ class GmailMaildirFolder(MaildirFolder): for (uid, message) in self.getmessagelist().items(): if message['mtime'] > statusfolder.getmessagemtime(uid): return True - return False #Nope, nothing changed + return False # Nope, nothing changed. # Interface from BaseFolder