dovecot-2.0: imap: Added imap_client_created_hook_set() to updat...

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 4 17:13:24 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/31a34cff1ebe
changeset: 12236:31a34cff1ebe
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 04 15:12:23 2010 +0100
description:
imap: Added imap_client_created_hook_set() to update the hook.

diffstat:

 src/imap/imap-common.h |   9 ++++++++-
 src/imap/main.c        |  11 ++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r b63b6ad01448 -r 31a34cff1ebe src/imap/imap-common.h
--- 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);
 
diff -r b63b6ad01448 -r 31a34cff1ebe src/imap/main.c
--- 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)
 {


More information about the dovecot-cvs mailing list