On Sun, 2006-02-05 at 12:06 +0200, Tom Alsberg wrote:
In the meanwhile, getting deeper into the sequence of calls when new mail arrives, I have traced the issue to be related the following in imap_sync_deinit(...):
if (status.messages != ctx->messages_count) { client_send_line(ctx->client, t_strdup_printf("* %u EXISTS", status.messages)); }
As I understand, at this point, status.messages should be the number of messages in the mailbox, and ctx->message_count the number of messages last reported to the client.
Right. But have you checked the code in lib-storage/index/mbox/mbox-sync.c? That's where it really does the mbox syncing and also checks again if mbox has changed before doing anything. Probably mbox_sync_has_changed() would be a good place to put some checks.
On another note, shouldn't the EXISTS message be on IDLE sent whenever there is a change in the mailbox? After all, a message can be replaced or changed, in which case the number of messages will not be updated, but one would want the client informed on the change...
ctx->messages_count is decreased whenever expunges happen (which is the only way to change/replace a mail), so the above checks works correctly.