# HG changeset patch # User Timo Sirainen # Date 1533548365 -10800 # Node ID d62b238d7d66ae81904290bb77381bfa8543e989 # Parent f2f813d047c858c08c2fcdcb3fc561ebc502705e imap: Fix command ambiguity checking with special plugins If the tagged line is already sent, that command can't result in ambiguity anymore. A cleaner fix would be to add a new _WAIT_SYNC_OUTPUT state, but that requires all the existing code to understand that new state correctly, so it has a higher chance of breaking something. So at least for now don't add it. diff -r f2f813d047c8 -r d62b238d7d66 src/imap/imap-client.c --- a/src/imap/imap-client.c Tue Dec 12 01:02:27 2017 +0200 +++ b/src/imap/imap-client.c Mon Aug 06 12:39:25 2018 +0300 @@ -772,7 +772,13 @@ cmd = new_cmd->client->command_queue; for (; cmd != NULL; cmd = cmd->next) { - if (cmd->state <= max_state && + /* The tagline_sent check is a bit kludgy here. Plugins may + hook into sync_notify_more() and send the tagline before + finishing the command. During this stage the state was been + dropped from _WAIT_SYNC to _WAIT_OUTPUT, so the <= max_state + check doesn't work correctly here. (Perhaps we should add + a new _WAIT_SYNC_OUTPUT?) */ + if (cmd->state <= max_state && !cmd->tagline_sent && cmd != new_cmd && (cmd->cmd_flags & flags) != 0) return cmd; }