commit 0c30e08ea8e98549f7bdf7942378d515d196f8cb
Author: Oswald Buddenhagen <[email protected]>
Date:   Wed Sep 25 17:13:00 2013 +0200

    deal with messages disappearing between being listed and fetched

 src/drv_imap.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index 4940b5b..bd940ae 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -1876,6 +1876,8 @@ imap_submit_load( imap_store_t *ctx, const char *buf, int 
tuids, struct imap_cmd
 
 /******************* imap_fetch_msg *******************/
 
+static void imap_fetch_msg_p2( imap_store_t *ctx, struct imap_cmd *gcmd, int 
response );
+
 static void
 imap_fetch_msg( store_t *ctx, message_t *msg, msg_data_t *data,
                 void (*cb)( int sts, void *aux ), void *aux )
@@ -1885,12 +1887,25 @@ imap_fetch_msg( store_t *ctx, message_t *msg, 
msg_data_t *data,
        INIT_IMAP_CMD_X(imap_cmd_fetch_msg, cmd, cb, aux)
        cmd->gen.gen.param.uid = msg->uid;
        cmd->msg_data = data;
-       imap_exec( (imap_store_t *)ctx, &cmd->gen.gen, imap_done_simple_msg,
+       data->data = 0;
+       imap_exec( (imap_store_t *)ctx, &cmd->gen.gen, imap_fetch_msg_p2,
                   "UID FETCH %d (%s%sBODY.PEEK[])", msg->uid,
                   !(msg->status & M_FLAGS) ? "FLAGS " : "",
                   (data->date== -1) ? "INTERNALDATE " : "" );
 }
 
+static void
+imap_fetch_msg_p2( imap_store_t *ctx, struct imap_cmd *gcmd, int response )
+{
+       struct imap_cmd_fetch_msg *cmd = (struct imap_cmd_fetch_msg *)gcmd;
+
+       if (response == RESP_OK && !cmd->msg_data->data) {
+               /* The FETCH succeeded, but there is no message with this UID. 
*/
+               response = RESP_NO;
+       }
+       imap_done_simple_msg( ctx, gcmd, response );
+}
+
 /******************* imap_set_flags *******************/
 
 static void imap_set_flags_p2( imap_store_t *, struct imap_cmd *, int );

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to