#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);
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)
{