From: helge Date: Mon, 11 Jul 2005 15:49:27 +0000 (+0000) Subject: improved text generator in some edge case X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84775e6c64b903bee57a2f8b3c7259ff335371c9;p=sope improved text generator in some edge case git-svn-id: http://svn.opengroupware.org/SOPE/trunk@886 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-mime/ChangeLog b/sope-mime/ChangeLog index b1e9a590..5e23813b 100644 --- a/sope-mime/ChangeLog +++ b/sope-mime/ChangeLog @@ -1,5 +1,7 @@ 2005-07-11 Helge Hess + * NGMime: added a safeguard for some edge case (v4.5.224) + * NGImap4: added NGImap4Connection, NGImap4ConnectionManager (v4.5.223) 2005-07-07 Helge Hess diff --git a/sope-mime/NGMime/ChangeLog b/sope-mime/NGMime/ChangeLog index 47664137..ad704b69 100644 --- a/sope-mime/NGMime/ChangeLog +++ b/sope-mime/NGMime/ChangeLog @@ -1,3 +1,8 @@ +2005-07-11 Helge Hess + + * NGMimeBodyGenerator.m: improved reliability against invalid body + objects + 2005-04-24 Helge Hess * fixed gcc 4.0 warnings diff --git a/sope-mime/NGMime/NGMimeBodyGenerator.m b/sope-mime/NGMime/NGMimeBodyGenerator.m index 9c687f11..09310ed7 100644 --- a/sope-mime/NGMime/NGMimeBodyGenerator.m +++ b/sope-mime/NGMime/NGMimeBodyGenerator.m @@ -106,22 +106,25 @@ static BOOL debugOn = NO; id body; encoding = [NSString defaultCStringEncoding]; - body = [_part body]; + body = [_part body]; + data = nil; if ([body isKindOfClass:[NSString class]]) { // TODO: deal with charset in content-type! data = [body dataUsingEncoding:encoding]; } - else + else if ([body respondsToSelector:@selector(bytes)]) data = body; -#if 0 - else { - NSLog(@"WARNING: textBodyGenerator expect that body is" - @" kind of class NSString"); + else if ([body respondsToSelector:@selector(dataUsingEncoding:)]) + data = [body dataUsingEncoding:encoding]; + else if (body != nil) { + [self logWithFormat:@"ERROR: unexpected part body: %@", body]; + return nil; } -#endif + if (data == nil) { - NSLog(@"WARNING(%s): generate empty body", __PRETTY_FUNCTION__); + [self logWithFormat:@"WARNING(%s): generate empty body", + __PRETTY_FUNCTION__]; data = [NSData data]; } return [self encodeData:data forPart:_part additionalHeaders:_addHeaders]; diff --git a/sope-mime/Version b/sope-mime/Version index bd3b377c..ee8cc21f 100644 --- a/sope-mime/Version +++ b/sope-mime/Version @@ -2,7 +2,7 @@ MAJOR_VERSION:=4 MINOR_VERSION:=5 -SUBMINOR_VERSION:=223 +SUBMINOR_VERSION:=224 # v4.5.214 requires libNGExtensions v4.5.146 # v4.2.149 requires libNGStreams v4.2.34