From 9963cba757cc5a174bc61050da3ed3ca527f5d63 Mon Sep 17 00:00:00 2001 From: Casper Zandbergen Date: Fri, 16 Jan 2026 16:48:12 +0100 Subject: [PATCH] Actually send the has_video_initially to recipient --- src/calls/calls_tests.rs | 2 ++ src/headerdef.rs | 1 + src/mimefactory.rs | 6 ++++++ src/mimeparser.rs | 6 ++++++ 4 files changed, 15 insertions(+) diff --git a/src/calls/calls_tests.rs b/src/calls/calls_tests.rs index b333a6044..01e7d7d30 100644 --- a/src/calls/calls_tests.rs +++ b/src/calls/calls_tests.rs @@ -68,6 +68,7 @@ async fn setup_call() -> Result { assert!(!info.is_incoming()); assert!(!info.is_accepted()); assert_eq!(info.place_call_info, PLACE_INFO); + assert_eq!(info.has_video_initially(), true); assert_text(t, m.id, "Outgoing call").await?; assert_eq!(call_state(t, m.id).await?, CallState::Alerting); } @@ -89,6 +90,7 @@ async fn setup_call() -> Result { assert!(info.is_incoming()); assert!(!info.is_accepted()); assert_eq!(info.place_call_info, PLACE_INFO); + assert_eq!(info.has_video_initially(), true); assert_text(t, m.id, "Incoming call").await?; assert_eq!(call_state(t, m.id).await?, CallState::Alerting); } diff --git a/src/headerdef.rs b/src/headerdef.rs index c57f05033..0ccdc6eae 100644 --- a/src/headerdef.rs +++ b/src/headerdef.rs @@ -91,6 +91,7 @@ pub enum HeaderDef { ChatDispositionNotificationTo, ChatWebrtcRoom, ChatWebrtcAccepted, + ChatWebrtcHasVideoInitially, /// This message deletes the messages listed in the value by rfc724_mid. ChatDelete, diff --git a/src/mimefactory.rs b/src/mimefactory.rs index 732fff545..baa6856cc 100644 --- a/src/mimefactory.rs +++ b/src/mimefactory.rs @@ -1765,6 +1765,12 @@ impl MimeFactory { mail_builder::headers::raw::Raw::new(b_encode(answer)).into(), )); } + if let Some(has_video) = msg.param.get(Param::CallHasVideoInitially) { + headers.push(( + "Chat-Webrtc-Has-Video-Initially", + mail_builder::headers::raw::Raw::new(b_encode(has_video)).into(), + )) + } if msg.viewtype == Viewtype::Voice || msg.viewtype == Viewtype::Audio diff --git a/src/mimeparser.rs b/src/mimeparser.rs index 69bb19855..d1de9d932 100644 --- a/src/mimeparser.rs +++ b/src/mimeparser.rs @@ -738,6 +738,9 @@ impl MimeMessage { let accepted = self .get_header(HeaderDef::ChatWebrtcAccepted) .map(|s| s.to_string()); + let has_video = self + .get_header(HeaderDef::ChatWebrtcHasVideoInitially) + .map(|s| s.to_string()); if let Some(part) = self.parts.first_mut() { if let Some(room) = room { if content == "call" { @@ -747,6 +750,9 @@ impl MimeMessage { } else if let Some(accepted) = accepted { part.param.set(Param::WebrtcAccepted, accepted); } + if let Some(has_video) = has_video { + part.param.set(Param::CallHasVideoInitially, has_video); + } } }