diff options
Diffstat (limited to 'camel/providers/imap4/camel-imap4-summary.c')
-rw-r--r-- | camel/providers/imap4/camel-imap4-summary.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/camel/providers/imap4/camel-imap4-summary.c b/camel/providers/imap4/camel-imap4-summary.c index 706617f17b..f894624273 100644 --- a/camel/providers/imap4/camel-imap4-summary.c +++ b/camel/providers/imap4/camel-imap4-summary.c @@ -31,6 +31,7 @@ #include <utime.h> #include <fcntl.h> #include <ctype.h> +#include <errno.h> #include <e-util/md5-utils.h> @@ -283,8 +284,10 @@ envelope_decode_addresses (CamelIMAP4Engine *engine, char **addrlist, CamelExcep static int envelope_decode_date (CamelIMAP4Engine *engine, time_t *date, CamelException *ex) { + unsigned char *literal = NULL; camel_imap4_token_t token; const char *nstring; + size_t n; if (camel_imap4_engine_next_token (engine, &token, ex) == -1) return -1; @@ -299,6 +302,12 @@ envelope_decode_date (CamelIMAP4Engine *engine, time_t *date, CamelException *ex case CAMEL_IMAP4_TOKEN_QSTRING: nstring = token.v.qstring; break; + case CAMEL_IMAP4_TOKEN_LITERAL: + if (camel_imap4_engine_literal (engine, &literal, &n, ex) == -1) + return -1; + + nstring = literal; + break; default: camel_imap4_utils_set_unexpected_token_error (ex, engine, &token); return -1; @@ -306,6 +315,9 @@ envelope_decode_date (CamelIMAP4Engine *engine, time_t *date, CamelException *ex *date = camel_header_decode_date (nstring, NULL); + if (literal) + g_free (literal); + return 0; } @@ -313,6 +325,8 @@ static int envelope_decode_nstring (CamelIMAP4Engine *engine, char **nstring, gboolean rfc2047, CamelException *ex) { camel_imap4_token_t token; + unsigned char *literal; + size_t n; if (camel_imap4_engine_next_token (engine, &token, ex) == -1) return -1; @@ -333,6 +347,17 @@ envelope_decode_nstring (CamelIMAP4Engine *engine, char **nstring, gboolean rfc2 else *nstring = g_strdup (token.v.qstring); break; + case CAMEL_IMAP4_TOKEN_LITERAL: + if (camel_imap4_engine_literal (engine, &literal, &n, ex) == -1) + return -1; + + if (rfc2047) { + *nstring = camel_header_decode_string (literal, NULL); + g_free (literal); + } else + *nstring = literal; + + break; default: camel_imap4_utils_set_unexpected_token_error (ex, engine, &token); return -1; |