Skip to content

Commit

Permalink
Allow 0 as a UIDVALIDITY resp-code value from the server
Browse files Browse the repository at this point in the history
Fixes issue #150
  • Loading branch information
jstedfast committed Feb 17, 2015
1 parent d929c09 commit b4388e9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion MailKit/Net/Imap/ImapEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,9 @@ public ImapResponseCode ParseResponseCode (CancellationToken cancellationToken)
case ImapResponseCodeType.UidValidity:
var uidvalidity = (UidValidityResponseCode) code;

if (token.Type != ImapTokenType.Atom || !uint.TryParse ((string) token.Value, out n32) || n32 == 0) {
// Note: we allow '0' here because some servers have been known to send "* OK [UIDVALIDITY 0]" when the folder
// has no messages. See https://github.com/jstedfast/MailKit/issues/150 for details.
if (token.Type != ImapTokenType.Atom || !uint.TryParse ((string) token.Value, out n32)) {
Debug.WriteLine ("Expected nz-number argument to 'UIDVALIDITY' RESP-CODE, but got: {0}", token);
throw UnexpectedToken (token, false);
}
Expand Down

0 comments on commit b4388e9

Please sign in to comment.