summaryrefslogtreecommitdiffstats
path: root/src/stanza/bind.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2023-08-05 20:14:09 +0100
committerLibravatar cel 🌸 <cel@blos.sm>2023-08-05 20:14:09 +0100
commit5334cd4ed69d12e4265b8b97ae9e7ed02f78a9ff (patch)
tree4f901d7543fa52e6ec5dac73ab6eef8f6c42e570 /src/stanza/bind.rs
parentdec6f0105d0da5f06f685d49fd4b118975542d07 (diff)
downloadluz-5334cd4ed69d12e4265b8b97ae9e7ed02f78a9ff.tar.gz
luz-5334cd4ed69d12e4265b8b97ae9e7ed02f78a9ff.tar.bz2
luz-5334cd4ed69d12e4265b8b97ae9e7ed02f78a9ff.zip
WIP: refactor Element type - namespace work
Diffstat (limited to 'src/stanza/bind.rs')
-rw-r--r--src/stanza/bind.rs29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/stanza/bind.rs b/src/stanza/bind.rs
index f1bdc2d..5e9704f 100644
--- a/src/stanza/bind.rs
+++ b/src/stanza/bind.rs
@@ -1,10 +1,12 @@
+use std::collections::BTreeMap;
+
use quick_xml::{
events::{BytesStart, BytesText, Event},
name::QName,
Reader,
};
-use super::{Element, IntoElement};
+use super::{Element, IntoElement, Node};
use crate::{JabberError, JID};
const XMLNS: &str = "urn:ietf:params:xml:ns:xmpp-bind";
@@ -14,7 +16,30 @@ pub struct Bind {
pub jid: Option<JID>,
}
-impl<'e> IntoElement<'e> for Bind {
+impl From<Bind> for Element {
+ fn from(value: Bind) -> Self {
+ let mut namespace_declarations = Box::new(BTreeMap::new());
+ namespace_declarations.insert(None, XMLNS.to_owned());
+ let mut children = Vec::new();
+ if let Some(resource) = value.resource {
+ children.push(Node::Element(
+ Element { prefix: None, localname: "", namespace: , namespace_declarations: , attributes: , children: }
+ )
+
+ )
+ }
+ Self {
+ prefix: None,
+ localname: "bind".to_string(),
+ namespace: XMLNS.to_owned(),
+ namespace_declarations,
+ attributes: todo!(),
+ children: todo!(),
+ }
+ }
+}
+
+impl IntoElement for Bind {
fn event(&self) -> quick_xml::events::Event<'static> {
let mut bind_event = BytesStart::new("bind");
bind_event.push_attribute(("xmlns", XMLNS));