From: Timo Sirainen Date: Mon, 4 Oct 2010 14:12:23 +0000 (+0100) Subject: imap: Added imap_client_created_hook_set() to update the hook. X-Git-Tag: 2.0.6~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93f0b2f8b3a4b1afe39a7bbcf7c4c251f3ca8e48;p=thirdparty%2Fdovecot%2Fcore.git imap: Added imap_client_created_hook_set() to update the hook. --- 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) {