Skip to content

v0.6.28

@lhaig lhaig tagged this 06 Sep 14:55
IMAP clients are told about new mail outside IDLE.

fix(imap): tell clients about new mail outside IDLE

  session.Poll returned nil with the comment "no-op, we use IDLE". go-imap runs
  Conn.poll after every command in the authenticated or selected state, and that
  is how a server delivers untagged EXISTS and EXPUNGE to a client polling with
  NOOP. Returning nil meant the only way any client learned about new messages
  was IDLE, and only while idling on that exact mailbox.

  Observed: a message appended to a user's Sent folder stored correctly, but
  Thunderbird did not display it until the client was restarted, which forced a
  fresh SELECT. Thunderbird idles on INBOX and polls other folders with NOOP.

  The fix needs two baselines. cachedMsgs is the sequence-number working set that
  handlers refresh freely -- Fetch, Store, Search, Copy and Move all overwrite it
  at the top of the handler, and the poll runs after the handler returns, so
  diffing against it destroys the pending EXISTS rather than deferring it.
  reportedUIDs records what the client has actually been sent.

  The baseline moves wherever the client is genuinely told something: Select,
  Poll, Idle, Expunge and Move. Expunge and Move write untagged EXPUNGEs
  themselves, and omitting them would leave the next poll re-sending a sequence
  number the client has already renumbered against, dropping a message it should
  have kept.

  Expunges are written highest sequence number first, since each renumbers those
  after it, and are withheld when allowExpunge is false because FETCH, STORE and
  SEARCH must not emit them mid-command.

Known and unchanged: Subscribe and Unsubscribe are still no-ops, and List
ignores SelectSubscribed, so LSUB returns every mailbox rather than the
subscribed subset. Every folder is effectively always subscribed.
Assets 2
Loading