IMAP: GETJMAPACCESS command to discover the JMAP session resource URL (closes #2736)

This commit is contained in:
Maurus Decimus
2026-06-19 18:16:40 +02:00
parent cff46f26d4
commit 4fd86298fa
8 changed files with 60 additions and 4 deletions

View File

@@ -74,6 +74,9 @@ pub enum Command {
// RFC 9208
GetQuota,
GetQuotaRoot,
// RFC 9698
GetJmapAccess,
}
impl Command {

View File

@@ -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() {

View File

@@ -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,

View File

@@ -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"),
}
}
}