@@ -13,7 +13,7 @@ use crate::mimeparser::{MimeMessage, SystemMessage};
1313use crate :: param:: Param ;
1414use crate :: sync:: SyncData ;
1515use crate :: tools:: time;
16- use anyhow:: { anyhow , ensure, Result } ;
16+ use anyhow:: { ensure, Result } ;
1717use std:: time:: Duration ;
1818use tokio:: task;
1919use tokio:: time:: sleep;
@@ -188,7 +188,7 @@ impl Context {
188188 }
189189 }
190190 SystemMessage :: CallAccepted => {
191- let call = self . load_call_by_child_id ( call_or_child_id) . await ?;
191+ let call = self . load_call_by_root_id ( call_or_child_id) . await ?;
192192 self . emit_msgs_changed ( call. msg . chat_id , call_or_child_id) ;
193193 if call. incoming {
194194 self . emit_event ( EventType :: IncomingCallAccepted {
@@ -202,7 +202,7 @@ impl Context {
202202 }
203203 }
204204 SystemMessage :: CallEnded => {
205- let call = self . load_call_by_child_id ( call_or_child_id) . await ?;
205+ let call = self . load_call_by_root_id ( call_or_child_id) . await ?;
206206 self . emit_msgs_changed ( call. msg . chat_id , call_or_child_id) ;
207207 self . emit_event ( EventType :: CallEnded {
208208 msg_id : call. msg . id ,
@@ -228,15 +228,6 @@ impl Context {
228228 self . load_call_by_message ( call)
229229 }
230230
231- async fn load_call_by_child_id ( & self , child_id : MsgId ) -> Result < CallInfo > {
232- let child = Message :: load_from_db ( self , child_id) . await ?;
233- if let Some ( call) = child. parent ( self ) . await ? {
234- self . load_call_by_message ( call)
235- } else {
236- Err ( anyhow ! ( "Call parent missing" ) )
237- }
238- }
239-
240231 fn load_call_by_message ( & self , call : Message ) -> Result < CallInfo > {
241232 ensure ! (
242233 call. get_info_type( ) == SystemMessage :: IncomingCall
0 commit comments