@@ -13,7 +13,7 @@ use crate::mimeparser::{MimeMessage, SystemMessage};
13
13
use crate :: param:: Param ;
14
14
use crate :: sync:: SyncData ;
15
15
use crate :: tools:: time;
16
- use anyhow:: { anyhow , ensure, Result } ;
16
+ use anyhow:: { ensure, Result } ;
17
17
use std:: time:: Duration ;
18
18
use tokio:: task;
19
19
use tokio:: time:: sleep;
@@ -188,7 +188,7 @@ impl Context {
188
188
}
189
189
}
190
190
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 ?;
192
192
self . emit_msgs_changed ( call. msg . chat_id , call_or_child_id) ;
193
193
if call. incoming {
194
194
self . emit_event ( EventType :: IncomingCallAccepted {
@@ -202,7 +202,7 @@ impl Context {
202
202
}
203
203
}
204
204
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 ?;
206
206
self . emit_msgs_changed ( call. msg . chat_id , call_or_child_id) ;
207
207
self . emit_event ( EventType :: CallEnded {
208
208
msg_id : call. msg . id ,
@@ -228,15 +228,6 @@ impl Context {
228
228
self . load_call_by_message ( call)
229
229
}
230
230
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
-
240
231
fn load_call_by_message ( & self , call : Message ) -> Result < CallInfo > {
241
232
ensure ! (
242
233
call. get_info_type( ) == SystemMessage :: IncomingCall
0 commit comments