aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-10-29 00:54:44 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-10-29 00:54:44 +0800
commit9975438eba281e709db995ca5947cc6d62c2d3d2 (patch)
tree5899f3ceb945cb578c35398ed1d2489ffe734fae /camel/providers
parentb374485568249c439f17c64f40320902fab37123 (diff)
downloadgsoc2013-evolution-9975438eba281e709db995ca5947cc6d62c2d3d2.tar
gsoc2013-evolution-9975438eba281e709db995ca5947cc6d62c2d3d2.tar.gz
gsoc2013-evolution-9975438eba281e709db995ca5947cc6d62c2d3d2.tar.bz2
gsoc2013-evolution-9975438eba281e709db995ca5947cc6d62c2d3d2.tar.lz
gsoc2013-evolution-9975438eba281e709db995ca5947cc6d62c2d3d2.tar.xz
gsoc2013-evolution-9975438eba281e709db995ca5947cc6d62c2d3d2.tar.zst
gsoc2013-evolution-9975438eba281e709db995ca5947cc6d62c2d3d2.zip
Handle literal strings. (envelope_decode_date): Same. Fixes bug #68894.
2004-10-28 Jeffrey Stedfast <fejj@ximian.com> * providers/imap4/camel-imap4-summary.c (envelope_decode_nstring): Handle literal strings. (envelope_decode_date): Same. Fixes bug #68894. svn path=/trunk/; revision=27759
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap4/camel-imap4-summary.c25
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;