From 93f0b2f8b3a4b1afe39a7bbcf7c4c251f3ca8e48 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 4 Oct 2010 15:12:23 +0100 Subject: [PATCH] imap: Added imap_client_created_hook_set() to update the hook. --- src/imap/imap-common.h | 9 ++++++++- src/imap/main.c | 11 ++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/imap/imap-common.h b/src/imap/imap-common.h index 9fa2981d2b..ec4aff3cbb 100644 --- a/src/imap/imap-common.h +++ b/src/imap/imap-common.h @@ -17,7 +17,14 @@ #include "imap-client.h" #include "imap-settings.h" -extern void (*hook_client_created)(struct client **client); +typedef void imap_client_created_func_t(struct client **client); + +extern imap_client_created_func_t *hook_client_created; + +/* Sets the hook_client_created and returns the previous hook, + which the new_hook should call if it's non-NULL. */ +imap_client_created_func_t * +imap_client_created_hook_set(imap_client_created_func_t *new_hook); void imap_refresh_proctitle(void); diff --git a/src/imap/main.c b/src/imap/main.c index 149518778c..0889fa4559 100644 --- a/src/imap/main.c +++ b/src/imap/main.c @@ -32,7 +32,16 @@ static bool verbose_proctitle = FALSE; static struct mail_storage_service_ctx *storage_service; static struct master_login *master_login = NULL; -void (*hook_client_created)(struct client **client) = NULL; +imap_client_created_func_t *hook_client_created = NULL; + +imap_client_created_func_t * +imap_client_created_hook_set(imap_client_created_func_t *new_hook) +{ + imap_client_created_func_t *old_hook = hook_client_created; + + hook_client_created = new_hook; + return old_hook; +} void imap_refresh_proctitle(void) { -- 2.47.3