Skip to content

Commit

Permalink
Reorganize logic in ImapToken.Create(type, builder) for robustness
Browse files Browse the repository at this point in the history
  • Loading branch information
jstedfast committed Aug 20, 2023
1 parent b3a00c7 commit b0ee23b
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions MailKit/Net/Imap/ImapToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,21 @@ public static ImapToken Create (ImapTokenType type, ByteArrayBuilder builder)
if (builder.Equals (value, true))
return token;
}
} else if (builder.Equals ("NIL", true)) {
foreach (var token in NilTokens) {
value = (string) token.Value;
} else if (type == ImapTokenType.Atom) {
if (builder.Equals ("NIL", true)) {
foreach (var token in NilTokens) {
value = (string) token.Value;

if (builder.Equals (value))
return token;
}
if (builder.Equals (value))
return token;
}

var nil = new ImapToken (ImapTokenType.Nil, builder.ToString ());
NilTokens.Add (nil);
var nil = new ImapToken (ImapTokenType.Nil, builder.ToString ());
NilTokens.Add (nil);

return nil;
}

return nil;
} else {
if (builder.Equals ("FETCH", false))
return Fetch;
if (builder.Equals ("BODY", false))
Expand Down

0 comments on commit b0ee23b

Please sign in to comment.