Update xmpp-rs deps
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
f9539f92f0
commit
a46f34efb2
3 changed files with 12 additions and 13 deletions
|
@ -8,9 +8,9 @@ description = "Reimplementation of the Scansion project in Rust"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
nom = "7.1"
|
nom = "7.1"
|
||||||
jid = { version = "0.9", features = [ "minidom" ] }
|
jid = { version = "*", features = [ "minidom" ] }
|
||||||
minidom = "0.15.1"
|
minidom = "*"
|
||||||
xmpp-parsers = "0.19.2"
|
xmpp-parsers = "0.20"
|
||||||
nom_locate = "4.0.0"
|
nom_locate = "4.0.0"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,6 @@ use std::str::FromStr;
|
||||||
use crate::parsers::parse_variable;
|
use crate::parsers::parse_variable;
|
||||||
use crate::types::{Client, Context, Entity, VariableAttr};
|
use crate::types::{Client, Context, Entity, VariableAttr};
|
||||||
|
|
||||||
use jid::BareJid;
|
|
||||||
use minidom::{Element, Error as MinidomError, Node};
|
use minidom::{Element, Error as MinidomError, Node};
|
||||||
use xmpp_parsers::{iq::Iq, message::Message, presence::Presence, Error as XMPPParserError};
|
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);
|
let scan = ScanNode::new(node);
|
||||||
res && filtered_other
|
res && filtered_other
|
||||||
.iter()
|
.iter()
|
||||||
.find(|onode| &&scan == onode)
|
.find(|onode| &scan == *onode)
|
||||||
.is_some()
|
.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()) {
|
if let Ok((_, var)) = parse_variable(val.as_str().into()) {
|
||||||
match var {
|
match var {
|
||||||
VariableAttr::FullJid(name) => match context.get(&name) {
|
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) {
|
VariableAttr::BareJid(name) => match context.get(&name) {
|
||||||
Some(Entity::Client(Client { jid, .. })) => {
|
Some(Entity::Client(Client { jid, .. })) => *val = format!("{}", jid.to_bare()),
|
||||||
*val = String::from(BareJid::from(jid.clone()))
|
|
||||||
}
|
|
||||||
_ => (),
|
_ => (),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,9 @@ fn bind_context(context: Context) -> Context {
|
||||||
match context {
|
match context {
|
||||||
Entity::Client(ref mut client) => match &client.jid {
|
Entity::Client(ref mut client) => match &client.jid {
|
||||||
Jid::Bare(bare) => {
|
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)
|
client.jid = Jid::Full(jid)
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
@ -145,7 +147,7 @@ pub fn read_actions_component(spec: Spec, context: &Context) -> Result<InOutStan
|
||||||
Entity::Client(Client {
|
Entity::Client(Client {
|
||||||
jid: Jid::Full(full),
|
jid: Jid::Full(full),
|
||||||
..
|
..
|
||||||
}) => BareJid::from(full.clone()),
|
}) => full.to_bare(),
|
||||||
Entity::Client(Client {
|
Entity::Client(Client {
|
||||||
jid: Jid::Bare(bare),
|
jid: Jid::Bare(bare),
|
||||||
..
|
..
|
||||||
|
@ -243,8 +245,8 @@ louise receives:
|
||||||
password,
|
password,
|
||||||
..
|
..
|
||||||
})) => {
|
})) => {
|
||||||
assert_eq!(full.node, Some(String::from("louise")));
|
assert_eq!(full.node_str(), Some(String::from("louise")).as_deref());
|
||||||
assert_eq!(full.domain, String::from("localhost"));
|
assert_eq!(full.domain_str(), String::from("localhost"));
|
||||||
assert_eq!(password, "password");
|
assert_eq!(password, "password");
|
||||||
}
|
}
|
||||||
other => panic!("Error: context: {other:?}"),
|
other => panic!("Error: context: {other:?}"),
|
||||||
|
|
Loading…
Reference in a new issue