Mercurial > dovecot > core-2.2
changeset 12236:31a34cff1ebe
imap: Added imap_client_created_hook_set() to update the hook.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 04 Oct 2010 15:12:23 +0100 |
parents | b63b6ad01448 |
children | 1df6a392a613 |
files | src/imap/imap-common.h src/imap/main.c |
diffstat | 2 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/imap-common.h Mon Oct 04 14:53:02 2010 +0100 +++ b/src/imap/imap-common.h Mon Oct 04 15:12:23 2010 +0100 @@ -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);
--- a/src/imap/main.c Mon Oct 04 14:53:02 2010 +0100 +++ b/src/imap/main.c Mon Oct 04 15:12:23 2010 +0100 @@ -32,7 +32,16 @@ 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) {