Skip to content

Commit

Permalink
Simplified reading of IMAP atom tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
jstedfast committed Dec 30, 2024
1 parent 30b32a9 commit bf38384
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions MailKit/Net/Imap/ImapStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ enum ImapStreamMode {

class ImapStream : Stream, ICancellableStream
{
public const string AtomSpecials = "(){%*\\\"\n";
public const string AtomSpecials = "(){%*\\\"";
public const string DefaultSpecials = "[]" + AtomSpecials;
const int ReadAheadSize = 128;
const int BlockSize = 4096;
Expand Down Expand Up @@ -524,7 +524,7 @@ public override async Task<int> ReadAsync (byte[] buffer, int offset, int count,

static bool IsAtom (byte c, string specials)
{
return !IsCtrl (c) && !IsWhiteSpace (c) && specials.IndexOf ((char) c) == -1;
return !IsCtrl (c) && c != (byte) ' ' && specials.IndexOf ((char) c) == -1;
}

static bool IsCtrl (byte c)
Expand All @@ -534,7 +534,7 @@ static bool IsCtrl (byte c)

static bool IsWhiteSpace (byte c)
{
return c == (byte) ' ' || c == (byte) '\t' || c == (byte) '\r';
return c == (byte) ' ' || c == (byte) '\r';
}

bool TryReadQuotedString (ByteArrayBuilder builder, ref bool escaped)
Expand Down

0 comments on commit bf38384

Please sign in to comment.