changeset 8731:3949c6d2e4c8 HEAD

imap: Added module contexts to struct client_command_context.
author Timo Sirainen <tss@iki.fi>
date Fri, 06 Feb 2009 13:49:07 -0500
parents 9b5d68776d03
children 4142c933e231
files src/imap/client.c src/imap/client.h
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/client.c	Fri Feb 06 13:39:48 2009 -0500
+++ b/src/imap/client.c	Fri Feb 06 13:49:07 2009 -0500
@@ -17,6 +17,7 @@
 #include <unistd.h>
 
 extern struct mail_storage_callbacks mail_storage_callbacks;
+struct imap_module_register imap_module_register = { 0 };
 
 static struct client *my_client; /* we don't need more than one currently */
 
@@ -433,6 +434,7 @@
 	cmd = p_new(client->command_pool, struct client_command_context, 1);
 	cmd->client = client;
 	cmd->pool = client->command_pool;
+	p_array_init(&cmd->module_contexts, cmd->pool, 5);
 
 	if (client->free_parser != NULL) {
 		cmd->parser = client->free_parser;
--- a/src/imap/client.h	Fri Feb 06 13:39:48 2009 -0500
+++ b/src/imap/client.h	Fri Feb 06 13:49:07 2009 -0500
@@ -43,6 +43,15 @@
 	CLIENT_COMMAND_STATE_DONE
 };
 
+struct imap_module_register {
+	unsigned int id;
+};
+
+union imap_module_context {
+	struct imap_module_register *reg;
+};
+extern struct imap_module_register imap_module_register;
+
 struct client_command_context {
 	struct client_command_context *prev, *next;
 	struct client *client;
@@ -61,6 +70,9 @@
 	command_func_t *func;
 	void *context;
 
+	/* Module-specific contexts. */
+	ARRAY_DEFINE(module_contexts, union imap_module_context *);
+
 	struct imap_parser *parser;
 	enum client_command_state state;