Update xmpp-rs deps

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2023-10-18 17:20:35 +02:00
parent f9539f92f0
commit a46f34efb2
3 changed files with 12 additions and 13 deletions

View file

@ -8,9 +8,9 @@ description = "Reimplementation of the Scansion project in Rust"
[dependencies]
nom = "7.1"
jid = { version = "0.9", features = [ "minidom" ] }
minidom = "0.15.1"
xmpp-parsers = "0.19.2"
jid = { version = "*", features = [ "minidom" ] }
minidom = "*"
xmpp-parsers = "0.20"
nom_locate = "4.0.0"
rand = "0.8"

View file

@ -43,7 +43,6 @@ use std::str::FromStr;
use crate::parsers::parse_variable;
use crate::types::{Client, Context, Entity, VariableAttr};
use jid::BareJid;
use minidom::{Element, Error as MinidomError, Node};
use xmpp_parsers::{iq::Iq, message::Message, presence::Presence, Error as XMPPParserError};
@ -182,7 +181,7 @@ impl PartialEq<Vec<Node>> for ScanNodes<NonStrictComparison> {
let scan = ScanNode::new(node);
res && filtered_other
.iter()
.find(|onode| &&scan == onode)
.find(|onode| &scan == *onode)
.is_some()
})
}
@ -282,13 +281,11 @@ fn apply_context(mut elem: Element, context: &Context) -> Element {
if let Ok((_, var)) = parse_variable(val.as_str().into()) {
match var {
VariableAttr::FullJid(name) => match context.get(&name) {
Some(Entity::Client(Client { jid, .. })) => *val = String::from(jid.clone()),
Some(Entity::Client(Client { jid, .. })) => *val = format!("{jid}"),
_ => (),
},
VariableAttr::BareJid(name) => match context.get(&name) {
Some(Entity::Client(Client { jid, .. })) => {
*val = String::from(BareJid::from(jid.clone()))
}
Some(Entity::Client(Client { jid, .. })) => *val = format!("{}", jid.to_bare()),
_ => (),
},
}

View file

@ -61,7 +61,9 @@ fn bind_context(context: Context) -> Context {
match context {
Entity::Client(ref mut client) => match &client.jid {
Jid::Bare(bare) => {
let jid = bare.clone().with_resource(make_resource());
let res = make_resource();
// u8 should always be a valid resource?
let jid = bare.clone().with_resource_str(&res).unwrap();
client.jid = Jid::Full(jid)
}
_ => (),
@ -145,7 +147,7 @@ pub fn read_actions_component(spec: Spec, context: &Context) -> Result<InOutStan
Entity::Client(Client {
jid: Jid::Full(full),
..
}) => BareJid::from(full.clone()),
}) => full.to_bare(),
Entity::Client(Client {
jid: Jid::Bare(bare),
..
@ -243,8 +245,8 @@ louise receives:
password,
..
})) => {
assert_eq!(full.node, Some(String::from("louise")));
assert_eq!(full.domain, String::from("localhost"));
assert_eq!(full.node_str(), Some(String::from("louise")).as_deref());
assert_eq!(full.domain_str(), String::from("localhost"));
assert_eq!(password, "password");
}
other => panic!("Error: context: {other:?}"),