Skip to content

Commit

Permalink
refactor: Use Option::or_else() to dedup emitting IncomingWebxdcNotify
Browse files Browse the repository at this point in the history
  • Loading branch information
iequidoo committed Nov 29, 2024
1 parent 8967d77 commit 45e55c9
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/webxdc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,14 +417,9 @@ impl Context {
if from_id != ContactId::SELF {
if let Some(notify_list) = status_update_item.notify {
let self_addr = instance.get_webxdc_self_addr(self).await?;
if let Some(notify_text) = notify_list.get(&self_addr) {
self.emit_event(EventType::IncomingWebxdcNotify {
contact_id: from_id,
msg_id: notify_msg_id,
text: notify_text.clone(),
href: status_update_item.href,
});
} else if let Some(notify_text) = notify_list.get("*") {
if let Some(notify_text) =
notify_list.get(&self_addr).or_else(|| notify_list.get("*"))
{
self.emit_event(EventType::IncomingWebxdcNotify {
contact_id: from_id,
msg_id: notify_msg_id,
Expand Down

0 comments on commit 45e55c9

Please sign in to comment.