From d31caae5a0ea3274faffe3fa2365fa2e9f0fb018 Mon Sep 17 00:00:00 2001 From: lumi Date: Tue, 21 Feb 2017 00:07:10 +0100 Subject: [PATCH] use the minidom ElementBuilder::text method --- src/client.rs | 10 +++++----- src/plugins/presence.rs | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/client.rs b/src/client.rs index 2a35ce74..5f28806d 100644 --- a/src/client.rs +++ b/src/client.rs @@ -141,11 +141,11 @@ impl Client { auth.extend(self.jid.node.as_ref().expect("JID has no node").bytes()); auth.push(0); auth.extend(password.bytes()); - let mut elem = Element::builder("auth") - .ns(ns::SASL) - .attr("mechanism", "PLAIN") - .build(); - elem.append_text_node(base64::encode(&auth)); + let elem = Element::builder("auth") + .text(base64::encode(&auth)) + .ns(ns::SASL) + .attr("mechanism", "PLAIN") + .build(); self.transport.write_element(&elem)?; did_sasl = true; } diff --git a/src/plugins/presence.rs b/src/plugins/presence.rs index 4dc9ca48..084189ec 100644 --- a/src/plugins/presence.rs +++ b/src/plugins/presence.rs @@ -75,10 +75,10 @@ impl PresencePlugin { .ns(ns::CLIENT) .build(); if let Some(stat) = status { - let mut elem = Element::builder("status") - .ns(ns::CLIENT) - .build(); - elem.append_text_node(stat); + let elem = Element::builder("status") + .ns(ns::CLIENT) + .text(stat) + .build(); stanza.append_child(elem); } let mut elem = Element::builder("show")