diff options
author | 2025-04-03 03:41:38 +0100 | |
---|---|---|
committer | 2025-04-03 03:41:38 +0100 | |
commit | 91f1994af940085d5d475a97820900ebbf0eb553 (patch) | |
tree | 6aab872f71d17a785d3d9286742fef38983d274c /filamento/src/logic/mod.rs | |
parent | 9ce3827a7d25714d17f266f0f50bb29f41090175 (diff) | |
download | luz-91f1994af940085d5d475a97820900ebbf0eb553.tar.gz luz-91f1994af940085d5d475a97820900ebbf0eb553.tar.bz2 luz-91f1994af940085d5d475a97820900ebbf0eb553.zip |
feat: better message handling, pep publish, xep_0172: nick
Diffstat (limited to 'filamento/src/logic/mod.rs')
-rw-r--r-- | filamento/src/logic/mod.rs | 14 |
1 files changed, 11 insertions, 3 deletions
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<UpdateMessage>, @@ -41,7 +43,7 @@ impl Pending { connection: &Connected, request: Stanza, id: String, - ) -> Result<Stanza, RequestError> { + ) -> Result<Stanza, IqRequestError> { 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<UpdateMessage>) -> Self { + pub fn new( + client: Client, + bare_jid: JID, + db: Db, + update_sender: mpsc::Sender<UpdateMessage>, + ) -> Self { Self { db, pending: Pending::new(), update_sender, client, + bare_jid, } } |