aboutsummaryrefslogtreecommitdiffstats
path: root/stanza/src/stream.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@bunny.garden>2025-06-01 13:31:52 +0100
committerLibravatar cel 🌸 <cel@bunny.garden>2025-06-01 13:31:52 +0100
commitc6bdf077b82b30f8228b56702bd3ee71d92b3910 (patch)
treedb12501d5d60906b77b19c1395a522967957c715 /stanza/src/stream.rs
parentc196aecbe7b3b29fbfff9e997478688e6833b7f3 (diff)
downloadluz-c6bdf077b82b30f8228b56702bd3ee71d92b3910.tar.gz
luz-c6bdf077b82b30f8228b56702bd3ee71d92b3910.tar.bz2
luz-c6bdf077b82b30f8228b56702bd3ee71d92b3910.zip
refactor: utilise new jid type safetyHEADmainjid-refactor
Diffstat (limited to 'stanza/src/stream.rs')
-rw-r--r--stanza/src/stream.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/stanza/src/stream.rs b/stanza/src/stream.rs
index 5be235a..e2f4f9b 100644
--- a/stanza/src/stream.rs
+++ b/stanza/src/stream.rs
@@ -1,6 +1,6 @@
use std::fmt::Display;
-use jid::JID;
+use jid::BareJID;
use peanuts::{Element, ElementBuilder, FromElement, IntoElement};
use thiserror::Error;
@@ -18,8 +18,8 @@ pub const XMLNS: &str = "http://etherx.jabber.org/streams";
// #[peanuts(xmlns = XMLNS)]
#[derive(Debug)]
pub struct Stream {
- pub from: Option<JID>,
- to: Option<JID>,
+ pub from: Option<BareJID>,
+ to: Option<BareJID>,
id: Option<String>,
version: Option<String>,
// TODO: lang enum
@@ -64,8 +64,8 @@ impl IntoElement for Stream {
impl<'s> Stream {
pub fn new(
- from: Option<JID>,
- to: Option<JID>,
+ from: Option<BareJID>,
+ to: Option<BareJID>,
id: Option<String>,
version: Option<String>,
lang: Option<String>,
@@ -81,7 +81,12 @@ impl<'s> Stream {
/// For initial stream headers, the initiating entity SHOULD include the 'xml:lang' attribute.
/// For privacy, it is better to not set `from` when sending a client stanza over an unencrypted connection.
- pub fn new_client(from: Option<JID>, to: JID, id: Option<String>, lang: String) -> Self {
+ pub fn new_client(
+ from: Option<BareJID>,
+ to: BareJID,
+ id: Option<String>,
+ lang: String,
+ ) -> Self {
Self {
from,
to: Some(to),