Skip to content

Commit aa36f76

Browse files
committed
notify about missed calls
1 parent da13227 commit aa36f76

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

src/calls.rs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,23 @@ impl Context {
156156
match mime_message.is_system_message {
157157
SystemMessage::IncomingCall => {
158158
let call = self.load_call_by_root_id(call_or_child_id).await?;
159-
self.emit_msgs_changed(call.msg.chat_id, call_or_child_id);
160-
if call.incoming && !call.is_stale_call() {
161-
self.emit_event(EventType::IncomingCall {
162-
msg_id: call.msg.id,
163-
});
164-
let wait = call.remaining_ring_seconds();
165-
task::spawn(Context::emit_end_call_if_unaccepted(
166-
self.clone(),
167-
wait.try_into()?,
168-
call.msg.id,
169-
));
159+
if call.incoming {
160+
if call.is_stale_call() {
161+
self.emit_incoming_msg(call.msg.chat_id, call_or_child_id);
162+
} else {
163+
self.emit_msgs_changed(call.msg.chat_id, call_or_child_id);
164+
self.emit_event(EventType::IncomingCall {
165+
msg_id: call.msg.id,
166+
});
167+
let wait = call.remaining_ring_seconds();
168+
task::spawn(Context::emit_end_call_if_unaccepted(
169+
self.clone(),
170+
wait.try_into()?,
171+
call.msg.id,
172+
));
173+
}
174+
} else {
175+
self.emit_msgs_changed(call.msg.chat_id, call_or_child_id);
170176
}
171177
}
172178
SystemMessage::CallAccepted => {

0 commit comments

Comments
 (0)