From: Timo Sirainen Date: Fri, 3 Dec 2010 05:46:57 +0000 (+0000) Subject: imap, pop3: Small optimization to last logging change. X-Git-Tag: 2.0.8~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bbb0b24625eb319b164497c4734e7e86b72df1bc;p=thirdparty%2Fdovecot%2Fcore.git imap, pop3: Small optimization to last logging change. Also added FIXMEs. This is an ugly way to change log prefixes. --- diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index 48b31aca9a..82154c3771 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -137,6 +137,9 @@ void client_command_cancel(struct client_command_context **_cmd) 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_start(struct client *client) 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; } diff --git a/src/pop3/pop3-client.c b/src/pop3/pop3-client.c index 4265cd4642..b5b4d9f891 100644 --- a/src/pop3/pop3-client.c +++ b/src/pop3/pop3-client.c @@ -46,6 +46,9 @@ 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; @@ -56,10 +59,9 @@ static void client_log_start(struct client *client) 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; }