From: helge Date: Tue, 13 Dec 2005 15:14:50 +0000 (+0000) Subject: fixed OGo bug #1587 (qp decoding in IMAP4 envelopes) X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54ce14f3e59e81d51ab21b69dcecf6a7abb4403e;p=sope fixed OGo bug #1587 (qp decoding in IMAP4 envelopes) git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1196 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-mime/ChangeLog b/sope-mime/ChangeLog index 5437929d..fe348fcd 100644 --- a/sope-mime/ChangeLog +++ b/sope-mime/ChangeLog @@ -1,3 +1,11 @@ +2005-12-13 Helge Hess + + * v4.5.238 + + * NGImap4: fixed QP handling in IMAP4 envelopes (#1587) + + * NGMime: code cleanups + 2005-11-17 Helge Hess * properly include string.h where required to avoid warnings (v4.5.237) diff --git a/sope-mime/NGImap4/ChangeLog b/sope-mime/NGImap4/ChangeLog index 79279d5a..f1d86707 100644 --- a/sope-mime/NGImap4/ChangeLog +++ b/sope-mime/NGImap4/ChangeLog @@ -1,3 +1,8 @@ +2005-12-13 Helge Hess + + * NGImap4ResponseParser.m: properly decode quoted-printable headers + when the QP marker starts somewhere inside the header value + 2005-07-27 Helge Hess * NGImap4Connection.m: fixed gcc 4.0 warnings diff --git a/sope-mime/NGImap4/NGImap4ResponseParser.m b/sope-mime/NGImap4/NGImap4ResponseParser.m index d3eeedca..fb89b618 100644 --- a/sope-mime/NGImap4/NGImap4ResponseParser.m +++ b/sope-mime/NGImap4/NGImap4ResponseParser.m @@ -1123,8 +1123,8 @@ static BOOL _parseThreadResponse(NGImap4ResponseParser *self, if ([_string isKindOfClass:StrClass]) { if ([_string length] <= 6 /* minimum size */) return _string; - if ([_string characterAtIndex:0] == '=' && - [_string characterAtIndex:1] == '?') { + + if ([_string rangeOfString:@"=?"].length > 0) { NSData *data; if (debugOn) @@ -1172,7 +1172,7 @@ static BOOL _parseThreadResponse(NGImap4ResponseParser *self, /* parse personal name, can be with quoted printable encoding! */ pname = [self _parseQuotedStringOrNIL]; - if ([pname isNotNull]) + if ([pname isNotNull]) // TODO: headerField 'subject'?? explain! pname = [self _decodeQP:pname headerField:@"subject"]; [self _consumeOptionalSpace]; diff --git a/sope-mime/NGMime/ChangeLog b/sope-mime/NGMime/ChangeLog index 084a4907..e13d2c4a 100644 --- a/sope-mime/NGMime/ChangeLog +++ b/sope-mime/NGMime/ChangeLog @@ -1,3 +1,9 @@ +2005-12-13 Helge Hess + + * NGMimeAddressHeaderFieldGenerator.m: use -warnWithFormat: + + * NGMimeUtilities.h: code cleanups + 2005-11-17 Helge Hess * properly include string.h where required to avoid warnings diff --git a/sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m b/sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m index c20d12a9..f4cbd869 100644 --- a/sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m +++ b/sope-mime/NGMime/NGMimeAddressHeaderFieldGenerator.m @@ -91,7 +91,7 @@ static int UseLFSeperatedAddressEntries = -1; enumerator = [[parser parseAddressList] objectEnumerator]; result = [[NSMutableString alloc] initWithCapacity:128]; - while ((obj = [enumerator nextObject])) { + while ((obj = [enumerator nextObject]) != nil) { NSString *tmp; char *buffer; unsigned bufLen, cnt; @@ -159,8 +159,8 @@ static int UseLFSeperatedAddressEntries = -1; length:(cnt + isoLen + desLen + isoEndLen)]; } else { - [self logWithFormat:@"WARNING(%s:%i): An error occour during " - @"quoted-printable decoding", + [self warnWithFormat: + @"%s:%i: An error occour during quoted-printable decoding", __PRETTY_FUNCTION__, __LINE__]; } if (des) free(des); diff --git a/sope-mime/NGMime/NGMimeUtilities.h b/sope-mime/NGMime/NGMimeUtilities.h index d3f6c24d..d5df2bdf 100644 --- a/sope-mime/NGMime/NGMimeUtilities.h +++ b/sope-mime/NGMime/NGMimeUtilities.h @@ -125,24 +125,29 @@ static inline BOOL isMime_ValidTypeAttributeChar(unsigned char _byte) { } static inline NSData *_quotedPrintableEncoding(NSData *_data) { - const char *bytes = [_data bytes]; - unsigned int length = [_data length]; + const char *bytes; + unsigned int length; NSData *result = nil; char *des = NULL; unsigned int desLen = 0; - unsigned cnt = length; - const char *test = bytes; + unsigned cnt; + const char *test; BOOL doEnc = NO; - while (cnt > 0) { + bytes = [_data bytes]; + length = [_data length]; + cnt = length; + test = bytes; + + for (cnt = length, test = bytes; cnt > 0; test++, cnt--) { if ((unsigned char)*test > 127) { doEnc = YES; break; } - test++; - cnt--; } - if (!doEnc) return _data; + if (!doEnc) + return _data; + desLen = length *3; des = NGMallocAtomic(sizeof(char) * desLen + 2); diff --git a/sope-mime/Version b/sope-mime/Version index 98802f86..662bf876 100644 --- a/sope-mime/Version +++ b/sope-mime/Version @@ -2,7 +2,7 @@ MAJOR_VERSION:=4 MINOR_VERSION:=5 -SUBMINOR_VERSION:=237 +SUBMINOR_VERSION:=238 # v4.5.214 requires libNGExtensions v4.5.146 # v4.2.149 requires libNGStreams v4.2.34