Update to jid-rs 0.2.3, which implements IntoAttributeValue on Jid.
This commit is contained in:
parent
d55fa8e5dd
commit
99b9525e6f
12 changed files with 21 additions and 21 deletions
|
@ -14,7 +14,6 @@ license = "MPL-2.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
minidom = "0.4.4"
|
minidom = "0.4.4"
|
||||||
jid = "0.2.0"
|
|
||||||
base64 = "0.6.0"
|
base64 = "0.6.0"
|
||||||
digest = "0.6.0"
|
digest = "0.6.0"
|
||||||
sha-1 = "0.4.0"
|
sha-1 = "0.4.0"
|
||||||
|
@ -23,3 +22,7 @@ sha3 = "0.6.0"
|
||||||
blake2 = "0.6.1"
|
blake2 = "0.6.1"
|
||||||
chrono = "0.4.0"
|
chrono = "0.4.0"
|
||||||
try_from = "0.2.2"
|
try_from = "0.2.2"
|
||||||
|
|
||||||
|
[dependencies.jid]
|
||||||
|
version = "0.2.3"
|
||||||
|
features = ["minidom"]
|
||||||
|
|
|
@ -49,7 +49,7 @@ impl From<Delay> for Element {
|
||||||
fn from(delay: Delay) -> Element {
|
fn from(delay: Delay) -> Element {
|
||||||
Element::builder("delay")
|
Element::builder("delay")
|
||||||
.ns(ns::DELAY)
|
.ns(ns::DELAY)
|
||||||
.attr("from", delay.from.map(String::from))
|
.attr("from", delay.from)
|
||||||
.attr("stamp", delay.stamp.to_rfc3339())
|
.attr("stamp", delay.stamp.to_rfc3339())
|
||||||
.append(delay.data)
|
.append(delay.data)
|
||||||
.build()
|
.build()
|
||||||
|
|
|
@ -307,7 +307,7 @@ impl From<Item> for Element {
|
||||||
fn from(item: Item) -> Element {
|
fn from(item: Item) -> Element {
|
||||||
Element::builder("item")
|
Element::builder("item")
|
||||||
.ns(ns::DISCO_ITEMS)
|
.ns(ns::DISCO_ITEMS)
|
||||||
.attr("jid", String::from(item.jid))
|
.attr("jid", item.jid)
|
||||||
.attr("node", item.node)
|
.attr("node", item.node)
|
||||||
.attr("name", item.name)
|
.attr("name", item.name)
|
||||||
.build()
|
.build()
|
||||||
|
|
|
@ -276,8 +276,8 @@ impl From<Iq> for Element {
|
||||||
fn from(iq: Iq) -> Element {
|
fn from(iq: Iq) -> Element {
|
||||||
let mut stanza = Element::builder("iq")
|
let mut stanza = Element::builder("iq")
|
||||||
.ns(ns::JABBER_CLIENT)
|
.ns(ns::JABBER_CLIENT)
|
||||||
.attr("from", iq.from.map(String::from))
|
.attr("from", iq.from)
|
||||||
.attr("to", iq.to.map(String::from))
|
.attr("to", iq.to)
|
||||||
.attr("id", iq.id)
|
.attr("id", iq.id)
|
||||||
.attr("type", &iq.payload)
|
.attr("type", &iq.payload)
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -298,8 +298,8 @@ impl From<Jingle> for Element {
|
||||||
Element::builder("jingle")
|
Element::builder("jingle")
|
||||||
.ns(ns::JINGLE)
|
.ns(ns::JINGLE)
|
||||||
.attr("action", jingle.action)
|
.attr("action", jingle.action)
|
||||||
.attr("initiator", match jingle.initiator { Some(initiator) => Some(String::from(initiator)), None => None })
|
.attr("initiator", jingle.initiator)
|
||||||
.attr("responder", match jingle.responder { Some(responder) => Some(String::from(responder)), None => None })
|
.attr("responder", jingle.responder)
|
||||||
.attr("sid", jingle.sid)
|
.attr("sid", jingle.sid)
|
||||||
.append(jingle.contents)
|
.append(jingle.contents)
|
||||||
.append(jingle.reason)
|
.append(jingle.reason)
|
||||||
|
|
|
@ -211,8 +211,8 @@ impl From<Message> for Element {
|
||||||
fn from(message: Message) -> Element {
|
fn from(message: Message) -> Element {
|
||||||
Element::builder("message")
|
Element::builder("message")
|
||||||
.ns(ns::JABBER_CLIENT)
|
.ns(ns::JABBER_CLIENT)
|
||||||
.attr("from", message.from.map(String::from))
|
.attr("from", message.from)
|
||||||
.attr("to", message.to.map(String::from))
|
.attr("to", message.to)
|
||||||
.attr("id", message.id)
|
.attr("id", message.id)
|
||||||
.attr("type", message.type_)
|
.attr("type", message.type_)
|
||||||
.append(message.subjects.into_iter()
|
.append(message.subjects.into_iter()
|
||||||
|
|
|
@ -186,7 +186,7 @@ impl From<Actor> for Element {
|
||||||
let elem = Element::builder("actor").ns(ns::MUC_USER);
|
let elem = Element::builder("actor").ns(ns::MUC_USER);
|
||||||
|
|
||||||
(match actor {
|
(match actor {
|
||||||
Actor::Jid(jid) => elem.attr("jid", String::from(jid)),
|
Actor::Jid(jid) => elem.attr("jid", jid),
|
||||||
Actor::Nick(nick) => elem.attr("nick", nick),
|
Actor::Nick(nick) => elem.attr("nick", nick),
|
||||||
}).build()
|
}).build()
|
||||||
}
|
}
|
||||||
|
@ -330,10 +330,7 @@ impl From<Item> for Element {
|
||||||
Element::builder("item")
|
Element::builder("item")
|
||||||
.ns(ns::MUC_USER)
|
.ns(ns::MUC_USER)
|
||||||
.attr("affiliation", item.affiliation)
|
.attr("affiliation", item.affiliation)
|
||||||
.attr("jid", match item.jid {
|
.attr("jid", item.jid)
|
||||||
Some(jid) => Some(String::from(jid)),
|
|
||||||
None => None,
|
|
||||||
})
|
|
||||||
.attr("nick", item.nick)
|
.attr("nick", item.nick)
|
||||||
.attr("role", item.role)
|
.attr("role", item.role)
|
||||||
.append(item.actor)
|
.append(item.actor)
|
||||||
|
|
|
@ -317,8 +317,8 @@ impl From<Presence> for Element {
|
||||||
fn from(presence: Presence) -> Element {
|
fn from(presence: Presence) -> Element {
|
||||||
Element::builder("presence")
|
Element::builder("presence")
|
||||||
.ns(ns::JABBER_CLIENT)
|
.ns(ns::JABBER_CLIENT)
|
||||||
.attr("from", presence.from.map(String::from))
|
.attr("from", presence.from)
|
||||||
.attr("to", presence.to.map(String::from))
|
.attr("to", presence.to)
|
||||||
.attr("id", presence.id)
|
.attr("id", presence.id)
|
||||||
.attr("type", presence.type_)
|
.attr("type", presence.type_)
|
||||||
.append(presence.show)
|
.append(presence.show)
|
||||||
|
|
|
@ -31,7 +31,7 @@ impl From<Item> for Element {
|
||||||
.ns(ns::PUBSUB_EVENT)
|
.ns(ns::PUBSUB_EVENT)
|
||||||
.attr("id", item.id)
|
.attr("id", item.id)
|
||||||
.attr("node", item.node)
|
.attr("node", item.node)
|
||||||
.attr("publisher", item.publisher.map(String::from))
|
.attr("publisher", item.publisher)
|
||||||
.append(item.payload)
|
.append(item.payload)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ impl From<PubSubEvent> for Element {
|
||||||
.ns(ns::PUBSUB_EVENT)
|
.ns(ns::PUBSUB_EVENT)
|
||||||
.attr("node", node)
|
.attr("node", node)
|
||||||
.attr("expiry", expiry.map(|expiry| expiry.to_rfc3339()))
|
.attr("expiry", expiry.map(|expiry| expiry.to_rfc3339()))
|
||||||
.attr("jid", jid.map(String::from))
|
.attr("jid", jid)
|
||||||
.attr("subid", subid)
|
.attr("subid", subid)
|
||||||
.attr("subscription", subscription)
|
.attr("subscription", subscription)
|
||||||
.build()
|
.build()
|
||||||
|
|
|
@ -74,7 +74,7 @@ impl From<Item> for Element {
|
||||||
fn from(item: Item) -> Element {
|
fn from(item: Item) -> Element {
|
||||||
Element::builder("item")
|
Element::builder("item")
|
||||||
.ns(ns::ROSTER)
|
.ns(ns::ROSTER)
|
||||||
.attr("jid", String::from(item.jid))
|
.attr("jid", item.jid)
|
||||||
.attr("name", item.name)
|
.attr("name", item.name)
|
||||||
.attr("subscription", item.subscription)
|
.attr("subscription", item.subscription)
|
||||||
.append(item.groups)
|
.append(item.groups)
|
||||||
|
|
|
@ -177,7 +177,7 @@ impl From<StanzaError> for Element {
|
||||||
let mut root = Element::builder("error")
|
let mut root = Element::builder("error")
|
||||||
.ns(ns::JABBER_CLIENT)
|
.ns(ns::JABBER_CLIENT)
|
||||||
.attr("type", err.type_)
|
.attr("type", err.type_)
|
||||||
.attr("by", err.by.map(String::from))
|
.attr("by", err.by)
|
||||||
.append(err.defined_condition)
|
.append(err.defined_condition)
|
||||||
.build();
|
.build();
|
||||||
for (lang, text) in err.texts {
|
for (lang, text) in err.texts {
|
||||||
|
|
|
@ -41,7 +41,7 @@ impl From<StanzaId> for Element {
|
||||||
Element::builder("stanza-id")
|
Element::builder("stanza-id")
|
||||||
.ns(ns::SID)
|
.ns(ns::SID)
|
||||||
.attr("id", stanza_id.id)
|
.attr("id", stanza_id.id)
|
||||||
.attr("by", String::from(stanza_id.by))
|
.attr("by", stanza_id.by)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue