Author: rfm
Date: Mon Jun 6 23:16:30 2016
New Revision: 39841
URL: http://svn.gna.org/viewcvs/gnustep?rev=39841&view=rev
Log:
Improve API for making doc 7bit safe
Modified:
libs/base/trunk/ChangeLog
libs/base/trunk/Headers/GNUstepBase/GSMime.h
libs/base/trunk/Source/Additions/GSMime.m
Modified: libs/base/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=39841&r1=39840&r2=39841&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog (original)
+++ libs/base/trunk/ChangeLog Mon Jun 6 23:16:30 2016
@@ -1,6 +1,13 @@
+2016-06-06 Richard Frith-Macdonald <[email protected]>
+
+ * 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 <[email protected]>
- * Tools/AGSParser.m: Ignore __asm__ directives
+ * Tools/AGSParser.m: Ignore __asm__ directives
2016-05-19 Seong Gu Lee <[email protected]>
Modified: libs/base/trunk/Headers/GNUstepBase/GSMime.h
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Headers/GNUstepBase/GSMime.h?rev=39841&r1=39840&r2=39841&view=diff
==============================================================================
--- libs/base/trunk/Headers/GNUstepBase/GSMime.h (original)
+++ libs/base/trunk/Headers/GNUstepBase/GSMime.h Mon Jun 6 23:16:30 2016
@@ -171,7 +171,8 @@
- (NSString*) contentSubtype;
- (NSString*) contentType;
- (NSArray*) contentsByName: (NSString*)key;
-- (void) convertToBase64;
+- (void) convertTo7BitSafe;
+- (void) convertToBase64; // DEPRECATED ... use convertTo7BitSafe
- (void) convertToBinary;
- (NSData*) convertToData;
- (NSString*) convertToText;
Modified: libs/base/trunk/Source/Additions/GSMime.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/Additions/GSMime.m?rev=39841&r1=39840&r2=39841&view=diff
==============================================================================
--- libs/base/trunk/Source/Additions/GSMime.m (original)
+++ libs/base/trunk/Source/Additions/GSMime.m Mon Jun 6 23:16:30 2016
@@ -5712,11 +5712,12 @@
/**
* 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.
- */
-- (void) convertToBase64
+ * (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) convertTo7BitSafe
{
if ([content isKindOfClass: NSArrayClass] == YES)
{
@@ -5725,7 +5726,7 @@
while ((d = [e nextObject]) != nil)
{
- [d convertToBase64];
+ [d convertTo7BitSafe];
}
}
else
@@ -5735,14 +5736,28 @@
if ([v isEqual: @"binary"] == YES || [v isEqual: @"8bit"] == YES)
{
- [h setValue: @"base64"];
- }
- }
-}
-
-/**
- * Converts any base64 encoded parts of the receiver's content to be
- * binary encoded instead ... a convenience method to
+ 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 (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 @@
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"];
}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs