From 14ef9924447ddf3e95d60f166e37a8fe1b1b540d Mon Sep 17 00:00:00 2001 From: Nicolas Sebrecht Date: Thu, 12 May 2016 18:04:41 +0200 Subject: [PATCH] conf: newmail_hook is a remote option Improve documentation. Signed-off-by: Nicolas Sebrecht --- offlineimap.conf | 24 +++++++++++++----------- offlineimap/folder/Base.py | 4 ++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/offlineimap.conf b/offlineimap.conf index 66bfff6..646d4e7 100644 --- a/offlineimap.conf +++ b/offlineimap.conf @@ -295,17 +295,6 @@ remoterepository = RemoteExample #postsynchook = notifysync.sh -# This option stands in the [Account Test] section. -# -# You can specify a newmail hook to execute an external command upon receipt -# of new mail in the INBOX. -# -# This example plays a sound file of your chosing when new mail arrives. -# -#newmail_hook = lambda: os.system( -#"cvlc --play-and-stop --play-and-exit /path/to/sound/file.mp3 > /dev/null 2>&1") - - # This option stands in the [Account Test] section. # # The historical backend is 'plain' which writes out the state in plain text @@ -1130,6 +1119,19 @@ remoteuser = username #readonly = False +# This option stands in the [Repository RemoteExample] section. +# +# You can specify a newmail hook to execute an external command upon receipt +# of new mail in the INBOX. +# +# The pythonfile must be set to import any required library. +# +# This example plays a sound file of your chosing when new mail arrives. +# +#newmail_hook = lambda: os.system( +#"cvlc --play-and-stop --play-and-exit /path/to/sound/file.mp3 > /dev/null 2>&1") + + [Repository GmailExample] # A repository using Gmail's IMAP interface. diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py index 298d1ee..1bed3bf 100644 --- a/offlineimap/folder/Base.py +++ b/offlineimap/folder/Base.py @@ -883,10 +883,10 @@ class BaseFolder(object): for thread in threads: thread.join() - # Execute new mail hook if we have new mail + # Execute new mail hook if we have new mail. if self.have_newmail: if self.newmail_hook != None: - self.newmail_hook(); + self.newmail_hook() def __syncmessagesto_delete(self, dstfolder, statusfolder): """Pass 2: Remove locally deleted messages on dst.