Update to jid-rs 0.2.3, which implements IntoAttributeValue on Jid.

This commit is contained in:
Emmanuel Gil Peyrot 2017-07-29 06:28:20 +01:00
parent d55fa8e5dd
commit 99b9525e6f
12 changed files with 21 additions and 21 deletions

View file

@ -14,7 +14,6 @@ license = "MPL-2.0"
[dependencies]
minidom = "0.4.4"
jid = "0.2.0"
base64 = "0.6.0"
digest = "0.6.0"
sha-1 = "0.4.0"
@ -23,3 +22,7 @@ sha3 = "0.6.0"
blake2 = "0.6.1"
chrono = "0.4.0"
try_from = "0.2.2"
[dependencies.jid]
version = "0.2.3"
features = ["minidom"]

View file

@ -49,7 +49,7 @@ impl From<Delay> for Element {
fn from(delay: Delay) -> Element {
Element::builder("delay")
.ns(ns::DELAY)
.attr("from", delay.from.map(String::from))
.attr("from", delay.from)
.attr("stamp", delay.stamp.to_rfc3339())
.append(delay.data)
.build()

View file

@ -307,7 +307,7 @@ impl From<Item> for Element {
fn from(item: Item) -> Element {
Element::builder("item")
.ns(ns::DISCO_ITEMS)
.attr("jid", String::from(item.jid))
.attr("jid", item.jid)
.attr("node", item.node)
.attr("name", item.name)
.build()

View file

@ -276,8 +276,8 @@ impl From<Iq> for Element {
fn from(iq: Iq) -> Element {
let mut stanza = Element::builder("iq")
.ns(ns::JABBER_CLIENT)
.attr("from", iq.from.map(String::from))
.attr("to", iq.to.map(String::from))
.attr("from", iq.from)
.attr("to", iq.to)
.attr("id", iq.id)
.attr("type", &iq.payload)
.build();

View file

@ -298,8 +298,8 @@ impl From<Jingle> for Element {
Element::builder("jingle")
.ns(ns::JINGLE)
.attr("action", jingle.action)
.attr("initiator", match jingle.initiator { Some(initiator) => Some(String::from(initiator)), None => None })
.attr("responder", match jingle.responder { Some(responder) => Some(String::from(responder)), None => None })
.attr("initiator", jingle.initiator)
.attr("responder", jingle.responder)
.attr("sid", jingle.sid)
.append(jingle.contents)
.append(jingle.reason)

View file

@ -211,8 +211,8 @@ impl From<Message> for Element {
fn from(message: Message) -> Element {
Element::builder("message")
.ns(ns::JABBER_CLIENT)
.attr("from", message.from.map(String::from))
.attr("to", message.to.map(String::from))
.attr("from", message.from)
.attr("to", message.to)
.attr("id", message.id)
.attr("type", message.type_)
.append(message.subjects.into_iter()

View file

@ -186,7 +186,7 @@ impl From<Actor> for Element {
let elem = Element::builder("actor").ns(ns::MUC_USER);
(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),
}).build()
}
@ -330,10 +330,7 @@ impl From<Item> for Element {
Element::builder("item")
.ns(ns::MUC_USER)
.attr("affiliation", item.affiliation)
.attr("jid", match item.jid {
Some(jid) => Some(String::from(jid)),
None => None,
})
.attr("jid", item.jid)
.attr("nick", item.nick)
.attr("role", item.role)
.append(item.actor)

View file

@ -317,8 +317,8 @@ impl From<Presence> for Element {
fn from(presence: Presence) -> Element {
Element::builder("presence")
.ns(ns::JABBER_CLIENT)
.attr("from", presence.from.map(String::from))
.attr("to", presence.to.map(String::from))
.attr("from", presence.from)
.attr("to", presence.to)
.attr("id", presence.id)
.attr("type", presence.type_)
.append(presence.show)

View file

@ -31,7 +31,7 @@ impl From<Item> for Element {
.ns(ns::PUBSUB_EVENT)
.attr("id", item.id)
.attr("node", item.node)
.attr("publisher", item.publisher.map(String::from))
.attr("publisher", item.publisher)
.append(item.payload)
.build()
}
@ -255,7 +255,7 @@ impl From<PubSubEvent> for Element {
.ns(ns::PUBSUB_EVENT)
.attr("node", node)
.attr("expiry", expiry.map(|expiry| expiry.to_rfc3339()))
.attr("jid", jid.map(String::from))
.attr("jid", jid)
.attr("subid", subid)
.attr("subscription", subscription)
.build()

View file

@ -74,7 +74,7 @@ impl From<Item> for Element {
fn from(item: Item) -> Element {
Element::builder("item")
.ns(ns::ROSTER)
.attr("jid", String::from(item.jid))
.attr("jid", item.jid)
.attr("name", item.name)
.attr("subscription", item.subscription)
.append(item.groups)

View file

@ -177,7 +177,7 @@ impl From<StanzaError> for Element {
let mut root = Element::builder("error")
.ns(ns::JABBER_CLIENT)
.attr("type", err.type_)
.attr("by", err.by.map(String::from))
.attr("by", err.by)
.append(err.defined_condition)
.build();
for (lang, text) in err.texts {

View file

@ -41,7 +41,7 @@ impl From<StanzaId> for Element {
Element::builder("stanza-id")
.ns(ns::SID)
.attr("id", stanza_id.id)
.attr("by", String::from(stanza_id.by))
.attr("by", stanza_id.by)
.build()
}
}