Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading to Visual Studio 2005, .NET 3.5, Fixing Large Subjects #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Net/IMAP/Client/IMAP_Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6487,7 +6487,7 @@ public void Fetch(bool uid,IMAP_t_SeqSet seqSet,IMAP_t_Fetch_i[] items,EventHand
throw new ArgumentNullException("items");
}
if(items.Length < 1){
throw new ArgumentException("Argument 'items' must conatain at least 1 value.","items");
throw new ArgumentException("Argument 'items' must contain at least 1 value.","items");
}

using(FetchAsyncOP op = new FetchAsyncOP(uid,seqSet,items,callback)){
Expand Down Expand Up @@ -6540,7 +6540,7 @@ public FetchAsyncOP(bool uid,IMAP_t_SeqSet seqSet,IMAP_t_Fetch_i[] items,EventHa
throw new ArgumentNullException("items");
}
if(items.Length < 1){
throw new ArgumentException("Argument 'items' must conatain at least 1 value.","items");
throw new ArgumentException("Argument 'items' must contain at least 1 value.","items");
}

m_Uid = uid;
Expand Down Expand Up @@ -10408,7 +10408,7 @@ public void Fetch(bool uid,IMAP_SequenceSet seqSet,IMAP_Fetch_DataItem[] items,I
throw new ArgumentNullException("items");
}
if(items.Length < 1){
throw new ArgumentException("Argument 'items' must conatain at least 1 value.","items");
throw new ArgumentException("Argument 'items' must contain at least 1 value.","items");
}
if(handler == null){
throw new ArgumentNullException("handler");
Expand Down
2 changes: 1 addition & 1 deletion Net/IO/SmartStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3443,7 +3443,7 @@ private void DoDataReading()
// Read buffer empty, buff next data block.
if(m_pOwner.BytesInReadBuffer == 0){
// Buffering started asynchronously.
if(m_pOwner.BufferRead(true,this.Buffering_Completed)){
if(m_pOwner.BufferRead(false,this.Buffering_Completed)) { // FALSE (SYNC) seems to work better with very large emails
return;
}
// Buffering completed synchronously, continue processing.
Expand Down
9 changes: 9 additions & 0 deletions Net/MIME/MIME_Encoding_EncodedWord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

namespace LumiSoft.Net.MIME
{
Expand Down Expand Up @@ -250,6 +251,14 @@ RFC 2231 updates.

string retVal = text;

// sometimes texts can have simultaneously multiple encoded blocks
// ex: "=?iso-8859-1?Q?Seg.:_Geranorte_*_Resseg.:_Tokio_Marine_*_Ramo:_RO_*_Solic?= =?iso-8859-1?Q?ita=E7=E3o_de_suporte?="
// that's two different blocks, each one encoded separately (separated by a space which didn't exist originally)
// So we should split by the space, and decode individually each part.
List<string> split = retVal.Trim().Split(' ').ToList();
if (split.Count >= 2 && split.TrueForAll(x => x.StartsWith("=?") && x.EndsWith("?=")))
return split.Aggregate((a, b) => DecodeTextS(a) + DecodeTextS(b));

retVal = encodedword_regex.Replace(retVal,delegate(Match m){
// We have encoded word, try to decode it.
// Also if we have continuing encoded word, we need to skip all whitespaces between words.
Expand Down
18 changes: 14 additions & 4 deletions Net/Mail/Mail_Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,21 @@ public MIME_Entity[] GetAttachments(bool includeInline,bool includeEmbbedMessage
try{
disposition = entity.ContentDisposition;
}
catch{
catch (Exception ex)
{
// ContentDisposition parsing failed.
System.Diagnostics.Debug.WriteLine(ex.ToString());
}

if(disposition != null && string.Equals(disposition.DispositionType,"attachment",StringComparison.InvariantCultureIgnoreCase)){
if(disposition != null && string.Equals(disposition.DispositionType,"attachment",StringComparison.InvariantCultureIgnoreCase))
{ // all attachments
retVal.Add(entity);
}
else if(!includeInline && disposition != null && string.Equals(disposition.DispositionType,"inline",StringComparison.InvariantCultureIgnoreCase)){
else if(!includeInline && disposition != null && string.Equals(disposition.DispositionType,"inline",StringComparison.InvariantCultureIgnoreCase))
{ // all inlines are ignored here (depending on includeInline)
}
else if(contentType != null && contentType.Type.ToLower() == "application"){
else if(contentType != null && contentType.Type.ToLower() == "application") // from here on, it's all about inlines
{
retVal.Add(entity);
}
else if(contentType != null && contentType.Type.ToLower() == "image"){
Expand All @@ -232,6 +237,11 @@ public MIME_Entity[] GetAttachments(bool includeInline,bool includeEmbbedMessage
else if(contentType != null && contentType.Type.ToLower() == "message"){
retVal.Add(entity);
}
else // just for debugging what kind of inlines could be possibly be ignored
{
if (contentType != null && contentType.Type != null && contentType.Type != "multipart") // esse teste eu que fiz.. pra ver o que est� sendo ignorado
System.Diagnostics.Debug.WriteLine(contentType.Type);
}
}

return retVal.ToArray();
Expand Down
Loading