commit b5b0751f35a3232ee93c7af996a582382c8c2c95
Author: Oswald Buddenhagen <[email protected]>
Date:   Sat Mar 12 16:16:42 2011 +0100

    get rid of redundant literal_pending state flag

 src/drv_imap.c |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index 5912e15..b5c28a7 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -88,7 +88,7 @@ typedef struct imap_store {
        unsigned caps; /* CAPABILITY results */
        parse_list_state_t parse_list_sts;
        /* command queue */
-       int nexttag, num_in_progress, literal_pending;
+       int nexttag, num_in_progress;
        struct imap_cmd *pending, **pending_append;
        struct imap_cmd *in_progress, **in_progress_append;
 
@@ -255,8 +255,6 @@ send_imap_cmd( imap_store_t *ctx, struct imap_cmd *cmd )
                if (socket_write( &ctx->conn, p, cmd->param.data_len, GiveOwn ) 
< 0 ||
                    socket_write( &ctx->conn, "\r\n", 2, KeepOwn ) < 0)
                        goto bail;
-       } else if (cmd->param.cont || cmd->param.data) {
-               ctx->literal_pending = 1;
        }
        if (cmd->param.to_trash && ctx->trashnc == TrashUnknown)
                ctx->trashnc = TrashChecking;
@@ -274,8 +272,13 @@ send_imap_cmd( imap_store_t *ctx, struct imap_cmd *cmd )
 static int
 cmd_submittable( imap_store_t *ctx, struct imap_cmd *cmd )
 {
+       struct imap_cmd *cmdp;
+
        return !ctx->conn.write_buf &&
-              !ctx->literal_pending &&
+              !(ctx->in_progress &&
+                (cmdp = (struct imap_cmd *)((char *)ctx->in_progress_append -
+                                            offsetof(struct imap_cmd, next)), 
1) &&
+                (cmdp->param.cont || cmdp->param.data)) &&
               !(cmd->param.to_trash && ctx->trashnc == TrashChecking) &&
               ctx->num_in_progress < ((imap_store_conf_t 
*)ctx->gen.conf)->server->max_in_progress;
 }
@@ -901,8 +904,6 @@ imap_socket_read( void *aux )
                        }
                        if (socket_write( &ctx->conn, "\r\n", 2, KeepOwn ) < 0)
                                return;
-                       if (!cmdp->param.cont)
-                               ctx->literal_pending = 0;
                } else {
                        tag = atoi( arg );
                        for (pcmdp = &ctx->in_progress; (cmdp = *pcmdp); pcmdp 
= &cmdp->next)
@@ -914,8 +915,6 @@ imap_socket_read( void *aux )
                        if (!(*pcmdp = cmdp->next))
                                ctx->in_progress_append = pcmdp;
                        ctx->num_in_progress--;
-                       if (cmdp->param.cont || cmdp->param.data)
-                               ctx->literal_pending = 0;
                        arg = next_arg( &cmd );
                        if (!strcmp( "OK", arg )) {
                                if (cmdp->param.to_trash)

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to