Skip to content

Commit 5ef70e7

Browse files
dario23djc
authored andcommitted
imap-proto/parser: correct HighestModSeq type to u64
see #28 (comment)
1 parent 84b8d81 commit 5ef70e7

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

imap-proto/src/parser.rs

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -362,26 +362,30 @@ named!(mailbox_data_lsub<Response>, do_parse!(
362362

363363
// Unlike `status_att` in the RFC syntax, this includes the value,
364364
// so that it can return a valid enum object instead of just a key.
365-
named!(status_att<StatusAttribute>, do_parse!(
366-
key: alt!(
367-
tag_s!("HIGHESTMODSEQ") |
368-
tag_s!("MESSAGES") |
369-
tag_s!("RECENT") |
370-
tag_s!("UIDNEXT") |
371-
tag_s!("UIDVALIDITY") |
372-
tag_s!("UNSEEN")
373-
) >>
374-
tag_s!(" ") >>
375-
val: number >>
376-
(match key {
377-
b"HIGHESTMODSEQ" => StatusAttribute::HighestModSeq(val),
378-
b"MESSAGES" => StatusAttribute::Messages(val),
379-
b"RECENT" => StatusAttribute::Recent(val),
380-
b"UIDNEXT" => StatusAttribute::UidNext(val),
381-
b"UIDVALIDITY" => StatusAttribute::UidValidity(val),
382-
b"UNSEEN" => StatusAttribute::Unseen(val),
383-
_ => panic!("invalid status key {}", str::from_utf8(key).unwrap()),
384-
})
365+
named!(status_att<StatusAttribute>, alt!(
366+
do_parse!(
367+
tag_s!("HIGHESTMODSEQ ") >>
368+
// note the _64 here
369+
val: number_64 >>
370+
(StatusAttribute::HighestModSeq(val))) |
371+
do_parse!(
372+
key: alt!(
373+
tag_s!("MESSAGES") |
374+
tag_s!("RECENT") |
375+
tag_s!("UIDNEXT") |
376+
tag_s!("UIDVALIDITY") |
377+
tag_s!("UNSEEN")
378+
) >>
379+
tag_s!(" ") >>
380+
val: number >>
381+
(match key {
382+
b"MESSAGES" => StatusAttribute::Messages(val),
383+
b"RECENT" => StatusAttribute::Recent(val),
384+
b"UIDNEXT" => StatusAttribute::UidNext(val),
385+
b"UIDVALIDITY" => StatusAttribute::UidValidity(val),
386+
b"UNSEEN" => StatusAttribute::Unseen(val),
387+
_ => panic!("invalid status key {}", str::from_utf8(key).unwrap()),
388+
}))
385389
));
386390

387391
named!(status_att_list<Vec<StatusAttribute>>, do_parse!(

imap-proto/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub enum ResponseCode<'a> {
5757

5858
#[derive(Debug, Eq, PartialEq)]
5959
pub enum StatusAttribute {
60-
HighestModSeq(u32), // RFC 4551
60+
HighestModSeq(u64), // RFC 4551
6161
Messages(u32),
6262
Recent(u32),
6363
UidNext(u32),

0 commit comments

Comments
 (0)