From a367aca33fecc03270b5b9ad2a6a21281d760fd8 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Thu, 27 Mar 2025 19:09:35 +0000 Subject: refactor(filamento): handle_online logic --- filamento/src/logic/process_stanza.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'filamento/src/logic/process_stanza.rs') diff --git a/filamento/src/logic/process_stanza.rs b/filamento/src/logic/process_stanza.rs index 94257aa..660da16 100644 --- a/filamento/src/logic/process_stanza.rs +++ b/filamento/src/logic/process_stanza.rs @@ -169,21 +169,14 @@ pub async fn recv_iq( } match iq.r#type { stanza::client::iq::IqType::Error | stanza::client::iq::IqType::Result => { - let send; - { - send = logic.pending().lock().await.remove(&iq.id); - } let from = iq .from .clone() .unwrap_or_else(|| connection.server().clone()); - if let Some(send) = send { - debug!("received iq result from {}", from); - let _ = send.send(Ok(Stanza::Iq(iq))); - Ok(None) - } else { - Err(IqError::NoMatchingId(iq.id)) - } + let id = iq.id.clone(); + debug!("received iq result with id `{}` from {}", id, from); + logic.pending().respond(Stanza::Iq(iq), id).await?; + Ok(None) } stanza::client::iq::IqType::Get => { let from = iq -- cgit