IMAP: GETJMAPACCESS command to discover the JMAP session resource URL (closes #2736)
This commit is contained in:
@@ -74,6 +74,9 @@ pub enum Command {
|
||||
// RFC 9208
|
||||
GetQuota,
|
||||
GetQuotaRoot,
|
||||
|
||||
// RFC 9698
|
||||
GetJmapAccess,
|
||||
}
|
||||
|
||||
impl Command {
|
||||
|
||||
@@ -80,6 +80,7 @@ impl CommandParser for Command {
|
||||
"ID" => Command::Id,
|
||||
"GETQUOTA" => Command::GetQuota,
|
||||
"GETQUOTAROOT" => Command::GetQuotaRoot,
|
||||
"GETJMAPACCESS" => Command::GetJmapAccess,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -413,7 +414,16 @@ impl<T: PartialEq> PushUnique<T> for Vec<T> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::protocol::Sequence;
|
||||
use crate::{Command, protocol::Sequence, receiver::CommandParser};
|
||||
|
||||
#[test]
|
||||
fn parse_command() {
|
||||
assert_eq!(
|
||||
Command::parse(b"GETJMAPACCESS", false),
|
||||
Some(Command::GetJmapAccess)
|
||||
);
|
||||
assert_eq!(Command::parse(b"NOTACOMMAND", false), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_sequence_set() {
|
||||
|
||||
@@ -142,11 +142,11 @@ impl Capability {
|
||||
Capability::LiteralPlus,
|
||||
Capability::Id,
|
||||
Capability::Utf8Accept,
|
||||
Capability::JmapAccess,
|
||||
];
|
||||
|
||||
if is_authenticated {
|
||||
capabilities.extend([
|
||||
Capability::JmapAccess,
|
||||
Capability::Idle,
|
||||
Capability::Namespace,
|
||||
Capability::Children,
|
||||
|
||||
@@ -726,6 +726,7 @@ impl Display for Command {
|
||||
Command::Id => write!(f, "ID"),
|
||||
Command::GetQuota => write!(f, "GETQUOTA"),
|
||||
Command::GetQuotaRoot => write!(f, "GETQUOTAROOT"),
|
||||
Command::GetJmapAccess => write!(f, "GETJMAPACCESS"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user