File tree 4 files changed +61
-1
lines changed
MessageReader/MessageReader
MessageReader.Android/MessageReader.Android
MessageReader.iOS/MessageReader.iOS
4 files changed +61
-1
lines changed Original file line number Diff line number Diff line change @@ -264,6 +264,8 @@ class HtmlPreviewVisitor : MimeVisitor
264
264
{
265
265
List <MultipartRelated > stack = new List <MultipartRelated > ();
266
266
List <MimeEntity > attachments = new List <MimeEntity > ();
267
+ List <MimeEntity > calenderAttachments = new List <MimeEntity > ();
268
+
267
269
readonly string tempDir ;
268
270
string body ;
269
271
@@ -283,6 +285,13 @@ class HtmlPreviewVisitor : MimeVisitor
283
285
get { return attachments ; }
284
286
}
285
287
288
+ /// <summary >
289
+ /// The list of text/calender entries that were in the MimeMessage.
290
+ /// </summary >
291
+ public IList <MimeEntity > CalenderAttachments {
292
+ get { return calenderAttachments ; }
293
+ }
294
+
286
295
/// <summary >
287
296
/// The HTML string that can be set on the BrowserControl.
288
297
/// </summary >
@@ -459,6 +468,12 @@ class HtmlPreviewVisitor : MimeVisitor
459
468
{
460
469
TextConverter converter ;
461
470
471
+ // treat text/calendar parts as attachments rather than message bodies
472
+ if (entity .ContentType .IsMimeType (" text" , " calendar" )) {
473
+ calendarAattachments .Add (entity );
474
+ return ;
475
+ }
476
+
462
477
if (body != null ) {
463
478
// since we've already found the body, treat this as an attachment
464
479
attachments .Add (entity );
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ class HtmlPreviewVisitor : MimeVisitor
42
42
{
43
43
readonly List < MultipartRelated > stack = new List < MultipartRelated > ( ) ;
44
44
readonly List < MimeEntity > attachments = new List < MimeEntity > ( ) ;
45
+ readonly List < MimeEntity > calenderAttachments = new List < MimeEntity > ( ) ;
46
+
45
47
readonly WebView webView ;
46
48
bool renderedBody ;
47
49
@@ -60,6 +62,13 @@ public IList<MimeEntity> Attachments {
60
62
get { return attachments ; }
61
63
}
62
64
65
+ /// <summary>
66
+ /// The list of text/calender entries that were in the MimeMessage.
67
+ /// </summary>
68
+ public IList < MimeEntity > CalenderAttachments {
69
+ get { return calenderAttachments ; }
70
+ }
71
+
63
72
protected override void VisitMultipartAlternative ( MultipartAlternative alternative )
64
73
{
65
74
// walk the multipart/alternative children backwards from greatest level of faithfulness to the least faithful
@@ -127,6 +136,12 @@ protected override void VisitTextPart (TextPart entity)
127
136
{
128
137
TextConverter converter ;
129
138
139
+ // treat text/calendar parts as attachments rather than message bodies
140
+ if ( entity . ContentType . IsMimeType ( "text" , "calendar" ) ) {
141
+ calenderAttachments . Add ( entity ) ;
142
+ return ;
143
+ }
144
+
130
145
if ( renderedBody ) {
131
146
// since we've already found the body, treat this as an attachment
132
147
attachments . Add ( entity ) ;
Original file line number Diff line number Diff line change 1
- //
1
+ //
2
2
// HtmlPreviewVisitor.cs
3
3
//
4
4
// Author: Jeffrey Stedfast <[email protected] >
@@ -42,6 +42,8 @@ class HtmlPreviewVisitor : MimeVisitor
42
42
{
43
43
readonly List < MultipartRelated > stack = new List < MultipartRelated > ( ) ;
44
44
readonly List < MimeEntity > attachments = new List < MimeEntity > ( ) ;
45
+ readonly List < MimeEntity > calenderAttachments = new List < MimeEntity > ( ) ;
46
+
45
47
readonly UIWebView webView ;
46
48
bool renderedBody ;
47
49
@@ -60,6 +62,13 @@ public IList<MimeEntity> Attachments {
60
62
get { return attachments ; }
61
63
}
62
64
65
+ /// <summary>
66
+ /// The list of text/calender entries that were in the MimeMessage.
67
+ /// </summary>
68
+ public IList < MimeEntity > CalenderAttachments {
69
+ get { return calenderAttachments ; }
70
+ }
71
+
63
72
protected override void VisitMultipartAlternative ( MultipartAlternative alternative )
64
73
{
65
74
// walk the multipart/alternative children backwards from greatest level of faithfulness to the least faithful
@@ -127,6 +136,12 @@ protected override void VisitTextPart (TextPart entity)
127
136
{
128
137
TextConverter converter ;
129
138
139
+ // treat text/calendar parts as attachments rather than message bodies
140
+ if ( entity . ContentType . IsMimeType ( "text" , "calendar" ) ) {
141
+ calenderAttachments . Add ( entity ) ;
142
+ return ;
143
+ }
144
+
130
145
if ( renderedBody ) {
131
146
// since we've already found the body, treat this as an attachment
132
147
attachments . Add ( entity ) ;
Original file line number Diff line number Diff line change @@ -41,6 +41,8 @@ class HtmlPreviewVisitor : MimeVisitor
41
41
{
42
42
readonly List < MultipartRelated > stack = new List < MultipartRelated > ( ) ;
43
43
readonly List < MimeEntity > attachments = new List < MimeEntity > ( ) ;
44
+ readonly List < MimeEntity > calenderAttachments = new List < MimeEntity > ( ) ;
45
+
44
46
string body ;
45
47
46
48
/// <summary>
@@ -57,6 +59,13 @@ public IList<MimeEntity> Attachments {
57
59
get { return attachments ; }
58
60
}
59
61
62
+ /// <summary>
63
+ /// The list of text/calender entries that were in the MimeMessage.
64
+ /// </summary>
65
+ public IList < MimeEntity > CalenderAttachments {
66
+ get { return calenderAttachments ; }
67
+ }
68
+
60
69
/// <summary>
61
70
/// The HTML string that can be set on the BrowserControl.
62
71
/// </summary>
@@ -206,6 +215,12 @@ protected override void VisitTextPart (TextPart entity)
206
215
{
207
216
TextConverter converter ;
208
217
218
+ // treat text/calendar parts as attachments rather than message bodies
219
+ if ( entity . ContentType . IsMimeType ( "text" , "calendar" ) ) {
220
+ calenderAttachments . Add ( entity ) ;
221
+ return ;
222
+ }
223
+
209
224
if ( body != null ) {
210
225
// since we've already found the body, treat this as an attachment
211
226
attachments . Add ( entity ) ;
You can’t perform that action at this time.
0 commit comments