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); let mut msg = Message::new(Viewtype::VideochatInvitation);
msg.param.set(Param::WebrtcInstance, &instance); msg.param.set(Param::WebrtcRoom, &instance);
msg.text = Some( msg.text = Some(
context context
.stock_string_repl_str( .stock_string_repl_str(

View File

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

View File

@@ -655,7 +655,7 @@ impl Message {
pub fn get_videochat_url(&self) -> Option<String> { pub fn get_videochat_url(&self) -> Option<String> {
if self.viewtype == Viewtype::VideochatInvitation { 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); return Some(Message::parse_webrtc_instance(instance).1);
} }
} }
@@ -664,7 +664,7 @@ impl Message {
pub fn get_videochat_type(&self) -> Option<VideochatType> { pub fn get_videochat_type(&self) -> Option<VideochatType> {
if self.viewtype == Viewtype::VideochatInvitation { 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); return Some(Message::parse_webrtc_instance(instance).0);
} }
} }

View File

@@ -881,10 +881,10 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
"videochat-invitation".into(), "videochat-invitation".into(),
)); ));
protected_headers.push(Header::new( protected_headers.push(Header::new(
"Chat-Webrtc-Instance".into(), "Chat-Webrtc-Room".into(),
self.msg self.msg
.param .param
.get(Param::WebrtcInstance) .get(Param::WebrtcRoom)
.unwrap_or_default() .unwrap_or_default()
.into(), .into(),
)); ));

View File

@@ -245,11 +245,11 @@ impl MimeMessage {
fn parse_videochat_headers(&mut self) { fn parse_videochat_headers(&mut self) {
if let Some(value) = self.get(HeaderDef::ChatContent).cloned() { if let Some(value) = self.get(HeaderDef::ChatContent).cloned() {
if value == "videochat-invitation" { 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() { if let Some(part) = self.parts.first_mut() {
part.typ = Viewtype::VideochatInvitation; part.typ = Viewtype::VideochatInvitation;
part.param part.param
.set(Param::WebrtcInstance, instance.unwrap_or_default()); .set(Param::WebrtcRoom, instance.unwrap_or_default());
} }
} }
} }
@@ -1474,7 +1474,7 @@ mod tests {
assert_eq!( assert_eq!(
mimeparser.parts[0] mimeparser.parts[0]
.param .param
.get(Param::WebrtcInstance) .get(Param::WebrtcRoom)
.unwrap_or_default(), .unwrap_or_default(),
"https://example.org/p2p/?roomname=6HiduoAn4xN" "https://example.org/p2p/?roomname=6HiduoAn4xN"
); );

View File

@@ -69,7 +69,7 @@ pub enum Param {
AttachGroupImage = b'A', AttachGroupImage = b'A',
/// For Messages /// For Messages
WebrtcInstance = b'V', WebrtcRoom = b'V',
/// For Messages: space-separated list of messaged IDs of forwarded copies. /// For Messages: space-separated list of messaged IDs of forwarded copies.
/// ///