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 # example, finding messages older than 3 months), without parsing each
# file/message content. # 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. # Default: no.
# #

View File

@ -123,10 +123,6 @@ class BaseFolder(object):
Should be implemented only for folders that suggest threads.""" Should be implemented only for folders that suggest threads."""
raise NotImplementedError 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): def quickchanged(self, statusfolder):
""" Runs quick check for folder changes and returns changed """ Runs quick check for folder changes and returns changed
status: True -- changed, False -- not changed. status: True -- changed, False -- not changed.

View File

@ -1,5 +1,5 @@
# Maildir folder support with labels # 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 # 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 # it under the terms of the GNU General Public License as published by
@ -17,14 +17,14 @@
import os import os
import six
from sys import exc_info from sys import exc_info
from .Maildir import MaildirFolder from .Maildir import MaildirFolder
from offlineimap import OfflineImapError from offlineimap import OfflineImapError
import offlineimap.accounts import offlineimap.accounts
from offlineimap import imaputil from offlineimap import imaputil
import six
class GmailMaildirFolder(MaildirFolder): class GmailMaildirFolder(MaildirFolder):
"""Folder implementation to support adding labels to messages in a Maildir. """Folder implementation to support adding labels to messages in a Maildir.
""" """
@ -44,6 +44,10 @@ class GmailMaildirFolder(MaildirFolder):
def quickchanged(self, statusfolder): def quickchanged(self, statusfolder):
"""Returns True if the Maildir has changed. Checks uids, flags and mtimes""" """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() self.cachemessagelist()
# Folder has different uids than statusfolder => TRUE # Folder has different uids than statusfolder => TRUE
if sorted(self.getmessageuidlist()) != \ if sorted(self.getmessageuidlist()) != \
@ -57,7 +61,7 @@ class GmailMaildirFolder(MaildirFolder):
for (uid, message) in self.getmessagelist().items(): for (uid, message) in self.getmessagelist().items():
if message['mtime'] > statusfolder.getmessagemtime(uid): if message['mtime'] > statusfolder.getmessagemtime(uid):
return True return True
return False #Nope, nothing changed return False # Nope, nothing changed.
# Interface from BaseFolder # Interface from BaseFolder