From 91f1994af940085d5d475a97820900ebbf0eb553 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Thu, 3 Apr 2025 03:41:38 +0100 Subject: feat: better message handling, pep publish, xep_0172: nick --- filamento/src/logic/mod.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'filamento/src/logic/mod.rs') diff --git a/filamento/src/logic/mod.rs b/filamento/src/logic/mod.rs index 15c2d12..1ddd7d3 100644 --- a/filamento/src/logic/mod.rs +++ b/filamento/src/logic/mod.rs @@ -1,5 +1,6 @@ use std::{collections::HashMap, sync::Arc}; +use jid::JID; use lampada::{Connected, Logic, error::ReadError}; use stanza::client::Stanza; use tokio::sync::{Mutex, mpsc, oneshot}; @@ -8,7 +9,7 @@ use tracing::{error, info, warn}; use crate::{ Client, Command, UpdateMessage, db::Db, - error::{Error, RequestError, ResponseError}, + error::{Error, IqRequestError, ResponseError}, }; mod abort; @@ -23,6 +24,7 @@ mod process_stanza; #[derive(Clone)] pub struct ClientLogic { client: Client, + bare_jid: JID, db: Db, pending: Pending, update_sender: mpsc::Sender, @@ -41,7 +43,7 @@ impl Pending { connection: &Connected, request: Stanza, id: String, - ) -> Result { + ) -> Result { let (send, recv) = oneshot::channel(); { self.0.lock().await.insert(id, send); @@ -74,12 +76,18 @@ impl Pending { } impl ClientLogic { - pub fn new(client: Client, db: Db, update_sender: mpsc::Sender) -> Self { + pub fn new( + client: Client, + bare_jid: JID, + db: Db, + update_sender: mpsc::Sender, + ) -> Self { Self { db, pending: Pending::new(), update_sender, client, + bare_jid, } } -- cgit