Skip to content

Commit a9886fc

Browse files
soywodduesee
authored andcommitted
fix: wrong vanished parsing
1 parent 803e37b commit a9886fc

1 file changed

Lines changed: 24 additions & 30 deletions

File tree

imap-codec/src/response.rs

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ use abnf_core::streaming::crlf;
44
use abnf_core::streaming::crlf_relaxed as crlf;
55
use abnf_core::streaming::sp;
66
use base64::{Engine, engine::general_purpose::STANDARD as _base64};
7-
#[cfg(feature = "ext_condstore_qresync")]
8-
use imap_types::sequence::SequenceSet;
97
use imap_types::{
108
core::{Text, Vec1},
119
fetch::MessageDataItem,
@@ -423,39 +421,35 @@ pub(crate) fn message_data(input: &[u8]) -> IMAPResult<&[u8], Data> {
423421
enum TmpData<'a> {
424422
Expunge,
425423
Fetch(Vec1<MessageDataItem<'a>>),
426-
#[cfg(feature = "ext_condstore_qresync")]
427-
Vanished(bool, SequenceSet),
428424
}
429425

430-
let (remaining, (seq, tmp)) = tuple((
431-
terminated(nz_number, sp),
432-
alt((
433-
value(TmpData::Expunge, tag_no_case(b"EXPUNGE")),
434-
map(preceded(tag_no_case(b"FETCH "), msg_att), TmpData::Fetch),
435-
#[cfg(feature = "ext_condstore_qresync")]
436-
map(
437-
tuple((
438-
tag_no_case("VANISHED"),
439-
opt(tag_no_case(" (EARLIER)")),
440-
preceded(sp, sequence_set),
426+
alt((
427+
map(
428+
tuple((
429+
terminated(nz_number, sp),
430+
alt((
431+
value(TmpData::Expunge, tag_no_case(b"EXPUNGE")),
432+
map(preceded(tag_no_case(b"FETCH "), msg_att), TmpData::Fetch),
441433
)),
442-
|(_, earlier, known_uids)| TmpData::Vanished(earlier.is_some(), known_uids),
443-
),
444-
)),
445-
))(input)?;
446-
447-
Ok((
448-
remaining,
449-
match tmp {
450-
TmpData::Expunge => Data::Expunge(seq),
451-
TmpData::Fetch(items) => Data::Fetch { seq, items },
452-
#[cfg(feature = "ext_condstore_qresync")]
453-
TmpData::Vanished(earlier, known_uids) => Data::Vanished {
454-
earlier,
434+
)),
435+
|(seq, tmp)| match tmp {
436+
TmpData::Expunge => Data::Expunge(seq),
437+
TmpData::Fetch(items) => Data::Fetch { seq, items },
438+
},
439+
),
440+
#[cfg(feature = "ext_condstore_qresync")]
441+
map(
442+
tuple((
443+
tag_no_case(b"VANISHED"),
444+
opt(tag_no_case(" (EARLIER)")),
445+
preceded(sp, sequence_set),
446+
)),
447+
|(_, earlier, known_uids)| Data::Vanished {
448+
earlier: earlier.is_some(),
455449
known_uids,
456450
},
457-
},
458-
))
451+
),
452+
))(input)
459453
}
460454

461455
#[cfg(test)]

0 commit comments

Comments
 (0)