mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 08:56:29 +03:00
notify webxdc info messages as needed
This commit is contained in:
@@ -315,20 +315,33 @@ impl Context {
|
|||||||
|
|
||||||
if can_info_msg {
|
if can_info_msg {
|
||||||
if let Some(ref info) = status_update_item.info {
|
if let Some(ref info) = status_update_item.info {
|
||||||
if let Some(info_msg_id) =
|
let overwritable_info =
|
||||||
self.get_overwritable_info_msg_id(instance, from_id).await?
|
self.get_overwritable_info_msg_id(instance, from_id).await?;
|
||||||
{
|
let notify_list = status_update_item.notify;
|
||||||
|
|
||||||
|
if notify_list.is_none() && overwritable_info.is_some() {
|
||||||
|
if let Some(overwritable_info) = overwritable_info {
|
||||||
chat::update_msg_text_and_timestamp(
|
chat::update_msg_text_and_timestamp(
|
||||||
self,
|
self,
|
||||||
instance.chat_id,
|
instance.chat_id,
|
||||||
info_msg_id,
|
overwritable_info,
|
||||||
info.as_str(),
|
info.as_str(),
|
||||||
timestamp,
|
timestamp,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: change add_info_msg_with_cmd() to emit DC_EVENT_INCOMING_MSG if update.notify refers to us
|
let notify = if let Some(notify_list) = notify_list {
|
||||||
chat::add_info_msg_with_cmd(
|
if let Ok(self_addr) = self.get_primary_self_addr().await {
|
||||||
|
notify_list.contains(&self_addr)
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
|
chat::add_info_msg_with_importance(
|
||||||
self,
|
self,
|
||||||
instance.chat_id,
|
instance.chat_id,
|
||||||
info.as_str(),
|
info.as_str(),
|
||||||
@@ -337,6 +350,7 @@ impl Context {
|
|||||||
None,
|
None,
|
||||||
Some(instance),
|
Some(instance),
|
||||||
Some(from_id),
|
Some(from_id),
|
||||||
|
notify,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user