differ between webrtc-instance-pattern and webrtc-rooms generated from that

This commit is contained in:
B. Petersen
2020-07-23 11:52:02 +02:00
parent 74fbd4fd16
commit 04c90e2d87
6 changed files with 10 additions and 10 deletions

View File

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

View File

@@ -35,7 +35,7 @@ pub enum HeaderDef {
ChatContent,
ChatDuration,
ChatDispositionNotificationTo,
ChatWebrtcInstance,
ChatWebrtcRoom,
Autocrypt,
AutocryptSetupMessage,
SecureJoin,

View File

@@ -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);
}
}

View File

@@ -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(),
));

View File

@@ -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"
);

View File

@@ -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.
///