dovecot-2.0: imap, pop3: Removed previous log prefix hack.

dovecot at dovecot.org dovecot at dovecot.org
Fri Dec 3 09:00:20 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/841f56ea9d54
changeset: 12496:841f56ea9d54
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Dec 03 06:57:58 2010 +0000
description:
imap, pop3: Removed previous log prefix hack.

diffstat:

 src/imap/cmd-append.c  |   3 ---
 src/imap/cmd-idle.c    |   4 ----
 src/imap/imap-client.c |  34 ----------------------------------
 src/imap/imap-client.h |   3 ---
 src/imap/imap-search.c |   2 --
 src/pop3/pop3-client.c |  32 --------------------------------
 6 files changed, 0 insertions(+), 78 deletions(-)

diffs (288 lines):

diff -r c9c9ea2bdec9 -r 841f56ea9d54 src/imap/cmd-append.c
--- a/src/imap/cmd-append.c	Fri Dec 03 05:46:57 2010 +0000
+++ b/src/imap/cmd-append.c	Fri Dec 03 06:57:58 2010 +0000
@@ -51,7 +51,6 @@
 	client->last_input = ioloop_time;
 	timeout_reset(client->to_idle);
 
-	client_log_start(client);
 	switch (i_stream_read(client->input)) {
 	case -1:
 		/* disconnected */
@@ -77,7 +76,6 @@
 		client_send_command_error(cmd, "Too long argument.");
 		cmd->param_error = TRUE;
 		client_command_free(&cmd);
-		client_log_stop();
 		return;
 	}
 
@@ -94,7 +92,6 @@
 		client_destroy(client, NULL);
 	else
 		client_continue_pending_input(client);
-	client_log_stop();
 }
 
 /* Returns -1 = error, 0 = need more data, 1 = successful. flags and
diff -r c9c9ea2bdec9 -r 841f56ea9d54 src/imap/cmd-idle.c
--- a/src/imap/cmd-idle.c	Fri Dec 03 05:46:57 2010 +0000
+++ b/src/imap/cmd-idle.c	Fri Dec 03 06:57:58 2010 +0000
@@ -82,7 +82,6 @@
 		return;
 	}
 
-	client_log_start(client);
 	while ((line = i_stream_next_line(client->input)) != NULL) {
 		if (client->input_skip_line)
 			client->input_skip_line = FALSE;
@@ -93,7 +92,6 @@
 			break;
 		}
 	}
-	client_log_stop();
 }
 
 static void idle_client_input(struct cmd_idle_context *ctx)
@@ -146,11 +144,9 @@
 		ctx->sync_pending = TRUE;
 	else {
 		ctx->manual_cork = TRUE;
-		client_log_start(client);
 		idle_sync_now(box, ctx);
 		if (client->disconnected)
 			client_destroy(client, NULL);
-		client_log_stop();
 	}
 }
 
diff -r c9c9ea2bdec9 -r 841f56ea9d54 src/imap/imap-client.c
--- a/src/imap/imap-client.c	Fri Dec 03 05:46:57 2010 +0000
+++ b/src/imap/imap-client.c	Fri Dec 03 06:57:58 2010 +0000
@@ -25,8 +25,6 @@
 struct client *imap_clients = NULL;
 unsigned int imap_client_count = 0;
 
-static struct mail_user *log_prefix_user = NULL;
-
 static void client_idle_timeout(struct client *client)
 {
 	if (client->output_lock == NULL)
@@ -97,7 +95,6 @@
 	if (hook_client_created != NULL)
 		hook_client_created(&client);
 
-	log_prefix_user = client->user;
 	imap_refresh_proctitle();
 	return client;
 }
@@ -135,29 +132,6 @@
 	}
 }
 
-void client_log_start(struct client *client)
-{
-	/* FIXME: This is kind of ugly way to do it here manually. Would be
-	   better if this was integrated to ioloop, so that all io/timeout
-	   callbacks could set the prefixes automatically */
-	if (log_prefix_user != NULL &&
-	    log_prefix_user == client->user)
-		return;
-
-	mail_user_set_log_prefix(client->user);
-	log_prefix_user = client->user;
-}
-
-void client_log_stop(void)
-{
-	if (imap_client_count == 1)
-		client_log_start(imap_clients);
-	else {
-		master_service_init_log(master_service, "imap: ");
-		log_prefix_user = NULL;
-	}
-}
-
 static const char *client_stats(struct client *client)
 {
 	static struct var_expand_table static_tab[] = {
@@ -195,7 +169,6 @@
 	i_assert(!client->destroyed);
 	client->destroyed = TRUE;
 
-	client_log_start(client);
 	if (!client->disconnected) {
 		client->disconnected = TRUE;
 		if (reason == NULL)
@@ -258,7 +231,6 @@
 	mail_storage_service_user_free(&client->service_user);
 	pool_unref(&client->pool);
 
-	client_log_stop();
 	master_service_client_connection_destroyed(master_service);
 	imap_refresh_proctitle();
 }
@@ -275,7 +247,6 @@
 	if (client->disconnected)
 		return;
 
-	client_log_start(client);
 	i_info("Disconnected: %s %s", reason, client_stats(client));
 	client->disconnected = TRUE;
 	(void)o_stream_flush(client->output);
@@ -817,8 +788,6 @@
 
 	i_assert(client->io != NULL);
 
-	client_log_start(client);
-
 	client->last_input = ioloop_time;
 	timeout_reset(client->to_idle);
 
@@ -850,7 +819,6 @@
 		client_destroy(client, NULL);
 	else
 		client_continue_pending_input(client);
-	client_log_stop();
 }
 
 static void client_output_cmd(struct client_command_context *cmd)
@@ -875,7 +843,6 @@
 
 	i_assert(!client->destroyed);
 
-	client_log_start(client);
 	client->last_output = ioloop_time;
 	timeout_reset(client->to_idle);
 	if (client->to_idle_output != NULL)
@@ -920,7 +887,6 @@
 		client_destroy(client, NULL);
 	else
 		client_continue_pending_input(client);
-	client_log_stop();
 	return ret;
 }
 
diff -r c9c9ea2bdec9 -r 841f56ea9d54 src/imap/imap-client.h
--- a/src/imap/imap-client.h	Fri Dec 03 05:46:57 2010 +0000
+++ b/src/imap/imap-client.h	Fri Dec 03 06:57:58 2010 +0000
@@ -209,9 +209,6 @@
 bool client_handle_input(struct client *client);
 int client_output(struct client *client);
 
-void client_log_start(struct client *client);
-void client_log_stop(void);
-
 void clients_destroy_all(void);
 
 #endif
diff -r c9c9ea2bdec9 -r 841f56ea9d54 src/imap/imap-search.c
--- a/src/imap/imap-search.c	Fri Dec 03 05:46:57 2010 +0000
+++ b/src/imap/imap-search.c	Fri Dec 03 06:57:58 2010 +0000
@@ -425,7 +425,6 @@
 	struct client *client = cmd->client;
 	bool finished;
 
-	client_log_start(client);
 	o_stream_cork(client->output);
 	finished = cmd_search_more(cmd);
 	o_stream_uncork(client->output);
@@ -440,7 +439,6 @@
 		client_destroy(client, NULL);
 	else
 		client_continue_pending_input(client);
-	client_log_stop();
 }
 
 int cmd_search_parse_return_if_found(struct imap_search_context *ctx,
diff -r c9c9ea2bdec9 -r 841f56ea9d54 src/pop3/pop3-client.c
--- a/src/pop3/pop3-client.c	Fri Dec 03 05:46:57 2010 +0000
+++ b/src/pop3/pop3-client.c	Fri Dec 03 06:57:58 2010 +0000
@@ -39,34 +39,9 @@
 struct client *pop3_clients;
 unsigned int pop3_client_count;
 
-static struct mail_user *log_prefix_user = NULL;
-
 static void client_input(struct client *client);
 static int client_output(struct client *client);
 
-static void client_log_start(struct client *client)
-{
-	/* FIXME: This is kind of ugly way to do it here manually. Would be
-	   better if this was integrated to ioloop, so that all io/timeout
-	   callbacks could set the prefixes automatically */
-	if (log_prefix_user != NULL &&
-	    log_prefix_user == client->user)
-		return;
-
-	mail_user_set_log_prefix(client->user);
-	log_prefix_user = client->user;
-}
-
-static void client_log_stop(void)
-{
-	if (pop3_client_count == 1)
-		client_log_start(pop3_clients);
-	else {
-		master_service_init_log(master_service, "pop3: ");
-		log_prefix_user = NULL;
-	}
-}
-
 static void client_commit_timeout(struct client *client)
 {
 	if (client->cmd != NULL) {
@@ -355,7 +330,6 @@
 	if (hook_client_created != NULL)
 		hook_client_created(&client);
 
-	log_prefix_user = client->user;
 	pop3_refresh_proctitle();
 	return client;
 }
@@ -454,7 +428,6 @@
 	if (client->seen_change_count > 0)
 		client_update_mails(client);
 
-	client_log_start(client);
 	if (!client->disconnected) {
 		if (reason == NULL)
 			reason = client_get_disconnect_reason(client);
@@ -507,7 +480,6 @@
 	mail_storage_service_user_free(&client->service_user);
 	i_free(client);
 
-	client_log_stop();
 	master_service_client_connection_destroyed(master_service);
 	pop3_refresh_proctitle();
 }
@@ -652,7 +624,6 @@
 	if (client->to_commit != NULL)
 		timeout_reset(client->to_commit);
 
-	client_log_start(client);
 	switch (i_stream_read(client->input)) {
 	case -1:
 		/* disconnected */
@@ -666,12 +637,10 @@
 	}
 
 	(void)client_handle_input(client);
-	client_log_stop();
 }
 
 static int client_output(struct client *client)
 {
-	client_log_start(client);
 	o_stream_cork(client->output);
 	if (o_stream_flush(client->output) < 0) {
 		client_destroy(client, NULL);
@@ -685,7 +654,6 @@
 
 	if (client->cmd != NULL)
 		client->cmd(client);
-	client_log_stop();
 
 	if (client->cmd == NULL) {
 		if (o_stream_get_buffer_used_size(client->output) <


More information about the dovecot-cvs mailing list