commit abd31aad6124471185143ae56b9f5546977258ac
Author: Oswald Buddenhagen <o...@users.sf.net>
Date:   Sun Jun 19 12:36:47 2022 +0200

    simplify assembly of IMAP APPEND commands
    
    treat the date string the same as the flag string.
    
    amends eb1f1076.

 src/drv_imap.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index 1446f7a4..8bae526e 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -3233,6 +3233,14 @@ imap_store_msg( store_t *gctx, msg_data_t *data, int 
to_trash,
                flagstr[d++] = ' ';
        }
        flagstr[d] = 0;
+       if (data->date) {
+DIAG_PUSH
+DIAG_DISABLE("-Wformat")  // configure ensures that %z actually works.
+               strftime( datestr, sizeof(datestr), "\"%d-%b-%Y %H:%M:%S %z\" 
", localtime( &data->date ) );
+DIAG_POP
+       } else {
+               datestr[0] = 0;
+       }
 
        INIT_IMAP_CMD(imap_cmd_out_uid_t, cmd, cb, aux)
        ctx->buffer_mem += data->len;
@@ -3255,18 +3263,8 @@ imap_store_msg( store_t *gctx, msg_data_t *data, int 
to_trash,
                        return;
                }
        }
-       if (data->date) {
-               /* configure ensures that %z actually works. */
-DIAG_PUSH
-DIAG_DISABLE("-Wformat")
-               strftime( datestr, sizeof(datestr), "%d-%b-%Y %H:%M:%S %z", 
localtime( &data->date ) );
-DIAG_POP
-               imap_exec( ctx, &cmd->gen, imap_store_msg_p2,
-                          "APPEND \"%\\s\" %s\"%\\s\" ", buf, flagstr, datestr 
);
-       } else {
-               imap_exec( ctx, &cmd->gen, imap_store_msg_p2,
-                          "APPEND \"%\\s\" %s", buf, flagstr );
-       }
+       imap_exec( ctx, &cmd->gen, imap_store_msg_p2,
+                  "APPEND \"%\\s\" %s%s", buf, flagstr, datestr );
        free( buf );
 }
 


_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to