isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 1b67c49965a72a058b26e3d6d3518b0c1e4c3c1f
parent eb1f10762f63f02a941d2af5a9388b7107b03163
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Sat, 27 Jul 2013 18:46:57 +0200

CHECK before FETCH after STORE

m$ exchange does not seem to update the index in time otherwise.

Diffstat:
Msrc/drv_imap.c | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c @@ -1958,6 +1958,8 @@ imap_store_msg_p2( imap_store_t *ctx ATTR_UNUSED, struct imap_cmd *cmd, int resp /******************* imap_find_new_msgs *******************/ +static void imap_find_new_msgs_p2( imap_store_t *, struct imap_cmd *, int ); + static void imap_find_new_msgs( store_t *gctx, void (*cb)( int sts, void *aux ), void *aux ) @@ -1966,6 +1968,19 @@ imap_find_new_msgs( store_t *gctx, struct imap_cmd_simple *cmd; INIT_IMAP_CMD(imap_cmd_simple, cmd, cb, aux) + imap_exec( (imap_store_t *)ctx, &cmd->gen, imap_find_new_msgs_p2, "CHECK" ); +} + +static void +imap_find_new_msgs_p2( imap_store_t *ctx, struct imap_cmd *gcmd, int response ) +{ + struct imap_cmd_simple *cmdp = (struct imap_cmd_simple *)gcmd, *cmd; + + if (response != RESP_OK) { + imap_done_simple_box( ctx, gcmd, response ); + return; + } + INIT_IMAP_CMD(imap_cmd_simple, cmd, cmdp->callback, cmdp->callback_aux) imap_exec( (imap_store_t *)ctx, &cmd->gen, imap_done_simple_box, "UID FETCH %d:1000000000 (UID BODY.PEEK[HEADER.FIELDS (X-TUID)])", ctx->gen.uidnext ); }