mirror of
https://github.com/chatmail/core.git
synced 2026-04-26 01:46:34 +03:00
differ between webrtc-instance-pattern and webrtc-rooms generated from that
This commit is contained in:
@@ -1638,7 +1638,7 @@ pub async fn send_videochat_invitation(context: &Context, chat_id: ChatId) -> Re
|
||||
};
|
||||
|
||||
let mut msg = Message::new(Viewtype::VideochatInvitation);
|
||||
msg.param.set(Param::WebrtcInstance, &instance);
|
||||
msg.param.set(Param::WebrtcRoom, &instance);
|
||||
msg.text = Some(
|
||||
context
|
||||
.stock_string_repl_str(
|
||||
|
||||
@@ -35,7 +35,7 @@ pub enum HeaderDef {
|
||||
ChatContent,
|
||||
ChatDuration,
|
||||
ChatDispositionNotificationTo,
|
||||
ChatWebrtcInstance,
|
||||
ChatWebrtcRoom,
|
||||
Autocrypt,
|
||||
AutocryptSetupMessage,
|
||||
SecureJoin,
|
||||
|
||||
@@ -655,7 +655,7 @@ impl Message {
|
||||
|
||||
pub fn get_videochat_url(&self) -> Option<String> {
|
||||
if self.viewtype == Viewtype::VideochatInvitation {
|
||||
if let Some(instance) = self.param.get(Param::WebrtcInstance) {
|
||||
if let Some(instance) = self.param.get(Param::WebrtcRoom) {
|
||||
return Some(Message::parse_webrtc_instance(instance).1);
|
||||
}
|
||||
}
|
||||
@@ -664,7 +664,7 @@ impl Message {
|
||||
|
||||
pub fn get_videochat_type(&self) -> Option<VideochatType> {
|
||||
if self.viewtype == Viewtype::VideochatInvitation {
|
||||
if let Some(instance) = self.param.get(Param::WebrtcInstance) {
|
||||
if let Some(instance) = self.param.get(Param::WebrtcRoom) {
|
||||
return Some(Message::parse_webrtc_instance(instance).0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -881,10 +881,10 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
||||
"videochat-invitation".into(),
|
||||
));
|
||||
protected_headers.push(Header::new(
|
||||
"Chat-Webrtc-Instance".into(),
|
||||
"Chat-Webrtc-Room".into(),
|
||||
self.msg
|
||||
.param
|
||||
.get(Param::WebrtcInstance)
|
||||
.get(Param::WebrtcRoom)
|
||||
.unwrap_or_default()
|
||||
.into(),
|
||||
));
|
||||
|
||||
@@ -245,11 +245,11 @@ impl MimeMessage {
|
||||
fn parse_videochat_headers(&mut self) {
|
||||
if let Some(value) = self.get(HeaderDef::ChatContent).cloned() {
|
||||
if value == "videochat-invitation" {
|
||||
let instance = self.get(HeaderDef::ChatWebrtcInstance).cloned();
|
||||
let instance = self.get(HeaderDef::ChatWebrtcRoom).cloned();
|
||||
if let Some(part) = self.parts.first_mut() {
|
||||
part.typ = Viewtype::VideochatInvitation;
|
||||
part.param
|
||||
.set(Param::WebrtcInstance, instance.unwrap_or_default());
|
||||
.set(Param::WebrtcRoom, instance.unwrap_or_default());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1474,7 +1474,7 @@ mod tests {
|
||||
assert_eq!(
|
||||
mimeparser.parts[0]
|
||||
.param
|
||||
.get(Param::WebrtcInstance)
|
||||
.get(Param::WebrtcRoom)
|
||||
.unwrap_or_default(),
|
||||
"https://example.org/p2p/?roomname=6HiduoAn4xN"
|
||||
);
|
||||
|
||||
@@ -69,7 +69,7 @@ pub enum Param {
|
||||
AttachGroupImage = b'A',
|
||||
|
||||
/// For Messages
|
||||
WebrtcInstance = b'V',
|
||||
WebrtcRoom = b'V',
|
||||
|
||||
/// For Messages: space-separated list of messaged IDs of forwarded copies.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user