Improve API for making doc 7bit safe

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39841 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2016-06-06 21:16:30 +00:00
parent e7c50a1eb2
commit 0adeacda9a
3 changed files with 35 additions and 11 deletions

View file

@ -1,6 +1,13 @@
2016-06-06 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GSMime.m:
Conversion of multipart document between base64 and binary encoding
should use quoted-printable rather than base64 for text parts.
Rename -convertToBase64 to be -convertTo7BitSafe instead.
2016-05-27 Niels Grewe <niels.grewe@halbordnung.de>
* Tools/AGSParser.m: Ignore __asm__ directives
* Tools/AGSParser.m: Ignore __asm__ directives
2016-05-19 Seong Gu Lee <sgleehd@gmail.com>

View file

@ -171,7 +171,8 @@ extern "C" {
- (NSString*) contentSubtype;
- (NSString*) contentType;
- (NSArray*) contentsByName: (NSString*)key;
- (void) convertToBase64;
- (void) convertTo7BitSafe;
- (void) convertToBase64; // DEPRECATED ... use convertTo7BitSafe
- (void) convertToBinary;
- (NSData*) convertToData;
- (NSString*) convertToText;

View file

@ -5712,11 +5712,12 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
/**
* Converts any binary parts of the receiver's content to be base64
* encoded rather than 8bit or binary encoded ... a convenience method to
* make the results of the -rawMimeData method safe for sending via
* routes which only support 7bit data.
* (or quoted-printable for text parts) encoded rather than 8bit or
* binary encoded ... a convenience method to make the results of
* the -rawMimeData method safe for sending via routes which only
* support 7bit data.
*/
- (void) convertToBase64
- (void) convertTo7BitSafe
{
if ([content isKindOfClass: NSArrayClass] == YES)
{
@ -5725,7 +5726,7 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
while ((d = [e nextObject]) != nil)
{
[d convertToBase64];
[d convertTo7BitSafe];
}
}
else
@ -5735,14 +5736,28 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
if ([v isEqual: @"binary"] == YES || [v isEqual: @"8bit"] == YES)
{
[h setValue: @"base64"];
h = [self headerNamed: @"content-type"];
v = [h value];
if ([v hasPrefix: @"text/"])
{
[h setValue: @"quoted-printable"];
}
else
{
[h setValue: @"base64"];
}
}
}
}
- (void) convertToBase64
{
[self convertTo7BitSafe];
}
/**
* Converts any base64 encoded parts of the receiver's content to be
* binary encoded instead ... a convenience method to
* Converts any base64 (or quoted-printable) encoded parts of the receiver's
* content to be binary encoded instead ... a convenience method to
* shrink down the size of the message when converted to data using
* the -rawMimeData method.
*/
@ -5763,7 +5778,8 @@ appendString(NSMutableData *m, NSUInteger offset, NSUInteger fold,
GSMimeHeader *h = [self headerNamed: @"content-transfer-encoding"];
NSString *v = [h value];
if ([v isEqual: @"base64"] == YES)
if ([v isEqual: @"base64"] == YES
|| [v isEqual: @"quoted-printable"] == YES)
{
[h setValue: @"binary"];
}