From: Timo Sirainen Date: Mon, 1 Feb 2016 18:30:26 +0000 (+0200) Subject: imap: Removed now-unused cmd_sync_callback(), which doesn't work very well. X-Git-Tag: 2.2.22.rc1~225 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71caf493c651b8eab5adb170db0237f293928e92;p=thirdparty%2Fdovecot%2Fcore.git imap: Removed now-unused cmd_sync_callback(), which doesn't work very well. See commit message in b7b25e0 for more details. --- diff --git a/src/imap/imap-sync.c b/src/imap/imap-sync.c index 8da541830e..df70625380 100644 --- a/src/imap/imap-sync.c +++ b/src/imap/imap-sync.c @@ -20,7 +20,6 @@ struct client_sync_context { enum mailbox_sync_flags flags; enum imap_sync_flags imap_flags; const char *tagline; - imap_sync_callback_t *callback; }; struct imap_sync_context { @@ -638,9 +637,6 @@ bool imap_sync_is_allowed(struct client *client) static bool cmd_finish_sync(struct client_command_context *cmd) { - if (cmd->sync->callback != NULL) - return cmd->sync->callback(cmd); - if (cmd->sync->tagline != NULL) client_send_tagline(cmd, cmd->sync->tagline); return TRUE; @@ -678,11 +674,12 @@ static bool cmd_sync_continue(struct client_command_context *sync_cmd) if (cmd->state == CLIENT_COMMAND_STATE_WAIT_SYNC && cmd != sync_cmd && cmd->sync->counter+1 == client->sync_counter) { - if (cmd_finish_sync(cmd)) - client_command_free(&cmd); + cmd_finish_sync(cmd); + client_command_free(&cmd); } } - return cmd_finish_sync(sync_cmd); + cmd_finish_sync(sync_cmd); + return TRUE; } static void get_common_sync_flags(struct client *client, @@ -755,10 +752,8 @@ static bool cmd_sync_client(struct client_command_context *sync_cmd) return TRUE; } -static bool ATTR_NULL(4, 5) -cmd_sync_full(struct client_command_context *cmd, enum mailbox_sync_flags flags, - enum imap_sync_flags imap_flags, const char *tagline, - imap_sync_callback_t *callback) +bool cmd_sync(struct client_command_context *cmd, enum mailbox_sync_flags flags, + enum imap_sync_flags imap_flags, const char *tagline) { struct client *client = cmd->client; @@ -769,7 +764,6 @@ cmd_sync_full(struct client_command_context *cmd, enum mailbox_sync_flags flags, if (client->mailbox == NULL) { /* no mailbox selected, no point in delaying the sync */ - i_assert(callback == NULL); if (tagline != NULL) client_send_tagline(cmd, tagline); return TRUE; @@ -780,7 +774,6 @@ cmd_sync_full(struct client_command_context *cmd, enum mailbox_sync_flags flags, cmd->sync->flags = flags; cmd->sync->imap_flags = imap_flags; cmd->sync->tagline = p_strdup(cmd->pool, tagline); - cmd->sync->callback = callback; cmd->state = CLIENT_COMMAND_STATE_WAIT_SYNC; cmd->func = NULL; @@ -791,20 +784,6 @@ cmd_sync_full(struct client_command_context *cmd, enum mailbox_sync_flags flags, return FALSE; } -bool cmd_sync(struct client_command_context *cmd, enum mailbox_sync_flags flags, - enum imap_sync_flags imap_flags, const char *tagline) -{ - return cmd_sync_full(cmd, flags, imap_flags, tagline, NULL); -} - -bool cmd_sync_callback(struct client_command_context *cmd, - enum mailbox_sync_flags flags, - enum imap_sync_flags imap_flags, - imap_sync_callback_t *callback) -{ - return cmd_sync_full(cmd, flags, imap_flags, NULL, callback); -} - static bool cmd_sync_drop_fast(struct client *client) { struct client_command_context *cmd, *prev; @@ -822,10 +801,9 @@ static bool cmd_sync_drop_fast(struct client *client) i_assert(cmd->sync != NULL); if ((cmd->sync->flags & MAILBOX_SYNC_FLAG_FAST) != 0) { - if (cmd_finish_sync(cmd)) { - client_command_free(&cmd); - ret = TRUE; - } + cmd_finish_sync(cmd); + client_command_free(&cmd); + ret = TRUE; } } return ret; diff --git a/src/imap/imap-sync.h b/src/imap/imap-sync.h index e5b49d9a86..a1c519872a 100644 --- a/src/imap/imap-sync.h +++ b/src/imap/imap-sync.h @@ -6,8 +6,6 @@ enum imap_sync_flags { IMAP_SYNC_FLAG_SAFE = 0x02 }; -typedef bool imap_sync_callback_t(struct client_command_context *cmd); - struct client; struct imap_sync_context * @@ -22,10 +20,6 @@ bool imap_sync_is_allowed(struct client *client); bool cmd_sync(struct client_command_context *cmd, enum mailbox_sync_flags flags, enum imap_sync_flags imap_flags, const char *tagline); -bool cmd_sync_callback(struct client_command_context *cmd, - enum mailbox_sync_flags flags, - enum imap_sync_flags imap_flags, - imap_sync_callback_t *callback); bool cmd_sync_delayed(struct client *client) ATTR_NOWARN_UNUSED_RESULT; #endif