changeset 10:82b7de533f98 HEAD

s/user_data/context/ and some s/Data/Context/
author Timo Sirainen <tss@iki.fi>
date Thu, 22 Aug 2002 15:48:38 +0300
parents 21c8e080150d
children e285afe55c48
files src/auth/auth-digest-md5.c src/auth/auth-plain.c src/auth/auth.c src/auth/auth.h src/auth/cookie.c src/auth/cookie.h src/auth/login-connection.c src/auth/main.c src/auth/master.c src/imap/client.c src/imap/cmd-list.c src/imap/cmd-store.c src/imap/commands-util.c src/lib-imap/imap-bodystructure.c src/lib-imap/imap-message-cache.c src/lib-imap/imap-message-cache.h src/lib-index/mail-index-update.c src/lib-index/mail-index.h src/lib-index/mail-messageset.c src/lib-index/mail-messageset.h src/lib-index/maildir/maildir-sync.c src/lib-index/mbox/mbox-append.c src/lib-index/mbox/mbox-fsck.c src/lib-mail/message-content-parser.c src/lib-mail/message-content-parser.h src/lib-mail/message-parser.c src/lib-mail/message-parser.h src/lib-mail/rfc822-tokenize.c src/lib-mail/rfc822-tokenize.h src/lib-storage/flags-file/flags-file.c src/lib-storage/flags-file/flags-file.h src/lib-storage/index/index-copy.c src/lib-storage/index/index-fetch-section.c src/lib-storage/index/index-fetch.c src/lib-storage/index/index-fetch.h src/lib-storage/index/index-search.c src/lib-storage/index/index-storage.c src/lib-storage/index/index-storage.h src/lib-storage/index/index-sync.c src/lib-storage/index/index-update-flags.c src/lib-storage/index/maildir/maildir-copy.c src/lib-storage/index/maildir/maildir-expunge.c src/lib-storage/index/maildir/maildir-list.c src/lib-storage/index/maildir/maildir-storage.h src/lib-storage/index/mbox/mbox-expunge.c src/lib-storage/index/mbox/mbox-list.c src/lib-storage/index/mbox/mbox-storage.h src/lib-storage/mail-search.c src/lib-storage/mail-search.h src/lib-storage/mail-storage.h src/lib-storage/subscription-file/subscription-file.c src/lib-storage/subscription-file/subscription-file.h src/lib/hash.c src/lib/hash.h src/lib/iobuffer.c src/lib/iobuffer.h src/lib/ioloop-internal.h src/lib/ioloop-poll.c src/lib/ioloop-select.c src/lib/ioloop.c src/lib/ioloop.h src/login/auth-connection.c src/login/auth-connection.h src/login/client-authenticate.c src/login/client.c src/login/client.h src/login/main.c src/login/master.c src/login/master.h src/login/ssl-proxy.c src/master/auth-process.c src/master/auth-process.h src/master/login-process.c src/master/main.c
diffstat 74 files changed, 727 insertions(+), 729 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/auth-digest-md5.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/auth/auth-digest-md5.c	Thu Aug 22 15:48:38 2002 +0300
@@ -510,9 +510,9 @@
 static void auth_digest_md5_continue(CookieData *cookie,
 				     AuthContinuedRequestData *request,
 				     const unsigned char *data,
-				     AuthCallback callback, void *user_data)
+				     AuthCallback callback, void *context)
 {
-	AuthData *auth = cookie->user_data;
+	AuthData *auth = cookie->context;
 	AuthReplyData reply;
 	const char *error;
 
@@ -526,7 +526,7 @@
 		   word from client */
 		auth->cookie_reply.success = TRUE;
 		reply.result = AUTH_RESULT_SUCCESS;
-		callback(&reply, NULL, user_data);
+		callback(&reply, NULL, context);
 		return;
 	}
 
@@ -537,21 +537,21 @@
 
 		reply.data_size = strlen(auth->rspauth);
 		callback(&reply, (const unsigned char *) auth->rspauth,
-			 user_data);
+			 context);
 		auth->authenticated = TRUE;
 		return;
 	}
 
 	/* failed */
 	reply.result = AUTH_RESULT_FAILURE;
-	callback(&reply, error, user_data);
+	callback(&reply, error, context);
 	cookie_remove(cookie->cookie);
 }
 
 static int auth_digest_md5_fill_reply(CookieData *cookie,
 				      AuthCookieReplyData *reply)
 {
-	AuthData *auth = cookie->user_data;
+	AuthData *auth = cookie->context;
 
 	if (!auth->authenticated)
 		return FALSE;
@@ -562,11 +562,11 @@
 
 static void auth_digest_md5_free(CookieData *cookie)
 {
-	pool_unref(((AuthData *) cookie->user_data)->pool);
+	pool_unref(((AuthData *) cookie->context)->pool);
 }
 
 static void auth_digest_md5_init(AuthInitRequestData *request,
-				 AuthCallback callback, void *user_data)
+				 AuthCallback callback, void *context)
 {
 	CookieData *cookie;
 	AuthReplyData reply;
@@ -584,7 +584,7 @@
 	cookie->auth_fill_reply = auth_digest_md5_fill_reply;
 	cookie->auth_continue = auth_digest_md5_continue;
 	cookie->free = auth_digest_md5_free;
-	cookie->user_data = auth;
+	cookie->context = auth;
 
 	cookie_add(cookie);
 
@@ -599,7 +599,7 @@
 
 	challenge = get_digest_challenge(auth);
 	reply.data_size = strlen(challenge);
-	callback(&reply, (const unsigned char *) challenge, user_data);
+	callback(&reply, (const unsigned char *) challenge, context);
 
 	t_pop();
 }
--- a/src/auth/auth-plain.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/auth/auth-plain.c	Thu Aug 22 15:48:38 2002 +0300
@@ -8,9 +8,9 @@
 static void auth_plain_continue(CookieData *cookie,
 				AuthContinuedRequestData *request,
 				const unsigned char *data,
-				AuthCallback callback, void *user_data)
+				AuthCallback callback, void *context)
 {
-	AuthCookieReplyData *cookie_reply = cookie->user_data;
+	AuthCookieReplyData *cookie_reply = cookie->context;
 	AuthReplyData reply;
 	const char *user, *pass;
 	unsigned int i, count;
@@ -43,7 +43,7 @@
 		}
 	}
 
-        callback(&reply, NULL, user_data);
+        callback(&reply, NULL, context);
 
 	if (!cookie_reply->success) {
 		/* failed, we don't need the cookie anymore */
@@ -55,7 +55,7 @@
 {
 	AuthCookieReplyData *cookie_reply;
 
-	cookie_reply = cookie->user_data;
+	cookie_reply = cookie->context;
 	if (!cookie_reply->success)
 		return FALSE;
 
@@ -65,12 +65,12 @@
 
 static void auth_plain_free(CookieData *cookie)
 {
-	i_free(cookie->user_data);
+	i_free(cookie->context);
 	i_free(cookie);
 }
 
 static void auth_plain_init(AuthInitRequestData *request,
-			    AuthCallback callback, void *user_data)
+			    AuthCallback callback, void *context)
 {
 	CookieData *cookie;
 	AuthReplyData reply;
@@ -79,7 +79,7 @@
 	cookie->auth_fill_reply = auth_plain_fill_reply;
 	cookie->auth_continue = auth_plain_continue;
 	cookie->free = auth_plain_free;
-	cookie->user_data = i_new(AuthCookieReplyData, 1);
+	cookie->context = i_new(AuthCookieReplyData, 1);
 
 	cookie_add(cookie);
 
@@ -89,7 +89,7 @@
 	reply.result = AUTH_RESULT_CONTINUE;
 	memcpy(reply.cookie, cookie->cookie, AUTH_COOKIE_SIZE);
 
-	callback(&reply, NULL, user_data);
+	callback(&reply, NULL, context);
 }
 
 AuthModule auth_plain = {
--- a/src/auth/auth.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/auth/auth.c	Thu Aug 22 15:48:38 2002 +0300
@@ -55,7 +55,7 @@
 }
 
 void auth_init_request(AuthInitRequestData *request,
-		       AuthCallback callback, void *user_data)
+		       AuthCallback callback, void *context)
 {
 	AuthModuleList *list;
 
@@ -64,13 +64,13 @@
 		i_error("BUG: imap-login requested unsupported "
 			"auth method %d", request->method);
 		failure_reply.id = request->id;
-		callback(&failure_reply, NULL, user_data);
+		callback(&failure_reply, NULL, context);
 		return;
 	}
 
 	for (list = auth_modules; list != NULL; list = list->next) {
 		if (list->module.method == request->method) {
-			list->module.init(request, callback, user_data);
+			list->module.init(request, callback, context);
 			return;
 		}
 	}
@@ -80,7 +80,7 @@
 
 void auth_continue_request(AuthContinuedRequestData *request,
 			   const unsigned char *data,
-			   AuthCallback callback, void *user_data)
+			   AuthCallback callback, void *context)
 {
 	CookieData *cookie_data;
 
@@ -88,10 +88,10 @@
 	if (cookie_data == NULL) {
 		/* timeouted cookie */
 		failure_reply.id = request->id;
-		callback(&failure_reply, NULL, user_data);
+		callback(&failure_reply, NULL, context);
 	} else {
 		cookie_data->auth_continue(cookie_data, request, data,
-					   callback, user_data);
+					   callback, context);
 	}
 }
 
--- a/src/auth/auth.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/auth/auth.h	Thu Aug 22 15:48:38 2002 +0300
@@ -4,13 +4,13 @@
 #include "auth-interface.h"
 
 typedef void (*AuthCallback) (AuthReplyData *reply, const unsigned char *data,
-			      void *user_data);
+			      void *context);
 
 typedef struct {
 	AuthMethod method;
 
 	void (*init)(AuthInitRequestData *request,
-		     AuthCallback callback, void *user_data);
+		     AuthCallback callback, void *context);
 } AuthModule;
 
 extern AuthMethod auth_methods;
@@ -20,10 +20,10 @@
 void auth_unregister_module(AuthModule *module);
 
 void auth_init_request(AuthInitRequestData *request,
-		       AuthCallback callback, void *user_data);
+		       AuthCallback callback, void *context);
 void auth_continue_request(AuthContinuedRequestData *request,
 			   const unsigned char *data,
-			   AuthCallback callback, void *user_data);
+			   AuthCallback callback, void *context);
 
 void auth_init(void);
 void auth_deinit(void);
--- a/src/auth/cookie.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/auth/cookie.c	Thu Aug 22 15:48:38 2002 +0300
@@ -121,7 +121,7 @@
 	return data;
 }
 
-static void cookie_timeout(void *user_data __attr_unused__,
+static void cookie_timeout(void *context __attr_unused__,
 			   Timeout timeout __attr_unused__)
 {
 	time_t remove_time;
--- a/src/auth/cookie.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/auth/cookie.h	Thu Aug 22 15:48:38 2002 +0300
@@ -12,7 +12,7 @@
 	void (*auth_continue)(CookieData *cookie,
 			      AuthContinuedRequestData *request,
 			      const unsigned char *data,
-			      AuthCallback callback, void *user_data);
+			      AuthCallback callback, void *context);
 
 	/* fills reply from cookie, returns TRUE if successful */
 	int (*auth_fill_reply)(CookieData *cookie, AuthCookieReplyData *reply);
@@ -20,7 +20,7 @@
 	/* Free all data related to cookie */
 	void (*free)(CookieData *cookie);
 
-	void *user_data;
+	void *context;
 };
 
 typedef void (*CookieFreeFunc)(void *data);
--- a/src/auth/login-connection.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/auth/login-connection.c	Thu Aug 22 15:48:38 2002 +0300
@@ -26,9 +26,9 @@
 static LoginConnection *connections;
 
 static void request_callback(AuthReplyData *reply, const unsigned char *data,
-			     void *user_data)
+			     void *context)
 {
-	LoginConnection *conn = user_data;
+	LoginConnection *conn = context;
 
 	i_assert(reply->data_size <= AUTH_MAX_REPLY_DATA_SIZE);
 
@@ -40,10 +40,10 @@
 	}
 }
 
-static void login_input(void *user_data, int fd __attr_unused__,
+static void login_input(void *context, int fd __attr_unused__,
 			IO io __attr_unused__)
 {
-	LoginConnection *conn  = user_data;
+	LoginConnection *conn  = context;
         unsigned char *data;
 	unsigned int size;
 
--- a/src/auth/main.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/auth/main.c	Thu Aug 22 15:48:38 2002 +0300
@@ -24,7 +24,7 @@
 	io_loop_stop(ioloop);
 }
 
-static void auth_accept(void *user_data __attr_unused__, int listen_fd,
+static void auth_accept(void *context __attr_unused__, int listen_fd,
 			IO io __attr_unused__)
 {
 	int fd;
--- a/src/auth/master.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/auth/master.c	Thu Aug 22 15:48:38 2002 +0300
@@ -43,7 +43,7 @@
 	}
 }
 
-static void master_input(void *user_data __attr_unused__, int fd,
+static void master_input(void *context __attr_unused__, int fd,
 			 IO io __attr_unused__)
 {
 	int ret;
--- a/src/imap/client.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/imap/client.c	Thu Aug 22 15:48:38 2002 +0300
@@ -332,7 +332,7 @@
 		client_destroy(client);
 }
 
-static void idle_timeout(void *user_data __attr_unused__,
+static void idle_timeout(void *context __attr_unused__,
 			 Timeout timeout __attr_unused__)
 {
 	if (my_client == NULL)
--- a/src/imap/cmd-list.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/imap/cmd-list.c	Thu Aug 22 15:48:38 2002 +0300
@@ -18,7 +18,7 @@
 	Pool pool;
 	ListNode *nodes;
 	MailStorage *storage;
-} ListData;
+} ListContext;
 
 static const char *mailbox_flags2str(MailboxFlags flags)
 {
@@ -79,13 +79,13 @@
 }
 
 static void list_func(MailStorage *storage __attr_unused__, const char *name,
-		     MailboxFlags flags, void *user_data)
+		      MailboxFlags flags, void *context)
 {
-	ListData *data = user_data;
+	ListContext *ctx = context;
 	ListNode *node;
 
-	node = list_node_get(data->pool, &data->nodes, name,
-			     data->storage->hierarchy_sep);
+	node = list_node_get(ctx->pool, &ctx->nodes, name,
+			     ctx->storage->hierarchy_sep);
 
 	/* set the flags, this also nicely overrides the NOSELECT flag
 	   set by list_node_get() */
@@ -129,7 +129,7 @@
 
 int cmd_list_full(Client *client, int subscribed)
 {
-	ListData data;
+	ListContext ctx;
 	const char *ref, *pattern;
 	char sep_chr, sep[3];
 
@@ -162,23 +162,23 @@
 			pattern = t_strconcat(ref, pattern, NULL);
 		}
 
-		data.pool = pool_create("ListData", 10240, FALSE);
-		data.nodes = NULL;
-		data.storage = client->storage;
+		ctx.pool = pool_create("ListCtx", 10240, FALSE);
+		ctx.nodes = NULL;
+		ctx.storage = client->storage;
 
 		if (!subscribed) {
 			client->storage->find_mailboxes(client->storage,
 							pattern,
-							list_func, &data);
+							list_func, &ctx);
 		} else {
 			client->storage->find_subscribed(client->storage,
 							 pattern,
-							 list_func, &data);
+							 list_func, &ctx);
 		}
 
-		list_send(client, data.nodes, subscribed ? "LSUB" : "LIST",
+		list_send(client, ctx.nodes, subscribed ? "LSUB" : "LIST",
 			  NULL, sep, imap_match_init(pattern, TRUE, sep_chr));
-		pool_unref(data.pool);
+		pool_unref(ctx.pool);
 	}
 
 	client_send_tagline(client, subscribed ?
--- a/src/imap/cmd-store.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/imap/cmd-store.c	Thu Aug 22 15:48:38 2002 +0300
@@ -6,9 +6,9 @@
 
 static void update_func(Mailbox *mailbox __attr_unused__, unsigned int seq,
 			unsigned int uid __attr_unused__, MailFlags flags,
-			const char *custom_flags[], void *user_data)
+			const char *custom_flags[], void *context)
 {
-	Client *client = user_data;
+	Client *client = context;
 	const char *str;
 
 	t_push();
@@ -20,9 +20,9 @@
 
 static void update_func_uid(Mailbox *mailbox __attr_unused__, unsigned int seq,
 			    unsigned int uid, MailFlags flags,
-			    const char *custom_flags[], void *user_data)
+			    const char *custom_flags[], void *context)
 {
-	Client *client = user_data;
+	Client *client = context;
 	const char *str;
 
 	t_push();
--- a/src/imap/commands-util.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/imap/commands-util.c	Thu Aug 22 15:48:38 2002 +0300
@@ -72,9 +72,9 @@
 
 static void sync_expunge_func(Mailbox *mailbox __attr_unused__,
 			      unsigned int seq,
-			      unsigned int uid __attr_unused__, void *user_data)
+			      unsigned int uid __attr_unused__, void *context)
 {
-	Client *client = user_data;
+	Client *client = context;
 	char str[MAX_INT_STRLEN+20];
 
 	i_snprintf(str, sizeof(str), "* %u EXPUNGE", seq);
@@ -83,9 +83,9 @@
 
 static void sync_flags_func(Mailbox *mailbox __attr_unused__, unsigned int seq,
 			    unsigned int uid __attr_unused__, MailFlags flags,
-			    const char *custom_flags[], void *user_data)
+			    const char *custom_flags[], void *context)
 {
-	Client *client = user_data;
+	Client *client = context;
 	const char *str;
 
 	t_push();
--- a/src/lib-imap/imap-bodystructure.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-imap/imap-bodystructure.c	Thu Aug 22 15:48:38 2002 +0300
@@ -32,9 +32,9 @@
 				     int extended);
 
 static void parse_content_type(const Rfc822Token *tokens,
-			       int count, void *user_data)
+			       int count, void *context)
 {
-        MessagePartBodyData *data = user_data;
+        MessagePartBodyData *data = context;
 	const char *value;
 	int i;
 
@@ -53,9 +53,9 @@
 
 static void parse_save_params_list(const Rfc822Token *name,
 				   const Rfc822Token *value, int value_count,
-				   void *user_data)
+				   void *context)
 {
-        MessagePartBodyData *data = user_data;
+        MessagePartBodyData *data = context;
 	const char *str;
 
 	if (data->str->len != 0)
@@ -70,9 +70,9 @@
 }
 
 static void parse_content_transfer_encoding(const Rfc822Token *tokens,
-					    int count, void *user_data)
+					    int count, void *context)
 {
-        MessagePartBodyData *data = user_data;
+        MessagePartBodyData *data = context;
 	const char *value;
 
 	value = rfc822_tokens_get_value_quoted(tokens, count, FALSE);
@@ -80,9 +80,9 @@
 }
 
 static void parse_content_disposition(const Rfc822Token *tokens,
-				      int count, void *user_data)
+				      int count, void *context)
 {
-        MessagePartBodyData *data = user_data;
+        MessagePartBodyData *data = context;
 	const char *value;
 
 	value = rfc822_tokens_get_value_quoted(tokens, count, FALSE);
@@ -90,9 +90,9 @@
 }
 
 static void parse_content_language(const Rfc822Token *tokens,
-				   int count, void *user_data)
+				   int count, void *context)
 {
-        MessagePartBodyData *data = user_data;
+        MessagePartBodyData *data = context;
 	const char *value;
 
 	if (count <= 0)
@@ -107,9 +107,9 @@
 static void parse_header(MessagePart *part,
 			 const char *name, unsigned int name_len,
 			 const char *value,
-			 unsigned int value_len, void *user_data)
+			 unsigned int value_len, void *context)
 {
-	Pool pool = user_data;
+	Pool pool = context;
 	MessagePartBodyData *part_data;
 	int parent_rfc822;
 
@@ -118,13 +118,13 @@
 			       strncasecmp(name, "Content-", 8) != 0))
 		return;
 
-	if (part->user_data == NULL) {
+	if (part->context == NULL) {
 		/* initialize message part data */
-		part->user_data = part_data =
+		part->context = part_data =
 			p_new(pool, MessagePartBodyData, 1);
 		part_data->pool = pool;
 	}
-	part_data = part->user_data;
+	part_data = part->context;
 
 	t_push();
 
@@ -190,7 +190,7 @@
 static void part_write_body_multipart(MessagePart *part, TempString *str,
 				      int extended)
 {
-	MessagePartBodyData *data = part->user_data;
+	MessagePartBodyData *data = part->context;
 
 	if (part->children != NULL)
 		part_write_bodystructure(part->children, str, extended);
@@ -243,7 +243,7 @@
 
 static void part_write_body(MessagePart *part, TempString *str, int extended)
 {
-	MessagePartBodyData *data = part->user_data;
+	MessagePartBodyData *data = part->context;
 
 	if (data == NULL) {
 		/* there was no content headers, use an empty structure */
@@ -281,7 +281,7 @@
 		i_assert(part->children != NULL);
 		i_assert(part->children->next == NULL);
 
-                child_data = part->children->user_data;
+                child_data = part->children->context;
 
 		t_string_append_c(str, ' ');
 		if (child_data != NULL && child_data->envelope != NULL) {
--- a/src/lib-imap/imap-message-cache.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-imap/imap-message-cache.c	Thu Aug 22 15:48:38 2002 +0300
@@ -47,8 +47,8 @@
 	IOBuffer *open_inbuf;
 	size_t open_size, open_virtual_size;
 
-	IOBuffer *(*inbuf_rewind)(IOBuffer *inbuf, void *user_data);
-	void *user_data;
+	IOBuffer *(*inbuf_rewind)(IOBuffer *inbuf, void *context);
+	void *context;
 };
 
 ImapMessageCache *imap_msgcache_alloc(void)
@@ -139,9 +139,9 @@
 static void parse_envelope_header(MessagePart *part,
 				  const char *name, unsigned int name_len,
 				  const char *value, unsigned int value_len,
-				  void *user_data)
+				  void *context)
 {
-	CachedMessage *msg = user_data;
+	CachedMessage *msg = context;
 
 	if (part == NULL || part->parent == NULL) {
 		/* parse envelope headers if we're at the root message part */
@@ -168,7 +168,7 @@
 	if (offset < cache->open_inbuf->offset) {
 		/* need to rewind */
 		cache->open_inbuf = cache->inbuf_rewind(cache->open_inbuf,
-							cache->user_data);
+							cache->context);
 		if (cache->open_inbuf == NULL)
 			i_fatal("Can't rewind message buffer");
 	}
@@ -324,8 +324,8 @@
 			   size_t pv_headers_size, size_t pv_body_size,
 			   IOBuffer *inbuf,
 			   IOBuffer *(*inbuf_rewind)(IOBuffer *inbuf,
-						     void *user_data),
-			   void *user_data)
+						     void *context),
+			   void *context)
 {
 	CachedMessage *msg;
 
@@ -340,7 +340,7 @@
 		cache->open_virtual_size = virtual_size;
 
 		cache->inbuf_rewind = inbuf_rewind;
-		cache->user_data = user_data;
+		cache->context = context;
 	}
 
 	if (pv_headers_size != 0 && msg->hdr_size == NULL) {
--- a/src/lib-imap/imap-message-cache.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-imap/imap-message-cache.h	Thu Aug 22 15:48:38 2002 +0300
@@ -41,8 +41,8 @@
 			   size_t pv_headers_size, size_t pv_body_size,
 			   IOBuffer *inbuf,
 			   IOBuffer *(*inbuf_rewind)(IOBuffer *inbuf,
-						     void *user_data),
-			   void *user_data);
+						     void *context),
+			   void *context);
 
 /* Close the IOBuffer for cached message. */
 void imap_msgcache_close(ImapMessageCache *cache);
--- a/src/lib-index/mail-index-update.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-index/mail-index-update.c	Thu Aug 22 15:48:38 2002 +0300
@@ -277,31 +277,31 @@
 	MessagePartEnvelopeData *envelope;
 
 	MessageHeaderFunc header_func;
-	void *user_data;
-} HeaderUpdateData;
+	void *context;
+} HeaderUpdateContext;
 
 static void update_header_func(MessagePart *part,
 			       const char *name, unsigned int name_len,
 			       const char *value, unsigned int value_len,
-			       void *user_data)
+			       void *context)
 {
-	HeaderUpdateData *data = user_data;
+	HeaderUpdateContext *ctx = context;
 	MailField field;
 	const char *str;
 
 	if (part != NULL && part->parent != NULL)
 		return;
 
-	if (data->header_func != NULL) {
-		data->header_func(part, name, name_len,
-				  value, value_len, data->user_data);
+	if (ctx->header_func != NULL) {
+		ctx->header_func(part, name, name_len,
+				 value, value_len, ctx->context);
 	}
 
 	if (name_len == 4 && strncasecmp(name, "Date", 4) == 0) {
 		/* date is stored into index record itself */
 		str = field_get_value(value, value_len);
-		if (!rfc822_parse_date(str, &data->update->rec->sent_date))
-			data->update->rec->sent_date = ioloop_time;
+		if (!rfc822_parse_date(str, &ctx->update->rec->sent_date))
+			ctx->update->rec->sent_date = ioloop_time;
 		return;
 	}
 
@@ -309,47 +309,47 @@
 	field = mail_header_get_field(name, name_len);
 	if (field != 0) {
 		/* do we want to store this? */
-		if (data->update->index->header->cache_fields & field) {
+		if (ctx->update->index->header->cache_fields & field) {
 			str = field_get_value(value, value_len);
-			data->update->index->update_field(data->update,
-							  field, str, 0);
+			ctx->update->index->update_field(ctx->update,
+							 field, str, 0);
 		}
 	}
 
-	if (data->update->index->header->cache_fields & FIELD_TYPE_ENVELOPE) {
-		if (data->envelope_pool == NULL) {
-			data->envelope_pool = pool_create("index envelope",
-							  2048, FALSE);
+	if (ctx->update->index->header->cache_fields & FIELD_TYPE_ENVELOPE) {
+		if (ctx->envelope_pool == NULL) {
+			ctx->envelope_pool =
+				pool_create("index envelope", 2048, FALSE);
 		}
-		imap_envelope_parse_header(data->envelope_pool,
-					   &data->envelope,
+		imap_envelope_parse_header(ctx->envelope_pool,
+					   &ctx->envelope,
 					   t_strndup(name, name_len),
 					   value, value_len);
 	}
 }
 
 void mail_index_update_headers(MailIndexUpdate *update, IOBuffer *inbuf,
-			       MessageHeaderFunc header_func, void *user_data)
+			       MessageHeaderFunc header_func, void *context)
 {
-	HeaderUpdateData data;
+	HeaderUpdateContext ctx;
 	MailField cache_fields;
 	MessagePart *part;
 	MessageSize hdr_size, body_size;
 	Pool pool;
 	const char *value;
 
-	data.update = update;
-	data.envelope_pool = NULL;
-	data.envelope = NULL;
-	data.header_func = header_func;
-	data.user_data = user_data;
+	ctx.update = update;
+	ctx.envelope_pool = NULL;
+	ctx.envelope = NULL;
+	ctx.header_func = header_func;
+	ctx.context = context;
 
 	cache_fields = update->index->header->cache_fields;
 	if ((cache_fields & (FIELD_TYPE_BODY|FIELD_TYPE_BODYSTRUCTURE)) != 0) {
 		/* for body / bodystructure, we need need to
 		   fully parse the message */
 		pool = pool_create("index message parser", 2048, FALSE);
-		part = message_parse(pool, inbuf, update_header_func, &data);
+		part = message_parse(pool, inbuf, update_header_func, &ctx);
 
 		/* update our sizes */
 		update->rec->header_size = part->header_size.physical_size;
@@ -380,7 +380,7 @@
 		pool_unref(pool);
 	} else {
 		message_parse_header(NULL, inbuf, &hdr_size,
-				     update_header_func, &data);
+				     update_header_func, &ctx);
 
 		update->rec->header_size = hdr_size.physical_size;
 		update->rec->body_size = (inbuf->stop_offset - inbuf->offset) -
@@ -397,13 +397,13 @@
 		}
 	}
 
-	if (data.envelope != NULL) {
+	if (ctx.envelope != NULL) {
 		t_push();
-		value = imap_envelope_get_part_data(data.envelope);
+		value = imap_envelope_get_part_data(ctx.envelope);
 		update->index->update_field(update, FIELD_TYPE_ENVELOPE,
 					    value, 0);
 		t_pop();
 
-		pool_unref(data.envelope_pool);
+		pool_unref(ctx.envelope_pool);
 	}
 }
--- a/src/lib-index/mail-index.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-index/mail-index.h	Thu Aug 22 15:48:38 2002 +0300
@@ -344,7 +344,7 @@
 int mail_index_rebuild_all(MailIndex *index);
 int mail_index_sync_file(MailIndex *index);
 void mail_index_update_headers(MailIndexUpdate *update, IOBuffer *inbuf,
-			       MessageHeaderFunc header_func, void *user_data);
+			       MessageHeaderFunc header_func, void *context);
 
 /* Max. mmap()ed size for a message */
 #define MAIL_MMAP_BLOCK_SIZE (1024*256)
--- a/src/lib-index/mail-messageset.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-index/mail-messageset.c	Thu Aug 22 15:48:38 2002 +0300
@@ -25,7 +25,7 @@
 
 static int mail_index_foreach(MailIndex *index,
 			      unsigned int seq, unsigned int seq2,
-			      MsgsetForeachFunc func, void *user_data)
+			      MsgsetForeachFunc func, void *context)
 {
 	MailIndexRecord *rec;
 	const unsigned int *expunges;
@@ -65,7 +65,7 @@
 		if (seq > seq2)
 			break;
 
-		if (!func(index, rec, seq, user_data))
+		if (!func(index, rec, seq, context))
 			return 0;
 
 		rec = index->next(index, rec);
@@ -81,7 +81,7 @@
 
 int mail_index_messageset_foreach(MailIndex *index, const char *messageset,
 				  unsigned int messages_count,
-				  MsgsetForeachFunc func, void *user_data)
+				  MsgsetForeachFunc func, void *context)
 {
 	const char *input;
 	unsigned int seq, seq2;
@@ -148,7 +148,7 @@
 			/* too large .. ignore silently */
 		} else {
 			ret = mail_index_foreach(index, seq, seq2,
-						 func, user_data);
+						 func, context);
 			if (ret <= 0)
 				return ret;
 			if (ret == 2)
@@ -162,7 +162,7 @@
 static int mail_index_uid_foreach(MailIndex *index,
 				  unsigned int uid, unsigned int uid2,
 				  unsigned int max_sequence,
-				  MsgsetForeachFunc func, void *user_data)
+				  MsgsetForeachFunc func, void *context)
 {
 	MailIndexRecord *rec;
 	off_t pos;
@@ -217,7 +217,7 @@
 		}
 		i_assert(*expunges != rec->uid);
 
-		if (!func(index, rec, seq, user_data))
+		if (!func(index, rec, seq, context))
 			return 0;
 
 		seq++;
@@ -234,7 +234,7 @@
 
 int mail_index_uidset_foreach(MailIndex *index, const char *uidset,
 			      unsigned int messages_count,
-			      MsgsetForeachFunc func, void *user_data)
+			      MsgsetForeachFunc func, void *context)
 {
 	MailIndexRecord *rec;
 	const char *input;
@@ -299,7 +299,7 @@
 		} else {
 			ret = mail_index_uid_foreach(index, uid, uid2,
 						     messages_count,
-						     func, user_data);
+						     func, context);
 			if (ret <= 0)
 				return ret;
 			if (ret == 2)
--- a/src/lib-index/mail-messageset.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-index/mail-messageset.h	Thu Aug 22 15:48:38 2002 +0300
@@ -5,17 +5,17 @@
 
 /* If FALSE is returned, the loop is stopped. */
 typedef int (*MsgsetForeachFunc)(MailIndex *index, MailIndexRecord *rec,
-				 unsigned int seq, void *user_data);
+				 unsigned int seq, void *context);
 
 /* Returns -1 if error occured, 0 if foreach-func returned FALSE,
    1 if everything was ok or 2 if some of the given sequences were expunged */
 int mail_index_messageset_foreach(MailIndex *index, const char *messageset,
 				  unsigned int messages_count,
-				  MsgsetForeachFunc func, void *user_data);
+				  MsgsetForeachFunc func, void *context);
 
 /* Like messageset_foreach() but for UIDs. */
 int mail_index_uidset_foreach(MailIndex *index, const char *uidset,
 			      unsigned int messages_count,
-			      MsgsetForeachFunc func, void *user_data);
+			      MsgsetForeachFunc func, void *context);
 
 #endif
--- a/src/lib-index/maildir/maildir-sync.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-index/maildir/maildir-sync.c	Thu Aug 22 15:48:38 2002 +0300
@@ -172,15 +172,15 @@
 	MailIndex *index;
 	const char *dir;
 	int failed;
-} HashAppendData;
+} HashAppendContext;
 
 static void maildir_index_hash_append_file(void *key __attr_unused__,
-					   void *value, void *user_data)
+					   void *value, void *context)
 {
-	HashAppendData *data = user_data;
+	HashAppendContext *ctx = context;
 
-	if (!maildir_index_append_file(data->index, data->dir, value)) {
-		data->failed = TRUE;
+	if (!maildir_index_append_file(ctx->index, ctx->dir, value)) {
+		ctx->failed = TRUE;
                 hash_foreach_stop();
 	}
 }
@@ -188,14 +188,14 @@
 static int maildir_index_append_files(MailIndex *index, const char *dir,
 				      HashTable *files)
 {
-	HashAppendData data;
+	HashAppendContext ctx;
 
-	data.failed = FALSE;
-	data.index = index;
-	data.dir = dir;
-	hash_foreach(files, maildir_index_hash_append_file, &data);
+	ctx.failed = FALSE;
+	ctx.index = index;
+	ctx.dir = dir;
+	hash_foreach(files, maildir_index_hash_append_file, &ctx);
 
-	return !data.failed;
+	return !ctx.failed;
 }
 
 static int maildir_index_sync_dir(MailIndex *index, const char *dir)
--- a/src/lib-index/mbox/mbox-append.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-index/mbox/mbox-append.c	Thu Aug 22 15:48:38 2002 +0300
@@ -110,9 +110,9 @@
 static void header_func(MessagePart *part __attr_unused__,
 			const char *name, unsigned int name_len,
 			const char *value, unsigned int value_len,
-			void *user_data)
+			void *context)
 {
-	MailIndexRecord *rec = user_data;
+	MailIndexRecord *rec = context;
 
 	rec->msg_flags |= mbox_header_get_flags(name, name_len,
 						value, value_len);
--- a/src/lib-index/mbox/mbox-fsck.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-index/mbox/mbox-fsck.c	Thu Aug 22 15:48:38 2002 +0300
@@ -12,20 +12,20 @@
 typedef struct {
 	const char *msgid;
 	MailFlags flags;
-} HeaderData;
+} HeaderContext;
 
 static void header_func(MessagePart *part __attr_unused__,
 			const char *name, unsigned int name_len,
 			const char *value, unsigned int value_len,
-			void *user_data)
+			void *context)
 {
-	HeaderData *data = user_data;
+	HeaderContext *ctx = context;
 
 	if (name_len != 10 || strncasecmp(name, "Message-ID", 10) != 0)
 		return;
 
-	data->msgid = t_strndup(value, value_len);
-	data->flags |= mbox_header_get_flags(name, name_len, value, value_len);
+	ctx->msgid = t_strndup(value, value_len);
+	ctx->flags |= mbox_header_get_flags(name, name_len, value, value_len);
 }
 
 static MailIndexRecord *
--- a/src/lib-mail/message-content-parser.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-mail/message-content-parser.c	Thu Aug 22 15:48:38 2002 +0300
@@ -4,10 +4,9 @@
 #include "rfc822-tokenize.h"
 #include "message-content-parser.h"
 
-int message_content_parse_header(const char *value,
-				 ParseContentFunc func,
+int message_content_parse_header(const char *value, ParseContentFunc func,
 				 ParseContentParamFunc param_func,
-				 void *user_data)
+				 void *context)
 {
 	const Rfc822Token *tokens;
 	int i, next, ntokens;
@@ -25,7 +24,7 @@
 	}
 
 	if (func != NULL)
-		func(tokens, i, user_data);
+		func(tokens, i, context);
 
 	if (param_func != NULL) {
 		/* parse the parameters */
@@ -41,7 +40,7 @@
 			    tokens[i+1].token == '=') {
 				/* <atom> = <value> */
 				param_func(tokens + i, tokens + i + 2,
-					   next - (i+2), user_data);
+					   next - (i+2), context);
 			}
 		}
 	}
--- a/src/lib-mail/message-content-parser.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-mail/message-content-parser.h	Thu Aug 22 15:48:38 2002 +0300
@@ -7,15 +7,14 @@
 
 /* Note that count can be 0 */
 typedef void (*ParseContentFunc)(const Rfc822Token *tokens, int count,
-				 void *user_data);
+				 void *context);
 /* name is always atom, value_count is always > 0 */
 typedef void (*ParseContentParamFunc)(const Rfc822Token *name,
 				      const Rfc822Token *value,
-				      int value_count, void *user_data);
+				      int value_count, void *context);
 
-int message_content_parse_header(const char *value,
-				 ParseContentFunc func,
+int message_content_parse_header(const char *value, ParseContentFunc func,
 				 ParseContentParamFunc param_func,
-				 void *user_data);
+				 void *context);
 
 #endif
--- a/src/lib-mail/message-parser.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-mail/message-parser.c	Thu Aug 22 15:48:38 2002 +0300
@@ -24,11 +24,11 @@
 	MessageBoundary *boundaries;
 
 	MessageHeaderFunc func;
-	void *user_data;
-} MessageParseData;
+	void *context;
+} MessageParseContext;
 
 static MessagePart *message_parse_part(IOBuffer *inbuf,
-				       MessageParseData *parse_data);
+				       MessageParseContext *parse_ctx);
 static MessagePart *message_parse_body(IOBuffer *inbuf,
 				       MessageBoundary *boundaries,
 				       MessageSize *body_size);
@@ -63,60 +63,60 @@
 }
 
 static void parse_content_type(const Rfc822Token *tokens, int count,
-			       void *user_data)
+			       void *context)
 {
-	MessageParseData *parse_data = user_data;
+	MessageParseContext *parse_ctx = context;
 	const char *str;
 
 	if (tokens[0].token != 'A')
 		return;
 
-	if (parse_data->last_content_type != NULL)
+	if (parse_ctx->last_content_type != NULL)
 		return;
 
 	str = rfc822_tokens_get_value(tokens, count, FALSE);
-	parse_data->last_content_type = p_strdup(parse_data->pool, str);
+	parse_ctx->last_content_type = p_strdup(parse_ctx->pool, str);
 
 	if (strcasecmp(str, "message/rfc822") == 0)
-		parse_data->part->message_rfc822 = TRUE;
+		parse_ctx->part->message_rfc822 = TRUE;
 	else if (strncasecmp(str, "text/", 5) == 0)
-		parse_data->part->text = TRUE;
+		parse_ctx->part->text = TRUE;
 	else if (strncasecmp(str, "multipart/", 10) == 0) {
-		parse_data->part->multipart = TRUE;
+		parse_ctx->part->multipart = TRUE;
 
 		if (strcasecmp(str+10, "digest") == 0)
-			parse_data->part->multipart_digest = TRUE;
+			parse_ctx->part->multipart_digest = TRUE;
 	}
 }
 
 static void parse_content_type_param(const Rfc822Token *name,
 				     const Rfc822Token *value,
-				     int value_count, void *user_data)
+				     int value_count, void *context)
 {
-	MessageParseData *parse_data = user_data;
+	MessageParseContext *parse_ctx = context;
 	const char *str;
 
-	if (!parse_data->part->multipart || name->len != 8 ||
+	if (!parse_ctx->part->multipart || name->len != 8 ||
 	    strncasecmp(name->ptr, "boundary", 8) != 0)
 		return;
 
-	if (parse_data->last_boundary == NULL) {
+	if (parse_ctx->last_boundary == NULL) {
 		str = rfc822_tokens_get_value(value, value_count, FALSE);
-		parse_data->last_boundary = p_strdup(parse_data->pool, str);
+		parse_ctx->last_boundary = p_strdup(parse_ctx->pool, str);
 	}
 }
 
 static void parse_header_field(MessagePart *part,
 			       const char *name, unsigned int name_len,
 			       const char *value, unsigned int value_len,
-			       void *user_data)
+			       void *context)
 {
-	MessageParseData *parse_data = user_data;
+	MessageParseContext *parse_ctx = context;
 
 	/* call the user-defined header parser */
-	if (parse_data->func != NULL) {
-		parse_data->func(part, name, name_len, value, value_len,
-				 parse_data->user_data);
+	if (parse_ctx->func != NULL) {
+		parse_ctx->func(part, name, name_len, value, value_len,
+				parse_ctx->context);
 	}
 
 	if (name_len == 12 && strncasecmp(name, "Content-Type", 12) == 0) {
@@ -124,38 +124,38 @@
 		(void)message_content_parse_header(t_strndup(value, value_len),
 						   parse_content_type,
 						   parse_content_type_param,
-						   parse_data);
+						   parse_ctx);
 	}
 }
 
 static MessagePart *message_parse_multipart(IOBuffer *inbuf,
-					    MessageParseData *parse_data)
+					    MessageParseContext *parse_ctx)
 {
 	MessagePart *parent_part, *next_part, *part;
 	MessageBoundary *b;
 
 	/* multipart message. add new boundary */
 	b = t_new(MessageBoundary, 1);
-	b->part = parse_data->part;
-	b->boundary = parse_data->last_boundary;
+	b->part = parse_ctx->part;
+	b->boundary = parse_ctx->last_boundary;
 	b->len = strlen(b->boundary);
 
-	b->next = parse_data->boundaries;
-	parse_data->boundaries = b;
+	b->next = parse_ctx->boundaries;
+	parse_ctx->boundaries = b;
 
 	/* reset fields */
-	parse_data->last_boundary = NULL;
-	parse_data->last_content_type = NULL;
+	parse_ctx->last_boundary = NULL;
+	parse_ctx->last_content_type = NULL;
 
 	/* skip the data before the first boundary */
-	parent_part = parse_data->part;
-	next_part = message_skip_boundary(inbuf, parse_data->boundaries,
+	parent_part = parse_ctx->part;
+	next_part = message_skip_boundary(inbuf, parse_ctx->boundaries,
 					  &parent_part->body_size);
 
 	/* now, parse the parts */
 	while (next_part == parent_part) {
 		/* new child */
-		part = message_part_append(parse_data->pool, parent_part);
+		part = message_part_append(parse_ctx->pool, parent_part);
 
 		/* set child position */
 		memcpy(&part->pos, &parent_part->pos, sizeof(MessagePosition));
@@ -164,8 +164,8 @@
 		part->pos.virtual_pos += parent_part->body_size.virtual_size +
 			parent_part->header_size.virtual_size;
 
-                parse_data->part = part;
-		next_part = message_parse_part(inbuf, parse_data);
+                parse_ctx->part = part;
+		next_part = message_parse_part(inbuf, parse_ctx);
 
 		/* update our size */
 		message_size_add_part(&parent_part->body_size, part);
@@ -174,64 +174,64 @@
 			break;
 
 		/* skip the boundary */
-		next_part = message_skip_boundary(inbuf, parse_data->boundaries,
+		next_part = message_skip_boundary(inbuf, parse_ctx->boundaries,
 						  &parent_part->body_size);
 	}
 
 	/* remove boundary */
-	i_assert(parse_data->boundaries == b);
-	parse_data->boundaries = b->next;
+	i_assert(parse_ctx->boundaries == b);
+	parse_ctx->boundaries = b->next;
 	return next_part;
 }
 
 static MessagePart *message_parse_part(IOBuffer *inbuf,
-				       MessageParseData *parse_data)
+				       MessageParseContext *parse_ctx)
 {
 	MessagePart *next_part, *part;
 	size_t hdr_size;
 
-	message_parse_header(parse_data->part, inbuf,
-			     &parse_data->part->header_size,
-			     parse_header_field, parse_data);
+	message_parse_header(parse_ctx->part, inbuf,
+			     &parse_ctx->part->header_size,
+			     parse_header_field, parse_ctx);
 
 	/* update message position/size */
-	hdr_size = parse_data->part->header_size.physical_size;
+	hdr_size = parse_ctx->part->header_size.physical_size;
 
-	if (parse_data->last_boundary != NULL)
-		return message_parse_multipart(inbuf, parse_data);
+	if (parse_ctx->last_boundary != NULL)
+		return message_parse_multipart(inbuf, parse_ctx);
 
-	if (parse_data->last_content_type == NULL) {
-		if (parse_data->part->parent != NULL &&
-		    parse_data->part->parent->multipart_digest) {
+	if (parse_ctx->last_content_type == NULL) {
+		if (parse_ctx->part->parent != NULL &&
+		    parse_ctx->part->parent->multipart_digest) {
 			/* when there's no content-type specified and we're
 			   below multipart/digest, the assume message/rfc822
 			   content-type */
-			parse_data->part->message_rfc822 = TRUE;
+			parse_ctx->part->message_rfc822 = TRUE;
 		} else {
 			/* otherwise we default to text/plain */
-			parse_data->part->text = TRUE;
+			parse_ctx->part->text = TRUE;
 		}
 	}
 
-	parse_data->last_boundary = NULL;
-        parse_data->last_content_type = NULL;
+	parse_ctx->last_boundary = NULL;
+        parse_ctx->last_content_type = NULL;
 
-	if (parse_data->part->message_rfc822) {
+	if (parse_ctx->part->message_rfc822) {
 		/* message/rfc822 part - the message body begins with
 		   headers again, this works pretty much the same as
 		   a single multipart/mixed item */
-		part = message_part_append(parse_data->pool, parse_data->part);
+		part = message_part_append(parse_ctx->pool, parse_ctx->part);
 
-		parse_data->part = part;
-		next_part = message_parse_part(inbuf, parse_data);
-		parse_data->part = part->parent;
+		parse_ctx->part = part;
+		next_part = message_parse_part(inbuf, parse_ctx);
+		parse_ctx->part = part->parent;
 
 		/* our body size is the size of header+body in message/rfc822 */
 		message_size_add_part(&part->parent->body_size, part);
 	} else {
 		/* normal message, read until the next boundary */
-		part = parse_data->part;
-		next_part = message_parse_body(inbuf, parse_data->boundaries,
+		part = parse_ctx->part;
+		next_part = message_parse_body(inbuf, parse_ctx->boundaries,
 					       &part->body_size);
 	}
 
@@ -239,19 +239,19 @@
 }
 
 MessagePart *message_parse(Pool pool, IOBuffer *inbuf,
-			   MessageHeaderFunc func, void *user_data)
+			   MessageHeaderFunc func, void *context)
 {
 	MessagePart *part;
-	MessageParseData parse_data;
+	MessageParseContext parse_ctx;
 
-	memset(&parse_data, 0, sizeof(parse_data));
-	parse_data.pool = pool;
-	parse_data.func = func;
-	parse_data.user_data = user_data;
-	parse_data.part = part = p_new(pool, MessagePart, 1);
+	memset(&parse_ctx, 0, sizeof(parse_ctx));
+	parse_ctx.pool = pool;
+	parse_ctx.func = func;
+	parse_ctx.context = context;
+	parse_ctx.part = part = p_new(pool, MessagePart, 1);
 
 	t_push();
-	message_parse_part(inbuf, &parse_data);
+	message_parse_part(inbuf, &parse_ctx);
 	t_pop();
 	return part;
 }
@@ -302,7 +302,7 @@
 
 void message_parse_header(MessagePart *part, IOBuffer *inbuf,
 			  MessageSize *hdr_size,
-			  MessageHeaderFunc func, void *user_data)
+			  MessageHeaderFunc func, void *context)
 {
 	unsigned char *msg;
 	unsigned int i, size, startpos, missing_cr_count;
@@ -390,7 +390,7 @@
 					/* and finally call the function */
 					func(part, msg + line_start, name_len,
 					     msg + colon_pos, value_len,
-					     user_data);
+					     context);
 				}
 
 				colon_pos = UINT_MAX;
--- a/src/lib-mail/message-parser.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-mail/message-parser.h	Thu Aug 22 15:48:38 2002 +0300
@@ -31,18 +31,18 @@
 	unsigned int text:1; /* content-type: text/.. */
 	unsigned int binary:1; /* content-transfer-encoding: binary */
 
-	void *user_data;
+	void *context;
 };
 
 /* NOTE: name and value aren't \0-terminated */
 typedef void (*MessageHeaderFunc)(MessagePart *part,
 				  const char *name, unsigned int name_len,
 				  const char *value, unsigned int value_len,
-				  void *user_data);
+				  void *context);
 
 /* func is called for each field in message header. */
 MessagePart *message_parse(Pool pool, IOBuffer *inbuf,
-			   MessageHeaderFunc func, void *user_data);
+			   MessageHeaderFunc func, void *context);
 
 /* Call func for each field in message header. Fills the hdr_size.
    part can be NULL, just make sure your header function works with it.
@@ -51,6 +51,6 @@
    message body. */
 void message_parse_header(MessagePart *part, IOBuffer *inbuf,
 			  MessageSize *hdr_size,
-			  MessageHeaderFunc func, void *user_data);
+			  MessageHeaderFunc func, void *context);
 
 #endif
--- a/src/lib-mail/rfc822-tokenize.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-mail/rfc822-tokenize.c	Thu Aug 22 15:48:38 2002 +0300
@@ -8,14 +8,14 @@
 #define PARSE_ERROR() \
 	STMT_START { \
 	if (error_func != NULL && \
-	    !error_func(str, (int) (p-str), '\0', user_data)) \
+	    !error_func(str, (int) (p-str), '\0', context)) \
 		return NULL; \
 	} STMT_END
 
 #define PARSE_ERROR_MISSING(c) \
 	STMT_START { \
 	if (error_func != NULL && \
-	    !error_func(str, (int) (p-str), c, user_data)) \
+	    !error_func(str, (int) (p-str), c, context)) \
 		return NULL; \
 	} STMT_END
 
@@ -37,7 +37,7 @@
 
 const Rfc822Token *rfc822_tokenize(const char *str, int *tokens_count,
 				   Rfc822TokenizeErrorFunc error_func,
-				   void *user_data)
+				   void *context)
 {
 	Rfc822Token *first_token, *token;
 	const char *p, *last_atom;
@@ -173,7 +173,7 @@
 	}
 
 	if (in_bracket && error_func != NULL) {
-		if (!error_func(str, (int) (p-str), '>', user_data))
+		if (!error_func(str, (int) (p-str), '>', context))
 			return NULL;
 	}
 
--- a/src/lib-mail/rfc822-tokenize.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-mail/rfc822-tokenize.h	Thu Aug 22 15:48:38 2002 +0300
@@ -39,14 +39,14 @@
    missing_char == '\0': unexpected character at str[pos]
    missing_char != '\0': missing character */
 typedef int (*Rfc822TokenizeErrorFunc)(const char *str, int pos,
-				       char missing_char, void *user_data);
+				       char missing_char, void *context);
 
 /* Tokenize the string. Returns NULL if string is empty. Memory for
    returned array is allocated from temporary pool. You don't have to use
    the tokens_count, since last token is always 0. */
 const Rfc822Token *rfc822_tokenize(const char *str, int *tokens_count,
 				   Rfc822TokenizeErrorFunc error_func,
-				   void *user_data);
+				   void *context);
 
 /* Returns the tokens as a string. */
 const char *rfc822_tokens_get_value(const Rfc822Token *tokens, int count,
--- a/src/lib-storage/flags-file/flags-file.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/flags-file/flags-file.c	Thu Aug 22 15:48:38 2002 +0300
@@ -409,8 +409,8 @@
 }
 
 static int get_flag_index(FlagsFile *ff, const char *flag,
-			  MailFlags (*get_used_flags)(void *user_data),
-			  void *user_data)
+			  MailFlags (*get_used_flags)(void *context),
+			  void *context)
 {
 	int i, first_empty;
 
@@ -434,7 +434,7 @@
 	first_empty = find_first_unused_flag(ff);
 	if (first_empty == -1) {
 		/* all custom flags are used, see if some of them are unused */
-		remove_unused_custom_flags(ff, get_used_flags(user_data));
+		remove_unused_custom_flags(ff, get_used_flags(context));
 
 		first_empty = find_first_unused_flag(ff);
 		if (first_empty == -1) {
@@ -452,8 +452,8 @@
 
 int flags_file_fix_custom_flags(FlagsFile *ff, MailFlags *flags,
 				const char *custom_flags[],
-				MailFlags (*get_used_flags)(void *user_data),
-				void *user_data)
+				MailFlags (*get_used_flags)(void *context),
+				void *context)
 {
 	MailFlags oldflags, flag;
 	int i, idx;
@@ -474,7 +474,7 @@
 				 *custom_flags[i] != '\0');
 
 			idx = get_flag_index(ff, custom_flags[i],
-					     get_used_flags, user_data);
+					     get_used_flags, context);
 			if (idx == -1) {
 				mail_storage_set_error(ff->storage,
 					"Maximum number of different custom "
--- a/src/lib-storage/flags-file/flags-file.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/flags-file/flags-file.h	Thu Aug 22 15:48:38 2002 +0300
@@ -15,8 +15,8 @@
    out which of them could be removed. */
 int flags_file_fix_custom_flags(FlagsFile *ff, MailFlags *flags,
 				const char *custom_flags[],
-				MailFlags (*get_used_flags)(void *user_data),
-				void *user_data);
+				MailFlags (*get_used_flags)(void *context),
+				void *context);
 
 /* Returns a pointer to list of flags. */
 const char **flags_file_list_get(FlagsFile *ff);
--- a/src/lib-storage/index/index-copy.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/index/index-copy.c	Thu Aug 22 15:48:38 2002 +0300
@@ -13,9 +13,9 @@
 } CopyData;
 
 static int copy_func(MailIndex *index, MailIndexRecord *rec,
-		     unsigned int seq __attr_unused__, void *user_data)
+		     unsigned int seq __attr_unused__, void *context)
 {
-	CopyData *cd = user_data;
+	CopyData *cd = context;
 	IOBuffer *inbuf;
 	int failed;
 
--- a/src/lib-storage/index/index-fetch-section.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/index/index-fetch-section.c	Thu Aug 22 15:48:38 2002 +0300
@@ -32,24 +32,24 @@
 
 /* fetch BODY[] or BODY[TEXT] */
 static int fetch_body(MailIndexRecord *rec, MailFetchBodyData *sect,
-		      FetchData *data, int fetch_header)
+		      FetchContext *ctx, int fetch_header)
 {
 	MessageSize size;
 	IOBuffer *inbuf;
 	const char *str;
 
-	if (!imap_msgcache_get_rfc822_partial(data->cache, rec->uid,
+	if (!imap_msgcache_get_rfc822_partial(ctx->cache, rec->uid,
 					      sect->skip, sect->max_size,
 					      fetch_header, &size, &inbuf)) {
 		i_error("Couldn't get BODY[] for UID %u (index %s)",
-			rec->uid, data->index->filepath);
+			rec->uid, ctx->index->filepath);
 		return FALSE;
 	}
 
 	str = t_strdup_printf("{%lu}\r\n", (unsigned long) size.virtual_size);
-	(void)io_buffer_send(data->outbuf, str, strlen(str));
+	(void)io_buffer_send(ctx->outbuf, str, strlen(str));
 
-	(void)imap_message_send(data->outbuf, inbuf, &size, 0, sect->max_size);
+	(void)imap_message_send(ctx->outbuf, inbuf, &size, 0, sect->max_size);
 	return TRUE;
 }
 
@@ -128,20 +128,20 @@
 	char *dest;
 	char *const *fields;
 	int (*match_func) (char *const *, const char *, unsigned int);
-} FetchHeaderFieldData;
+} FetchHeaderFieldContext;
 
 static void fetch_header_field(MessagePart *part __attr_unused__,
 			       const char *name, unsigned int name_len,
 			       const char *value __attr_unused__,
 			       unsigned int value_len __attr_unused__,
-			       void *user_data)
+			       void *context)
 {
-	FetchHeaderFieldData *data = user_data;
+	FetchHeaderFieldContext *ctx = context;
 	const char *name_start, *name_end, *cr;
 	unsigned int len;
 
 	/* see if we want this field */
-	if (!data->match_func(data->fields, name, name_len))
+	if (!ctx->match_func(ctx->fields, name, name_len))
 		return;
 
 	/* add the field, inserting CRs when needed. FIXME: is this too
@@ -156,11 +156,11 @@
 		else if (*name == '\n' && cr != name-1) {
 			/* missing CR */
 			len = (unsigned int) (name-name_start);
-			memcpy(data->dest, name_start, len);
+			memcpy(ctx->dest, name_start, len);
 
-			data->dest[len++] = '\r';
-			data->dest[len++] = '\n';
-			data->dest += len;
+			ctx->dest[len++] = '\r';
+			ctx->dest[len++] = '\n';
+			ctx->dest += len;
 
 			name_start = name+1;
 		}
@@ -169,8 +169,8 @@
 	if (name_start != name_end) {
 		/* last linebreak was \r\n */
 		len = (unsigned int) (name_end-name_start);
-		memcpy(data->dest, name_start, len);
-		data->dest += len;
+		memcpy(ctx->dest, name_start, len);
+		ctx->dest += len;
 	}
 }
 
@@ -180,20 +180,20 @@
 		    int (*match_func) (char *const *, const char *,
 				       unsigned int))
 {
-	FetchHeaderFieldData data;
+	FetchHeaderFieldContext ctx;
 
-	data.dest = dest;
-	data.fields = fields;
-	data.match_func = match_func;
+	ctx.dest = dest;
+	ctx.fields = fields;
+	ctx.match_func = match_func;
 
-	message_parse_header(NULL, inbuf, NULL, fetch_header_field, &data);
-	return (unsigned int) (data.dest - dest);
+	message_parse_header(NULL, inbuf, NULL, fetch_header_field, &ctx);
+	return (unsigned int) (ctx.dest - dest);
 }
 
 /* fetch wanted headers from given data */
 static void fetch_header_from(IOBuffer *inbuf, MessageSize *size,
 			      const char *section, MailFetchBodyData *sect,
-			      FetchData *data)
+			      FetchContext *ctx)
 {
 	const char *str;
 	char *dest;
@@ -205,8 +205,8 @@
 		/* all headers */
 		str = t_strdup_printf("{%lu}\r\n",
 				      (unsigned long) size->virtual_size);
-		(void)io_buffer_send(data->outbuf, str, strlen(str));
-		(void)imap_message_send(data->outbuf, inbuf, size,
+		(void)io_buffer_send(ctx->outbuf, str, strlen(str));
+		(void)imap_message_send(ctx->outbuf, inbuf, size,
 					sect->skip, sect->max_size);
 		return;
 	}
@@ -245,36 +245,36 @@
 	}
 
 	str = t_strdup_printf("{%u}\r\n", len);
-	io_buffer_send(data->outbuf, str, strlen(str));
-	if (len > 0) io_buffer_send(data->outbuf, dest, len);
+	io_buffer_send(ctx->outbuf, str, strlen(str));
+	if (len > 0) io_buffer_send(ctx->outbuf, dest, len);
 
 	t_pop();
 }
 
 /* fetch BODY[HEADER...] */
 static int fetch_header(MailIndexRecord *rec, MailFetchBodyData *sect,
-			FetchData *data)
+			FetchContext *ctx)
 {
 	MessageSize hdr_size;
 	IOBuffer *inbuf;
 
-	if (!imap_msgcache_get_rfc822(data->cache, rec->uid,
+	if (!imap_msgcache_get_rfc822(ctx->cache, rec->uid,
 				      &hdr_size, NULL, &inbuf))
 		return FALSE;
 
-	fetch_header_from(inbuf, &hdr_size, sect->section, sect, data);
+	fetch_header_from(inbuf, &hdr_size, sect->section, sect, ctx);
 	return TRUE;
 }
 
 /* Find MessagePart for section (eg. 1.3.4) */
 static MessagePart *part_find(MailIndexRecord *rec, MailFetchBodyData *sect,
-			      FetchData *data, const char **section)
+			      FetchContext *ctx, const char **section)
 {
 	MessagePart *part;
 	const char *path;
 	int num;
 
-	part = imap_msgcache_get_parts(data->cache, rec->uid);
+	part = imap_msgcache_get_parts(ctx->cache, rec->uid);
 
 	path = sect->section;
 	while (*path >= '0' && *path <= '9' && part != NULL) {
@@ -308,13 +308,13 @@
 
 /* fetch BODY[1.2] or BODY[1.2.TEXT] */
 static int fetch_part_body(MessagePart *part, unsigned int uid,
-			   MailFetchBodyData *sect, FetchData *data)
+			   MailFetchBodyData *sect, FetchContext *ctx)
 {
 	IOBuffer *inbuf;
 	const char *str;
 	off_t skip_pos;
 
-	if (!imap_msgcache_get_data(data->cache, uid, &inbuf))
+	if (!imap_msgcache_get_data(ctx->cache, uid, &inbuf))
 		return FALSE;
 
 	/* jump to beginning of wanted data */
@@ -324,11 +324,11 @@
 
 	str = t_strdup_printf("{%lu}\r\n",
 			      (unsigned long) part->body_size.virtual_size);
-	(void)io_buffer_send(data->outbuf, str, strlen(str));
+	(void)io_buffer_send(ctx->outbuf, str, strlen(str));
 
 	/* FIXME: potential performance problem with big messages:
 	   FETCH BODY[1]<100000..1024>, hopefully no clients do this */
-	(void)imap_message_send(data->outbuf, inbuf, &part->body_size,
+	(void)imap_message_send(ctx->outbuf, inbuf, &part->body_size,
 				sect->skip, sect->max_size);
 	return TRUE;
 }
@@ -336,42 +336,42 @@
 /* fetch BODY[1.2.MIME|HEADER...] */
 static int fetch_part_header(MessagePart *part, unsigned int uid,
 			     const char *section, MailFetchBodyData *sect,
-			     FetchData *data)
+			     FetchContext *ctx)
 {
 	IOBuffer *inbuf;
 
-	if (!imap_msgcache_get_data(data->cache, uid, &inbuf))
+	if (!imap_msgcache_get_data(ctx->cache, uid, &inbuf))
 		return FALSE;
 
 	io_buffer_skip(inbuf, part->pos.physical_pos);
-	fetch_header_from(inbuf, &part->header_size, section, sect, data);
+	fetch_header_from(inbuf, &part->header_size, section, sect, ctx);
 	return TRUE;
 }
 
 static int fetch_part(MailIndexRecord *rec, MailFetchBodyData *sect,
-		      FetchData *data)
+		      FetchContext *ctx)
 {
 	MessagePart *part;
 	const char *section;
 
-	part = part_find(rec, sect, data, &section);
+	part = part_find(rec, sect, ctx, &section);
 	if (part == NULL)
 		return FALSE;
 
 	if (*section == '\0' || strcasecmp(section, "TEXT") == 0)
-		return fetch_part_body(part, rec->uid, sect, data);
+		return fetch_part_body(part, rec->uid, sect, ctx);
 
 	if (strncasecmp(section, "HEADER", 6) == 0)
-		return fetch_part_header(part, rec->uid, section, sect, data);
+		return fetch_part_header(part, rec->uid, section, sect, ctx);
 	if (strcasecmp(section, "MIME") == 0)
-		return fetch_part_header(part, rec->uid, section, sect, data);
+		return fetch_part_header(part, rec->uid, section, sect, ctx);
 
 	return FALSE;
 }
 
 void index_fetch_body_section(MailIndexRecord *rec,
 			      unsigned int seq __attr_unused__,
-			      MailFetchBodyData *sect, FetchData *data)
+			      MailFetchBodyData *sect, FetchContext *ctx)
 {
 	const char *str;
 	int fetch_ok;
@@ -380,22 +380,22 @@
 		t_strdup_printf(" BODY[%s] ", sect->section) :
 		t_strdup_printf(" BODY[%s]<%lu> ", sect->section,
 				(unsigned long) sect->skip);
-	(void)io_buffer_send(data->outbuf, str, strlen(str));
+	(void)io_buffer_send(ctx->outbuf, str, strlen(str));
 
 	if (*sect->section == '\0') {
-		fetch_ok = fetch_body(rec, sect, data, TRUE);
+		fetch_ok = fetch_body(rec, sect, ctx, TRUE);
 	} else if (strcasecmp(sect->section, "TEXT") == 0) {
-		fetch_ok = fetch_body(rec, sect, data, FALSE);
+		fetch_ok = fetch_body(rec, sect, ctx, FALSE);
 	} else if (strncasecmp(sect->section, "HEADER", 6) == 0) {
-		fetch_ok = fetch_header(rec, sect, data);
+		fetch_ok = fetch_header(rec, sect, ctx);
 	} else if (*sect->section >= '0' && *sect->section <= '9') {
-		fetch_ok = fetch_part(rec, sect, data);
+		fetch_ok = fetch_part(rec, sect, ctx);
 	} else {
 		fetch_ok = FALSE;
 	}
 
 	if (!fetch_ok) {
 		/* error */
-		(void)io_buffer_send(data->outbuf, "{0}\r\n", 5);
+		(void)io_buffer_send(ctx->outbuf, "{0}\r\n", 5);
 	}
 }
--- a/src/lib-storage/index/index-fetch.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/index/index-fetch.c	Thu Aug 22 15:48:38 2002 +0300
@@ -13,138 +13,138 @@
 
 #include <unistd.h>
 
-static void index_fetch_body(MailIndexRecord *rec, FetchData *data)
+static void index_fetch_body(MailIndexRecord *rec, FetchContext *ctx)
 {
 	const char *body;
 
-	body = imap_msgcache_get(data->cache, rec->uid, IMAP_CACHE_BODY);
+	body = imap_msgcache_get(ctx->cache, rec->uid, IMAP_CACHE_BODY);
 	if (body != NULL)
-		t_string_printfa(data->str, " BODY %s", body);
+		t_string_printfa(ctx->str, " BODY %s", body);
 	else {
 		i_error("Couldn't generate BODY for UID %u (index %s)",
-			rec->uid, data->index->filepath);
+			rec->uid, ctx->index->filepath);
 	}
 }
 
-static void index_fetch_bodystructure(MailIndexRecord *rec, FetchData *data)
+static void index_fetch_bodystructure(MailIndexRecord *rec, FetchContext *ctx)
 {
 	const char *bodystructure;
 
-	bodystructure = imap_msgcache_get(data->cache, rec->uid,
+	bodystructure = imap_msgcache_get(ctx->cache, rec->uid,
 					  IMAP_CACHE_BODYSTRUCTURE);
 	if (bodystructure != NULL) {
-		t_string_printfa(data->str, " BODYSTRUCTURE %s",
+		t_string_printfa(ctx->str, " BODYSTRUCTURE %s",
 				 bodystructure);
 	} else {
 		i_error("Couldn't generate BODYSTRUCTURE for UID %u (index %s)",
-			rec->uid, data->index->filepath);
+			rec->uid, ctx->index->filepath);
 	}
 }
 
-static void index_fetch_envelope(MailIndexRecord *rec, FetchData *data)
+static void index_fetch_envelope(MailIndexRecord *rec, FetchContext *ctx)
 {
 	const char *envelope;
 
-	envelope = imap_msgcache_get(data->cache, rec->uid,
+	envelope = imap_msgcache_get(ctx->cache, rec->uid,
 				     IMAP_CACHE_ENVELOPE);
 	if (envelope != NULL)
-		t_string_printfa(data->str, " ENVELOPE (%s)", envelope);
+		t_string_printfa(ctx->str, " ENVELOPE (%s)", envelope);
 	else {
 		i_error("Couldn't generate ENVELOPE for UID %u (index %s)",
-			rec->uid, data->index->filepath);
+			rec->uid, ctx->index->filepath);
 	}
 }
 
-static void index_fetch_rfc822_size(MailIndexRecord *rec, FetchData *data)
+static void index_fetch_rfc822_size(MailIndexRecord *rec, FetchContext *ctx)
 {
-	t_string_printfa(data->str, " RFC822.SIZE %lu",
+	t_string_printfa(ctx->str, " RFC822.SIZE %lu",
 			 (unsigned long) rec->full_virtual_size);
 }
 
-static void index_fetch_flags(MailIndexRecord *rec, FetchData *data)
+static void index_fetch_flags(MailIndexRecord *rec, FetchContext *ctx)
 {
 	MailFlags flags;
 
 	flags = rec->msg_flags;
-	if (rec->uid >= data->index->first_recent_uid)
+	if (rec->uid >= ctx->index->first_recent_uid)
 		flags |= MAIL_RECENT;
-	if (data->update_seen)
+	if (ctx->update_seen)
 		flags |= MAIL_SEEN;
 
-	t_string_printfa(data->str, " FLAGS (%s)",
-			 imap_write_flags(flags, data->custom_flags));
+	t_string_printfa(ctx->str, " FLAGS (%s)",
+			 imap_write_flags(flags, ctx->custom_flags));
 }
 
-static void index_fetch_internaldate(MailIndexRecord *rec, FetchData *data)
+static void index_fetch_internaldate(MailIndexRecord *rec, FetchContext *ctx)
 {
-	t_string_printfa(data->str, " INTERNALDATE \"%s\"",
+	t_string_printfa(ctx->str, " INTERNALDATE \"%s\"",
                          rfc822_to_date(rec->internal_date));
 }
 
-static void index_fetch_uid(MailIndexRecord *rec, FetchData *data)
+static void index_fetch_uid(MailIndexRecord *rec, FetchContext *ctx)
 {
-	t_string_printfa(data->str, " UID %u", rec->uid);
+	t_string_printfa(ctx->str, " UID %u", rec->uid);
 }
 
-static void index_fetch_rfc822(MailIndexRecord *rec, FetchData *data)
+static void index_fetch_rfc822(MailIndexRecord *rec, FetchContext *ctx)
 {
 	MessageSize hdr_size, body_size;
 	IOBuffer *inbuf;
 	const char *str;
 
-	if (!imap_msgcache_get_rfc822(data->cache, rec->uid,
+	if (!imap_msgcache_get_rfc822(ctx->cache, rec->uid,
 				      &hdr_size, &body_size, &inbuf)) {
 		i_error("Couldn't get RFC822 for UID %u (index %s)",
-			rec->uid, data->index->filepath);
+			rec->uid, ctx->index->filepath);
 		return;
 	}
 
 	str = t_strdup_printf(" RFC822 {%lu}\r\n",
 			      (unsigned long) (hdr_size.virtual_size +
 					       body_size.virtual_size));
-	(void)io_buffer_send(data->outbuf, str, strlen(str));
+	(void)io_buffer_send(ctx->outbuf, str, strlen(str));
 
 	body_size.physical_size += hdr_size.physical_size;
 	body_size.virtual_size += hdr_size.virtual_size;
-	(void)imap_message_send(data->outbuf, inbuf, &body_size, 0, -1);
+	(void)imap_message_send(ctx->outbuf, inbuf, &body_size, 0, -1);
 }
 
-static void index_fetch_rfc822_header(MailIndexRecord *rec, FetchData *data)
+static void index_fetch_rfc822_header(MailIndexRecord *rec, FetchContext *ctx)
 {
 	MessageSize hdr_size;
 	IOBuffer *inbuf;
 	const char *str;
 
-	if (!imap_msgcache_get_rfc822(data->cache, rec->uid,
+	if (!imap_msgcache_get_rfc822(ctx->cache, rec->uid,
 				      &hdr_size, NULL, &inbuf)) {
 		i_error("Couldn't get RFC822.HEADER for UID %u (index %s)",
-			rec->uid, data->index->filepath);
+			rec->uid, ctx->index->filepath);
 		return;
 	}
 
 	str = t_strdup_printf(" RFC822.HEADER {%lu}\r\n",
 			      (unsigned long) hdr_size.virtual_size);
-	(void)io_buffer_send(data->outbuf, str, strlen(str));
-	(void)imap_message_send(data->outbuf, inbuf, &hdr_size, 0, -1);
+	(void)io_buffer_send(ctx->outbuf, str, strlen(str));
+	(void)imap_message_send(ctx->outbuf, inbuf, &hdr_size, 0, -1);
 }
 
-static void index_fetch_rfc822_text(MailIndexRecord *rec, FetchData *data)
+static void index_fetch_rfc822_text(MailIndexRecord *rec, FetchContext *ctx)
 {
 	MessageSize body_size;
 	IOBuffer *inbuf;
 	const char *str;
 
-	if (!imap_msgcache_get_rfc822(data->cache, rec->uid,
+	if (!imap_msgcache_get_rfc822(ctx->cache, rec->uid,
 				      NULL, &body_size, &inbuf)) {
 		i_error("Couldn't get RFC822.TEXT for UID %u (index %s)",
-			rec->uid, data->index->filepath);
+			rec->uid, ctx->index->filepath);
 		return;
 	}
 
 	str = t_strdup_printf(" RFC822.TEXT {%lu}\r\n",
 			      (unsigned long) body_size.virtual_size);
-	(void)io_buffer_send(data->outbuf, str, strlen(str));
-	(void)imap_message_send(data->outbuf, inbuf, &body_size, 0, -1);
+	(void)io_buffer_send(ctx->outbuf, str, strlen(str));
+	(void)imap_message_send(ctx->outbuf, inbuf, &body_size, 0, -1);
 }
 
 static ImapCacheField index_get_cache(MailFetchData *fetch_data)
@@ -180,7 +180,7 @@
 	return field;
 }
 
-static IOBuffer *inbuf_rewind(IOBuffer *inbuf, void *user_data __attr_unused__)
+static IOBuffer *inbuf_rewind(IOBuffer *inbuf, void *context __attr_unused__)
 {
 	if (!io_buffer_seek(inbuf, 0)) {
 		i_error("inbuf_rewind: lseek() failed: %m");
@@ -193,25 +193,25 @@
 	return inbuf;
 }
 
-static int index_cache_message(MailIndexRecord *rec, FetchData *data,
+static int index_cache_message(MailIndexRecord *rec, FetchContext *ctx,
 			       ImapCacheField field)
 {
 	IOBuffer *inbuf;
 
-	inbuf = data->index->open_mail(data->index, rec);
+	inbuf = ctx->index->open_mail(ctx->index, rec);
 	if (inbuf == NULL) {
 		i_error("Couldn't open message UID %u (index %s)",
-			rec->uid, data->index->filepath);
+			rec->uid, ctx->index->filepath);
 		return FALSE;
 	}
 
 	if (MSG_HAS_VALID_CRLF_DATA(rec)) {
-		imap_msgcache_message(data->cache, rec->uid,
+		imap_msgcache_message(ctx->cache, rec->uid,
 				      field, rec->full_virtual_size,
 				      rec->header_size, rec->body_size,
 				      inbuf, inbuf_rewind, NULL);
 	} else {
-		imap_msgcache_message(data->cache, rec->uid,
+		imap_msgcache_message(ctx->cache, rec->uid,
 				      field, rec->full_virtual_size,
 				      0, 0, inbuf, inbuf_rewind, NULL);
 	}
@@ -219,97 +219,97 @@
 	return TRUE;
 }
 
-static void index_cache_mail(FetchData *data, MailIndexRecord *rec)
+static void index_cache_mail(FetchContext *ctx, MailIndexRecord *rec)
 {
 	ImapCacheField fields;
 	const char *value;
 
-	fields = index_get_cache(data->fetch_data);
-	if (imap_msgcache_is_cached(data->cache, rec->uid, fields))
+	fields = index_get_cache(ctx->fetch_data);
+	if (imap_msgcache_is_cached(ctx->cache, rec->uid, fields))
 		return;
 
 	/* see if we can get some of the values from our index */
 	if (fields & IMAP_CACHE_BODY) {
-		value = data->index->lookup_field(data->index, rec,
-						  FIELD_TYPE_BODY);
-		imap_msgcache_set(data->cache, rec->uid,
+		value = ctx->index->lookup_field(ctx->index, rec,
+						 FIELD_TYPE_BODY);
+		imap_msgcache_set(ctx->cache, rec->uid,
 				  IMAP_CACHE_BODY, value);
 	}
 
 	if (fields & IMAP_CACHE_BODYSTRUCTURE) {
-		value = data->index->lookup_field(data->index, rec,
-						  FIELD_TYPE_BODYSTRUCTURE);
-		imap_msgcache_set(data->cache, rec->uid,
+		value = ctx->index->lookup_field(ctx->index, rec,
+						 FIELD_TYPE_BODYSTRUCTURE);
+		imap_msgcache_set(ctx->cache, rec->uid,
 				  IMAP_CACHE_BODYSTRUCTURE, value);
 	}
 
 	if (fields & IMAP_CACHE_ENVELOPE) {
-		value = data->index->lookup_field(data->index, rec,
-						  FIELD_TYPE_ENVELOPE);
-		imap_msgcache_set(data->cache, rec->uid,
+		value = ctx->index->lookup_field(ctx->index, rec,
+						 FIELD_TYPE_ENVELOPE);
+		imap_msgcache_set(ctx->cache, rec->uid,
 				  IMAP_CACHE_ENVELOPE, value);
 	}
 
 	/* if we still don't have everything, open the message and
 	   cache the needed fields */
 	if (fields != 0 &&
-	    !imap_msgcache_is_cached(data->cache, rec->uid, fields))
-		(void)index_cache_message(rec, data, fields);
+	    !imap_msgcache_is_cached(ctx->cache, rec->uid, fields))
+		(void)index_cache_message(rec, ctx, fields);
 }
 
 static int index_fetch_mail(MailIndex *index __attr_unused__,
 			    MailIndexRecord *rec, unsigned int seq,
-			    void *user_data)
+			    void *context)
 {
-	FetchData *data = user_data;
+	FetchContext *ctx = context;
 	MailFetchBodyData *sect;
 
-	data->str = t_string_new(2048);
+	ctx->str = t_string_new(2048);
 
-	t_string_printfa(data->str, "* %u FETCH (", seq);
-	(void)io_buffer_send(data->outbuf, data->str->str, data->str->len);
-	t_string_truncate(data->str, 0);
+	t_string_printfa(ctx->str, "* %u FETCH (", seq);
+	(void)io_buffer_send(ctx->outbuf, ctx->str->str, ctx->str->len);
+	t_string_truncate(ctx->str, 0);
 
 	/* first see what we need to do. this way we don't first do some
 	   light parsing and later notice that we need to do heavier parsing
 	   anyway */
-	index_cache_mail(data, rec);
+	index_cache_mail(ctx, rec);
 
-	if (data->fetch_data->uid)
-		index_fetch_uid(rec, data);
-	if (data->fetch_data->flags)
-		index_fetch_flags(rec, data);
-	if (data->fetch_data->internaldate)
-		index_fetch_internaldate(rec, data);
+	if (ctx->fetch_data->uid)
+		index_fetch_uid(rec, ctx);
+	if (ctx->fetch_data->flags)
+		index_fetch_flags(rec, ctx);
+	if (ctx->fetch_data->internaldate)
+		index_fetch_internaldate(rec, ctx);
 
-	if (data->fetch_data->body)
-		index_fetch_body(rec, data);
-	if (data->fetch_data->bodystructure)
-		index_fetch_bodystructure(rec, data);
-	if (data->fetch_data->envelope)
-		index_fetch_envelope(rec, data);
-	if (data->fetch_data->rfc822_size)
-		index_fetch_rfc822_size(rec, data);
+	if (ctx->fetch_data->body)
+		index_fetch_body(rec, ctx);
+	if (ctx->fetch_data->bodystructure)
+		index_fetch_bodystructure(rec, ctx);
+	if (ctx->fetch_data->envelope)
+		index_fetch_envelope(rec, ctx);
+	if (ctx->fetch_data->rfc822_size)
+		index_fetch_rfc822_size(rec, ctx);
 
 	/* send the data written into temp string, skipping the initial space */
-	if (data->str->len > 0) {
-		(void)io_buffer_send(data->outbuf, data->str->str+1,
-				     data->str->len-1);
+	if (ctx->str->len > 0) {
+		(void)io_buffer_send(ctx->outbuf, ctx->str->str+1,
+				     ctx->str->len-1);
 	}
 
 	/* large data */
-	if (data->fetch_data->rfc822)
-		index_fetch_rfc822(rec, data);
-	if (data->fetch_data->rfc822_text)
-		index_fetch_rfc822_text(rec, data);
-	if (data->fetch_data->rfc822_header)
-		index_fetch_rfc822_header(rec, data);
+	if (ctx->fetch_data->rfc822)
+		index_fetch_rfc822(rec, ctx);
+	if (ctx->fetch_data->rfc822_text)
+		index_fetch_rfc822_text(rec, ctx);
+	if (ctx->fetch_data->rfc822_header)
+		index_fetch_rfc822_header(rec, ctx);
 
-	sect = data->fetch_data->body_sections;
+	sect = ctx->fetch_data->body_sections;
 	for (; sect != NULL; sect = sect->next)
-		index_fetch_body_section(rec, seq, sect, data);
+		index_fetch_body_section(rec, seq, sect, ctx);
 
-	(void)io_buffer_send(data->outbuf, ")\r\n", 3);
+	(void)io_buffer_send(ctx->outbuf, ")\r\n", 3);
 
 	return TRUE;
 }
@@ -318,28 +318,28 @@
 			IOBuffer *outbuf, int *all_found)
 {
 	IndexMailbox *ibox = (IndexMailbox *) box;
-	FetchData data;
+	FetchContext ctx;
 	MailFetchBodyData *sect;
 	int ret;
 
 	if (!ibox->index->set_lock(ibox->index, MAIL_LOCK_SHARED))
 		return mail_storage_set_index_error(ibox);
 
-	memset(&data, 0, sizeof(data));
-	data.box = box;
-	data.cache = ibox->cache;
-	data.index = ibox->index;
-	data.custom_flags = flags_file_list_get(ibox->flagsfile);
+	memset(&ctx, 0, sizeof(ctx));
+	ctx.box = box;
+	ctx.cache = ibox->cache;
+	ctx.index = ibox->index;
+	ctx.custom_flags = flags_file_list_get(ibox->flagsfile);
 
-	data.fetch_data = fetch_data;
-	data.outbuf = outbuf;
+	ctx.fetch_data = fetch_data;
+	ctx.outbuf = outbuf;
 
 	/* If we have any BODY[..] sections, \Seen flag is added for
 	   all messages */
-	sect = data.fetch_data->body_sections;
+	sect = ctx.fetch_data->body_sections;
 	for (; sect != NULL; sect = sect->next) {
 		if (!sect->peek) {
-			data.update_seen = TRUE;
+			ctx.update_seen = TRUE;
 			break;
 		}
 	}
@@ -348,12 +348,12 @@
 		ret = mail_index_uidset_foreach(ibox->index,
 						fetch_data->messageset,
 						ibox->synced_messages_count,
-						index_fetch_mail, &data);
+						index_fetch_mail, &ctx);
 	} else {
 		ret = mail_index_messageset_foreach(ibox->index,
 						    fetch_data->messageset,
 						    ibox->synced_messages_count,
-						    index_fetch_mail, &data);
+						    index_fetch_mail, &ctx);
 	}
 
         flags_file_list_unref(ibox->flagsfile);
@@ -364,7 +364,7 @@
 	if (all_found != NULL)
 		*all_found = ret == 1;
 
-	if (ret >= 1 && data.update_seen && !box->readonly) {
+	if (ret >= 1 && ctx.update_seen && !box->readonly) {
 		/* BODY[..] was fetched, set \Seen flag for all messages.
 		   This needs to be done separately because we need exclusive
 		   lock for it */
--- a/src/lib-storage/index/index-fetch.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/index/index-fetch.h	Thu Aug 22 15:48:38 2002 +0300
@@ -11,10 +11,10 @@
 	IOBuffer *outbuf;
 	TempString *str;
 	int update_seen;
-} FetchData;
+} FetchContext;
 
 ImapCacheField index_fetch_body_get_cache(const char *section);
 void index_fetch_body_section(MailIndexRecord *rec, unsigned int seq,
-			      MailFetchBodyData *sect, FetchData *data);
+			      MailFetchBodyData *sect, FetchContext *data);
 
 #endif
--- a/src/lib-storage/index/index-search.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/index/index-search.c	Thu Aug 22 15:48:38 2002 +0300
@@ -20,7 +20,7 @@
 	IndexMailbox *ibox;
 	MailIndexRecord *rec;
 	unsigned int seq;
-} SearchIndexData;
+} SearchIndexContext;
 
 typedef struct {
 	MailSearchArg *args;
@@ -28,7 +28,7 @@
 
 	const char *name, *value;
 	unsigned int name_len, value_len;
-} SearchHeaderData;
+} SearchHeaderContext;
 
 typedef struct {
 	MailSearchArg *args;
@@ -36,7 +36,7 @@
 	size_t size;
 
 	unsigned int max_searchword_len;
-} SearchTextData;
+} SearchTextContext;
 
 /* truncate timestamp to day */
 static time_t timestamp_trunc(time_t t)
@@ -172,11 +172,11 @@
 	}
 }
 
-static void search_index_arg(MailSearchArg *arg, void *user_data)
+static void search_index_arg(MailSearchArg *arg, void *context)
 {
-	SearchIndexData *data = user_data;
+	SearchIndexContext *ctx = context;
 
-	switch (search_arg_match_index(data->ibox, data->rec, data->seq,
+	switch (search_arg_match_index(ctx->ibox, ctx->rec, ctx->seq,
 				       arg->type, arg->value.str)) {
 	case -1:
 		/* unknown */
@@ -231,11 +231,11 @@
 	}
 }
 
-static void search_cached_arg(MailSearchArg *arg, void *user_data)
+static void search_cached_arg(MailSearchArg *arg, void *context)
 {
-	SearchIndexData *data = user_data;
+	SearchIndexContext *ctx = context;
 
-	switch (search_arg_match_cached(data->ibox->index, data->rec,
+	switch (search_arg_match_cached(ctx->ibox->index, ctx->rec,
 					arg->type, arg->value.str)) {
 	case -1:
 		/* unknown */
@@ -291,9 +291,9 @@
 	return -1;
 }
 
-static void search_header_arg(MailSearchArg *arg, void *user_data)
+static void search_header_arg(MailSearchArg *arg, void *context)
 {
-	SearchHeaderData *data = user_data;
+	SearchHeaderContext *ctx = context;
 	const char *value;
 	unsigned int len;
 	int ret;
@@ -301,41 +301,41 @@
 	/* first check that the field name matches to argument. */
 	switch (arg->type) {
 	case SEARCH_FROM:
-		if (data->name_len != 4 ||
-		    strncasecmp(data->name, "From", 4) != 0)
+		if (ctx->name_len != 4 ||
+		    strncasecmp(ctx->name, "From", 4) != 0)
 			return;
 		value = arg->value.str;
 		break;
 	case SEARCH_TO:
-		if (data->name_len != 2 ||
-		    strncasecmp(data->name, "To", 2) != 0)
+		if (ctx->name_len != 2 ||
+		    strncasecmp(ctx->name, "To", 2) != 0)
 			return;
 		value = arg->value.str;
 		break;
 	case SEARCH_CC:
-		if (data->name_len != 2 ||
-		    strncasecmp(data->name, "Cc", 2) != 0)
+		if (ctx->name_len != 2 ||
+		    strncasecmp(ctx->name, "Cc", 2) != 0)
 			return;
 		value = arg->value.str;
 		break;
 	case SEARCH_BCC:
-		if (data->name_len != 3 ||
-		    strncasecmp(data->name, "Bcc", 3) != 0)
+		if (ctx->name_len != 3 ||
+		    strncasecmp(ctx->name, "Bcc", 3) != 0)
 			return;
 		value = arg->value.str;
 		break;
 	case SEARCH_SUBJECT:
-		if (data->name_len != 7 ||
-		    strncasecmp(data->name, "Subject", 7) != 0)
+		if (ctx->name_len != 7 ||
+		    strncasecmp(ctx->name, "Subject", 7) != 0)
 			return;
 		value = arg->value.str;
 		break;
 	case SEARCH_HEADER:
-		data->custom_header = TRUE;
+		ctx->custom_header = TRUE;
 
 		len = strlen(arg->value.str);
-		if (data->name_len != len ||
-		    strncasecmp(data->name, arg->value.str, len) != 0)
+		if (ctx->name_len != len ||
+		    strncasecmp(ctx->name, arg->value.str, len) != 0)
 			return;
 
 		value = arg->hdr_value;
@@ -344,34 +344,34 @@
 	}
 
 	/* then check if the value matches */
-	ret = header_value_match(data->value, data->value_len, value);
+	ret = header_value_match(ctx->value, ctx->value_len, value);
         ARG_SET_RESULT(arg, ret);
 }
 
 static void search_header(MessagePart *part __attr_unused__,
 			  const char *name, unsigned int name_len,
 			  const char *value, unsigned int value_len,
-			  void *user_data)
+			  void *context)
 {
-	SearchHeaderData *data = user_data;
+	SearchHeaderContext *ctx = context;
 
-	if (data->custom_header ||
+	if (ctx->custom_header ||
 	    (name_len == 4 && strncasecmp(name, "From", 4) == 0) ||
 	    (name_len == 2 && strncasecmp(name, "To", 2) == 0) ||
 	    (name_len == 2 && strncasecmp(name, "Cc", 2) == 0) ||
 	    (name_len == 3 && strncasecmp(name, "Bcc", 3) == 0) ||
 	    (name_len == 7 && strncasecmp(name, "Subject", 7) == 0)) {
-		data->name = name;
-		data->value = value;
-		data->name_len = name_len;
-		data->value_len = value_len;
+		ctx->name = name;
+		ctx->value = value;
+		ctx->name_len = name_len;
+		ctx->value_len = value_len;
 
-		data->custom_header = FALSE;
-		mail_search_args_foreach(data->args, search_header_arg, data);
+		ctx->custom_header = FALSE;
+		mail_search_args_foreach(ctx->args, search_header_arg, ctx);
 	}
 }
 
-static void search_text(MailSearchArg *arg, SearchTextData *data)
+static void search_text(MailSearchArg *arg, SearchTextContext *ctx)
 {
 	const char *p;
 	unsigned int i, len, max;
@@ -380,12 +380,12 @@
 		return;
 
 	len = strlen(arg->value.str);
-	if (len > data->max_searchword_len)
-		data->max_searchword_len = len;
+	if (len > ctx->max_searchword_len)
+		ctx->max_searchword_len = len;
 
-	if (data->size >= len) {
-		max = data->size-len;
-		for (i = 0, p = data->msg; i <= max; i++, p++) {
+	if (ctx->size >= len) {
+		max = ctx->size-len;
+		for (i = 0, p = ctx->msg; i <= max; i++, p++) {
 			if (i_toupper(*p) == arg->value.str[0] &&
 			    strncasecmp(p, arg->value.str, len) == 0) {
 				/* match */
@@ -396,24 +396,24 @@
 	}
 }
 
-static void search_text_header(MailSearchArg *arg, void *user_data)
+static void search_text_header(MailSearchArg *arg, void *context)
 {
-	SearchTextData *data = user_data;
+	SearchTextContext *ctx = context;
 
 	if (arg->type == SEARCH_TEXT)
-		search_text(arg, data);
+		search_text(arg, ctx);
 }
 
-static void search_text_body(MailSearchArg *arg, void *user_data)
+static void search_text_body(MailSearchArg *arg, void *context)
 {
-	SearchTextData *data = user_data;
+	SearchTextContext *ctx = context;
 
 	if (arg->type == SEARCH_TEXT || arg->type == SEARCH_BODY)
-		search_text(arg, data);
+		search_text(arg, ctx);
 }
 
 static void search_text_set_unmatched(MailSearchArg *arg,
-				      void *user_data __attr_unused__)
+				      void *context __attr_unused__)
 {
 	if (arg->type == SEARCH_TEXT || arg->type == SEARCH_BODY)
 		ARG_SET_RESULT(arg, -1);
@@ -423,26 +423,26 @@
 				  MailSearchArg *args,
 				  MailSearchForeachFunc search_func)
 {
-	SearchTextData data;
+	SearchTextContext ctx;
 	unsigned int size;
 	int ret;
 
-	memset(&data, 0, sizeof(data));
-	data.args = args;
+	memset(&ctx, 0, sizeof(ctx));
+	ctx.args = args;
 
 	/* do this in blocks: read data, compare it for all search words, skip
 	   for block size - (strlen(largest_searchword)-1) and continue. */
 	while (max_size > 0 &&
 	       (ret = io_buffer_read_max(inbuf, max_size)) > 0) {
-		data.msg = io_buffer_get_data(inbuf, &size);
+		ctx.msg = io_buffer_get_data(inbuf, &size);
 		if (size > 0) {
-			data.size = max_size < size ? max_size : size;
-			max_size -= data.size;
+			ctx.size = max_size < size ? max_size : size;
+			max_size -= ctx.size;
 
-			mail_search_args_foreach(args, search_func, &data);
+			mail_search_args_foreach(args, search_func, &ctx);
 
-			if (data.max_searchword_len < size)
-				size -= data.max_searchword_len-1;
+			if (ctx.max_searchword_len < size)
+				size -= ctx.max_searchword_len-1;
 			io_buffer_skip(inbuf, size);
 		}
 	}
@@ -464,14 +464,14 @@
 		return FALSE;
 
 	if (have_headers) {
-		SearchHeaderData data;
+		SearchHeaderContext ctx;
 
-		memset(&data, 0, sizeof(data));
+		memset(&ctx, 0, sizeof(ctx));
 
 		/* header checks */
-		data.custom_header = TRUE;
-		data.args = args;
-		message_parse_header(NULL, inbuf, NULL, search_header, &data);
+		ctx.custom_header = TRUE;
+		ctx.args = args;
+		message_parse_header(NULL, inbuf, NULL, search_header, &ctx);
 	}
 
 	if (have_text) {
@@ -603,7 +603,7 @@
 static void search_messages(IndexMailbox *ibox, MailSearchArg *args,
 			    IOBuffer *outbuf, int uid_result)
 {
-	SearchIndexData data;
+	SearchIndexContext ctx;
 	MailIndexRecord *rec;
 	unsigned int first_seq, last_seq, seq;
 	char num[MAX_INT_STRLEN+10];
@@ -611,17 +611,17 @@
 	/* see if we can limit the records we look at */
 	search_get_sequences(ibox, args, &first_seq, &last_seq);
 
-	data.ibox = ibox;
+	ctx.ibox = ibox;
 
 	rec = ibox->index->lookup(ibox->index, first_seq);
 	for (seq = first_seq; rec != NULL && seq <= last_seq; seq++) {
-		data.rec = rec;
-		data.seq = seq;
+		ctx.rec = rec;
+		ctx.seq = seq;
 
 		mail_search_args_reset(args);
 
-		mail_search_args_foreach(args, search_index_arg, &data);
-		mail_search_args_foreach(args, search_cached_arg, &data);
+		mail_search_args_foreach(args, search_index_arg, &ctx);
+		mail_search_args_foreach(args, search_cached_arg, &ctx);
 
 		if (search_arg_match_text(ibox, rec, args) &&
 		    args->result == 1) {
--- a/src/lib-storage/index/index-storage.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/index/index-storage.c	Thu Aug 22 15:48:38 2002 +0300
@@ -72,9 +72,9 @@
 	return FALSE;
 }
 
-static MailFlags get_used_flags(void *user_data)
+static MailFlags get_used_flags(void *context)
 {
-        IndexMailbox *ibox = user_data;
+        IndexMailbox *ibox = context;
 	MailIndexRecord *rec;
 	MailFlags used_flags;
 
--- a/src/lib-storage/index/index-storage.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/index/index-storage.h	Thu Aug 22 15:48:38 2002 +0300
@@ -14,7 +14,7 @@
 	/* expunge messages marked as deleted, requires index to be
 	   exclusively locked */
 	int (*expunge_locked)(IndexMailbox *ibox,
-			      MailExpungeFunc expunge_func, void *user_data);
+			      MailExpungeFunc expunge_func, void *context);
 
 	MailIndex *index;
 	FlagsFile *flagsfile;
@@ -47,11 +47,11 @@
 int index_storage_sync(Mailbox *box, unsigned int *messages, int expunge,
 		       MailExpungeFunc expunge_func,
 		       MailFlagUpdateFunc flag_func,
-		       void *user_data);
+		       void *context);
 int index_storage_update_flags(Mailbox *box, const char *messageset, int uidset,
 			       MailFlags flags, const char *custom_flags[],
 			       ModifyType modify_type,
-			       MailFlagUpdateFunc func, void *user_data,
+			       MailFlagUpdateFunc func, void *context,
 			       int *all_found);
 int index_storage_fetch(Mailbox *box, MailFetchData *fetch_data,
 			IOBuffer *outbuf, int *all_found);
--- a/src/lib-storage/index/index-sync.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/index/index-sync.c	Thu Aug 22 15:48:38 2002 +0300
@@ -7,7 +7,7 @@
 int index_storage_sync(Mailbox *box, unsigned int *messages, int expunge,
 		       MailExpungeFunc expunge_func,
 		       MailFlagUpdateFunc flag_func,
-		       void *user_data)
+		       void *context)
 {
 	IndexMailbox *ibox = (IndexMailbox *) box;
 	ModifyLogRecord *log;
@@ -39,7 +39,7 @@
 		case RECORD_TYPE_EXPUNGE:
 			if (expunge_func != NULL) {
 				expunge_func(box, log->seq,
-					     log->uid, user_data);
+					     log->uid, context);
 			}
 			break;
 		case RECORD_TYPE_FLAGS_CHANGED:
@@ -55,7 +55,7 @@
 					flags |= MAIL_RECENT;
 
 				flag_func(box, log->seq, log->uid, flags,
-					  custom_flags, user_data);
+					  custom_flags, context);
 			}
 			break;
 		}
@@ -67,7 +67,7 @@
 
 	if (!failed && expunge) {
 		/* expunge messages */
-		failed = !ibox->expunge_locked(ibox, expunge_func, user_data);
+		failed = !ibox->expunge_locked(ibox, expunge_func, context);
 	}
 
 	/* get the messages count even if there was some failures.
--- a/src/lib-storage/index/index-update-flags.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/index/index-update-flags.c	Thu Aug 22 15:48:38 2002 +0300
@@ -10,24 +10,24 @@
 	FlagsFile *flagsfile;
 	ModifyType modify_type;
 	MailFlagUpdateFunc func;
-	void *user_data;
-} UpdateData;
+	void *context;
+} UpdateContext;
 
 static int update_func(MailIndex *index, MailIndexRecord *rec,
-		       unsigned int seq, void *user_data)
+		       unsigned int seq, void *context)
 {
-	UpdateData *data = user_data;
+	UpdateContext *ctx = context;
 	MailFlags flags;
 
-	switch (data->modify_type) {
+	switch (ctx->modify_type) {
 	case MODIFY_ADD:
-		flags = rec->msg_flags | data->flags;
+		flags = rec->msg_flags | ctx->flags;
 		break;
 	case MODIFY_REMOVE:
-		flags = rec->msg_flags & ~data->flags;
+		flags = rec->msg_flags & ~ctx->flags;
 		break;
 	case MODIFY_REPLACE:
-		flags = data->flags;
+		flags = ctx->flags;
 		break;
 	default:
 		flags = 0;
@@ -40,11 +40,11 @@
 	if (!index->update_flags(index, rec, seq, flags, FALSE))
 		return FALSE;
 
-	if (data->func != NULL) {
-		data->func(data->box, seq, rec->uid, flags,
-			   flags_file_list_get(data->flagsfile),
-			   data->user_data);
-		flags_file_list_unref(data->flagsfile);
+	if (ctx->func != NULL) {
+		ctx->func(ctx->box, seq, rec->uid, flags,
+			  flags_file_list_get(ctx->flagsfile),
+			  ctx->context);
+		flags_file_list_unref(ctx->flagsfile);
 	}
 	return TRUE;
 }
@@ -52,11 +52,11 @@
 int index_storage_update_flags(Mailbox *box, const char *messageset, int uidset,
 			       MailFlags flags, const char *custom_flags[],
 			       ModifyType modify_type,
-			       MailFlagUpdateFunc func, void *user_data,
+			       MailFlagUpdateFunc func, void *context,
 			       int *all_found)
 {
 	IndexMailbox *ibox = (IndexMailbox *) box;
-        UpdateData data;
+        UpdateContext ctx;
 	int ret;
 
 	if (box->readonly) {
@@ -70,22 +70,22 @@
 	if (!ibox->index->set_lock(ibox->index, MAIL_LOCK_EXCLUSIVE))
 		return mail_storage_set_index_error(ibox);
 
-	data.box = box;
-	data.flags = flags & ~MAIL_RECENT; /* \Recent can't be changed */
-	data.flagsfile = ibox->flagsfile;
-	data.modify_type = modify_type;
-	data.func = func;
-	data.user_data = user_data;
+	ctx.box = box;
+	ctx.flags = flags & ~MAIL_RECENT; /* \Recent can't be changed */
+	ctx.flagsfile = ibox->flagsfile;
+	ctx.modify_type = modify_type;
+	ctx.func = func;
+	ctx.context = context;
 
 	if (uidset) {
 		ret = mail_index_uidset_foreach(ibox->index, messageset,
 						ibox->synced_messages_count,
-						update_func, &data);
+						update_func, &ctx);
 	} else {
 		ret = mail_index_messageset_foreach(ibox->index,
 						    messageset,
 						    ibox->synced_messages_count,
-						    update_func, &data);
+						    update_func, &ctx);
 	}
 
 	if (!ibox->index->set_lock(ibox->index, MAIL_LOCK_UNLOCK) || ret == -1)
--- a/src/lib-storage/index/maildir/maildir-copy.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/index/maildir/maildir-copy.c	Thu Aug 22 15:48:38 2002 +0300
@@ -11,27 +11,27 @@
 	MailStorage *storage;
 	const char *dest_maildir;
 	int error;
-} CopyHardData;
+} CopyHardContext;
 
 static int copy_hard_func(MailIndex *index, MailIndexRecord *rec,
-			  unsigned int seq __attr_unused__, void *user_data)
+			  unsigned int seq __attr_unused__, void *context)
 {
-	CopyHardData *data = user_data;
+	CopyHardContext *ctx = context;
 	const char *fname;
 	char src[1024], dest[1024];
 
 	/* link the file */
 	fname = index->lookup_field(index, rec, FIELD_TYPE_LOCATION);
 	i_snprintf(src, sizeof(src), "%s/cur/%s", index->dir, fname);
-	i_snprintf(dest, sizeof(dest), "%s/new/%s", data->dest_maildir, fname);
+	i_snprintf(dest, sizeof(dest), "%s/new/%s", ctx->dest_maildir, fname);
 
 	if (link(src, dest) == 0)
 		return TRUE;
 	else {
 		if (errno != EXDEV) {
-			mail_storage_set_critical(data->storage, "link(%s, %s) "
+			mail_storage_set_critical(ctx->storage, "link(%s, %s) "
 						  "failed: %m", src, dest);
-			data->error = TRUE;
+			ctx->error = TRUE;
 		}
 		return FALSE;
 	}
@@ -41,7 +41,7 @@
 				       IndexMailbox *dest,
 				       const char *messageset, int uidset)
 {
-        CopyHardData data;
+        CopyHardContext ctx;
 	int ret;
 
 	if (!src->index->set_lock(src->index, MAIL_LOCK_SHARED))
@@ -51,18 +51,18 @@
 		return mail_storage_set_index_error(dest);
 	}
 
-	data.storage = src->box.storage;
-	data.dest_maildir = dest->index->dir;
-	data.error = FALSE;
+	ctx.storage = src->box.storage;
+	ctx.dest_maildir = dest->index->dir;
+	ctx.error = FALSE;
 
 	if (uidset) {
 		ret = mail_index_uidset_foreach(src->index, messageset,
 						src->synced_messages_count,
-						copy_hard_func, &data);
+						copy_hard_func, &ctx);
 	} else {
 		ret = mail_index_messageset_foreach(src->index, messageset,
 						    src->synced_messages_count,
-						    copy_hard_func, &data);
+						    copy_hard_func, &ctx);
 	}
 
 	if (ret == -1)
@@ -78,7 +78,7 @@
 		ret = -1;
 	}
 
-	return data.error ? -1 : ret;
+	return ctx.error ? -1 : ret;
 }
 
 int maildir_storage_copy(Mailbox *box, Mailbox *destbox,
--- a/src/lib-storage/index/maildir/maildir-expunge.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/index/maildir/maildir-expunge.c	Thu Aug 22 15:48:38 2002 +0300
@@ -31,7 +31,7 @@
 }
 
 int maildir_expunge_locked(IndexMailbox *ibox,
-			   MailExpungeFunc expunge_func, void *user_data)
+			   MailExpungeFunc expunge_func, void *context)
 {
 	MailIndexRecord *rec;
 	unsigned int seq, uid;
@@ -46,7 +46,7 @@
 				return FALSE;
 
 			if (expunge_func != NULL)
-				expunge_func(&ibox->box, seq, uid, user_data);
+				expunge_func(&ibox->box, seq, uid, context);
 			seq--;
 		}
 		rec = ibox->index->next(ibox->index, rec);
--- a/src/lib-storage/index/maildir/maildir-list.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/index/maildir/maildir-list.c	Thu Aug 22 15:48:38 2002 +0300
@@ -12,8 +12,8 @@
 
 typedef struct {
 	MailboxFunc func;
-	void *user_data;
-} FindSubscribedData;
+	void *context;
+} FindSubscribedContext;
 
 static MailboxFlags maildir_get_marked_flags(const char *dir)
 {
@@ -52,7 +52,7 @@
 }
 
 int maildir_find_mailboxes(MailStorage *storage, const char *mask,
-			   MailboxFunc func, void *user_data)
+			   MailboxFunc func, void *context)
 {
         const ImapMatchGlob *glob;
 	DIR *dirp;
@@ -116,13 +116,13 @@
 		}
 
                 flags = maildir_get_marked_flags(path);
-		func(storage, fname+1, flags, user_data);
+		func(storage, fname+1, flags, context);
 	}
 
 	if (!failed && !found_inbox &&
 	    imap_match(glob, "INBOX", 0, NULL) >= 0) {
 		/* .INBOX directory doesn't exist yet, but INBOX still exists */
-		func(storage, "INBOX", 0, user_data);
+		func(storage, "INBOX", 0, context);
 	}
 
 	(void)closedir(dirp);
@@ -130,9 +130,9 @@
 }
 
 static int maildir_subs_func(MailStorage *storage, const char *name,
-			     void *user_data)
+			     void *context)
 {
-	FindSubscribedData *data = user_data;
+	FindSubscribedContext *ctx = context;
 	MailboxFlags flags;
 	struct stat st;
 	char path[1024];
@@ -144,19 +144,19 @@
 	else
 		flags = MAILBOX_NOSELECT;
 
-	data->func(storage, name, flags, data->user_data);
+	ctx->func(storage, name, flags, ctx->context);
 	return TRUE;
 }
 
 int maildir_find_subscribed(MailStorage *storage, const char *mask,
-			    MailboxFunc func, void *user_data)
+			    MailboxFunc func, void *context)
 {
-	FindSubscribedData data;
+	FindSubscribedContext ctx;
 
-	data.func = func;
-	data.user_data = user_data;
+	ctx.func = func;
+	ctx.context = context;
 
-	if (subsfile_foreach(storage, mask, maildir_subs_func, &data) <= 0)
+	if (subsfile_foreach(storage, mask, maildir_subs_func, &ctx) <= 0)
 		return FALSE;
 
 	return TRUE;
--- a/src/lib-storage/index/maildir/maildir-storage.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/index/maildir/maildir-storage.h	Thu Aug 22 15:48:38 2002 +0300
@@ -10,11 +10,11 @@
 			 IOBuffer *data, size_t data_size);
 
 int maildir_find_mailboxes(MailStorage *storage, const char *mask,
-			   MailboxFunc func, void *user_data);
+			   MailboxFunc func, void *context);
 int maildir_find_subscribed(MailStorage *storage, const char *mask,
-			    MailboxFunc func, void *user_data);
+			    MailboxFunc func, void *context);
 
 int maildir_expunge_locked(IndexMailbox *ibox,
-			   MailExpungeFunc expunge_func, void *user_data);
+			   MailExpungeFunc expunge_func, void *context);
 
 #endif
--- a/src/lib-storage/index/mbox/mbox-expunge.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/index/mbox/mbox-expunge.c	Thu Aug 22 15:48:38 2002 +0300
@@ -4,7 +4,7 @@
 #include "mbox-storage.h"
 
 int mbox_expunge_locked(IndexMailbox *ibox,
-			MailExpungeFunc expunge_func, void *user_data)
+			MailExpungeFunc expunge_func, void *context)
 {
 	MailIndexRecord *rec;
 	unsigned int seq, uid;
@@ -24,7 +24,7 @@
 				return FALSE;
 
 			if (expunge_func != NULL)
-				expunge_func(&ibox->box, seq, uid, user_data);
+				expunge_func(&ibox->box, seq, uid, context);
 			seq--;
 		}
 		rec = ibox->index->next(ibox->index, rec);
--- a/src/lib-storage/index/mbox/mbox-list.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/index/mbox/mbox-list.c	Thu Aug 22 15:48:38 2002 +0300
@@ -12,11 +12,11 @@
 
 typedef struct {
 	MailboxFunc func;
-	void *user_data;
-} FindSubscribedData;
+	void *context;
+} FindSubscribedContext;
 
 static int mbox_find_path(MailStorage *storage, const ImapMatchGlob *glob,
-			  MailboxFunc func, void *user_data,
+			  MailboxFunc func, void *context,
 			  const char *relative_dir, int *found_inbox)
 {
 	DIR *dirp;
@@ -88,7 +88,7 @@
 		if (S_ISDIR(st.st_mode)) {
 			/* subdirectory, scan it too */
 			if (!mbox_find_path(storage, glob, func,
-					    user_data, path, NULL)) {
+					    context, path, NULL)) {
 				failed = TRUE;
 				break;
 			}
@@ -97,7 +97,7 @@
 			    strcasecmp(path, "inbox") == 0)
 				*found_inbox = TRUE;
 
-			func(storage, path, MAILBOX_NOINFERIORS, user_data);
+			func(storage, path, MAILBOX_NOINFERIORS, context);
 		}
 	}
 
@@ -106,7 +106,7 @@
 }
 
 int mbox_find_mailboxes(MailStorage *storage, const char *mask,
-			MailboxFunc func, void *user_data)
+			MailboxFunc func, void *context)
 {
         const ImapMatchGlob *glob;
 	int found_inbox;
@@ -116,23 +116,23 @@
 	glob = imap_match_init(mask, TRUE, '/');
 
 	found_inbox = FALSE;
-	if (!mbox_find_path(storage, glob, func, user_data,
+	if (!mbox_find_path(storage, glob, func, context,
 			    NULL, &found_inbox))
 		return FALSE;
 
 	if (!found_inbox && imap_match(glob, "INBOX", 0, NULL) < 0) {
 		/* INBOX always exists */
 		func(storage, "INBOX", MAILBOX_UNMARKED | MAILBOX_NOINFERIORS,
-		     user_data);
+		     context);
 	}
 
 	return TRUE;
 }
 
 static int mbox_subs_func(MailStorage *storage, const char *name,
-			  void *user_data)
+			  void *context)
 {
-	FindSubscribedData *data = user_data;
+	FindSubscribedContext *ctx = context;
 	MailboxFlags flags;
 	struct stat st;
 	char path[1024];
@@ -147,19 +147,19 @@
 			0 : MAILBOX_NOSELECT;
 	}
 
-	data->func(storage, name, flags, data->user_data);
+	ctx->func(storage, name, flags, ctx->context);
 	return TRUE;
 }
 
 int mbox_find_subscribed(MailStorage *storage, const char *mask,
-			 MailboxFunc func, void *user_data)
+			 MailboxFunc func, void *context)
 {
-	FindSubscribedData data;
+	FindSubscribedContext ctx;
 
-	data.func = func;
-	data.user_data = user_data;
+	ctx.func = func;
+	ctx.context = context;
 
-	if (subsfile_foreach(storage, mask, mbox_subs_func, &data) <= 0)
+	if (subsfile_foreach(storage, mask, mbox_subs_func, &ctx) <= 0)
 		return FALSE;
 
 	return TRUE;
--- a/src/lib-storage/index/mbox/mbox-storage.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/index/mbox/mbox-storage.h	Thu Aug 22 15:48:38 2002 +0300
@@ -9,11 +9,11 @@
 		      time_t internal_date, IOBuffer *data, size_t data_size);
 
 int mbox_find_mailboxes(MailStorage *storage, const char *mask,
-			MailboxFunc func, void *user_data);
+			MailboxFunc func, void *context);
 int mbox_find_subscribed(MailStorage *storage, const char *mask,
-			 MailboxFunc func, void *user_data);
+			 MailboxFunc func, void *context);
 
 int mbox_expunge_locked(IndexMailbox *ibox,
-			MailExpungeFunc expunge_func, void *user_data);
+			MailExpungeFunc expunge_func, void *context);
 
 #endif
--- a/src/lib-storage/mail-search.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/mail-search.c	Thu Aug 22 15:48:38 2002 +0300
@@ -369,7 +369,7 @@
 }
 
 static void search_arg_foreach(MailSearchArg *arg, MailSearchForeachFunc func,
-			       void *user_data)
+			       void *context)
 {
 	MailSearchArg *subarg;
 
@@ -384,7 +384,7 @@
 		subarg = arg->value.subargs;
 		while (subarg != NULL) {
 			if (subarg->result == 0)
-				search_arg_foreach(subarg, func, user_data);
+				search_arg_foreach(subarg, func, context);
 
 			if (subarg->result == -1) {
 				/* failed */
@@ -405,7 +405,7 @@
 		arg->result = -1;
 		while (subarg != NULL) {
 			if (subarg->result == 0)
-				search_arg_foreach(subarg, func, user_data);
+				search_arg_foreach(subarg, func, context);
 
 			if (subarg->result == 1) {
 				/* matched */
@@ -420,18 +420,18 @@
 		}
 	} else {
 		/* just a single condition */
-		func(arg, user_data);
+		func(arg, context);
 	}
 }
 
 int mail_search_args_foreach(MailSearchArg *args, MailSearchForeachFunc func,
-			     void *user_data)
+			     void *context)
 {
 	int result;
 
 	result = 1;
 	for (; args != NULL; args = args->next) {
-		search_arg_foreach(args, func, user_data);
+		search_arg_foreach(args, func, context);
 
 		if (args->result == -1) {
 			/* failed, abort */
--- a/src/lib-storage/mail-search.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/mail-search.h	Thu Aug 22 15:48:38 2002 +0300
@@ -62,7 +62,7 @@
 	int result;
 };
 
-typedef void (*MailSearchForeachFunc)(MailSearchArg *arg, void *user_data);
+typedef void (*MailSearchForeachFunc)(MailSearchArg *arg, void *context);
 
 /* Builds search arguments based on IMAP arguments. */
 MailSearchArg *mail_search_args_build(Pool pool, ImapArg *args, int args_count,
@@ -74,7 +74,7 @@
 /* goes through arguments in list that don't have a result yet.
    Returns 1 = search matched, -1 = search unmatched, 0 = don't know yet */
 int mail_search_args_foreach(MailSearchArg *args, MailSearchForeachFunc func,
-			     void *user_data);
+			     void *context);
 
 /* Fills have_headers, have_body and have_text based on if such search
    argument exists that needs to be checked. */
--- a/src/lib-storage/mail-storage.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/mail-storage.h	Thu Aug 22 15:48:38 2002 +0300
@@ -44,14 +44,14 @@
 typedef struct _MailSearchArg MailSearchArg;
 
 typedef void (*MailboxFunc)(MailStorage *storage, const char *name,
-			    MailboxFlags flags, void *user_data);
+			    MailboxFlags flags, void *context);
 
 typedef void (*MailExpungeFunc)(Mailbox *mailbox, unsigned int seq,
-				unsigned int uid, void *user_data);
+				unsigned int uid, void *context);
 typedef void (*MailFlagUpdateFunc)(Mailbox *mailbox, unsigned int seq,
 				   unsigned int uid, MailFlags flags,
 				   const char *custom_flags[],
-				   void *user_data);
+				   void *context);
 
 /* All methods returning int return either TRUE or FALSE. */
 struct _MailStorage {
@@ -89,7 +89,7 @@
 	/* Execute specified function for all mailboxes matching given
 	   mask. The mask is in RFC2060 LIST format. */
 	int (*find_mailboxes)(MailStorage *storage, const char *mask,
-			      MailboxFunc func, void *user_data);
+			      MailboxFunc func, void *context);
 
 	/* Subscribe/unsubscribe mailbox. There should be no error when
 	   subscribing to already subscribed mailbox. Subscribing to
@@ -98,7 +98,7 @@
 
 	/* Exactly like find_mailboxes(), but list only subscribed mailboxes. */
 	int (*find_subscribed)(MailStorage *storage, const char *mask,
-			       MailboxFunc func, void *user_data);
+			       MailboxFunc func, void *context);
 
 	/* Returns mailbox name status */
 	int (*get_mailbox_name_status)(MailStorage *storage, const char *name,
@@ -132,7 +132,7 @@
 	   to expunge() function is that expunge_func is also called. */
 	int (*sync)(Mailbox *box, unsigned int *messages, int expunge,
 		    MailExpungeFunc expunge_func, MailFlagUpdateFunc flag_func,
-		    void *user_data);
+		    void *context);
 
 	/* Expunge all mails with \Deleted flag. */
 	int (*expunge)(Mailbox *box);
@@ -141,7 +141,7 @@
 	int (*update_flags)(Mailbox *box, const char *messageset, int uidset,
 			    MailFlags flags, const char *custom_flags[],
 			    ModifyType modify_type,
-			    MailFlagUpdateFunc func, void *user_data,
+			    MailFlagUpdateFunc func, void *context,
 			    int *all_found);
 
 	/* Copy mails to another mailbox */
--- a/src/lib-storage/subscription-file/subscription-file.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/subscription-file/subscription-file.c	Thu Aug 22 15:48:38 2002 +0300
@@ -180,7 +180,7 @@
 }
 
 int subsfile_foreach(MailStorage *storage, const char *mask,
-		     SubsFileForeachFunc func, void *user_data)
+		     SubsFileForeachFunc func, void *context)
 {
         const ImapMatchGlob *glob;
 	const char *path, *start, *end, *p, *line;
@@ -206,7 +206,7 @@
 		line = t_strdup_until(start, p);
 		if (line != NULL && *line != '\0' &&
 		    imap_match(glob, line, 0, NULL) >= 0)
-			ret = func(storage, line, user_data);
+			ret = func(storage, line, context);
 		t_pop();
 
 		if (p == end)
--- a/src/lib-storage/subscription-file/subscription-file.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib-storage/subscription-file/subscription-file.h	Thu Aug 22 15:48:38 2002 +0300
@@ -5,12 +5,12 @@
 
 /* Returns FALSE if foreach should be aborted */
 typedef int (*SubsFileForeachFunc)(MailStorage *storage, const char *name,
-				   void *user_data);
+				   void *context);
 
 int subsfile_set_subscribed(MailStorage *storage, const char *name, int set);
 
 /* Returns -1 if error, 0 if foreach function returned FALSE or 1 if all ok */
 int subsfile_foreach(MailStorage *storage, const char *mask,
-		     SubsFileForeachFunc func, void *user_data);
+		     SubsFileForeachFunc func, void *context);
 
 #endif
--- a/src/lib/hash.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib/hash.c	Thu Aug 22 15:48:38 2002 +0300
@@ -262,7 +262,7 @@
                 hash_cleanup(table);
 }
 
-void hash_foreach(HashTable *table, HashForeachFunc func, void *user_data)
+void hash_foreach(HashTable *table, HashForeachFunc func, void *context)
 {
 	HashNode *node;
 	unsigned int i;
@@ -276,7 +276,7 @@
 	for (i = 0; i < table->size; i++) {
 		for (node = table->nodes[i]; node; node = node->next) {
 			if (!node->destroyed) {
-				func(node->key, node->value, user_data);
+				func(node->key, node->value, context);
 
 				if (foreach_stop) {
 					foreach_stop = FALSE;
--- a/src/lib/hash.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib/hash.h	Thu Aug 22 15:48:38 2002 +0300
@@ -5,7 +5,7 @@
 typedef unsigned int (*HashFunc) (const void *p);
 /* Returns 0 if the pointers are equal. */
 typedef int (*HashCompareFunc) (const void *p1, const void *p2);
-typedef void (*HashForeachFunc) (void *key, void *value, void *user_data);
+typedef void (*HashForeachFunc) (void *key, void *value, void *context);
 
 typedef struct _HashTable HashTable;
 
@@ -39,7 +39,7 @@
 /* Calls the given function for each node in hash table. You may safely
    call hash_*() functions inside your function, but if you add any
    new nodes, they may or may not be called for in this foreach loop. */
-void hash_foreach(HashTable *table, HashForeachFunc func, void *user_data);
+void hash_foreach(HashTable *table, HashForeachFunc func, void *context);
 /* Stop the active hash_foreach() loop */
 void hash_foreach_stop(void);
 
--- a/src/lib/iobuffer.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib/iobuffer.c	Thu Aug 22 15:48:38 2002 +0300
@@ -179,14 +179,14 @@
 
 void io_buffer_set_send_blocking(IOBuffer *buf, unsigned int max_size,
 				 int timeout_msecs, TimeoutFunc timeout_func,
-				 void *user_data)
+				 void *context)
 {
 	i_assert(!buf->receive);
 
 	buf->transmit = TRUE;
 	buf->timeout_msecs = timeout_msecs;
 	buf->timeout_func = timeout_func;
-	buf->timeout_user_data = user_data;
+	buf->timeout_context = context;
 	buf->blocking = max_size > 0;
 	buf->max_size = max_size;
 }
@@ -230,7 +230,7 @@
 
 			/* call flush function */
 			if (buf->flush_func != NULL) {
-				buf->flush_func(buf->flush_user_data, buf);
+				buf->flush_func(buf->flush_context, buf);
 				buf->flush_func = NULL;
 
 				if (buf->corked) {
@@ -265,43 +265,43 @@
 	IOBuffer *inbuf;
 
 	int timeout;
-} IOBufferBlockData;
+} IOBufferBlockContext;
 
-static void block_loop_send(IOBufferBlockData *bd)
+static void block_loop_send(IOBufferBlockContext *ctx)
 {
 	int ret;
 
-	if (bd->outbuf->skip != bd->outbuf->pos) {
-		buf_send_real(bd->outbuf);
+	if (ctx->outbuf->skip != ctx->outbuf->pos) {
+		buf_send_real(ctx->outbuf);
 	} else {
 		/* send the data */
-		ret = !bd->outbuf->file ?
-			net_transmit(bd->outbuf->fd, bd->data, bd->size) :
-			my_write(bd->outbuf->fd, bd->data, bd->size);
+		ret = !ctx->outbuf->file ?
+			net_transmit(ctx->outbuf->fd, ctx->data, ctx->size) :
+			my_write(ctx->outbuf->fd, ctx->data, ctx->size);
 
 		if (ret < 0) {
-			bd->outbuf->closed = TRUE;
+			ctx->outbuf->closed = TRUE;
 		} else {
-			bd->outbuf->offset += ret;
-			bd->data += ret;
-			bd->size -= ret;
+			ctx->outbuf->offset += ret;
+			ctx->data += ret;
+			ctx->size -= ret;
 		}
 	}
 
-	if (bd->outbuf->closed || bd->size == 0)
-		io_loop_stop(bd->ioloop);
+	if (ctx->outbuf->closed || ctx->size == 0)
+		io_loop_stop(ctx->ioloop);
 }
 
-static void block_loop_timeout(void *user_data, Timeout timeout __attr_unused__)
+static void block_loop_timeout(void *context, Timeout timeout __attr_unused__)
 {
-	IOBufferBlockData *data = user_data;
+	IOBufferBlockContext *ctx = context;
 
-	data->timeout = TRUE;
-	io_loop_stop(data->ioloop);
+	ctx->timeout = TRUE;
+	io_loop_stop(ctx->ioloop);
 }
 
-static int io_buffer_ioloop(IOBuffer *buf, IOBufferBlockData *bd,
-			    void (*send_func)(IOBufferBlockData *bd))
+static int io_buffer_ioloop(IOBuffer *buf, IOBufferBlockContext *ctx,
+			    void (*send_func)(IOBufferBlockContext *ctx))
 {
 	Timeout to;
 	int save_errno;
@@ -311,14 +311,14 @@
 		io_remove(buf->io);
 
 	/* create a new I/O loop */
-	bd->ioloop = io_loop_create();
-	bd->outbuf = buf;
+	ctx->ioloop = io_loop_create();
+	ctx->outbuf = buf;
 
-	buf->io = io_add(buf->fd, IO_WRITE, (IOFunc) send_func, bd);
+	buf->io = io_add(buf->fd, IO_WRITE, (IOFunc) send_func, ctx);
 	to = buf->timeout_msecs <= 0 ? NULL :
-		timeout_add(buf->timeout_msecs, block_loop_timeout, bd);
+		timeout_add(buf->timeout_msecs, block_loop_timeout, ctx);
 
-	io_loop_run(bd->ioloop);
+	io_loop_run(ctx->ioloop);
 	save_errno = errno;
 
 	if (buf->corked) {
@@ -333,30 +333,30 @@
 	}
 
 	if (to != NULL) {
-		if (bd->timeout && buf->timeout_func != NULL) {
+		if (ctx->timeout && buf->timeout_func != NULL) {
 			/* call user-given timeout function */
-			buf->timeout_func(buf->timeout_user_data, to);
+			buf->timeout_func(buf->timeout_context, to);
 		}
 		timeout_remove(to);
 	}
 
-	io_loop_destroy(bd->ioloop);
+	io_loop_destroy(ctx->ioloop);
 
 	errno = save_errno;
-	return bd->size > 0 ? -1 : 1;
+	return ctx->size > 0 ? -1 : 1;
 }
 
 static int io_buffer_send_blocking(IOBuffer *buf, const void *data,
 				   unsigned int size)
 {
-        IOBufferBlockData bd;
+        IOBufferBlockContext ctx;
 
-	memset(&bd, 0, sizeof(IOBufferBlockData));
+	memset(&ctx, 0, sizeof(ctx));
 
-	bd.data = data;
-	bd.size = size;
+	ctx.data = data;
+	ctx.size = size;
 
-        return io_buffer_ioloop(buf, &bd, block_loop_send);
+        return io_buffer_ioloop(buf, &ctx, block_loop_send);
 }
 
 void io_buffer_cork(IOBuffer *buf)
@@ -451,27 +451,27 @@
 }
 
 #ifdef HAVE_SYS_SENDFILE_H
-static void block_loop_sendfile(IOBufferBlockData *bd)
+static void block_loop_sendfile(IOBufferBlockContext *ctx)
 {
 	int ret;
 
-	ret = sendfile(bd->outbuf->fd, bd->inbuf->fd,
-		       &bd->inbuf->mmap_offset, bd->size);
+	ret = sendfile(ctx->outbuf->fd, ctx->inbuf->fd,
+		       &ctx->inbuf->mmap_offset, ctx->size);
 	if (ret < 0) {
 		if (errno != EINTR && errno != EAGAIN)
-			bd->outbuf->closed = TRUE;
+			ctx->outbuf->closed = TRUE;
 		ret = 0;
 	}
 
-	bd->size -= ret;
-	if (bd->outbuf->closed || bd->size == 0)
-		io_loop_stop(bd->ioloop);
+	ctx->size -= ret;
+	if (ctx->outbuf->closed || ctx->size == 0)
+		io_loop_stop(ctx->ioloop);
 }
 
 static int io_buffer_sendfile(IOBuffer *outbuf, IOBuffer *inbuf,
 			      unsigned int size)
 {
-        IOBufferBlockData bd;
+        IOBufferBlockContext ctx;
 	int ret;
 
 	io_buffer_send_flush(outbuf);
@@ -489,12 +489,12 @@
 		return 1;
 	}
 
-	memset(&bd, 0, sizeof(IOBufferBlockData));
+	memset(&ctx, 0, sizeof(ctx));
 
-	bd.inbuf = inbuf;
-	bd.size = size - ret;
+	ctx.inbuf = inbuf;
+	ctx.size = size - ret;
 
-	ret = io_buffer_ioloop(outbuf, &bd, block_loop_sendfile);
+	ret = io_buffer_ioloop(outbuf, &ctx, block_loop_sendfile);
 	if (ret < 0 && errno == EINVAL) {
 		/* this shouldn't happen, must be a bug. It would also
 		   mess up later if we let this pass. */
@@ -504,32 +504,32 @@
 }
 #endif
 
-static void block_loop_copy(IOBufferBlockData *bd)
+static void block_loop_copy(IOBufferBlockContext *ctx)
 {
 	unsigned char *in_data;
 	unsigned int size;
 	int ret;
 
-	while ((ret = io_buffer_read_data(bd->inbuf, &in_data,
+	while ((ret = io_buffer_read_data(ctx->inbuf, &in_data,
 					  &size, 0)) <= 0) {
 		if (ret == -1) {
 			/* disconnected */
-			bd->outbuf->closed = TRUE;
+			ctx->outbuf->closed = TRUE;
 			break;
 		}
 	}
 
 	/* send the data */
-	bd->data = (const char *) in_data;
-	bd->size = size;
-	block_loop_send(bd);
+	ctx->data = (const char *) in_data;
+	ctx->size = size;
+	block_loop_send(ctx);
 
-	io_buffer_skip(bd->inbuf, size - bd->size);
+	io_buffer_skip(ctx->inbuf, size - ctx->size);
 }
 
 int io_buffer_send_buf(IOBuffer *outbuf, IOBuffer *inbuf, unsigned int size)
 {
-	IOBufferBlockData bd;
+	IOBufferBlockContext ctx;
 	unsigned char *in_data;
 	unsigned int in_size;
 	int ret;
@@ -563,12 +563,12 @@
 	}
 
 	/* create blocking send loop */
-	memset(&bd, 0, sizeof(IOBufferBlockData));
+	memset(&ctx, 0, sizeof(ctx));
 
-	bd.inbuf = inbuf;
-	bd.size = size;
+	ctx.inbuf = inbuf;
+	ctx.size = size;
 
-	return io_buffer_ioloop(outbuf, &bd, block_loop_copy);
+	return io_buffer_ioloop(outbuf, &ctx, block_loop_copy);
 }
 
 void io_buffer_send_flush(IOBuffer *buf)
@@ -583,17 +583,17 @@
 }
 
 void io_buffer_send_flush_callback(IOBuffer *buf, IOBufferFlushFunc func,
-				   void *user_data)
+				   void *context)
 {
 	i_assert(!buf->receive);
 
 	if (buf->skip == buf->pos) {
-		func(user_data, buf);
+		func(context, buf);
 		return;
 	}
 
 	buf->flush_func = func;
-	buf->flush_user_data = user_data;
+	buf->flush_context = context;
 }
 
 int io_buffer_read_mmaped(IOBuffer *buf, unsigned int size)
--- a/src/lib/iobuffer.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib/iobuffer.h	Thu Aug 22 15:48:38 2002 +0300
@@ -5,7 +5,7 @@
 
 #define IO_BUFFER_MIN_SIZE		512
 
-typedef void (*IOBufferFlushFunc) (void *user_data, IOBuffer *buf);
+typedef void (*IOBufferFlushFunc) (void *context, IOBuffer *buf);
 
 struct _IOBuffer {
 	int fd;
@@ -22,10 +22,10 @@
 
 	int timeout_msecs;
 	TimeoutFunc timeout_func;
-	void *timeout_user_data;
+	void *timeout_context;
 
 	IOBufferFlushFunc flush_func;
-	void *flush_user_data;
+	void *flush_context;
 
 	unsigned char *buffer;
         unsigned int cr_lookup_pos; /* used only when reading a line */
@@ -74,7 +74,7 @@
    timeout_msecs to 0 may block infinitely. */
 void io_buffer_set_send_blocking(IOBuffer *buf, unsigned int max_size,
 				 int timeout_msecs, TimeoutFunc timeout_func,
-				 void *user_data);
+				 void *context);
 
 /* Set TCP_CORK on if supported, ie. don't send out partial frames.
    io_buffer_send_flush() removes the cork. */
@@ -93,7 +93,7 @@
    If the buffer is empty already, the function will be called immediately.
    The function will be called only once. */
 void io_buffer_send_flush_callback(IOBuffer *buf, IOBufferFlushFunc func,
-				   void *user_data);
+				   void *context);
 
 /* Returns number of bytes read if read was ok,
    -1 if disconnected / EOF, -2 if the buffer is full */
--- a/src/lib/ioloop-internal.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib/ioloop-internal.h	Thu Aug 22 15:48:38 2002 +0300
@@ -32,7 +32,7 @@
 	unsigned int invalid:1;
 
 	IOFunc func;
-        void *user_data;
+        void *context;
 };
 
 struct _Timeout {
@@ -44,7 +44,7 @@
         int destroyed;
 
 	TimeoutFunc func;
-        void *user_data;
+        void *context;
 };
 
 int io_loop_get_wait_time(Timeout timeout, struct timeval *tv,
--- a/src/lib/ioloop-poll.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib/ioloop-poll.c	Thu Aug 22 15:48:38 2002 +0300
@@ -203,7 +203,7 @@
 		}
 
 		t_id = t_push();
-		io->func(io->user_data, io->fd, io);
+		io->func(io->context, io->fd, io);
 		if (t_pop() != t_id)
 			i_panic("Leaked a t_pop() call!");
 
--- a/src/lib/ioloop-select.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib/ioloop-select.c	Thu Aug 22 15:48:38 2002 +0300
@@ -111,7 +111,7 @@
 
 		if (!destroyed) {
 			t_id = t_push();
-			io->func(io->user_data, io->fd, io);
+			io->func(io->context, io->fd, io);
 			if (t_pop() != t_id)
 				i_panic("Leaked a t_pop() call!");
 		}
--- a/src/lib/ioloop.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib/ioloop.c	Thu Aug 22 15:48:38 2002 +0300
@@ -89,7 +89,7 @@
 }
 
 IO io_add_priority(int fd, int priority, int condition,
-		   IOFunc func, void *user_data)
+		   IOFunc func, void *context)
 {
 	IO io;
 
@@ -102,7 +102,7 @@
         io->condition = condition;
 
 	io->func = func;
-        io->user_data = user_data;
+        io->context = context;
 
 	if (io->fd > current_ioloop->highest_fd)
                 current_ioloop->highest_fd = io->fd;
@@ -180,7 +180,7 @@
 	}
 }
 
-Timeout timeout_add(int msecs, TimeoutFunc func, void *user_data)
+Timeout timeout_add(int msecs, TimeoutFunc func, void *context)
 {
 	Timeout timeout;
 
@@ -188,7 +188,7 @@
         timeout->msecs = msecs;
 
 	timeout->func = func;
-	timeout->user_data = user_data;
+	timeout->context = context;
 
         timeout_update_next(timeout, NULL);
         timeout_list_insert(current_ioloop, timeout);
@@ -275,7 +275,7 @@
                 timeout_update_next(t, &ioloop_timeval);
 
                 t_id = t_push();
-		t->func(t->user_data, t);
+		t->func(t->context, t);
 		if (t_pop() != t_id)
                         i_panic("Leaked a t_pop() call!");
 	}
--- a/src/lib/ioloop.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/lib/ioloop.h	Thu Aug 22 15:48:38 2002 +0300
@@ -10,8 +10,8 @@
 #define IO_PRIORITY_DEFAULT	0
 #define IO_PRIORITY_HIGH	-100
 
-typedef void (*IOFunc) (void *user_data, int fd, IO io);
-typedef void (*TimeoutFunc) (void *user_data, Timeout timeout);
+typedef void (*IOFunc) (void *context, int fd, IO io);
+typedef void (*TimeoutFunc) (void *context, Timeout timeout);
 
 /* Time when the I/O loop started calling handlers.
    Can be used instead of time(NULL). */
@@ -21,13 +21,13 @@
 /* I/O listeners - you can create different handlers for IO_READ and IO_WRITE,
    but make sure you don't create multiple handlers of same type, it's not
    checked and removing one will stop the other from working as well. */
-IO io_add(int fd, int condition, IOFunc func, void *user_data);
+IO io_add(int fd, int condition, IOFunc func, void *context);
 IO io_add_priority(int fd, int priority, int condition,
-		   IOFunc func, void *user_data);
+		   IOFunc func, void *context);
 void io_remove(IO io);
 
 /* Timeout handlers */
-Timeout timeout_add(int msecs, TimeoutFunc func, void *user_data);
+Timeout timeout_add(int msecs, TimeoutFunc func, void *context);
 void timeout_remove(Timeout timeout);
 
 void io_loop_run(IOLoop ioloop);
--- a/src/login/auth-connection.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/login/auth-connection.c	Thu Aug 22 15:48:38 2002 +0300
@@ -38,7 +38,7 @@
 static int request_id_counter;
 static AuthConnection *auth_connections;
 
-static void auth_input(void *user_data, int fd, IO io);
+static void auth_input(void *context, int fd, IO io);
 static void auth_connect_missing(void);
 
 static AuthConnection *auth_connection_new(const char *path)
@@ -78,12 +78,12 @@
 {
 	request->callback(request, request->conn->auth_process,
 			  AUTH_RESULT_INTERNAL_FAILURE,
-			  "Authentication process died", 0, request->user_data);
+			  "Authentication process died", 0, request->context);
 	request_destroy(request);
 }
 
 static void request_hash_destroy(void *key __attr_unused__, void *value,
-				 void *user_data __attr_unused__)
+				 void *context __attr_unused__)
 {
 	request_abort(value);
 }
@@ -179,17 +179,17 @@
 	t_push();
 	request->callback(request, request->conn->auth_process,
 			  reply_data->result, data, reply_data->data_size,
-			  request->user_data);
+			  request->context);
 	t_pop();
 
 	if (reply_data->result != AUTH_RESULT_CONTINUE)
 		request_destroy(request);
 }
 
-static void auth_input(void *user_data, int fd __attr_unused__,
+static void auth_input(void *context, int fd __attr_unused__,
 		       IO io __attr_unused__)
 {
-	AuthConnection *conn = user_data;
+	AuthConnection *conn = context;
         AuthInitData init_data;
 	unsigned char *data;
 	unsigned int size;
@@ -249,7 +249,7 @@
 }
 
 int auth_init_request(AuthMethod method, AuthCallback callback,
-		      void *user_data, const char **error)
+		      void *context, const char **error)
 {
 	AuthConnection *conn;
 	AuthRequest *request;
@@ -268,7 +268,7 @@
 	request->conn = conn;
 	request->id = ++request_id_counter;
 	request->callback = callback;
-	request->user_data = user_data;
+	request->context = context;
 
 	hash_insert(conn->requests, INT_TO_POINTER(request->id), request);
 
--- a/src/login/auth-connection.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/login/auth-connection.h	Thu Aug 22 15:48:38 2002 +0300
@@ -7,7 +7,7 @@
    reply_data_size contains the error message. */
 typedef void (*AuthCallback)(AuthRequest *request, int auth_process,
 			     AuthResult result, const unsigned char *reply_data,
-			     unsigned int reply_data_size, void *user_data);
+			     unsigned int reply_data_size, void *context);
 
 struct _AuthRequest {
         AuthMethod method;
@@ -17,7 +17,7 @@
 	unsigned char cookie[AUTH_COOKIE_SIZE];
 
 	AuthCallback callback;
-	void *user_data;
+	void *context;
 
 	unsigned int init_sent:1;
 };
@@ -25,7 +25,7 @@
 extern AuthMethod available_auth_methods;
 
 int auth_init_request(AuthMethod method, AuthCallback callback,
-		      void *user_data, const char **error);
+		      void *context, const char **error);
 
 void auth_continue_request(AuthRequest *request, const unsigned char *data,
 			   unsigned int data_size);
--- a/src/login/client-authenticate.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/login/client-authenticate.c	Thu Aug 22 15:48:38 2002 +0300
@@ -80,9 +80,9 @@
 	client_unref(client);
 }
 
-static void master_callback(MasterReplyResult result, void *user_data)
+static void master_callback(MasterReplyResult result, void *context)
 {
-	Client *client = user_data;
+	Client *client = context;
 
 	switch (result) {
 	case MASTER_RESULT_SUCCESS:
@@ -116,9 +116,9 @@
 
 static int auth_callback(AuthRequest *request, int auth_process,
 			 AuthResult result, const unsigned char *reply_data,
-			 unsigned int reply_data_size, void *user_data)
+			 unsigned int reply_data_size, void *context)
 {
-	Client *client = user_data;
+	Client *client = context;
 
 	switch (result) {
 	case AUTH_RESULT_CONTINUE:
@@ -159,12 +159,12 @@
 
 static void login_callback(AuthRequest *request, int auth_process,
 			   AuthResult result, const unsigned char *reply_data,
-			   unsigned int reply_data_size, void *user_data)
+			   unsigned int reply_data_size, void *context)
 {
-	Client *client = user_data;
+	Client *client = context;
 
 	if (auth_callback(request, auth_process, result,
-			  reply_data, reply_data_size, user_data)) {
+			  reply_data, reply_data_size, context)) {
 		auth_continue_request(request, client->plain_login,
 				      client->plain_login_len);
 
@@ -216,19 +216,19 @@
 static void authenticate_callback(AuthRequest *request, int auth_process,
 				  AuthResult result,
 				  const unsigned char *reply_data,
-				  unsigned int reply_data_size, void *user_data)
+				  unsigned int reply_data_size, void *context)
 {
-	Client *client = user_data;
+	Client *client = context;
 
 	if (auth_callback(request, auth_process, result,
-			  reply_data, reply_data_size, user_data))
+			  reply_data, reply_data_size, context))
 		client_send_auth_data(client, reply_data, reply_data_size);
 }
 
-static void client_auth_input(void *user_data, int fd __attr_unused__,
+static void client_auth_input(void *context, int fd __attr_unused__,
 			      IO io __attr_unused__)
 {
-	Client *client = user_data;
+	Client *client = context;
 	char *line;
 	int size;
 
--- a/src/login/client.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/login/client.c	Thu Aug 22 15:48:38 2002 +0300
@@ -156,10 +156,10 @@
 	return FALSE;
 }
 
-void client_input(void *user_data, int fd __attr_unused__,
+void client_input(void *context, int fd __attr_unused__,
 		  IO io __attr_unused__)
 {
-	Client *client = user_data;
+	Client *client = context;
 	char *line;
 
 	client->last_input = ioloop_time;
@@ -192,10 +192,10 @@
 }
 
 static void client_hash_destroy_oldest(void *key, void *value __attr_unused__,
-				       void *user_data)
+				       void *context)
 {
 	Client *client = key;
-	Client **destroy_clients = user_data;
+	Client **destroy_clients = context;
 	int i;
 
 	for (i = 0; i < CLIENT_DESTROY_OLDEST_COUNT; i++) {
@@ -315,7 +315,7 @@
 }
 
 static void client_hash_check_idle(void *key, void *value __attr_unused__,
-				   void *user_data __attr_unused__)
+				   void *context __attr_unused__)
 {
 	Client *client = key;
 
@@ -325,7 +325,7 @@
 	}
 }
 
-static void idle_timeout(void *user_data __attr_unused__,
+static void idle_timeout(void *context __attr_unused__,
 			 Timeout timeout __attr_unused__)
 {
 	hash_foreach(clients, client_hash_check_idle, NULL);
@@ -338,7 +338,7 @@
 }
 
 static void client_hash_destroy(void *key, void *value __attr_unused__,
-				void *user_data __attr_unused__)
+				void *context __attr_unused__)
 {
 	client_destroy(key, NULL);
 }
--- a/src/login/client.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/login/client.h	Thu Aug 22 15:48:38 2002 +0300
@@ -34,7 +34,7 @@
 void client_syslog(Client *client, const char *text);
 
 int client_read(Client *client);
-void client_input(void *user_data, int fd, IO io);
+void client_input(void *context, int fd, IO io);
 
 void clients_init(void);
 void clients_deinit(void);
--- a/src/login/main.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/login/main.c	Thu Aug 22 15:48:38 2002 +0300
@@ -23,7 +23,7 @@
 	io_loop_stop(ioloop);
 }
 
-static void login_accept(void *user_data __attr_unused__, int listen_fd,
+static void login_accept(void *context __attr_unused__, int listen_fd,
 			 IO io __attr_unused__)
 {
 	IPADDR addr;
@@ -36,7 +36,7 @@
 	(void)client_create(fd, &addr);
 }
 
-static void login_accept_ssl(void *user_data __attr_unused__, int listen_fd,
+static void login_accept_ssl(void *context __attr_unused__, int listen_fd,
 			     IO io __attr_unused__)
 {
 	Client *client;
--- a/src/login/master.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/login/master.c	Thu Aug 22 15:48:38 2002 +0300
@@ -13,7 +13,7 @@
 
 	int id;
 	MasterCallback callback;
-	void *user_data;
+	void *context;
 };
 
 static IO io_master;
@@ -22,14 +22,14 @@
 static unsigned int master_pos;
 static char master_buf[sizeof(MasterReply)];
 
-static void push_request(int id, MasterCallback callback, void *user_data)
+static void push_request(int id, MasterCallback callback, void *context)
 {
 	WaitingRequest *req;
 
 	req = i_new(WaitingRequest, 1);
 	req->id = id;
 	req->callback = callback;
-	req->user_data = user_data;
+	req->context = context;
 
 	*next_request = req;
 	next_request = &req->next;
@@ -51,7 +51,7 @@
 			"(got %d, expecting %d)", reply->id, req->id);
 	}
 
-	req->callback(reply->result, req->user_data);
+	req->callback(reply->result, req->context);
 
 	requests = req->next;
 	if (requests == NULL)
@@ -62,7 +62,7 @@
 
 void master_request_imap(int fd, int auth_process, const char *login_tag,
 			 unsigned char cookie[AUTH_COOKIE_SIZE],
-			 MasterCallback callback, void *user_data)
+			 MasterCallback callback, void *context)
 {
 	MasterRequest req;
 
@@ -82,10 +82,10 @@
 		    fd, &req, sizeof(req)) != sizeof(req))
 		i_fatal("fd_send() failed: %m");
 
-	push_request(req.id, callback, user_data);
+	push_request(req.id, callback, context);
 }
 
-static void master_input(void *user_data __attr_unused__, int fd,
+static void master_input(void *context __attr_unused__, int fd,
 			 IO io __attr_unused__)
 {
 	int ret;
--- a/src/login/master.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/login/master.h	Thu Aug 22 15:48:38 2002 +0300
@@ -3,12 +3,12 @@
 
 #include "../master/master-interface.h"
 
-typedef void (*MasterCallback)(MasterReplyResult result, void *user_data);
+typedef void (*MasterCallback)(MasterReplyResult result, void *context);
 
 /* Request IMAP process for given cookie. */
 void master_request_imap(int fd, int auth_process, const char *login_tag,
 			 unsigned char cookie[AUTH_COOKIE_SIZE],
-			 MasterCallback callback, void *user_data);
+			 MasterCallback callback, void *context);
 
 void master_init(void);
 void master_deinit(void);
--- a/src/login/ssl-proxy.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/login/ssl-proxy.c	Thu Aug 22 15:48:38 2002 +0300
@@ -37,8 +37,8 @@
 static GNUTLS_CERTIFICATE_SERVER_CREDENTIALS x509_cred;
 static GNUTLS_DH_PARAMS dh_params;
 
-static void ssl_input(void *user_data, int handle, IO io);
-static void plain_input(void *user_data, int handle, IO io);
+static void ssl_input(void *context, int handle, IO io);
+static void plain_input(void *context, int handle, IO io);
 static void ssl_proxy_destroy(SSLProxy *proxy);
 
 static int proxy_recv_ssl(SSLProxy *proxy, void *data, unsigned int size)
@@ -94,10 +94,10 @@
 	i_free(proxy);
 }
 
-static void ssl_output(void *user_data, int fd __attr_unused__,
+static void ssl_output(void *context, int fd __attr_unused__,
 		       IO io __attr_unused__)
 {
-        SSLProxy *proxy = user_data;
+        SSLProxy *proxy = context;
 	int sent;
 
 	sent = net_transmit(proxy->fd_plain,
@@ -120,10 +120,10 @@
 	proxy->io_ssl = io_add(proxy->fd_ssl, IO_READ, ssl_input, proxy);
 }
 
-static void ssl_input(void *user_data, int fd __attr_unused__,
+static void ssl_input(void *context, int fd __attr_unused__,
 		      IO io __attr_unused__)
 {
-        SSLProxy *proxy = user_data;
+        SSLProxy *proxy = context;
 	int rcvd, sent;
 
 	rcvd = proxy_recv_ssl(proxy, proxy->outbuf_plain,
@@ -151,10 +151,10 @@
 	proxy->io_ssl = io_add(proxy->fd_ssl, IO_WRITE, ssl_output, proxy);
 }
 
-static void plain_output(void *user_data, int fd __attr_unused__,
+static void plain_output(void *context, int fd __attr_unused__,
 			 IO io __attr_unused__)
 {
-	SSLProxy *proxy = user_data;
+	SSLProxy *proxy = context;
 	int sent;
 
 	/* FIXME: (void*) 1 is horrible kludge, but there's no need for us
@@ -173,10 +173,10 @@
 	proxy->io_plain = io_add(proxy->fd_plain, IO_READ, plain_input, proxy);
 }
 
-static void plain_input(void *user_data, int fd __attr_unused__,
+static void plain_input(void *context, int fd __attr_unused__,
 			IO io __attr_unused__)
 {
-	SSLProxy *proxy = user_data;
+	SSLProxy *proxy = context;
 	char buf[1024];
 	int rcvd, sent;
 
--- a/src/master/auth-process.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/master/auth-process.c	Thu Aug 22 15:48:38 2002 +0300
@@ -33,7 +33,7 @@
 	int id;
 
 	AuthCallback callback;
-	void *user_data;
+	void *context;
 };
 
 static Timeout to;
@@ -42,14 +42,14 @@
 static void auth_process_destroy(AuthProcess *p);
 
 static void push_request(AuthProcess *process, int id,
-			 AuthCallback callback, void *user_data)
+			 AuthCallback callback, void *context)
 {
 	WaitingRequest *req;
 
 	req = i_new(WaitingRequest, 1);
 	req->id = id;
 	req->callback = callback;
-	req->user_data = user_data;
+	req->context = context;
 
 	*process->next_request = req;
 	process->next_request = &req->next;
@@ -85,14 +85,14 @@
 	if (process->requests == NULL)
 		process->next_request = &process->requests;
 
-	req->callback(reply, req->user_data);
+	req->callback(reply, req->context);
 
 	i_free(req);
 }
 
-static void auth_process_input(void *user_data, int fd, IO io __attr_unused__)
+static void auth_process_input(void *context, int fd, IO io __attr_unused__)
 {
-	AuthProcess *p = user_data;
+	AuthProcess *p = context;
 	int ret;
 
 	ret = net_receive(fd, p->reply_buf + p->reply_pos,
@@ -148,7 +148,7 @@
 	for (; p->requests != NULL; p->requests = next) {
 		next = p->requests->next;
 
-		p->requests->callback(NULL, p->requests->user_data);
+		p->requests->callback(NULL, p->requests->context);
 		i_free(p->requests);
 	}
 
@@ -261,7 +261,7 @@
 
 void auth_process_request(AuthProcess *process, int id,
 			  unsigned char cookie[AUTH_COOKIE_SIZE],
-			  AuthCallback callback, void *user_data)
+			  AuthCallback callback, void *context)
 {
 	AuthCookieRequestData req;
 
@@ -271,7 +271,7 @@
 	if (io_buffer_send(process->outbuf, &req, sizeof(req)) < 0)
 		auth_process_destroy(process);
 
-	push_request(process, id, callback, user_data);
+	push_request(process, id, callback, context);
 }
 
 static int auth_process_get_count(const char *name)
@@ -295,7 +295,7 @@
 		(void)close(p->fd);
 }
 
-static void auth_processes_start_missing(void *user_data __attr_unused__,
+static void auth_processes_start_missing(void *context __attr_unused__,
 					 Timeout timeout __attr_unused__)
 {
 	AuthConfig *config;
--- a/src/master/auth-process.h	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/master/auth-process.h	Thu Aug 22 15:48:38 2002 +0300
@@ -3,7 +3,7 @@
 
 /* cookie_reply is NULL if some error occured */
 typedef void (*AuthCallback)(AuthCookieReplyData *cookie_reply,
-			     void *user_data);
+			     void *context);
 
 typedef struct _AuthProcess AuthProcess;
 
@@ -13,7 +13,7 @@
 /* Request information about given cookie */
 void auth_process_request(AuthProcess *process, int id,
 			  unsigned char cookie[AUTH_COOKIE_SIZE],
-			  AuthCallback callback, void *user_data);
+			  AuthCallback callback, void *context);
 
 /* Close any fds used by auth processes */
 void auth_processes_cleanup(void);
--- a/src/master/login-process.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/master/login-process.c	Thu Aug 22 15:48:38 2002 +0300
@@ -39,14 +39,14 @@
 static void login_process_destroy(LoginProcess *p);
 static void login_process_unref(LoginProcess *p);
 
-static void auth_callback(AuthCookieReplyData *cookie_reply, void *user_data)
+static void auth_callback(AuthCookieReplyData *cookie_reply, void *context)
 {
 	const char *env[] = {
 		"MAIL", NULL,
 		"LOGIN_TAG", NULL,
 		NULL
 	};
-	LoginAuthRequest *request = user_data;
+	LoginAuthRequest *request = context;
         LoginProcess *process;
 	MasterReply reply;
 
@@ -76,10 +76,10 @@
 	i_free(request);
 }
 
-static void login_process_input(void *user_data, int fd __attr_unused__,
+static void login_process_input(void *context, int fd __attr_unused__,
 				IO io __attr_unused__)
 {
-	LoginProcess *p = user_data;
+	LoginProcess *p = context;
 	AuthProcess *auth_process;
 	LoginAuthRequest *authreq;
 	MasterRequest req;
@@ -258,7 +258,7 @@
 }
 
 static void login_hash_cleanup(void *key __attr_unused__, void *value,
-			       void *user_data __attr_unused__)
+			       void *context __attr_unused__)
 {
 	LoginProcess *p = value;
 
@@ -270,7 +270,7 @@
 	hash_foreach(processes, login_hash_cleanup, NULL);
 }
 
-static void login_processes_start_missing(void *user_data __attr_unused__,
+static void login_processes_start_missing(void *context __attr_unused__,
 					  Timeout timeout __attr_unused__)
 {
 	/* create max. one process every second, that way if it keeps
@@ -287,7 +287,7 @@
 }
 
 static void login_hash_destroy(void *key __attr_unused__, void *value,
-			       void *user_data __attr_unused__)
+			       void *context __attr_unused__)
 {
 	login_process_destroy(value);
 }
--- a/src/master/main.c	Thu Aug 22 15:12:35 2002 +0300
+++ b/src/master/main.c	Thu Aug 22 15:48:38 2002 +0300
@@ -69,7 +69,7 @@
 	io_loop_stop(ioloop);
 }
 
-static void children_check_timeout(void *user_data __attr_unused__,
+static void children_check_timeout(void *context __attr_unused__,
 				   Timeout timeout __attr_unused__)
 {
 	const char *process_type_name;