mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
fix: do not notify about incoming calls for contact requests and blocked contacts
This commit is contained in:
30
src/calls.rs
30
src/calls.rs
@@ -2,8 +2,9 @@
|
|||||||
//!
|
//!
|
||||||
//! Internally, calls are bound a user-visible message initializing the call.
|
//! Internally, calls are bound a user-visible message initializing the call.
|
||||||
//! This means, the "Call ID" is a "Message ID" - similar to Webxdc IDs.
|
//! This means, the "Call ID" is a "Message ID" - similar to Webxdc IDs.
|
||||||
|
use crate::chat::ChatIdBlocked;
|
||||||
use crate::chat::{Chat, ChatId, send_msg};
|
use crate::chat::{Chat, ChatId, send_msg};
|
||||||
use crate::constants::Chattype;
|
use crate::constants::{Blocked, Chattype};
|
||||||
use crate::contact::ContactId;
|
use crate::contact::ContactId;
|
||||||
use crate::context::Context;
|
use crate::context::Context;
|
||||||
use crate::events::EventType;
|
use crate::events::EventType;
|
||||||
@@ -345,12 +346,27 @@ impl Context {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
self.emit_event(EventType::IncomingCall {
|
if let Some(chat_id_blocked) =
|
||||||
msg_id: call.msg.id,
|
ChatIdBlocked::lookup_by_contact(self, from_id).await?
|
||||||
chat_id: call.msg.chat_id,
|
{
|
||||||
place_call_info: call.place_call_info.to_string(),
|
match chat_id_blocked.blocked {
|
||||||
has_video,
|
Blocked::Not => {
|
||||||
});
|
self.emit_event(EventType::IncomingCall {
|
||||||
|
msg_id: call.msg.id,
|
||||||
|
chat_id: call.msg.chat_id,
|
||||||
|
place_call_info: call.place_call_info.to_string(),
|
||||||
|
has_video,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Blocked::Yes | Blocked::Request => {
|
||||||
|
// Do not notify about incoming calls
|
||||||
|
// from contact requests and blocked contacts.
|
||||||
|
//
|
||||||
|
// User can still access the call and accept it
|
||||||
|
// via the chat in case of contact requests.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
let wait = call.remaining_ring_seconds();
|
let wait = call.remaining_ring_seconds();
|
||||||
task::spawn(Context::emit_end_call_if_unaccepted(
|
task::spawn(Context::emit_end_call_if_unaccepted(
|
||||||
self.clone(),
|
self.clone(),
|
||||||
|
|||||||
Reference in New Issue
Block a user