Skip to content
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
3 changes: 3 additions & 0 deletions lib/src/private/imap/status_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class StatusParser extends ResponseParser<Mailbox> {
case 'UNSEEN':
box.messagesUnseen = value;
break;
case 'HIGHESTMODSEQ':
box.highestModSequence = value;
break;
default:
print(
'unexpected STATUS: $entry=${listEntries[i + 1]}\nin $details',
Expand Down
23 changes: 23 additions & 0 deletions test/src/imap/status_parser_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:enough_mail/src/private/imap/all_parsers.dart';
import 'package:enough_mail/src/private/imap/imap_response.dart';
import 'package:enough_mail/src/private/imap/imap_response_line.dart';
import 'package:test/test.dart';

// cSpell:disable

void main() {
Expand Down Expand Up @@ -58,4 +59,26 @@ void main() {
expect(processed, true);
expect(box.messagesExists, 2);
});

test('Status with HIGHESTMODSEQ', () {
// A CONDSTORE server includes HIGHESTMODSEQ when asked for it (RFC 7162
// section 3.1.6). It used to fall into the default branch and be printed
// as unexpected instead of being recorded on the mailbox.
const responseText =
'STATUS "INBOX" (MESSAGES 231 UNSEEN 5 HIGHESTMODSEQ 7011231777)';
final details = ImapResponse()..add(ImapResponseLine(responseText));
final box = Mailbox(
encodedName: 'INBOX',
encodedPath: 'INBOX',
flags: [MailboxFlag.inbox],
pathSeparator: '/',
);
final parser = StatusParser(box);
final response = Response<Mailbox>()..status = ResponseStatus.ok;
final processed = parser.parseUntagged(details, response);
expect(processed, true);
expect(box.messagesExists, 231);
expect(box.messagesUnseen, 5);
expect(box.highestModSequence, 7011231777);
});
}