aboutsummaryrefslogtreecommitdiffstats
path: root/lampada/src/connection
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lampada/src/connection/mod.rs31
-rw-r--r--lampada/src/connection/read.rs4
-rw-r--r--lampada/src/connection/write.rs4
3 files changed, 23 insertions, 16 deletions
diff --git a/lampada/src/connection/mod.rs b/lampada/src/connection/mod.rs
index 3a3187f..485b93d 100644
--- a/lampada/src/connection/mod.rs
+++ b/lampada/src/connection/mod.rs
@@ -1,3 +1,7 @@
+// SPDX-FileCopyrightText: 2025 cel <cel@bunny.garden>
+//
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
// TODO: consider if this needs to be handled by a supervisor or could be handled by luz directly
use std::{
@@ -7,7 +11,7 @@ use std::{
time::Duration,
};
-use jid::JID;
+use jid::{BareJID, FullJID, JID};
use luz::jabber_stream::bound_stream::BoundJabberStream;
use read::{ReadControl, ReadControlHandle, ReadState};
use stanza::{client::Stanza, stream_error::Error as StreamError};
@@ -121,12 +125,11 @@ where
break
}
- let mut jid = self.connected.jid.clone();
- let mut domain = jid.domainpart.clone();
+ let mut jid = self.connected.jid.clone().into();
// TODO: make sure connect_and_login does not modify the jid, but instead returns a jid. or something like that
- let connection = luz::connect_and_login(&mut jid, &*self.password, &mut domain).await;
+ let connection = luz::connect_and_login(&jid, &*self.password).await;
match connection {
- Ok(c) => {
+ Ok((c, full_jid)) => {
let (read, write) = c.split();
let (send, recv) = oneshot::channel();
self.writer_crash = recv;
@@ -169,12 +172,11 @@ where
else => break,
};
- let mut jid = self.connected.jid.clone();
- let mut domain = jid.domainpart.clone();
+ let mut jid = self.connected.jid.clone().into();
// TODO: same here
- let connection = luz::connect_and_login(&mut jid, &*self.password, &mut domain).await;
+ let connection = luz::connect_and_login(&jid, &*self.password).await;
match connection {
- Ok(c) => {
+ Ok((c, full_jid)) => {
let (read, write) = c.split();
let (send, recv) = oneshot::channel();
self.writer_crash = recv;
@@ -214,11 +216,10 @@ where
else => break,
};
- let mut jid = self.connected.jid.clone();
- let mut domain = jid.domainpart.clone();
- let connection = luz::connect_and_login(&mut jid, &*self.password, &mut domain).await;
+ let mut jid = self.connected.jid.clone().into();
+ let connection = luz::connect_and_login(&jid, &*self.password).await;
match connection {
- Ok(c) => {
+ Ok((c, full_jid)) => {
let (read, write) = c.split();
let (send, recv) = oneshot::channel();
self.writer_crash = recv;
@@ -305,8 +306,7 @@ impl SupervisorHandle {
pub fn new<Lgc>(
streams: BoundJabberStream,
on_crash: oneshot::Sender<()>,
- jid: JID,
- server: JID,
+ jid: FullJID,
password: Arc<String>,
logic: Lgc,
) -> (WriteHandle, Self)
@@ -327,7 +327,6 @@ impl SupervisorHandle {
let connected = Connected {
jid,
write_handle: write_handle.clone(),
- server,
};
let supervisor_sender = SupervisorSender {
diff --git a/lampada/src/connection/read.rs b/lampada/src/connection/read.rs
index 591a2cb..ebcf66a 100644
--- a/lampada/src/connection/read.rs
+++ b/lampada/src/connection/read.rs
@@ -1,3 +1,7 @@
+// SPDX-FileCopyrightText: 2025 cel <cel@bunny.garden>
+//
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
use std::{
collections::HashMap,
marker::PhantomData,
diff --git a/lampada/src/connection/write.rs b/lampada/src/connection/write.rs
index b982eea..a047674 100644
--- a/lampada/src/connection/write.rs
+++ b/lampada/src/connection/write.rs
@@ -1,3 +1,7 @@
+// SPDX-FileCopyrightText: 2025 cel <cel@bunny.garden>
+//
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
use std::ops::{Deref, DerefMut};
use luz::jabber_stream::bound_stream::BoundJabberWriter;