]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap, pop3: Small optimization to last logging change.
authorTimo Sirainen <tss@iki.fi>
Fri, 3 Dec 2010 05:46:57 +0000 (05:46 +0000)
committerTimo Sirainen <tss@iki.fi>
Fri, 3 Dec 2010 05:46:57 +0000 (05:46 +0000)
Also added FIXMEs. This is an ugly way to change log prefixes.

src/imap/imap-client.c
src/pop3/pop3-client.c

index 48b31aca9ae5f84e3d123b7963c8acd4b9b1d5a0..82154c3771bbbe7fbb1bdbf7c1d764855fd774ba 100644 (file)
@@ -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;
        }
index 4265cd46426052a4c30abdcf2117218bfbec4348..b5b4d9f891cb7e66b93de313c1ded58325c3b451 100644 (file)
@@ -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;
        }