Execute pre/post hooks for IDLE-toggled syncs

Make IDLE syncs be equal to the regular synchronisations
in respect to pre-sync and post-sync hooks.

From: mxgr7 <maxgerer@gmail.com>
Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
This commit is contained in:
mxgr7 2013-07-04 05:48:12 +02:00 committed by Eygene Ryabinkin
parent 67d68c2fc8
commit 0d992ee7d3
2 changed files with 8 additions and 1 deletions

View File

@ -18,7 +18,8 @@ WIP (add new stuff for the next release)
OfflineIMAP v6.5.5-rc1 (2012-09-05)
===================================
* Bump version number
* Execute pre/post-sync hooks during synchronizations
toggled by IMAP IDLE message processing. (maxgerer@gmail.com)
OfflineIMAP v6.5.5-rc1 (2012-09-05)
===================================

View File

@ -507,7 +507,13 @@ class IdleThread(object):
remoterepos = account.remoterepos
statusrepos = account.statusrepos
remotefolder = remoterepos.getfolder(self.folder)
hook = account.getconf('presynchook', '')
account.callhook(hook)
offlineimap.accounts.syncfolder(account, remotefolder, quick=False)
hook = account.getconf('postsynchook', '')
account.callhook(hook)
ui = getglobalui()
ui.unregisterthread(currentThread()) #syncfolder registered the thread