From 60541d1651a18ea0ba1441586ff3f9982ce82e8f Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 13 Mar 2021 12:24:20 +0100 Subject: [PATCH] Close call of removed conversation --- src/controllers/calls_controller.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/controllers/calls_controller.rs b/src/controllers/calls_controller.rs index b1b062a..c0b60ac 100644 --- a/src/controllers/calls_controller.rs +++ b/src/controllers/calls_controller.rs @@ -462,6 +462,21 @@ pub fn handle_event(e: &events_helper::Event) -> Res { } } + // Call active call of user (if any) + Event::DeletedConversation(conv_id) => { + let mut conn = None; + user_ws_controller::foreach_connection(|f| { + if f.is_having_call_with_conversation(conv_id) { + conn = Some(f.clone()); + } + Ok(()) + })?; + + if let Some(c) = conn { + make_user_leave_call(conv_id, &c)?; + } + } + _ => {} }