diff --git a/OpenPop/Mime/Header/MessageHeader.cs b/OpenPop/Mime/Header/MessageHeader.cs index 438e9d8..e761360 100644 --- a/OpenPop/Mime/Header/MessageHeader.cs +++ b/OpenPop/Mime/Header/MessageHeader.cs @@ -40,8 +40,15 @@ public sealed class MessageHeader /// public string ContentDescription { get; private set; } - /// - /// ID of the content part (like an attached image). Used with MultiPart messages.
+ /// + /// The Content location.
+ ///
+ /// if no Content-Location header was present in the message. + ///
+ public string ContentLocation { get; private set; } + + /// + /// ID of the content part (like an attached image). Used with MultiPart messages.
///
/// if no Content-ID header field was present in the message. ///
@@ -440,7 +447,12 @@ private void ParseHeader(string headerName, string headerValue) // Human description of for example a file. Can be encoded ContentDescription = EncodedWord.Decode(headerValue.Trim()); break; - + + // See https://tools.ietf.org/html/rfc2557#page-6 + case "CONTENT-LOCATION": + ContentLocation = headerValue.Trim(); + break; + // See http://tools.ietf.org/html/rfc2045#section-5.1 // Example: Content-type: text/plain; charset="us-ascii" case "CONTENT-TYPE": @@ -473,4 +485,4 @@ private void ParseHeader(string headerName, string headerValue) } #endregion } -} \ No newline at end of file +} diff --git a/OpenPop/Mime/MessagePart.cs b/OpenPop/Mime/MessagePart.cs index 78c480f..5eedd4d 100644 --- a/OpenPop/Mime/MessagePart.cs +++ b/OpenPop/Mime/MessagePart.cs @@ -100,6 +100,13 @@ public class MessagePart /// if no Content-Description header was present in the message.
///
public string ContentDescription { get; private set; } + + /// + /// his header describes the Content location.
+ ///
+ /// if no Content-Location header was present in the message.
+ ///
+ public string ContentLocation { get; private set; } /// /// This header describes the Content encoding during transfer.
@@ -108,7 +115,7 @@ public class MessagePart /// to the default of SevenBit in accordance to the RFC. ///
/// See RFC 2045 section 6 for details - public ContentTransferEncoding ContentTransferEncoding { get; private set; } + public ContentTransferEncoding ContentTransferEncoding { get; private set; } /// /// ID of the content part (like an attached image). Used with MultiPart messages.
@@ -226,7 +233,7 @@ internal MessagePart(byte[] rawBody, MessageHeader headers, IParsingErrorHandler ContentTransferEncoding = headers.ContentTransferEncoding; ContentId = headers.ContentId; ContentDisposition = headers.ContentDisposition; - + ContentLocation = headers.ContentLocation; FileName = FindFileName(ContentType, ContentDisposition, "(no name)"); try { @@ -545,4 +552,4 @@ public void Save(Stream messageStream) } #endregion } -} \ No newline at end of file +} diff --git a/OpenPopUnitTests/Mime/MessagePartTests.cs b/OpenPopUnitTests/Mime/MessagePartTests.cs index 19188bb..ebef099 100644 --- a/OpenPopUnitTests/Mime/MessagePartTests.cs +++ b/OpenPopUnitTests/Mime/MessagePartTests.cs @@ -179,6 +179,20 @@ public void TestContentDescription() string actualDescription = messagePart.ContentDescription; Assert.AreEqual(expectedDescription, actualDescription); } + + [Test] + public void TestContentLocation() + { + const string messagePartContent = + "Content-Location: Mime-Location\r\n" + + "\r\n"; // End of message headers + + MessagePart messagePart = new Message(Encoding.ASCII.GetBytes(messagePartContent)).MessagePart; + + const string expectedLocation = "Mime-Location"; + string actualLocation = messagePart.ContentLocation; + Assert.AreEqual(expectedLocation, actualLocation); + } [Test] public void TestContentDescriptionTwo()