Skip to content

Commit

Permalink
imap: Replace "if(mail_debug){i_debug}" with "e_debug"
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey-Kitov authored and sirainen committed May 30, 2018
1 parent b3f97a8 commit ef2116e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 32 deletions.
7 changes: 3 additions & 4 deletions src/imap/cmd-urlfetch.c
Expand Up @@ -68,10 +68,9 @@ static bool cmd_urlfetch_cancel(struct client_command_context *cmd)
return FALSE;

if (ctx->ufetch != NULL) {
if (cmd->client->user->mail_debug) {
i_debug("URLFETCH: Canceling command; "
"aborting URLAUTH fetch requests prematurely");
}
e_debug(cmd->client->event,
"URLFETCH: Canceling command; "
"aborting URLAUTH fetch requests prematurely");
imap_urlauth_fetch_deinit(&ctx->ufetch);
}
return TRUE;
Expand Down
21 changes: 9 additions & 12 deletions src/imap/imap-client-hibernate.c
Expand Up @@ -212,8 +212,8 @@ bool imap_client_hibernate(struct client **_client)
"Couldn't export state: %s (mailbox=%s)", error,
client->mailbox == NULL ? "" :
mailbox_get_vname(client->mailbox));
} else if (ret == 0 && client->user->mail_debug) {
i_debug("Couldn't hibernate imap client: "
} else if (ret == 0) {
e_debug(client->event, "Couldn't hibernate imap client: "
"Couldn't export state: %s (mailbox=%s)", error,
client->mailbox == NULL ? "" :
mailbox_get_vname(client->mailbox));
Expand All @@ -222,11 +222,9 @@ bool imap_client_hibernate(struct client **_client)
fd_notify = mailbox_watch_extract_notify_fd(client->mailbox,
&error);
if (fd_notify == -1) {
if (client->user->mail_debug) {
i_debug("Couldn't hibernate imap client: "
"Couldn't extract notifications fd: %s",
error);
}
e_debug(client->event, "Couldn't hibernate imap client: "
"Couldn't extract notifications fd: %s",
error);
ret = -1;
}
}
Expand All @@ -238,11 +236,10 @@ bool imap_client_hibernate(struct client **_client)
if (ret > 0) {
/* hide the disconnect log message, because the client didn't
actually log out */
if (client->user->mail_debug) {
i_debug("Successfully hibernated imap client in mailbox %s",
client->mailbox == NULL ? "<none>" :
mailbox_get_vname(client->mailbox));
}
e_debug(client->event,
"Successfully hibernated imap client in mailbox %s",
client->mailbox == NULL ? "<none>" :
mailbox_get_vname(client->mailbox));
client->disconnected = TRUE;
client->hibernated = TRUE;
client_destroy(client, NULL);
Expand Down
23 changes: 12 additions & 11 deletions src/imap/imap-master-client.c
Expand Up @@ -258,13 +258,15 @@ imap_master_client_input_args(struct connection *conn, const char *const *args,
master_input.state_import_bad_idle_done;
imap_client->state_import_idle_continue =
master_input.state_import_idle_continue;
if (imap_client->user->mail_debug) {
if (imap_client->state_import_bad_idle_done)
i_debug("imap-master: Unhibernated because IDLE was stopped with BAD command");
else if (imap_client->state_import_idle_continue)
i_debug("imap-master: Unhibernated to send mailbox changes");
else
i_debug("imap-master: Unhibernated because IDLE was stopped with DONE");
if (imap_client->state_import_bad_idle_done) {
e_debug(imap_client->event,
"imap-master: Unhibernated because IDLE was stopped with BAD command");
} else if (imap_client->state_import_idle_continue) {
e_debug(imap_client->event,
"imap-master: Unhibernated to send mailbox changes");
} else {
e_debug(imap_client->event,
"imap-master: Unhibernated because IDLE was stopped with DONE");
}

ret = imap_state_import_internal(imap_client, master_input.state->data,
Expand All @@ -281,10 +283,9 @@ imap_master_client_input_args(struct connection *conn, const char *const *args,
/* make sure all pending input gets handled */
i_assert(imap_client->to_delayed_input == NULL);
if (master_input.client_input->used > 0) {
if (imap_client->user->mail_debug) {
i_debug("imap-master: Pending client input: '%s'",
str_sanitize(str_c(master_input.client_input), 128));
}
e_debug(imap_client->event,
"imap-master: Pending client input: '%s'",
str_sanitize(str_c(master_input.client_input), 128));
imap_client->to_delayed_input =
timeout_add(0, client_input, imap_client);
}
Expand Down
9 changes: 4 additions & 5 deletions src/imap/imap-state.c
Expand Up @@ -686,11 +686,10 @@ import_state_mailbox_open(struct client *client,
status.highest_modseq));
client->sync_last_full_modseq = status.highest_modseq;
}
if (client->user->mail_debug) {
i_debug("Unhibernation sync: %u expunges, %u new messages, %u flag changes, %"PRIu64" modseq changes",
expunge_count, new_mails_count, flag_change_count,
status.highest_modseq - state->highest_modseq);
}
e_debug(client->event,
"Unhibernation sync: %u expunges, %u new messages, %u flag changes, %"PRIu64" modseq changes",
expunge_count, new_mails_count, flag_change_count,
status.highest_modseq - state->highest_modseq);
return 0;
}

Expand Down

0 comments on commit ef2116e

Please sign in to comment.