fixup! add support for the imap quota extension (RFC 2087)

This commit is contained in:
Edward Rudd 2022-10-25 15:26:36 -04:00
parent 0a9297f0fc
commit e082d2f4f4
2 changed files with 8 additions and 9 deletions

View file

@ -2556,9 +2556,10 @@ mod tests {
#[test] #[test]
fn get_quota_with_limits() { fn get_quota_with_limits() {
let response = b"* QUOTA my_root (STORAGE 10 500)\r\n\ let response = b"* QUOTA my_root (STORAGE 10 500)\r
a1 OK completed\r\n" a1 OK completed\r
.to_vec(); "
.to_vec();
let mock_stream = MockStream::new(response); let mock_stream = MockStream::new(response);
let mut session = mock_session!(mock_stream); let mut session = mock_session!(mock_stream);
let quota = session.get_quota("my_root").unwrap(); let quota = session.get_quota("my_root").unwrap();

View file

@ -49,12 +49,10 @@ pub enum QuotaResourceName<'a> {
impl<'a> From<&'a str> for QuotaResourceName<'a> { impl<'a> From<&'a str> for QuotaResourceName<'a> {
fn from(input: &'a str) -> Self { fn from(input: &'a str) -> Self {
if input == "STORAGE" { match input {
QuotaResourceName::Storage "STORAGE" => QuotaResourceName::Storage,
} else if input == "MESSAGE" { "MESSAGE" => QuotaResourceName::Message,
QuotaResourceName::Message _ => QuotaResourceName::Atom(Cow::from(input)),
} else {
QuotaResourceName::Atom(Cow::from(input))
} }
} }
} }