GmailMaildir: quick mode is not compatible with utime_from_header

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2016-06-08 19:02:04 +02:00
parent c4c73dd1a0
commit 7fcd160911
3 changed files with 10 additions and 9 deletions

View File

@ -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.
#

View File

@ -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.

View File

@ -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