From 77358f170674c68bef1e0da1b699694bec8330df Mon Sep 17 00:00:00 2001 From: Michael Elkins Date: Fri, 26 Jan 2001 20:21:27 +0000 Subject: [PATCH] include for off_t patch from "lorenzo martignoni" - fixed uploading of message to IMAP server --- imap.c | 20 ++++++++++---------- isync.h | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/imap.c b/imap.c index 5a2f3f8..b9b614e 100644 --- a/imap.c +++ b/imap.c @@ -968,11 +968,8 @@ imap_append_message (imap_t * imap, int fd, message_t * msg) sizeof (flagstr) - strlen (flagstr), ") "); } - send_server (imap->sock, "APPEND %s%s %s{%d}\r\n", + send_server (imap->sock, "APPEND %s%s %s{%d}", imap->prefix, imap->box->box, flagstr, msg->size + lines); - socket_write (imap->sock, buf, strlen (buf)); - if (Verbose) - fputs (buf, stdout); if (buffer_gets (imap->buf, &s)) return -1; @@ -980,7 +977,10 @@ imap_append_message (imap_t * imap, int fd, message_t * msg) puts (s); if (*s != '+') + { + puts ("Error, expected `+' from server (aborting)"); return -1; + } /* rewind */ lseek (fd, 0, 0); @@ -1002,12 +1002,12 @@ imap_append_message (imap_t * imap, int fd, message_t * msg) end++; if (start != end) socket_write (imap->sock, buf + start, end - start); -/* if (Verbose) - { - buf[end] = 0; - puts (buf + start); - } */ - socket_write (imap->sock, "\r\n", 2); + /* only send a crlf if we actually hit the end of a line. we + * might be in the middle of a line in which case we don't + * send one. + */ + if (end != len) + socket_write (imap->sock, "\r\n", 2); start = end + 1; } sofar += len; diff --git a/isync.h b/isync.h index b0b0c7c..d5bb461 100644 --- a/isync.h +++ b/isync.h @@ -18,6 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #if HAVE_LIBSSL #include