From f6935342c20c7c91e448c637a990dda20332cb81 Mon Sep 17 00:00:00 2001 From: Reto Schnyder Date: Mon, 10 Aug 2020 19:38:58 +0200 Subject: [PATCH] Fix hooks for IDLE sync `presynchook` and `postsynchook` for IDLE-triggered syncs were broken by da69fd8. This fixes them. Signed-off-by: Reto Schnyder Signed-off-by: Nicolas Sebrecht --- offlineimap/imapserver.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py index 6d12736..1673798 100644 --- a/offlineimap/imapserver.py +++ b/offlineimap/imapserver.py @@ -823,11 +823,12 @@ class IdleThread(object): statusrepos = account.statusrepos remotefolder = remoterepos.getfolder(self.folder, decode=False) - hook = account.getconf('presynchook', '') - account.callhook(hook) + hook_env = { + 'OIMAP_ACCOUNT_NAME': account.getname(), + } + account.callhook('presynchook', hook_env) offlineimap.accounts.syncfolder(account, remotefolder, quick=False) - hook = account.getconf('postsynchook', '') - account.callhook(hook) + account.callhook('postsynchook', hook_env) ui = getglobalui() ui.unregisterthread(currentThread()) #syncfolder registered the thread