Skip to content

Commit

Permalink
Moved the IsAttachment property from MimePart down into MimeEntity
Browse files Browse the repository at this point in the history
  • Loading branch information
jstedfast committed Jun 18, 2015
1 parent 1b631b0 commit f4eea92
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
23 changes: 23 additions & 0 deletions MimeKit/MimeEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,29 @@ public string ContentId {
}
}

/// <summary>
/// Gets a value indicating whether this <see cref="MimePart"/> is an attachment.
/// </summary>
/// <remarks>
/// If the Content-Disposition header is set and has a value of <c>"attachment"</c>,
/// then this property returns <c>true</c>. Otherwise it is assumed that the
/// <see cref="MimePart"/> is not meant to be treated as an attachment.
/// </remarks>
/// <value><c>true</c> if this <see cref="MimePart"/> is an attachment; otherwise, <c>false</c>.</value>
public bool IsAttachment {
get { return ContentDisposition != null && ContentDisposition.IsAttachment; }
set {
if (value) {
if (ContentDisposition == null)
ContentDisposition = new ContentDisposition (ContentDisposition.Attachment);
else if (!ContentDisposition.IsAttachment)
ContentDisposition.Disposition = ContentDisposition.Attachment;
} else if (ContentDisposition != null && ContentDisposition.IsAttachment) {
ContentDisposition.Disposition = ContentDisposition.Inline;
}
}
}

/// <summary>
/// Returns a <see cref="System.String"/> that represents the current <see cref="MimeKit.MimeEntity"/>.
/// </summary>
Expand Down
23 changes: 0 additions & 23 deletions MimeKit/MimePart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,29 +321,6 @@ public IContentObject ContentObject {
get; set;
}

/// <summary>
/// Gets a value indicating whether this <see cref="MimePart"/> is an attachment.
/// </summary>
/// <remarks>
/// If the Content-Disposition header is set and has a value of <c>"attachment"</c>,
/// then this property returns <c>true</c>. Otherwise it is assumed that the
/// <see cref="MimePart"/> is not meant to be treated as an attachment.
/// </remarks>
/// <value><c>true</c> if this <see cref="MimePart"/> is an attachment; otherwise, <c>false</c>.</value>
public bool IsAttachment {
get { return ContentDisposition != null && ContentDisposition.IsAttachment; }
set {
if (value) {
if (ContentDisposition == null)
ContentDisposition = new ContentDisposition (ContentDisposition.Attachment);
else if (!ContentDisposition.IsAttachment)
ContentDisposition.Disposition = ContentDisposition.Attachment;
} else if (ContentDisposition != null && ContentDisposition.IsAttachment) {
ContentDisposition.Disposition = ContentDisposition.Inline;
}
}
}

/// <summary>
/// Dispatches to the specific visit method for this MIME entity.
/// </summary>
Expand Down

0 comments on commit f4eea92

Please sign in to comment.