Index: src/imap/cmd-append.c =================================================================== RCS file: /var/lib/cvs/dovecot/src/imap/cmd-append.c,v retrieving revision 1.80.2.9 diff -u -r1.80.2.9 cmd-append.c --- src/imap/cmd-append.c 13 Mar 2007 15:42:20 -0000 1.80.2.9 +++ src/imap/cmd-append.c 13 Mar 2007 15:44:43 -0000 @@ -25,6 +25,7 @@ struct imap_parser *save_parser; struct mail_save_context *save_ctx; struct mailbox_keywords old_keywords; + struct timeout *to; unsigned int failed:1; }; @@ -117,6 +118,7 @@ static void cmd_append_finish(struct cmd_append_context *ctx) { + timeout_remove(&ctx->to); io_remove(&ctx->client->io); imap_parser_destroy(&ctx->save_parser); @@ -433,6 +435,27 @@ return 0; } +static void append_timeout(void *context) +{ + struct cmd_append_context *ctx = context; + const char *str; + + if (ioloop_time - ctx->client->last_input < 10) + return; + + if (ctx->input == NULL) + str = ctx->msg_size == 0 ? + "* OK You're stuck at startup" : + "* OK Just the finishing CRLF!"; + else { + str = t_strdup_printf("* OK Come on, %"PRIuUOFF_T + " more bytes, you can do it!", + ctx->msg_size - ctx->input->v_offset); + } + client_send_line(ctx->client, str); + +} + bool cmd_append(struct client_command_context *cmd) { struct client *client = cmd->client; @@ -447,6 +470,7 @@ ctx->cmd = cmd; ctx->client = client; ctx->box = get_mailbox(cmd, mailbox); + ctx->to = timeout_add(10000, append_timeout, ctx); if (ctx->box == NULL) ctx->failed = TRUE; else {