Communicate syncmode to synchooks

This patch sets the environment variable OFFLINEIMAPSYNCMODE to either
full, quick or idle depending on the context of the pre- and
postsynchook.

Adding the context as an argument was considered but this would break
existing configurations and it makes calling a program directly more
cumbersome. Some programs (e.g. imapfilter) may not know what to do with
this extra argument.

Signed-off-by: Mart Lubbers <mart@martlubbers.net>
This commit is contained in:
Mart Lubbers
2021-09-07 09:38:10 +02:00
parent 4ca9c75c6f
commit 7748de52fb
3 changed files with 23 additions and 17 deletions

View File

@ -832,10 +832,10 @@ class IdleThread:
remotefolder = remoterepos.getfolder(self.folder, decode=False)
hook = account.getconf('presynchook', '')
account.callhook(hook)
account.callhook(hook, "idle")
offlineimap.accounts.syncfolder(account, remotefolder, quick=False)
hook = account.getconf('postsynchook', '')
account.callhook(hook)
account.callhook(hook, "idle")
ui = getglobalui()
ui.unregisterthread(currentThread()) # syncfolder registered the thread