David Champion wrote: > Thanks for the work. If you could, it would make code review easier to > use Mercurial for the patch generation. > > $ hg clone http://dev.mutt.org/hg/mutt > $ cd mutt > $ hg up -C HEAD > [apply your patches locally] > [resolve any conflicts resulting from version differences] > $ hg ci > > You can then use 'hg diff' to make a patch, or 'hg email' to send the > patchset to the list. For one thing this will automatically exclude > untracked/generated files.
I used hg to create the patch this time. This version is a bit cleaner, it uses the existing struct body to store the MIME information. It's still totally alpha though, I've really just implemented the protocol and parsing parts. -- Chris Burdess
# HG changeset patch # User [email protected] # Date 1332963378 -3600 # Branch HEAD # Node ID b40a9921b7d59081303c04205681039b27be5592 # Parent c26dbc7021f4ec56c0e41d43019e43dd0be666de Initial BODYSTRUCTURE changes diff -r c26dbc7021f4 -r b40a9921b7d5 imap/Makefile.am --- a/imap/Makefile.am Tue Dec 20 22:24:35 2011 -0800 +++ b/imap/Makefile.am Wed Mar 28 20:36:18 2012 +0100 @@ -19,7 +19,8 @@ AM_CPPFLAGS = -I$(top_srcdir) -I../intl noinst_LIBRARIES = libimap.a -noinst_HEADERS = auth.h imap_private.h message.h +noinst_HEADERS = auth.h bodystructure.h imap_private.h message.h -libimap_a_SOURCES = auth.c auth_login.c browse.c command.c imap.c imap.h \ - message.c utf7.c util.c $(AUTHENTICATORS) $(GSSSOURCES) +libimap_a_SOURCES = auth.c auth_login.c bodystructure.c browse.c command.c \ + imap.c imap.h message.c utf7.c util.c \ + $(AUTHENTICATORS) $(GSSSOURCES) diff -r c26dbc7021f4 -r b40a9921b7d5 imap/bodystructure.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imap/bodystructure.c Wed Mar 28 20:36:18 2012 +0100 @@ -0,0 +1,406 @@ +/* + * Copyright (C) 2012 Chris Burdess <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include "bodystructure.h" + +#include <errno.h> +#include <stdlib.h> +#include <ctype.h> +#include <string.h> + +#include "mutt.h" +#include "imap_private.h" +#include "message.h" +#include "mime.h" +#include "mx.h" + +#ifdef HAVE_PGP +#include "pgp.h" +#endif + +#if USE_HCACHE +#include "hcache.h" +#endif + +#include "bcache.h" + +BODY *imap_parse_part (char *pc); +BODY *imap_parse_part_list (char *pc); +void imap_parse_multipart (BODY *part, char *pc); +void imap_parse_bodypart (BODY *part, char *pc); +char *imap_parse_string (char *pc); +LOFF_T imap_parse_size (char *pc); +PARAMETER *imap_parse_param_list (char *pc); +ADDRESS *imap_parse_address_structure (char *pc); + +void imap_parse_bodystructure (MESSAGE *msg, char *pc) +{ + pc++; /* initial BODYSTRUCTURE lparen */ + SKIPWS (pc); + msg->content = imap_parse_part (pc); +} + +BODY *imap_parse_part (char *pc) +{ + BODY *part = NULL; + + if (*pc) { + part = (BODY *) safe_calloc (1, sizeof (BODY)); + if (*pc == '(') + imap_parse_multipart (part, pc); + else + imap_parse_bodypart (part, pc); + } + return part; +} + +BODY *imap_parse_part_list (char *pc) +{ + int number = 1; + BODY *first = NULL; + BODY *prev = NULL; + BODY *cur; + + while (*pc == '(') { + pc++; + SKIPWS (pc); + cur = imap_parse_part (pc); + pc = imap_skip_to_rparen (pc); + SKIPWS (pc); + if (!first) + first = cur; + else + prev->next = cur; + cur->number = number++; + prev = cur; + } + return first; +} + +void imap_parse_multipart (BODY *part, char *pc) +{ + part->type = TYPEMULTIPART; + part->parts = imap_parse_part_list (pc); + while (*pc == '(') + pc = imap_skip_to_rparen (pc); + part->subtype = imap_parse_string (pc); + pc = imap_next_word (pc); + part->parameter = imap_parse_param_list (pc); +} + +void imap_parse_bodypart (BODY *part, char *pc) +{ + char *buf; + + buf = imap_parse_string (pc); + if (buf) + { + part->type = mutt_check_mime_type (buf); + FREE (&buf); + } + pc = imap_next_word (pc); + + part->subtype = imap_parse_string (pc); + pc = imap_next_word (pc); + + part->parameter = imap_parse_param_list (pc); + if (*pc == '(') + pc = imap_skip_to_rparen (pc); + else + pc = imap_next_word (pc); + + /* part->id = imap_parse_string (pc); NB Content-ID */ + pc = imap_next_word (pc); + + part->description = imap_parse_string (pc); + pc = imap_next_word (pc); + + buf = imap_parse_string (pc); + if (buf) + { + part->encoding = mutt_check_encoding (buf); + FREE (&buf); + } + pc = imap_next_word (pc); + + part->length = imap_parse_size (pc); + pc = imap_next_word (pc); + + if (part->type == TYPEMESSAGE) + part->parts = imap_parse_part_list (pc); +} + +char *imap_parse_string (char *pc) +{ + char *start; + size_t len = 0; + char *ret; + + if (!*pc) + return NULL; + if (!ascii_strncasecmp ("NIL", pc, 3)) { + return NULL; + } + if (*pc == '"') + { + start = ++pc; + while (pc && *pc != '"') { + pc++; + len++; + } + pc++; + SKIPWS (pc); + ret = (char *) safe_calloc (1, len + 1); + strncpy ((char *) ret, start, len); + return ret; + } + else + { + pc = imap_next_word (pc); + return NULL; + } +} + +LOFF_T imap_parse_size (char *pc) +{ + char *start; + size_t len = 0; + char *buf; + LOFF_T ret; + + if (!*pc) + return 0; + if (!ascii_strncasecmp ("NIL", pc, 3)) { + return 0; + } + start = pc++; + while (*pc && !ISSPACE (*pc)) + { + pc++; + len++; + } + SKIPWS (pc); + buf = (char *) safe_calloc (1, len + 1); + strncpy ((char *) buf, start, len); + ret = atol (buf); + FREE (&buf); + return ret; +} + +PARAMETER *imap_parse_param_list (char *pc) +{ + if (!*pc) + return NULL; + if (!ascii_strncasecmp ("NIL", pc, 3)) { + SKIPWS (pc); + return NULL; + } + /* TODO */ + return NULL; +} + +char *first_text_part_number (MESSAGE *msg) +{ + char *buf; + char *acc; + BODY *part = msg->content; + + buf = (char *) safe_calloc (1, 8); + acc = (char *) safe_calloc (1, 32); + while (part) + { + if (part->type == TYPEMULTIPART) + { + if (part->number > 0) + { + sprintf (buf, "%d.", part->number); + strcat (acc, buf); + } + part = part->parts; + } + else + { + if (part->type == TYPETEXT) + { + sprintf (buf, "%d", part->number); + strcat (acc, buf); + FREE (&buf); + return acc; + } + else + part = part->next; + } + } + return ""; /* default to whole MIME-IMB structure */ +} + +/* copied from parse.c as there is no forward declaration for it */ +static LIST *imap_parse_references (char *s) +{ + LIST *t, *lst = NULL; + char *m; + const char *sp; + + m = mutt_extract_message_id (s, &sp); + while (m) + { + t = safe_malloc (sizeof (LIST)); + t->data = m; + t->next = lst; + lst = t; + m = mutt_extract_message_id (NULL, &sp); + } + return lst; +} + +void imap_parse_envelope (BODY *part, char *pc) +{ + ENVELOPE *e; + char *buf; + + pc++; /* initial ENVELOPE lparen */ + SKIPWS (pc); + + part->hdr = mutt_new_header (); + e = mutt_new_envelope(); + part->hdr->env = e; + + buf = imap_parse_string (pc); + if (buf) + { + part->hdr->date_sent = mutt_parse_date (buf, part->hdr); + FREE (&buf); + } + pc = imap_next_word (pc); + + e->subject = imap_parse_string (pc); + pc = imap_next_word (pc); + + e->from = imap_parse_address_structure (pc); + if (*pc == '(') + pc = imap_skip_to_rparen (pc); + else + pc = imap_next_word (pc); + + e->sender = imap_parse_address_structure (pc); + if (*pc == '(') + pc = imap_skip_to_rparen (pc); + else + pc = imap_next_word (pc); + + e->reply_to = imap_parse_address_structure (pc); + if (*pc == '(') + pc = imap_skip_to_rparen (pc); + else + pc = imap_next_word (pc); + + e->to = imap_parse_address_structure (pc); + if (*pc == '(') + pc = imap_skip_to_rparen (pc); + else + pc = imap_next_word (pc); + + e->cc = imap_parse_address_structure (pc); + if (*pc == '(') + pc = imap_skip_to_rparen (pc); + else + pc = imap_next_word (pc); + + e->bcc = imap_parse_address_structure (pc); + if (*pc == '(') + pc = imap_skip_to_rparen (pc); + else + pc = imap_next_word (pc); + + buf = imap_parse_string (pc); + if (buf) + { + e->in_reply_to = imap_parse_references (buf); + FREE (&buf); + } + pc = imap_next_word (pc); + + buf = imap_parse_string (pc); + if (buf) + { + e->message_id = mutt_extract_message_id (buf, NULL); + FREE (&buf); + } + pc = imap_next_word (pc); + +} + +ADDRESS *imap_parse_address_structure (char *pc) +{ + ADDRESS *first = NULL; + ADDRESS *prev = NULL; + ADDRESS *cur; + char *buf1; + char *buf2; + + if (*pc == '(') + { + pc++; + SKIPWS (pc); + while (*pc == '(') + { + pc++; + SKIPWS (pc); + + cur = (ADDRESS *) safe_calloc (1, sizeof (ADDRESS)); + if (!first) + first = cur; + else + prev->next = cur; + prev = cur; + cur->personal = imap_parse_string (pc); + pc = imap_next_word (pc); + + /* skip at-domain-list */ + if (*pc == '(') + pc = imap_skip_to_rparen (pc); + else + pc = imap_next_word (pc); + + buf1 = imap_parse_string (pc); + pc = imap_next_word (pc); + buf2 = imap_parse_string (pc); + pc = imap_skip_to_rparen (pc); + if (buf1 && buf2) + { + cur->mailbox = (char *) safe_calloc (1, strlen (buf1) + + strlen (buf2) + 1); + sprintf (cur->mailbox, "%s@%s", buf1, buf2); +#ifdef EXACT_ADDRESS + cur->val = cur->mailbox; +#endif + } + if (buf1) + FREE (&buf1); + if (buf2) + FREE (&buf2); + } + } + return first; +} + diff -r c26dbc7021f4 -r b40a9921b7d5 imap/bodystructure.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imap/bodystructure.h Wed Mar 28 20:36:18 2012 +0100 @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2012 Chris Burdess <[email protected]> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef BODYSTRUCTURE_H +#define BODYSTRUCTURE_H 1 + +#endif /* BODYSTRUCTURE_H */ diff -r c26dbc7021f4 -r b40a9921b7d5 imap/imap_private.h --- a/imap/imap_private.h Tue Dec 20 22:24:35 2011 -0800 +++ b/imap/imap_private.h Wed Mar 28 20:36:18 2012 +0100 @@ -296,6 +296,11 @@ void imap_utf7_encode (char **s); void imap_utf7_decode (char **s); +/* bodystructure.c */ +void imap_parse_bodystructure (MESSAGE *msg, char *pc); +char *first_text_part_number (MESSAGE *msg); +void imap_parse_envelope (BODY *part, char *pc); + #if USE_HCACHE /* typedef size_t (*hcache_keylen_t)(const char* fn); */ #define imap_hcache_keylen mutt_strlen diff -r c26dbc7021f4 -r b40a9921b7d5 imap/message.c --- a/imap/message.c Tue Dec 20 22:24:35 2011 -0800 +++ b/imap/message.c Wed Mar 28 20:36:18 2012 +0100 @@ -463,7 +463,8 @@ snprintf (buf, sizeof (buf), "UID FETCH %u %s", HEADER_DATA(h)->uid, (mutt_bit_isset (idata->capabilities, IMAP4REV1) ? - (option (OPTIMAPPEEK) ? "BODY.PEEK[]" : "BODY[]") : + (/*option (OPTIMAPBODYSTRUCTURE)*/1 ? "BODYSTRUCTURE" : + (option (OPTIMAPPEEK) ? "BODY.PEEK[]" : "BODY[]")) : "RFC822")); imap_cmd_start (idata, buf); @@ -519,11 +520,117 @@ if ((pc = imap_set_flags (idata, h, pc)) == NULL) goto bail; } + else if (ascii_strncasecmp ("BODYSTRUCTURE", pc, 13) == 0) + { + pc = imap_next_word (pc); + imap_parse_bodystructure (msg, pc); + pc = imap_skip_to_rparen (pc); + } } } } while (rc == IMAP_CMD_CONTINUE); + if (msg->content) + { + mutt_message _("Fetching message text..."); + /* Load the first text part of the message */ + char cmdbuf[32]; + snprintf (cmdbuf, sizeof (cmdbuf), option (OPTIMAPPEEK) ? "BODY.PEEK[%s]" : "BODY[%s]", first_text_part_number (msg)); + snprintf (buf, sizeof (buf), "UID FETCH %u (ENVELOPE %s)", HEADER_DATA(h)->uid, cmdbuf); + imap_cmd_start (idata, buf); + do + { + if ((rc = imap_cmd_step (idata)) != IMAP_CMD_CONTINUE) + break; + + pc = idata->buf; + pc = imap_next_word (pc); + pc = imap_next_word (pc); + sprintf (msg->fp, ""); + + if (!ascii_strncasecmp ("FETCH", pc, 5)) + { + pc = imap_next_word (pc); + while (*pc) + { + if (pc[0] == '(') + pc++; + if (ascii_strncasecmp ("UID", pc, 3) == 0) + { + pc = imap_next_word (pc); + uid = atoi (pc); + if (uid != HEADER_DATA(h)->uid) + mutt_error (_("The message index is incorrect. Try reopening the mailbox.")); + pc = imap_next_word (pc); + } + else if (ascii_strncasecmp ("RFC822.HEADER", pc, 13) == 0) + { + pc = imap_next_word (pc); + if (imap_get_literal_count(pc, &bytes) < 0) + { + imap_error ("imap_fetch_message()", buf); + printf("\r\nHEADER literal count bad: %s\r\n", buf); + goto bail; + } + mutt_progress_init (&progressbar, _("Fetching message header..."), + M_PROGRESS_SIZE, NetInc, bytes); + rc = imap_read_literal (msg->fp, idata, bytes, &progressbar); + if (rc < 0) + {printf("\r\nHEADER bad literal\r\n"); + goto bail;} + if ((rc = imap_cmd_step (idata)) != IMAP_CMD_CONTINUE) + {printf("\r\nHEADER bad last line\r\n"); + goto bail;} + pc = idata->buf; + pc = imap_next_word (pc); + } + else if (ascii_strncasecmp ("ENVELOPE", pc, 8) == 0) + { + mutt_message _("Parsing envelope..."); + pc = imap_next_word (pc); + imap_parse_envelope (msg->content, pc); + pc = imap_skip_to_rparen (pc); + } + else if (ascii_strncasecmp ("BODY[", pc, 5) == 0) + { + pc = imap_next_word (pc); + if (imap_get_literal_count(pc, &bytes) < 0) + { + imap_error ("imap_fetch_message()", buf); + printf("\r\nBODYS literal count bad: %s\r\n", buf); + goto bail; + } + mutt_progress_init (&progressbar, _("Fetching message body..."), + M_PROGRESS_SIZE, NetInc, bytes); + rc = imap_read_literal (msg->fp, idata, bytes, &progressbar); + if (rc < 0) + {printf("\r\nBODYS bad literal\r\n"); + goto bail;} + if ((rc = imap_cmd_step (idata)) != IMAP_CMD_CONTINUE) + {printf("\r\nBODYS bad last line\r\n"); + goto bail;} + pc = idata->buf; + pc = imap_next_word (pc); + + fetched = 1; + } + else if ((ascii_strncasecmp ("FLAGS", pc, 5) == 0) && !h->changed) + { + if ((pc = imap_set_flags (idata, h, pc)) == NULL) + {printf("\r\nBODYS bad flags\r\n"); + goto bail;} + pc = imap_next_word (pc); + } + else + pc = imap_next_word (pc); + } + } + } + while (rc == IMAP_CMD_CONTINUE); + } + + /* see comment before command start. */ h->active = 1; @@ -538,7 +645,8 @@ goto bail; if (!fetched || !imap_code (idata->buf)) - goto bail; + {printf("\r\nbad code: %d\r\n", fetched); + goto bail;} msg_cache_commit (idata, h); @@ -586,6 +694,7 @@ return 0; bail: + printf("\r\nIN BAIL\r\n"); safe_fclose (&msg->fp); imap_cache_del (idata, h); if (cache->path) diff -r c26dbc7021f4 -r b40a9921b7d5 init.h --- a/init.h Tue Dec 20 22:24:35 2011 -0800 +++ b/init.h Wed Mar 28 20:36:18 2012 +0100 @@ -1075,6 +1075,13 @@ ** the previous methods are unavailable. If a method is available but ** authentication fails, mutt will not connect to the IMAP server. */ + { "imap_bodystructure", DT_BOOL, R_NONE, OPTIMAPBODYSTRUCTURE, 0 }, + /* + ** .pp + ** When \fIset\fP, mutt will only fetch individual MIME parts of the + ** message from the IMAP server on demand. Initially only the first text + ** part will be downloaded. + */ { "imap_check_subscribed", DT_BOOL, R_NONE, OPTIMAPCHECKSUBSCRIBED, 0 }, /* ** .pp diff -r c26dbc7021f4 -r b40a9921b7d5 mailbox.h --- a/mailbox.h Tue Dec 20 22:24:35 2011 -0800 +++ b/mailbox.h Wed Mar 28 20:36:18 2012 +0100 @@ -52,6 +52,7 @@ unsigned replied : 1; } flags; time_t received; /* the time at which this message was received */ + BODY *content; /* preparsed version of the message content */ } MESSAGE; CONTEXT *mx_open_mailbox (const char *, int, CONTEXT *); diff -r c26dbc7021f4 -r b40a9921b7d5 mutt.h --- a/mutt.h Tue Dec 20 22:24:35 2011 -0800 +++ b/mutt.h Wed Mar 28 20:36:18 2012 +0100 @@ -366,6 +366,7 @@ OPTIMAPPASSIVE, OPTIMAPPEEK, OPTIMAPSERVERNOISE, + OPTIMAPBODYSTRUCTURE, #endif #if defined(USE_SSL) # ifndef USE_SSL_GNUTLS @@ -692,6 +693,7 @@ unsigned int collapsed : 1; /* used by recvattach */ unsigned int attach_qualifies : 1; + int number; /* MIME-IMB number of this part */ } BODY; /* #3279: AIX defines conflicting struct thread */ # HG changeset patch # User [email protected] # Date 1332964144 -3600 # Branch HEAD # Node ID 18ca3373e34a9903fbd11cc308e5bf7d7ed82ec8 # Parent b40a9921b7d59081303c04205681039b27be5592 imap_skip_to_rparen function diff -r b40a9921b7d5 -r 18ca3373e34a imap/bodystructure.c --- a/imap/bodystructure.c Wed Mar 28 20:36:18 2012 +0100 +++ b/imap/bodystructure.c Wed Mar 28 20:49:04 2012 +0100 @@ -404,3 +404,30 @@ return first; } +char *imap_skip_to_rparen (char *s) +{ + int quoted = 0; + int depth = 0; + + do + { + if (!quoted && *s == '(') + depth++; + else if (!quoted && *s == ')') + depth--; + else if (*s == '\\') + { + s++; + if (*s) + s++; + continue; + } + else if (*s == '\"') + quoted = quoted ? 0 : 1; + s++; + } + while (depth > 0 && s && *s); + SKIPWS (s); + return s; +} + diff -r b40a9921b7d5 -r 18ca3373e34a imap/imap_private.h --- a/imap/imap_private.h Wed Mar 28 20:36:18 2012 +0100 +++ b/imap/imap_private.h Wed Mar 28 20:49:04 2012 +0100 @@ -300,6 +300,7 @@ void imap_parse_bodystructure (MESSAGE *msg, char *pc); char *first_text_part_number (MESSAGE *msg); void imap_parse_envelope (BODY *part, char *pc); +char *imap_skip_to_rparen (char *s); #if USE_HCACHE /* typedef size_t (*hcache_keylen_t)(const char* fn); */ # HG changeset patch # User [email protected] # Date 1333033413 -3600 # Branch HEAD # Node ID 40818e290ba19300112b5d49f7087f0647ab89a1 # Parent 18ca3373e34a9903fbd11cc308e5bf7d7ed82ec8 Removed some debugging diff -r 18ca3373e34a -r 40818e290ba1 imap/message.c --- a/imap/message.c Wed Mar 28 20:49:04 2012 +0100 +++ b/imap/message.c Thu Mar 29 16:03:33 2012 +0100 @@ -537,7 +537,8 @@ /* Load the first text part of the message */ char cmdbuf[32]; snprintf (cmdbuf, sizeof (cmdbuf), option (OPTIMAPPEEK) ? "BODY.PEEK[%s]" : "BODY[%s]", first_text_part_number (msg)); - snprintf (buf, sizeof (buf), "UID FETCH %u (ENVELOPE %s)", HEADER_DATA(h)->uid, cmdbuf); + /*snprintf (buf, sizeof (buf), "UID FETCH %u (ENVELOPE %s)", HEADER_DATA(h)->uid, cmdbuf);*/ + snprintf (buf, sizeof (buf), "UID FETCH %u (RFC822.HEADER %s)", HEADER_DATA(h)->uid, cmdbuf); imap_cmd_start (idata, buf); do { @@ -577,20 +578,18 @@ M_PROGRESS_SIZE, NetInc, bytes); rc = imap_read_literal (msg->fp, idata, bytes, &progressbar); if (rc < 0) - {printf("\r\nHEADER bad literal\r\n"); - goto bail;} + goto bail; if ((rc = imap_cmd_step (idata)) != IMAP_CMD_CONTINUE) - {printf("\r\nHEADER bad last line\r\n"); - goto bail;} + goto bail; pc = idata->buf; pc = imap_next_word (pc); } else if (ascii_strncasecmp ("ENVELOPE", pc, 8) == 0) { - mutt_message _("Parsing envelope..."); pc = imap_next_word (pc); imap_parse_envelope (msg->content, pc); pc = imap_skip_to_rparen (pc); + SKIPWS (pc); } else if (ascii_strncasecmp ("BODY[", pc, 5) == 0) { @@ -598,18 +597,15 @@ if (imap_get_literal_count(pc, &bytes) < 0) { imap_error ("imap_fetch_message()", buf); - printf("\r\nBODYS literal count bad: %s\r\n", buf); goto bail; } mutt_progress_init (&progressbar, _("Fetching message body..."), M_PROGRESS_SIZE, NetInc, bytes); rc = imap_read_literal (msg->fp, idata, bytes, &progressbar); if (rc < 0) - {printf("\r\nBODYS bad literal\r\n"); - goto bail;} + goto bail; if ((rc = imap_cmd_step (idata)) != IMAP_CMD_CONTINUE) - {printf("\r\nBODYS bad last line\r\n"); - goto bail;} + goto bail; pc = idata->buf; pc = imap_next_word (pc); @@ -618,8 +614,7 @@ else if ((ascii_strncasecmp ("FLAGS", pc, 5) == 0) && !h->changed) { if ((pc = imap_set_flags (idata, h, pc)) == NULL) - {printf("\r\nBODYS bad flags\r\n"); - goto bail;} + goto bail; pc = imap_next_word (pc); } else
