diff options
Diffstat (limited to 'imap/fetch.c')
| -rw-r--r-- | imap/fetch.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/imap/fetch.c b/imap/fetch.c index fd25265..5daf150 100644 --- a/imap/fetch.c +++ b/imap/fetch.c @@ -1,5 +1,5 @@ /* -** Copyright 1998 - 2010 Double Precision, Inc. +** Copyright 1998 - 2018 Double Precision, Inc. ** See COPYING for distribution information. */ @@ -249,7 +249,7 @@ int do_fetch(unsigned long n, int byuid, void *p) struct rfc2045 *rfc2045p; int seen; int open_err; - const char *cannot_open_because=""; + int unicode_err=0; fp=NULL; open_err=0; @@ -284,13 +284,8 @@ int do_fetch(unsigned long n, int byuid, void *p) seen=1; if (rc < 0) { - open_err=1; - cannot_open_because= - " because it is a Unicode message and your" - " E-mail reader did not enable Unicode support." - " Please use an E-mail reader that supports" - " IMAP with UTF-8 (see" - " https://tools.ietf.org/html/rfc6855.html)"; + rc=0; + unicode_err=1; } if ((fi=fi->next) != 0) writes(" "); } @@ -300,11 +295,25 @@ int do_fetch(unsigned long n, int byuid, void *p) { writes("* NO [ALERT] Cannot open message "); writen(n); - writes(cannot_open_because); writes("\r\n"); return (0); } + if (current_maildir_info.msgs[n-1].err8bitflag) + unicode_err=0; + + if (unicode_err) + { + current_maildir_info.msgs[n-1].err8bitflag=1; + + writes("* OK [ALERT] Message "); + writen(n); + writes(" appears to be a Unicode message and your" + " E-mail reader did not enable Unicode support." + " Please use an E-mail reader that supports" + " IMAP with UTF-8 (see" + " https://tools.ietf.org/html/rfc6855.html)\r\n"); + } #if SMAP if (!smapflag) @@ -450,7 +459,10 @@ static int fetchitem(FILE **fp, int *open_err, struct fetchinfo *fi, if (mimecorrectness && !enabled_utf8 && ((*mimep)->rfcviolation & RFC2045_ERR8BITHEADER)) - return -1; + { + /* Still return -1, in order to [ALERT] the client */ + rc= -1; + } (*fetchfunc)(*fp, fi, i, msgnum, *mimep); return (rc); |
