diff --git a/head/offlineimap.py b/head/offlineimap.py index cb693a8..b16db86 100644 --- a/head/offlineimap.py +++ b/head/offlineimap.py @@ -21,7 +21,6 @@ from imapsync import imaplib, imaputil, imapserver, repository, folder import re, getpass, os, os.path from ConfigParser import ConfigParser -imaplib.Debug = 5 config = ConfigParser() config.read("imapsync.conf") metadatadir = os.path.expanduser(config.get("general", "metadata")) @@ -67,11 +66,12 @@ for accountname in accounts: #if not localfolder.isuidvalidityok(remotefolder): # print 'UID validity is a problem for this folder; skipping.' # continue - #print "Reading remote message list...", - #remotefolder.cachemessagelist() - #print len(remotefolder.getmessagelist().keys()), "messages." + print "Reading remote message list...", + remotefolder.cachemessagelist() + print len(remotefolder.getmessagelist().keys()), "messages." print "Reading local message list...", localfolder.cachemessagelist() print len(localfolder.getmessagelist().keys()), "messages." - print "Synchronizing locally-made changes..." + print "Synchronizing remote to local..." + remotefolder.syncmessagesto(localfolder) diff --git a/head/offlineimap/folder/IMAP.py b/head/offlineimap/folder/IMAP.py index b00d7e4..2a4c64b 100644 --- a/head/offlineimap/folder/IMAP.py +++ b/head/offlineimap/folder/IMAP.py @@ -39,6 +39,9 @@ class IMAPFolder(BaseFolder): response = self.imapobj.status(self.getfullname(), ('MESSAGES'))[1][0] result = imaputil.imapsplit(response)[1] maxmsgid = long(imaputil.flags2hash(result)['MESSAGES']) + if (maxmsgid < 1): + # No messages? return. + return # Now, get the flags and UIDs for these. response = self.imapobj.fetch('1:%d' % maxmsgid, '(FLAGS UID)')[1]