changeset 12495:c9c9ea2bdec9

imap, pop3: Small optimization to last logging change. Also added FIXMEs. This is an ugly way to change log prefixes.
author Timo Sirainen <tss@iki.fi>
date Fri, 03 Dec 2010 05:46:57 +0000
parents 8ebf513b875c
children 841f56ea9d54
files src/imap/imap-client.c src/pop3/pop3-client.c
diffstat 2 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/imap-client.c	Fri Dec 03 05:43:16 2010 +0000
+++ b/src/imap/imap-client.c	Fri Dec 03 05:46:57 2010 +0000
@@ -137,6 +137,9 @@
 
 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;
@@ -147,10 +150,9 @@
 
 void client_log_stop(void)
 {
-	if (imap_client_count == 1) {
-		mail_user_set_log_prefix(imap_clients->user);
-		log_prefix_user = imap_clients->user;
-	} else {
+	if (imap_client_count == 1)
+		client_log_start(imap_clients);
+	else {
 		master_service_init_log(master_service, "imap: ");
 		log_prefix_user = NULL;
 	}
--- a/src/pop3/pop3-client.c	Fri Dec 03 05:43:16 2010 +0000
+++ b/src/pop3/pop3-client.c	Fri Dec 03 05:46:57 2010 +0000
@@ -46,6 +46,9 @@
 
 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;
@@ -56,10 +59,9 @@
 
 static void client_log_stop(void)
 {
-	if (pop3_client_count == 1) {
-		mail_user_set_log_prefix(pop3_clients->user);
-		log_prefix_user = pop3_clients->user;
-	} else {
+	if (pop3_client_count == 1)
+		client_log_start(pop3_clients);
+	else {
 		master_service_init_log(master_service, "pop3: ");
 		log_prefix_user = NULL;
 	}