Skip to content

Commit

Permalink
Added more interfaces for various MimeEntity subclasses
Browse files Browse the repository at this point in the history
Part of the fix for issue #980
  • Loading branch information
jstedfast committed Dec 9, 2023
1 parent 93a017a commit 66dc8a9
Show file tree
Hide file tree
Showing 18 changed files with 910 additions and 10 deletions.
67 changes: 67 additions & 0 deletions MimeKit/IMessageDeliveryStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
//
// IMessageDeliveryStatus.cs
//
// Author: Jeffrey Stedfast <[email protected]>
//
// Copyright (c) 2013-2023 .NET Foundation and Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

namespace MimeKit {
/// <summary>
/// An interface for a message delivery status MIME part.
/// </summary>
/// <remarks>
/// <para>A message delivery status MIME part is a machine readable notification denoting the
/// delivery status of a message and has a MIME-type of message/delivery-status.</para>
/// <para>For more information, see <a href="https://tools.ietf.org/html/rfc3464">rfc3464</a>.</para>
/// <seealso cref="MultipartReport"/>
/// </remarks>
/// <example>
/// <code language="c#" source="Examples\MessageDeliveryStatusExamples.cs" region="ProcessDeliveryStatusNotification" />
/// </example>
public interface IMessageDeliveryStatus : IMimePart
{
/// <summary>
/// Get the groups of delivery status fields.
/// </summary>
/// <remarks>
/// <para>Gets the groups of delivery status fields. The first <see cref="HeaderList"/>
/// contains the per-message fields while each remaining <see cref="HeaderList"/> contains
/// fields that pertain to particular recipients of the message.</para>
/// <para>For more information about these fields and their values, check out
/// <a href="https://tools.ietf.org/html/rfc3464">rfc3464</a>.</para>
/// <para><a href="https://tools.ietf.org/html/rfc3464#section-2.2">Section 2.2</a> defines
/// the per-message fields while
/// <a href="https://tools.ietf.org/html/rfc3464#section-2.3">Section 2.3</a> defines
/// the per-recipient fields.</para>
/// </remarks>
/// <example>
/// <code language="c#" source="Examples\MessageDeliveryStatusExamples.cs" region="ProcessDeliveryStatusNotification" />
/// </example>
/// <value>The fields.</value>
/// <exception cref="System.ObjectDisposedException">
/// The <see cref="IMessageDeliveryStatus"/> has been disposed.
/// </exception>
HeaderListCollection StatusGroups {
get;
}
}
}
53 changes: 53 additions & 0 deletions MimeKit/IMessageDispositionNotification.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// IMessageDispositionNotification.cs
//
// Author: Jeffrey Stedfast <[email protected]>
//
// Copyright (c) 2013-2023 .NET Foundation and Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

namespace MimeKit {
/// <summary>
/// An interface for a message disposition notification MIME part.
/// </summary>
/// <remarks>
/// A message disposition notification MIME part is a machine readable notification
/// denoting the disposition of a message once it has been successfully delivered
/// and has a MIME-type of message/disposition-notification.
/// <seealso cref="MimeKit.MultipartReport"/>
/// </remarks>
public interface IMessageDispositionNotification : IMimePart
{
/// <summary>
/// Get the disposition notification fields.
/// </summary>
/// <remarks>
/// Gets the disposition notification fields.
/// </remarks>
/// <value>The disposition notification fields.</value>
/// <exception cref="System.ObjectDisposedException">
/// The <see cref="IMessageDispositionNotification"/> has been disposed.
/// </exception>
HeaderList Fields {
get;
}
}
}
51 changes: 51 additions & 0 deletions MimeKit/IMessageFeedbackReport.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
// IMessageFeedbackReport.cs
//
// Author: Jeffrey Stedfast <[email protected]>
//
// Copyright (c) 2013-2023 .NET Foundation and Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

namespace MimeKit {
/// <summary>
/// An interface for a message feedback report MIME part.
/// </summary>
/// <remarks>
/// A <c>message/feedback-report</c> MIME part is a machine readable feedback report.
/// <seealso cref="MimeKit.MultipartReport"/>
/// </remarks>
public interface IMessageFeedbackReport : IMimePart
{
/// <summary>
/// Get the feedback report fields.
/// </summary>
/// <remarks>
/// Gets the feedback report fields.
/// </remarks>
/// <value>The feedback report fields.</value>
/// <exception cref="System.ObjectDisposedException">
/// The <see cref="IMessageFeedbackReport"/> has been disposed.
/// </exception>
HeaderList Fields {
get;
}
}
}
72 changes: 72 additions & 0 deletions MimeKit/IMessagePartial.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//
// IMessagePartial.cs
//
// Author: Jeffrey Stedfast <[email protected]>
//
// Copyright (c) 2013-2023 .NET Foundation and Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

namespace MimeKit {
/// <summary>
/// An interface for a MIME part containing a partial message as its content.
/// </summary>
/// <remarks>
/// <para>The "message/partial" MIME-type is used to split large messages into
/// multiple parts, typically to work around transport systems that have size
/// limitations (for example, some SMTP servers limit have a maximum message
/// size that they will accept).</para>
/// </remarks>
public interface IMessagePartial : IMimePart
{
/// <summary>
/// Get the "id" parameter of the Content-Type header.
/// </summary>
/// <remarks>
/// The "id" parameter is a unique identifier used to match the parts together.
/// </remarks>
/// <value>The identifier.</value>
string Id {
get;
}

/// <summary>
/// Get the "number" parameter of the Content-Type header.
/// </summary>
/// <remarks>
/// The "number" parameter is the sequential (1-based) index of the partial message fragment.
/// </remarks>
/// <value>The part number.</value>
int? Number {
get;
}

/// <summary>
/// Get the "total" parameter of the Content-Type header.
/// </summary>
/// <remarks>
/// The "total" parameter is the total number of pieces that make up the complete message.
/// </remarks>
/// <value>The total number of parts.</value>
int? Total {
get;
}
}
}
83 changes: 83 additions & 0 deletions MimeKit/IMultipartAlternative.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//
// IMultipartAlternative.cs
//
// Author: Jeffrey Stedfast <[email protected]>
//
// Copyright (c) 2013-2023 .NET Foundation and Contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

using MimeKit.Text;

namespace MimeKit {
/// <summary>
/// An interface for a multipart/alternative MIME entity.
/// </summary>
/// <remarks>
/// A multipart/alternative MIME entity contains, as one might expect, is used to offer a list of
/// alternative formats for the main body of the message (usually they will be "text/plain" and
/// "text/html"). These alternatives are in order of increasing faithfulness to the original document
/// (in other words, the last entity will be in a format that, when rendered, will most closely match
/// what the sending client's WYSISYG editor produced).
/// </remarks>
public interface IMultipartAlternative : IMultipart
{
/// <summary>
/// Get the text of the text/plain alternative.
/// </summary>
/// <remarks>
/// Gets the text of the text/plain alternative, if it exists.
/// </remarks>
/// <value>The text if a text/plain alternative exists; otherwise, <c>null</c>.</value>
/// <exception cref="System.ObjectDisposedException">
/// The <see cref="IMultipartAlternative"/> has been disposed.
/// </exception>
string TextBody {
get;
}

/// <summary>
/// Get the HTML-formatted text of the text/html alternative.
/// </summary>
/// <remarks>
/// Gets the HTML-formatted text of the text/html alternative, if it exists.
/// </remarks>
/// <value>The HTML if a text/html alternative exists; otherwise, <c>null</c>.</value>
/// <exception cref="System.ObjectDisposedException">
/// The <see cref="IMultipartAlternative"/> has been disposed.
/// </exception>
string HtmlBody {
get;
}

/// <summary>
/// Get the text body in the specified format.
/// </summary>
/// <remarks>
/// Gets the text body in the specified format, if it exists.
/// </remarks>
/// <returns>The text body in the desired format if it exists; otherwise, <c>null</c>.</returns>
/// <param name="format">The desired text format.</param>
/// <exception cref="System.ObjectDisposedException">
/// The <see cref="IMultipartAlternative"/> has been disposed.
/// </exception>
string GetTextBody (TextFormat format);
}
}
Loading

0 comments on commit 66dc8a9

Please sign in to comment.