Skip to content

Commit 1bf92cc

Browse files
reinaldocoelho_cpreinaldocoelho_cp
authored andcommitted
Include bug fix to emails with mime-type using CamelCase format.
Adjust test to bug and update version number of all ActiveUp.Net.* to version 2.0.2.<build> (Automatic with appveyour).
1 parent e54c35b commit 1bf92cc

18 files changed

Lines changed: 1880 additions & 136 deletions

File tree

ActiveUp.Net.sln

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActiveUp.Net.Smtp", "Class
5555
EndProject
5656
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActiveUp.Net.Tests", "Class Library\ActiveUp.Net.Tests\ActiveUp.Net.Tests.csproj", "{5AD3438E-9024-4908-BA15-92726159C4FB}"
5757
EndProject
58-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{3133457C-5D55-4F53-9115-81C494679D37}"
59-
EndProject
60-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActiveUp.Net.Samples", "Samples\CS\ActiveUp.Net.Samples\ActiveUp.Net.Samples.csproj", "{D7048DA0-D973-4B69-9133-BF6620561E77}"
61-
EndProject
62-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActiveUp.MailSystem.DesktopClient2010", "Samples\CS\ActiveUp.MailSystem.DesktopClient\ActiveUp.MailSystem.DesktopClient2010.csproj", "{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}"
63-
EndProject
6458
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActiveUp.Net", "Class Library\ActiveUp.Net\ActiveUp.Net.csproj", "{25DA9502-B959-4E81-9368-471AE231BCC0}"
6559
EndProject
6660
Global
@@ -582,56 +576,6 @@ Global
582576
{5AD3438E-9024-4908-BA15-92726159C4FB}.Trial|Any CPU.Build.0 = Release|Any CPU
583577
{5AD3438E-9024-4908-BA15-92726159C4FB}.Trial|Mixed Platforms.ActiveCfg = Release|Any CPU
584578
{5AD3438E-9024-4908-BA15-92726159C4FB}.Trial|Mixed Platforms.Build.0 = Release|Any CPU
585-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Debug|.NET.ActiveCfg = Debug|Any CPU
586-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
587-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Debug|Any CPU.Build.0 = Debug|Any CPU
588-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
589-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
590-
{D7048DA0-D973-4B69-9133-BF6620561E77}.MailSystem Dev|.NET.ActiveCfg = MailSystem Dev|Any CPU
591-
{D7048DA0-D973-4B69-9133-BF6620561E77}.MailSystem Dev|Any CPU.ActiveCfg = MailSystem Dev|Any CPU
592-
{D7048DA0-D973-4B69-9133-BF6620561E77}.MailSystem Dev|Any CPU.Build.0 = MailSystem Dev|Any CPU
593-
{D7048DA0-D973-4B69-9133-BF6620561E77}.MailSystem Dev|Mixed Platforms.ActiveCfg = MailSystem Dev|Any CPU
594-
{D7048DA0-D973-4B69-9133-BF6620561E77}.MailSystem Dev|Mixed Platforms.Build.0 = MailSystem Dev|Any CPU
595-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Release|.NET.ActiveCfg = Release|Any CPU
596-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Release|Any CPU.ActiveCfg = Release|Any CPU
597-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Release|Any CPU.Build.0 = Release|Any CPU
598-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
599-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Release|Mixed Platforms.Build.0 = Release|Any CPU
600-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Retail|.NET.ActiveCfg = Retail|Any CPU
601-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Retail|Any CPU.ActiveCfg = Retail|Any CPU
602-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Retail|Any CPU.Build.0 = Retail|Any CPU
603-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Retail|Mixed Platforms.ActiveCfg = Retail|Any CPU
604-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Retail|Mixed Platforms.Build.0 = Retail|Any CPU
605-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Trial|.NET.ActiveCfg = Trial|Any CPU
606-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Trial|Any CPU.ActiveCfg = Trial|Any CPU
607-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Trial|Any CPU.Build.0 = Trial|Any CPU
608-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Trial|Mixed Platforms.ActiveCfg = Trial|Any CPU
609-
{D7048DA0-D973-4B69-9133-BF6620561E77}.Trial|Mixed Platforms.Build.0 = Trial|Any CPU
610-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Debug|.NET.ActiveCfg = Debug|Any CPU
611-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
612-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
613-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
614-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
615-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.MailSystem Dev|.NET.ActiveCfg = Release|Any CPU
616-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.MailSystem Dev|Any CPU.ActiveCfg = Release|Any CPU
617-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.MailSystem Dev|Any CPU.Build.0 = Release|Any CPU
618-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.MailSystem Dev|Mixed Platforms.ActiveCfg = Release|Any CPU
619-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.MailSystem Dev|Mixed Platforms.Build.0 = Release|Any CPU
620-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Release|.NET.ActiveCfg = Release|Any CPU
621-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
622-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Release|Any CPU.Build.0 = Release|Any CPU
623-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
624-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
625-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Retail|.NET.ActiveCfg = Release|Any CPU
626-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Retail|Any CPU.ActiveCfg = Release|Any CPU
627-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Retail|Any CPU.Build.0 = Release|Any CPU
628-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Retail|Mixed Platforms.ActiveCfg = Release|Any CPU
629-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Retail|Mixed Platforms.Build.0 = Release|Any CPU
630-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Trial|.NET.ActiveCfg = Release|Any CPU
631-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Trial|Any CPU.ActiveCfg = Release|Any CPU
632-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Trial|Any CPU.Build.0 = Release|Any CPU
633-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Trial|Mixed Platforms.ActiveCfg = Release|Any CPU
634-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4}.Trial|Mixed Platforms.Build.0 = Release|Any CPU
635579
{25DA9502-B959-4E81-9368-471AE231BCC0}.Debug|.NET.ActiveCfg = Debug|Any CPU
636580
{25DA9502-B959-4E81-9368-471AE231BCC0}.Debug|.NET.Build.0 = Debug|Any CPU
637581
{25DA9502-B959-4E81-9368-471AE231BCC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -687,8 +631,6 @@ Global
687631
{3F01CF20-C49D-44A9-AA57-68F04915FE97} = {629D406B-F46A-4A9D-A31F-C5956E0AB157}
688632
{D9BCD15E-A438-4554-89D3-1CF122167FDD} = {629D406B-F46A-4A9D-A31F-C5956E0AB157}
689633
{5AD3438E-9024-4908-BA15-92726159C4FB} = {33BAFFED-FB5D-48EF-85D9-CDE2EB2CFA64}
690-
{D7048DA0-D973-4B69-9133-BF6620561E77} = {3133457C-5D55-4F53-9115-81C494679D37}
691-
{2CFFCA13-B00A-4605-B6A4-D49A616CFCB4} = {3133457C-5D55-4F53-9115-81C494679D37}
692634
{25DA9502-B959-4E81-9368-471AE231BCC0} = {629D406B-F46A-4A9D-A31F-C5956E0AB157}
693635
EndGlobalSection
694636
EndGlobal

Class Library/ActiveUp.Net.Common/Parser.cs

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ private static void ParseSubParts(ref MimePart part, Message message)
140140
Logger.AddEntry("boundary : " + boundary);
141141
string[] arrpart = Regex.Split(parentPartAsciiBody, @"\r?\n?" + Regex.Escape("--" + boundary));
142142

143-
foreach(var strpart in arrpart)
143+
foreach (var strpart in arrpart)
144144
{
145145
if (string.IsNullOrWhiteSpace(strpart)) continue;
146146

147-
int bounaryByteLen = Encoding.ASCII.GetByteCount(parentPartAsciiBody.Substring(0, parentPartAsciiBody.IndexOf(strpart)));
147+
int bounaryByteLen = Encoding.ASCII.GetByteCount(parentPartAsciiBody.Substring(0, parentPartAsciiBody.IndexOf(strpart)));
148148
int binaryPartLen = bounaryByteLen + Encoding.ASCII.GetByteCount(strpart.ToCharArray());
149149

150150
//complete Part (incl. boundary)
@@ -193,6 +193,11 @@ internal static void DispatchParts(ref Message message)
193193
DispatchPart(message.PartTreeRoot, ref message);
194194
}
195195

196+
/// <summary>
197+
/// Process message Part loaded to complete Message.
198+
/// </summary>
199+
/// <param name="part">Loaded part from EML.</param>
200+
/// <param name="message">Final message.</param>
196201
private static void DispatchPart(MimePart part, ref Message message)
197202
{
198203
// This is a container part.
@@ -213,29 +218,33 @@ private static void DispatchPart(MimePart part, ref Message message)
213218

214219
// We will consider the highest-level text parts that are not attachments to be the intended for display.
215220
// We know the highest-level parts will be set, because the parser first goes to the deepest level and returns top-level parts last.
216-
if (part.ContentType.Type.Equals("text") && !part.ContentDisposition.Disposition.Equals("attachment"))
221+
if (part.ContentType.Type.ToLower().Equals("text") && !part.ContentDisposition.Disposition.ToLower().Equals("attachment"))
217222
{
218-
if (part.ContentType.SubType.Equals("plain"))
223+
if (part.ContentType.SubType.ToLower().Equals("plain"))
219224
{
220-
if (part.ContentDisposition.Disposition == "inline")
221-
message.BodyText.Text += part.TextContent;
222-
else {
223-
message.BodyText.Charset = part.Charset;
224-
message.BodyText.Text = part.TextContent;
225-
}
225+
if (part.ContentDisposition.Disposition.ToLower() == "inline")
226+
message.BodyText.Text += part.TextContent;
227+
else
228+
{
229+
message.BodyText.Charset = part.Charset;
230+
message.BodyText.Text = part.TextContent;
231+
}
226232
}
227-
else if (part.ContentType.SubType.Equals("html"))
233+
else if (part.ContentType.SubType.ToLower().Equals("html"))
228234
{
229-
if (part.ContentDisposition.Disposition == "inline") {
230-
message.IsHtml = true;
231-
message.BodyHtml.Text += part.TextContent;
232-
} else {
233-
message.IsHtml = true;
234-
message.BodyHtml.Charset = part.Charset;
235-
message.BodyHtml.Text = part.TextContent;
236-
}
235+
if (part.ContentDisposition.Disposition.ToLower() == "inline")
236+
{
237+
message.IsHtml = true;
238+
message.BodyHtml.Text += part.TextContent;
239+
}
240+
else
241+
{
242+
message.IsHtml = true;
243+
message.BodyHtml.Charset = part.Charset;
244+
message.BodyHtml.Text = part.TextContent;
245+
}
237246
}
238-
else if (part.ContentType.SubType.Equals("xml"))
247+
else if (part.ContentType.SubType.ToLower().Equals("xml"))
239248
{
240249
//Recupera anexos que nao estejam marcados com 'Content-Disposition' e 'attachment'. Alguns anexos com mimetype xml podem ter essa caracteristica.
241250
//Recovers attachments that are not marked with 'Content-Disposition' 'attachment'. Some attachments with xml mime-type may have this feature.
@@ -245,7 +254,7 @@ private static void DispatchPart(MimePart part, ref Message message)
245254

246255
// Parse message/rfc822 parts as Message objects and place them in the appropriate collection.
247256
if (part.ContentType.MimeType.Equals("message/rfc822"))
248-
message.SubMessages.Add(Parser.ParseMessage(part.BinaryContent));
257+
message.SubMessages.Add(ParseMessage(part.BinaryContent));
249258

250259
if (part.ContentType.MimeType.Equals("application/pkcs7-signature")
251260
|| part.ContentType.MimeType.Equals("application/x-pkcs7-signature"))
@@ -319,7 +328,7 @@ private static void DecodePartBody(ref MimePart part)
319328
}
320329
// Otherwise, this is an unencoded part body and we keep the text version as it is.
321330
else
322-
{
331+
{
323332
part.TextContent = Codec.GetEncoding(charset).GetString(part.BinaryContent);
324333
}
325334
}
@@ -466,7 +475,7 @@ public static MimePart ParseMimePart(byte[] binaryData, Message message)
466475
if (bodyStart < data.Length)
467476
{
468477
body = data.Substring(bodyStart);
469-
part.BinaryContent = GetBinaryPart(binaryData, body);
478+
part.BinaryContent = GetBinaryPart(binaryData, body);
470479
}
471480

472481
// Parse header fields and their parameters.
@@ -522,7 +531,8 @@ public static MimePart ParseMimePart(byte[] binaryData, Message message)
522531
}
523532

524533

525-
private static byte[] GetBinaryPart(byte[] srcData, string asciiPart) {
534+
private static byte[] GetBinaryPart(byte[] srcData, string asciiPart)
535+
{
526536
byte[] result = new byte[Encoding.ASCII.GetByteCount(asciiPart.ToCharArray())];
527537
Array.Copy(srcData, (srcData.Length - result.Length), result, 0, result.Length);
528538

@@ -983,7 +993,8 @@ public static Address ParseAddress(string input)
983993
if (displayNameMatch.Success)
984994
{
985995
address = new Address(input.Replace(displayNameMatch.Value, string.Empty).Trim().Trim(new[] { '<', '>' }), displayNameMatch.Groups[1].Value);
986-
} else
996+
}
997+
else
987998
{
988999
address = new Address(input.Trim().Trim(new[] { '<', '>' }), string.Empty);
9891000
}

Class Library/ActiveUp.Net.Common/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@
4848
//
4949
// You can specify all the values or you can default the Revision and Build Numbers
5050
// by using the '*' as shown below:
51-
[assembly: AssemblyVersion("1.0.0.0")]
52-
[assembly: AssemblyFileVersion("1.0.0.0")]
51+
[assembly: AssemblyVersion("2.0.2.*")]
52+
[assembly: AssemblyFileVersion("2.0.2.0")]
5353
[assembly: InternalsVisibleTo("ActiveUp.Net.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100410af98e2c0f72503b6705a859a15b91ed7a8fb5361184aeacc798e5b07e688ce8e878adc06995052e5e5ba60439251d8f2fee73e716e669f73f3ca5205f309ec67a1cdc53ed69e1e185831813156f61a8c10fef832b76293adb6201050debe596f27595d1f2f94aeb73bc23604d099f2039052c0c39e41ed8e3ae5638ad24d8")]

Class Library/ActiveUp.Net.Dns/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
//
3232
// You can specify all the values or you can default the Revision and Build Numbers
3333
// by using the '*' as shown below: 2.2.0209.0
34-
[assembly: AssemblyVersion("5.0.3454.364")]
34+
[assembly: AssemblyVersion("2.0.2.*")]
3535
#if !PocketPC
36-
[assembly: AssemblyFileVersion("5.0.3454.364")]
36+
[assembly: AssemblyFileVersion("2.0.2.0")]
3737
#endif
3838

3939
[assembly: System.Security.AllowPartiallyTrustedCallers]

Class Library/ActiveUp.Net.Groupware/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
// General Information about an assembly is controlled through the following
@@ -29,7 +28,7 @@
2928
// Build Number
3029
// Revision
3130
//
32-
[assembly: AssemblyVersion("5.0.3454.364")]
33-
[assembly: AssemblyFileVersion("5.0.3454.364")]
31+
[assembly: AssemblyVersion("2.0.2.*")]
32+
[assembly: AssemblyFileVersion("2.0.2.0")]
3433

3534
[assembly: System.Security.AllowPartiallyTrustedCallers]

Class Library/ActiveUp.Net.Imap4/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
//
3232
// You can specify all the values or you can default the Revision and Build Numbers
3333
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("5.0.3454.364")]
35-
[assembly: AssemblyFileVersion("5.0.3454.364")]
34+
[assembly: AssemblyVersion("2.0.2.*")]
35+
[assembly: AssemblyFileVersion("2.0.2.0")]

Class Library/ActiveUp.Net.Mail/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
// Build Number
3030
// Revision
3131
//
32-
[assembly: AssemblyVersion("5.0.3454.364")]
32+
[assembly: AssemblyVersion("2.0.2.*")]
3333
#if !PocketPC
34-
[assembly: AssemblyFileVersion("5.0.3454.364")]
34+
[assembly: AssemblyFileVersion("2.0.2.0")]
3535
#endif
3636

3737
[assembly: System.Security.AllowPartiallyTrustedCallers]

Class Library/ActiveUp.Net.Nntp/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
//
3232
// You can specify all the values or you can default the Revision and Build Numbers
3333
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("5.0.3454.364")]
35-
[assembly: AssemblyFileVersion("5.0.3454.364")]
34+
[assembly: AssemblyVersion("2.0.2.*")]
35+
[assembly: AssemblyFileVersion("2.0.2.0")]

Class Library/ActiveUp.Net.OpenPGP/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
// General Information about an assembly is controlled through the following
@@ -31,7 +30,7 @@
3130
//
3231
// You can specify all the values or you can default the Revision and Build Numbers
3332
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("5.0.3454.364")]
35-
[assembly: AssemblyFileVersion("5.0.3454.364")]
33+
[assembly: AssemblyVersion("2.0.2.*")]
34+
[assembly: AssemblyFileVersion("2.0.2.0")]
3635

3736
[assembly: System.Security.AllowPartiallyTrustedCallers]

Class Library/ActiveUp.Net.Pop3/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
// General Information about an assembly is controlled through the following
@@ -31,5 +30,5 @@
3130
//
3231
// You can specify all the values or you can default the Revision and Build Numbers
3332
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("5.0.3454.364")]
35-
[assembly: AssemblyFileVersion("5.0.3454.364")]
33+
[assembly: AssemblyVersion("2.0.2.*")]
34+
[assembly: AssemblyFileVersion("2.0.2.0")]

0 commit comments

Comments
 (0)