Author: atsushi
Date: 2007-10-19 03:25:50 -0400 (Fri, 19 Oct 2007)
New Revision: 87814
Modified:
trunk/mcs/class/System/System.Net.Mail/AlternateView.cs
trunk/mcs/class/System/System.Net.Mail/Attachment.cs
trunk/mcs/class/System/System.Net.Mail/AttachmentBase.cs
trunk/mcs/class/System/System.Net.Mail/ChangeLog
trunk/mcs/class/System/System.Net.Mail/SmtpClient.cs
trunk/mcs/class/System/Test/System.Net.Mail/AlternateViewTest.cs
trunk/mcs/class/System/Test/System.Net.Mail/ChangeLog
Log:
2007-10-19 Atsushi Enomoto <[EMAIL PROTECTED]>
* AlternateView.cs, AttachmentView.cs, AttachmentBase.cs :
reverted default back to TransferEncoding.Base64 again, and use
QuotedPrintable only when created from string.
No need to check null Stream at AlternateView.ctor(). See base.
* SmtpClient.cs : For multipart message, do not send body twice (it
still emits extraneous part, which should be fixed too).
Do not premise charset existence in every AttachmentBase.
* AlternateViewTest.cs : default TransferEncoding value is more
complicated.
Modified: trunk/mcs/class/System/System.Net.Mail/AlternateView.cs
===================================================================
--- trunk/mcs/class/System/System.Net.Mail/AlternateView.cs 2007-10-19
05:37:24 UTC (rev 87813)
+++ trunk/mcs/class/System/System.Net.Mail/AlternateView.cs 2007-10-19
07:25:50 UTC (rev 87814)
@@ -65,20 +65,14 @@
public AlternateView (Stream contentStream) : base
(contentStream)
{
- if (contentStream == null)
- throw new ArgumentNullException ();
}
public AlternateView (Stream contentStream, string mediaType) :
base (contentStream, mediaType)
{
- if (contentStream == null)
- throw new ArgumentNullException ();
}
public AlternateView (Stream contentStream, ContentType
contentType) : base (contentStream, contentType)
{
- if (contentStream == null)
- throw new ArgumentNullException ();
}
#endregion // Constructors
@@ -103,7 +97,9 @@
if (content == null)
throw new ArgumentNullException ();
MemoryStream ms = new MemoryStream
(Encoding.UTF8.GetBytes (content));
- return new AlternateView (ms);
+ AlternateView av = new AlternateView (ms);
+ av.TransferEncoding = TransferEncoding.QuotedPrintable;
+ return av;
}
public static AlternateView CreateAlternateViewFromString
(string content, ContentType contentType)
@@ -111,7 +107,9 @@
if (content == null)
throw new ArgumentNullException ();
MemoryStream ms = new MemoryStream
(Encoding.UTF8.GetBytes (content));
- return new AlternateView (ms, contentType);
+ AlternateView av = new AlternateView (ms, contentType);
+ av.TransferEncoding = TransferEncoding.QuotedPrintable;
+ return av;
}
public static AlternateView CreateAlternateViewFromString
(string content, Encoding encoding, string mediaType)
@@ -119,7 +117,9 @@
if (content == null)
throw new ArgumentNullException ();
MemoryStream ms = new MemoryStream (encoding.GetBytes
(content));
- return new AlternateView (ms, mediaType);
+ AlternateView av = new AlternateView (ms, mediaType);
+ av.TransferEncoding = TransferEncoding.QuotedPrintable;
+ return av;
}
protected override void Dispose (bool disposing)
Modified: trunk/mcs/class/System/System.Net.Mail/Attachment.cs
===================================================================
--- trunk/mcs/class/System/System.Net.Mail/Attachment.cs 2007-10-19
05:37:24 UTC (rev 87813)
+++ trunk/mcs/class/System/System.Net.Mail/Attachment.cs 2007-10-19
07:25:50 UTC (rev 87814)
@@ -119,7 +119,9 @@
sw.Write (content);
sw.Flush ();
ms.Position = 0;
- return new Attachment (ms, contentType);
+ Attachment a = new Attachment (ms, contentType);
+ a.TransferEncoding = TransferEncoding.QuotedPrintable;
+ return a;
}
public static Attachment CreateAttachmentFromString (string
content, string name)
@@ -132,6 +134,7 @@
sw.Flush ();
ms.Position = 0;
Attachment a = new Attachment (ms, new ContentType
("text/plain"));
+ a.TransferEncoding = TransferEncoding.QuotedPrintable;
a.Name = name;
return a;
}
@@ -145,7 +148,9 @@
sw.Write (content);
sw.Flush ();
ms.Position = 0;
- return new Attachment (ms, name, mediaType);
+ Attachment a = new Attachment (ms, name, mediaType);
+ a.TransferEncoding = TransferEncoding.QuotedPrintable;
+ return a;
}
#endregion // Methods
Modified: trunk/mcs/class/System/System.Net.Mail/AttachmentBase.cs
===================================================================
--- trunk/mcs/class/System/System.Net.Mail/AttachmentBase.cs 2007-10-19
05:37:24 UTC (rev 87813)
+++ trunk/mcs/class/System/System.Net.Mail/AttachmentBase.cs 2007-10-19
07:25:50 UTC (rev 87814)
@@ -43,7 +43,7 @@
string id;
ContentType contentType = new ContentType ();
Stream contentStream;
- TransferEncoding transferEncoding =
TransferEncoding.QuotedPrintable;
+ TransferEncoding transferEncoding = TransferEncoding.Base64;
#endregion // Fields
Modified: trunk/mcs/class/System/System.Net.Mail/ChangeLog
===================================================================
--- trunk/mcs/class/System/System.Net.Mail/ChangeLog 2007-10-19 05:37:24 UTC
(rev 87813)
+++ trunk/mcs/class/System/System.Net.Mail/ChangeLog 2007-10-19 07:25:50 UTC
(rev 87814)
@@ -1,3 +1,13 @@
+2007-10-19 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * AlternateView.cs, AttachmentView.cs, AttachmentBase.cs :
+ reverted default back to TransferEncoding.Base64 again, and use
+ QuotedPrintable only when created from string.
+ No need to check null Stream at AlternateView.ctor(). See base.
+ * SmtpClient.cs : For multipart message, do not send body twice (it
+ still emits extraneous part, which should be fixed too).
+ Do not premise charset existence in every AttachmentBase.
+
2007-10-17 Atsushi Enomoto <[EMAIL PROTECTED]>
* AlternateView.cs : dispose linked resources. Remove MonoTODOs.
Modified: trunk/mcs/class/System/System.Net.Mail/SmtpClient.cs
===================================================================
--- trunk/mcs/class/System/System.Net.Mail/SmtpClient.cs 2007-10-19
05:37:24 UTC (rev 87813)
+++ trunk/mcs/class/System/System.Net.Mail/SmtpClient.cs 2007-10-19
07:25:50 UTC (rev 87814)
@@ -599,8 +599,8 @@
SendHeader (HeaderName.ContentTransferEncoding,
GetTransferEncodingName (message.ContentTransferEncoding));
SendData (string.Empty);
- SendData (EncodeBody (message));
- SendData (string.Empty);
+ //SendData (EncodeBody (message));
+ //SendData (string.Empty);
message.AlternateViews.Add
(AlternateView.CreateAlternateViewFromString (message.Body, new ContentType
("text/plain")));
@@ -642,7 +642,8 @@
break;
case TransferEncoding.QuotedPrintable:
StreamReader sr = new StreamReader
(alternateViews [i].ContentStream);
- SendData (ToQuotedPrintable
(sr.ReadToEnd (), Encoding.GetEncoding (contentType.CharSet)));
+ Encoding encoding = contentType.CharSet
!= null ? Encoding.GetEncoding (contentType.CharSet) : Encoding.ASCII;
+ SendData (ToQuotedPrintable
(sr.ReadToEnd (), encoding));
break;
case TransferEncoding.SevenBit:
case TransferEncoding.Unknown:
@@ -677,7 +678,8 @@
break;
case TransferEncoding.QuotedPrintable:
StreamReader sr = new StreamReader
(attachments [i].ContentStream);
- SendData (ToQuotedPrintable
(sr.ReadToEnd (), Encoding.GetEncoding (contentType.CharSet)));
+ Encoding encoding = contentType.CharSet
!= null ? Encoding.GetEncoding (contentType.CharSet) : Encoding.ASCII;
+ SendData (ToQuotedPrintable
(sr.ReadToEnd (), encoding));
break;
case TransferEncoding.SevenBit:
case TransferEncoding.Unknown:
Modified: trunk/mcs/class/System/Test/System.Net.Mail/AlternateViewTest.cs
===================================================================
--- trunk/mcs/class/System/Test/System.Net.Mail/AlternateViewTest.cs
2007-10-19 05:37:24 UTC (rev 87813)
+++ trunk/mcs/class/System/Test/System.Net.Mail/AlternateViewTest.cs
2007-10-19 07:25:50 UTC (rev 87814)
@@ -67,7 +67,11 @@
[Test]
public void TransferEncodingTest ()
{
- Assert.AreEqual (TransferEncoding.QuotedPrintable,
av.TransferEncoding);
+ Assert.AreEqual (TransferEncoding.QuotedPrintable,
av.TransferEncoding, "#1");
+
+ MemoryStream ms = new MemoryStream (new byte [] {1, 2,
3});
+ Assert.AreEqual (TransferEncoding.Base64, new
AlternateView (ms).TransferEncoding, "#2");
+ Assert.AreEqual (TransferEncoding.Base64, new
AlternateView (ms, "text/plain").TransferEncoding, "#3");
}
}
}
Modified: trunk/mcs/class/System/Test/System.Net.Mail/ChangeLog
===================================================================
--- trunk/mcs/class/System/Test/System.Net.Mail/ChangeLog 2007-10-19
05:37:24 UTC (rev 87813)
+++ trunk/mcs/class/System/Test/System.Net.Mail/ChangeLog 2007-10-19
07:25:50 UTC (rev 87814)
@@ -1,3 +1,8 @@
+2007-10-19 Atsushi Enomoto <[EMAIL PROTECTED]>
+
+ * AlternateViewTest.cs : default TransferEncoding value is more
+ complicated.
+
2007-10-17 Atsushi Enomoto <[EMAIL PROTECTED]>
* LinkedResourceTest.cs, AttachmentTest.cs, AlternateViewTest.cs:
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches