diff --git a/Changelog.rst b/Changelog.rst index 5e9be44..2b8aef8 100644 --- a/Changelog.rst +++ b/Changelog.rst @@ -122,7 +122,7 @@ OfflineIMAP v6.5.2 (2012-01-17) * Some sanity checks and improved error messages. -* Revert 6.5.1.1 change to use public imaplib2 function, it was reported to +* Revert 6.5.1.1 change to use public imaplib2 function, it was reported to not always work. * Don't fail when ~/netrc is not readable by us. @@ -280,7 +280,7 @@ Changes * Refresh server capabilities after login, so we know that Gmail supports UIDPLUS (it only announces that after login, not before). This prevents us from adding custom headers to Gmail uploads. - + Bug Fixes --------- @@ -338,7 +338,7 @@ New Features * When a message upload/download fails, we do not abort the whole folder synchronization, but only skip that message, informing the user at the end of the sync run. - + * If you connect via ssl and 'cert_fingerprint' is configured, we check that the server certificate is actually known and identical by comparing the stored sha1 fingerprint with the current one. @@ -437,7 +437,7 @@ Notes ----- This was a very active rc1 and we could expect a lot of new fixes for the next -release. +release. The most important fix is about a bug that could lead to data loss. Find more information about his bug here: @@ -588,7 +588,7 @@ I'd like to thank reporters who involved in this cycle: - Pan Tsu - Vincent Beffara - Will Styler - + (my apologies if I forget somebody) ...and all active developers, of course! The imaplib2 migration looks to go the right way to be definetly released but diff --git a/docs/MANUAL.rst b/docs/MANUAL.rst index 15f0625..936abc3 100644 --- a/docs/MANUAL.rst +++ b/docs/MANUAL.rst @@ -40,7 +40,7 @@ Most configuration is done via the configuration file. However, any setting can OfflineImap is well suited to be frequently invoked by cron jobs, or can run in daemon mode to periodically check your email (however, it will exit in some error situations). -The documentation is included in the git repository and can be created by +The documentation is included in the git repository and can be created by issueing `make dev-doc` in the `doc` folder (python-sphinx required), or it can be viewed online at http://docs.offlineimap.org. @@ -420,7 +420,7 @@ This is an example of a setup where "TheOtherImap" requires all folders to be un # The below will put all GMAIL folders as sub-folders of the 'local' INBOX, # assuming that your path separator on 'local' is a dot. nametrans = lambda x: 'INBOX.' + x - + [Repository TheOtherImap] #This is the 'local' repository type = IMAP @@ -437,7 +437,7 @@ Add this to the remote gmail repository section to only sync mails which are in To only get the All Mail folder from a Gmail account, you would e.g. do:: - folderfilter = lambda folder: folder.startswith('[Gmail]/All Mail') + folderfilter = lambda folder: folder.startswith('[Gmail]/All Mail') Another nametrans transpose example @@ -464,25 +464,25 @@ offlineimap.conf:: ui = ttyui pythonfile=~/bin/offlineimap-helpers.py socktimeout = 90 - + [Account acc1] localrepository = acc1local remoterepository = acc1remote autorefresh = 2 - + [Account acc2] localrepository = acc2local remoterepository = acc2remote autorefresh = 4 - + [Repository acc1local] type = Maildir localfolders = ~/Mail/acc1 - + [Repository acc2local] type = Maildir localfolders = ~/Mail/acc2 - + [Repository acc1remote] type = IMAP remotehost = imap.acc1.com @@ -494,7 +494,7 @@ offlineimap.conf:: # Folders to get: folderfilter = lambda foldername: foldername in [ 'INBOX', 'Drafts', 'Sent', 'archiv'] - + [Repository acc2remote] type = IMAP remotehost = imap.acc2.net @@ -532,7 +532,7 @@ Offlineimap handles the renaming correctly in both directions:: retval = "acc1." + foldername retval = re.sub("/", ".", retval) return retval - + def oimaptransfolder_acc2(foldername): if(foldername == "INBOX"): retval = "acc2" diff --git a/docs/doc-src/API.rst b/docs/doc-src/API.rst index d3c80bf..c456435 100644 --- a/docs/doc-src/API.rst +++ b/docs/doc-src/API.rst @@ -9,7 +9,7 @@ Within :mod:`offlineimap`, the classes :class:`OfflineImap` provides the high-level functionality. The rest of the classes should usually not needed to be touched by the user. Email repositories are represented by a :class:`offlineimap.repository.Base.BaseRepository` or derivatives (see :mod:`offlineimap.repository` for details). A folder within a repository is represented by a :class:`offlineimap.folder.Base.BaseFolder` or any derivative from :mod:`offlineimap.folder`. -This page contains the main API overview of OfflineImap |release|. +This page contains the main API overview of OfflineImap |release|. OfflineImap can be imported as:: @@ -22,7 +22,7 @@ be merged into the main documentation. :mod:`offlineimap` -- The OfflineImap module ============================================= - + .. module:: offlineimap .. autoclass:: offlineimap.OfflineImap(cmdline_opts = None) diff --git a/docs/doc-src/FAQ.rst b/docs/doc-src/FAQ.rst index 1d49c3d..b8c2b56 100644 --- a/docs/doc-src/FAQ.rst +++ b/docs/doc-src/FAQ.rst @@ -67,13 +67,13 @@ based in instructions submitted by Chris Walker:: First, you must run OfflineIMAP in the Cygwin environment. The Windows filesystem is not powerful enough to accomodate Maildir by itself. - + Next, you’ll need to mount your Maildir directory in a special way. There is information for doing that at http://barnson.org/node/295. That site gives this example:: - + mount -f -s -b -o managed "d:/tmp/mail" "/home/of/mail" - + That URL also has more details on making OfflineIMAP work with Windows. @@ -383,9 +383,9 @@ you’ll list this:: [mbnames] enabled = yes filename = ~/Mutt/muttrc.mailboxes - header = "mailboxes " - peritem = "+%(accountname)s/%(foldername)s" - sep = " " + header = "mailboxes " + peritem = "+%(accountname)s/%(foldername)s" + sep = " " footer = "\n" Then in your ``.muttrc``:: @@ -448,7 +448,7 @@ written in Korn, so you’ll need ksh, pdksh, or mksh to run it:: # remove any old instances of this shell script or offlineimap for pid in $(pgrep offlineimap) do - if $pid -ne $$ + if $pid -ne $$ then kill $pid fi diff --git a/docs/doc-src/HACKING.rst b/docs/doc-src/HACKING.rst index 9192458..54a89ef 100644 --- a/docs/doc-src/HACKING.rst +++ b/docs/doc-src/HACKING.rst @@ -440,7 +440,7 @@ Know the status of your patch after submission of the branch in which your patch has been merged (i.e. it will not tell you if your patch is merged in pu if you rebase on top of master). - + .. * Read the git mailing list, the maintainer regularly posts messages entitled "What's cooking in git.git" and "What's in git.git" giving the status of various proposed changes. diff --git a/offlineimap.conf b/offlineimap.conf index 71eac11..3228c21 100644 --- a/offlineimap.conf +++ b/offlineimap.conf @@ -190,7 +190,7 @@ remoterepository = RemoteExample # In this case a call to imapfilter to filter mail before the sync process # starts and a custom shell script after the sync completes. # The pre sync script has to complete before a sync to the account will -# start. +# start. # presynchook = imapfilter # postsynchook = notifysync.sh diff --git a/offlineimap/CustomConfig.py b/offlineimap/CustomConfig.py index 3cd1cef..5e95ae6 100644 --- a/offlineimap/CustomConfig.py +++ b/offlineimap/CustomConfig.py @@ -29,7 +29,7 @@ class CustomConfigParser(SafeConfigParser): return self.get(*(section, option) + args, **kwargs) else: return default - + def getdefaultint(self, section, option, default, *args, **kwargs): if self.has_option(section, option): return self.getint (*(section, option) + args, **kwargs) @@ -120,7 +120,7 @@ class ConfigHelperMixin: return self._confighelper_runner(option, default, self.getconfig().getdefaultint, self.getconfig().getint) - + def getconffloat(self, option, default = CustomConfigDefault): return self._confighelper_runner(option, default, self.getconfig().getdefaultfloat, diff --git a/offlineimap/__init__.py b/offlineimap/__init__.py index a7d043c..8152284 100644 --- a/offlineimap/__init__.py +++ b/offlineimap/__init__.py @@ -14,6 +14,6 @@ __homepage__ = "http://offlineimap.org" banner = __bigcopyright__ from offlineimap.error import OfflineImapError -# put this last, so we don't run into circular dependencies using +# put this last, so we don't run into circular dependencies using # e.g. offlineimap.__version__. from offlineimap.init import OfflineImap diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py index 81a81eb..27c9a2b 100644 --- a/offlineimap/folder/Base.py +++ b/offlineimap/folder/Base.py @@ -210,7 +210,7 @@ class BaseFolder(object): If the backend CAN assign a new uid, but cannot find out what this UID is (as is the case with some IMAP servers), it returns 0 but DOES save the message. - + IMAP backend should be the only one that can assign a new uid. @@ -493,7 +493,7 @@ class BaseFolder(object): continue #don't actually remove in a dryrun dstfolder.deletemessagesflags(uids, set(flag)) statusfolder.deletemessagesflags(uids, set(flag)) - + def syncmessagesto(self, dstfolder, statusfolder): """Syncs messages in this folder to the destination dstfolder. @@ -514,7 +514,7 @@ class BaseFolder(object): uids present (except for potential negative uids that couldn't be placed anywhere). - Pass3: Synchronize flag changes + Pass3: Synchronize flag changes Compare flag mismatches in self with those in statusfolder. If msg has a valid UID and exists on dstfolder (has not e.g. been deleted there), sync the flag change to both dstfolder and diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index 4218886..db23813 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -44,7 +44,7 @@ class IMAPFolder(BaseFolder): Prefer SELECT to EXAMINE if we can, since some servers (Courier) do not stabilize UID validity until the folder is - selected. + selected. .. todo: Still valid? Needs verification :param: Enforce new SELECT even if we are on that folder already. :returns: raises :exc:`OfflineImapError` severity FOLDER on error""" @@ -116,7 +116,7 @@ class IMAPFolder(BaseFolder): maxmsgid = max(long(msgid), maxmsgid) # Different number of messages than last time? if maxmsgid != statusfolder.getmessagecount(): - return True + return True return False def cachemessagelist(self): @@ -526,7 +526,7 @@ class IMAPFolder(BaseFolder): self.ui.debug('imap', 'savemessage: header is: %s: %s' %\ (headername, headervalue)) content = self.savemessage_addheader(content, headername, - headervalue) + headervalue) if len(content)>200: dbg_output = "%s...%s" % (content[:150], content[-50:]) else: @@ -710,11 +710,11 @@ class IMAPFolder(BaseFolder): def change_message_uid(self, uid, new_uid): """Change the message from existing uid to new_uid - If the backend supports it. IMAP does not and will throw errors.""" + If the backend supports it. IMAP does not and will throw errors.""" raise OfflineImapError('IMAP backend cannot change a messages UID from ' '%d to %d' % (uid, new_uid), OfflineImapError.ERROR.MESSAGE) - + def deletemessage(self, uid): self.deletemessages_noconvert([uid]) diff --git a/offlineimap/folder/LocalStatusSQLite.py b/offlineimap/folder/LocalStatusSQLite.py index ac67c2f..b624134 100644 --- a/offlineimap/folder/LocalStatusSQLite.py +++ b/offlineimap/folder/LocalStatusSQLite.py @@ -35,7 +35,7 @@ class LocalStatusSQLiteFolder(LocalStatusFolder): #though. According to sqlite docs, you need to commit() before #the connection is closed or your changes will be lost!""" #get db connection which autocommits - #connection = sqlite.connect(self.filename, isolation_level=None) + #connection = sqlite.connect(self.filename, isolation_level=None) #cursor = connection.cursor() #return connection, cursor @@ -43,7 +43,7 @@ class LocalStatusSQLiteFolder(LocalStatusFolder): cur_version = 1 def __init__(self, name, repository): - super(LocalStatusSQLiteFolder, self).__init__(name, repository) + super(LocalStatusSQLiteFolder, self).__init__(name, repository) # dblock protects against concurrent writes in same connection self._dblock = Lock() #Try to establish connection, no need for threadsafety in __init__ diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py index 24d943c..23f48b4 100644 --- a/offlineimap/folder/Maildir.py +++ b/offlineimap/folder/Maildir.py @@ -196,7 +196,7 @@ class MaildirFolder(BaseFolder): if sorted(self.getmessageuidlist()) != \ sorted(statusfolder.getmessageuidlist()): return True - # Also check for flag changes, it's quick on a Maildir + # Also check for flag changes, it's quick on a Maildir for (uid, message) in self.getmessagelist().iteritems(): if message['flags'] != statusfolder.getmessageflags(uid): return True @@ -235,7 +235,7 @@ class MaildirFolder(BaseFolder): return '%d_%d.%d.%s,U=%d,FMD5=%s%s2,%s' % \ (timeval, timeseq, os.getpid(), socket.gethostname(), uid, self._foldermd5, self.infosep, ''.join(sorted(flags))) - + def savemessage(self, uid, content, flags, rtime): """Writes a new message, with the specified uid. @@ -263,7 +263,7 @@ class MaildirFolder(BaseFolder): fd = os.open(os.path.join(tmpdir, messagename), os.O_EXCL|os.O_CREAT|os.O_WRONLY, 0o666) except OSError as e: - if e.errno == 17: + if e.errno == 17: #FILE EXISTS ALREADY severity = OfflineImapError.ERROR.MESSAGE raise OfflineImapError("Unique filename %s already existing." %\ @@ -348,7 +348,7 @@ class MaildirFolder(BaseFolder): os.path.join(self.getfullname(), dir_prefix, filename)) self.messagelist[new_uid] = self.messagelist[uid] del self.messagelist[uid] - + def deletemessage(self, uid): """Unlinks a message file from the Maildir. @@ -373,4 +373,4 @@ class MaildirFolder(BaseFolder): os.unlink(filepath) # Yep -- return. del(self.messagelist[uid]) - + diff --git a/offlineimap/folder/UIDMaps.py b/offlineimap/folder/UIDMaps.py index f571772..7dc43f3 100644 --- a/offlineimap/folder/UIDMaps.py +++ b/offlineimap/folder/UIDMaps.py @@ -42,7 +42,7 @@ class MappedIMAPFolder(IMAPFolder): def _getmapfilename(self): return os.path.join(self.repository.getmapdir(), self.getfolderbasename()) - + def _loadmaps(self): self.maplock.acquire() try: diff --git a/offlineimap/imaplib2.py b/offlineimap/imaplib2.py index b7e0d22..dfd6900 100644 --- a/offlineimap/imaplib2.py +++ b/offlineimap/imaplib2.py @@ -1330,7 +1330,7 @@ class IMAP4(object): self.ouq.put(rqb) return rqb - # Must setup continuation expectancy *before* ouq.put + # Must setup continuation expectancy *before* ouq.put crqb = self._request_push(tag='continuation') self.ouq.put(rqb) @@ -2442,7 +2442,7 @@ if __name__ == '__main__': run('id', ()) run('id', ('("name", "imaplib2")',)) run('id', ("version", __version__, "os", os.uname()[0])) - + for cmd,args in test_seq2: if (cmd,args) != ('uid', ('SEARCH', 'SUBJECT', 'IMAP4 test')): run(cmd, args) diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py index c8f70d6..ef05cb7 100644 --- a/offlineimap/imapserver.py +++ b/offlineimap/imapserver.py @@ -137,7 +137,7 @@ class IMAPServer: try: if self.gss_step == self.GSS_STATE_STEP: if not self.gss_vc: - rc, self.gss_vc = kerberos.authGSSClientInit('imap@' + + rc, self.gss_vc = kerberos.authGSSClientInit('imap@' + self.hostname) response = kerberos.authGSSClientResponse(self.gss_vc) rc = kerberos.authGSSClientStep(self.gss_vc, data) @@ -188,7 +188,7 @@ class IMAPServer: self.lastowner[imapobj] = curThread.ident self.connectionlock.release() return imapobj - + self.connectionlock.release() # Release until need to modify data """ Must be careful here that if we fail we should bail out gracefully @@ -433,7 +433,7 @@ class IMAPServer: certnames = [] # cert expired? - notafter = cert.get('notAfter') + notafter = cert.get('notAfter') if notafter: if time.time() >= cert_time_to_seconds(notafter): return '%s certificate expired %s' % (errstr, notafter) diff --git a/offlineimap/init.py b/offlineimap/init.py index d52fd3a..ce24e48 100644 --- a/offlineimap/init.py +++ b/offlineimap/init.py @@ -277,7 +277,7 @@ class OfflineImap: if options.logfile: sys.stderr = self.ui.logfile - + socktimeout = config.getdefaultint("general", "socktimeout", 0) if socktimeout > 0: socket.setdefaulttimeout(socktimeout) diff --git a/offlineimap/mbnames.py b/offlineimap/mbnames.py index fb8af74..facbfa7 100644 --- a/offlineimap/mbnames.py +++ b/offlineimap/mbnames.py @@ -70,5 +70,3 @@ def genmbnames(): file.close() finally: mblock.release() - - diff --git a/offlineimap/repository/Base.py b/offlineimap/repository/Base.py index 575c993..db80ecd 100644 --- a/offlineimap/repository/Base.py +++ b/offlineimap/repository/Base.py @@ -116,7 +116,7 @@ class BaseRepository(CustomConfig.ConfigHelperMixin, object): def getlocaleval(self): return self.account.getlocaleval() - + def getfolders(self): """Returns a list of ALL folders on this server.""" return [] diff --git a/offlineimap/repository/Gmail.py b/offlineimap/repository/Gmail.py index f4260c0..5f86ed3 100644 --- a/offlineimap/repository/Gmail.py +++ b/offlineimap/repository/Gmail.py @@ -28,7 +28,7 @@ class GmailRepository(IMAPRepository): HOSTNAME = "imap.gmail.com" # Gmail IMAP server port PORT = 993 - + def __init__(self, reposname, account): """Initialize a GmailRepository object.""" # Enforce SSL usage diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py index 67ae2c0..3aec2fa 100644 --- a/offlineimap/repository/IMAP.py +++ b/offlineimap/repository/IMAP.py @@ -362,7 +362,7 @@ class IMAPRepository(BaseRepository): OfflineImapError.ERROR.FOLDER) finally: self.imapserver.releaseconnection(imapobj) - + class MappedIMAPRepository(IMAPRepository): def getfoldertype(self): return MappedIMAPFolder diff --git a/offlineimap/repository/LocalStatus.py b/offlineimap/repository/LocalStatus.py index b1b763a..bb9ada4 100644 --- a/offlineimap/repository/LocalStatus.py +++ b/offlineimap/repository/LocalStatus.py @@ -91,7 +91,7 @@ class LocalStatusRepository(BaseRepository): return folder def getfolders(self): - """Returns a list of all cached folders. + """Returns a list of all cached folders. Does nothing for this backend. We mangle the folder file names (see getfolderfilename) so we can not derive folder names from diff --git a/offlineimap/repository/Maildir.py b/offlineimap/repository/Maildir.py index f2d5581..1e23bea 100644 --- a/offlineimap/repository/Maildir.py +++ b/offlineimap/repository/Maildir.py @@ -85,7 +85,7 @@ class MaildirRepository(BaseRepository): if self.account.dryrun: return full_path = os.path.abspath(os.path.join(self.root, foldername)) - + # sanity tests if self.getsep() == '/': for component in foldername.split('/'): diff --git a/offlineimap/ui/Machine.py b/offlineimap/ui/Machine.py index 069bb35..cee2849 100644 --- a/offlineimap/ui/Machine.py +++ b/offlineimap/ui/Machine.py @@ -79,7 +79,7 @@ class MachineUI(UIBase): s._printData('connecting', "%s\n%s" % (hostname, str(port))) def syncfolders(s, srcrepos, destrepos): - s._printData('syncfolders', "%s\n%s" % (s.getnicename(srcrepos), + s._printData('syncfolders', "%s\n%s" % (s.getnicename(srcrepos), s.getnicename(destrepos))) def syncingfolder(s, srcrepos, srcfolder, destrepos, destfolder): diff --git a/offlineimap/ui/__init__.py b/offlineimap/ui/__init__.py index 6ddbaf6..3da42b9 100644 --- a/offlineimap/ui/__init__.py +++ b/offlineimap/ui/__init__.py @@ -20,7 +20,7 @@ from offlineimap.ui import TTY, Noninteractive, Machine UI_LIST = {'ttyui': TTY.TTYUI, 'basic': Noninteractive.Basic, - 'quiet': Noninteractive.Quiet, + 'quiet': Noninteractive.Quiet, 'machineui': Machine.MachineUI} #add Blinkenlights UI if it imports correctly (curses installed) diff --git a/offlineimap/ui/debuglock.py b/offlineimap/ui/debuglock.py index 4f2a4f9..4756b08 100644 --- a/offlineimap/ui/debuglock.py +++ b/offlineimap/ui/debuglock.py @@ -25,7 +25,7 @@ class DebuggingLock: def __init__(self, name): self.lock = Lock() self.name = name - + def acquire(self, blocking = 1): self.print_tb("Acquire lock") self.lock.acquire(blocking) @@ -45,5 +45,5 @@ class DebuggingLock: self.logmsg(".... %s: Thread %s attempting to %s\n" % \ (self.name, currentThread().getName(), msg) + \ "\n".join(traceback.format_list(traceback.extract_stack()))) - +