aboutsummaryrefslogtreecommitdiffstats
path: root/filamento/src/logic/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'filamento/src/logic/mod.rs')
-rw-r--r--filamento/src/logic/mod.rs14
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,
}
}