diff --git a/src/client_auth.rs b/src/client_auth.rs index 5ae57b7..c6aa79d 100644 --- a/src/client_auth.rs +++ b/src/client_auth.rs @@ -36,7 +36,6 @@ impl ClientAuth { Box::new(Anonymous::new()), ]; - println!("stream_features: {}", stream.stream_features); let mech_names: Vec = match stream.stream_features.get_child("mechanisms", Some(NS_XMPP_SASL)) { None => @@ -46,12 +45,12 @@ impl ClientAuth { .map(|mech_el| mech_el.content_str()) .collect(), }; - println!("Offered mechanisms: {:?}", mech_names); + println!("SASL mechanisms offered: {:?}", mech_names); for mut mech in mechs { let name = mech.name().to_owned(); if mech_names.iter().any(|name1| *name1 == name) { - println!("Selected mechanism: {:?}", name); + println!("SASL mechanism selected: {:?}", name); let initial = try!(mech.initial()); let mut this = ClientAuth { state: ClientAuthState::Invalid, @@ -79,7 +78,6 @@ impl ClientAuth { ); nonza.text(content.to_base64(base64::URL_SAFE)); - println!("send {}", nonza); let send = stream.send(Packet::Stanza(nonza)); self.state = ClientAuthState::WaitSend(send); @@ -97,7 +95,6 @@ impl Future for ClientAuth { ClientAuthState::WaitSend(mut send) => match send.poll() { Ok(Async::Ready(stream)) => { - println!("send done"); self.state = ClientAuthState::WaitRecv(stream); self.poll() }, diff --git a/src/client_bind.rs b/src/client_bind.rs index ac85a9c..45f68e6 100644 --- a/src/client_bind.rs +++ b/src/client_bind.rs @@ -31,10 +31,7 @@ impl ClientBind { // return the (probably // usable) stream immediately ClientBind::Unsupported(stream), Some(_) => { - println!("Bind is supported!"); - let iq = make_bind_request(stream.jid.resource.as_ref()); - println!("Send {}", iq); let send = stream.send(Packet::Stanza(iq)); ClientBind::WaitSend(send) }, diff --git a/src/starttls.rs b/src/starttls.rs index 2e7da7b..97a65c5 100644 --- a/src/starttls.rs +++ b/src/starttls.rs @@ -37,7 +37,6 @@ impl StartTlsClient { "starttls".to_owned(), Some(NS_XMPP_TLS.to_owned()), vec![] ); - println!("send {}", nonza); let packet = Packet::Stanza(nonza); let send = xmpp_stream.send(packet); @@ -60,7 +59,6 @@ impl Future for StartTlsClient { StartTlsClientState::SendStartTls(mut send) => match send.poll() { Ok(Async::Ready(xmpp_stream)) => { - println!("starttls sent"); let new_state = StartTlsClientState::AwaitProceed(xmpp_stream); retry = true; (new_state, Ok(Async::NotReady)) @@ -75,7 +73,6 @@ impl Future for StartTlsClient { Ok(Async::Ready(Some(Packet::Stanza(ref stanza)))) if stanza.name == "proceed" => { - println!("* proceed *"); let stream = xmpp_stream.stream.into_inner(); let connect = TlsConnector::builder().unwrap() .build().unwrap() @@ -96,7 +93,7 @@ impl Future for StartTlsClient { StartTlsClientState::StartingTls(mut connect) => match connect.poll() { Ok(Async::Ready(tls_stream)) => { - println!("Got a TLS stream!"); + println!("TLS stream established"); let start = XMPPStream::from_stream(tls_stream, self.jid.clone()); let new_state = StartTlsClientState::Start(start); retry = true; diff --git a/src/xmpp_codec.rs b/src/xmpp_codec.rs index b780a48..2551cc4 100644 --- a/src/xmpp_codec.rs +++ b/src/xmpp_codec.rs @@ -20,7 +20,6 @@ impl XMPPRoot { fn new(root: xml::StartTag) -> Self { let mut builder = xml::ElementBuilder::new(); let mut attributes = HashMap::new(); - println!("root attributes: {:?}", root.attributes); for (name_ns, value) in root.attributes { match name_ns { (ref name, None) if name == "xmlns" => @@ -73,10 +72,13 @@ impl Decoder for XMPPCodec { type Error = Error; fn decode(&mut self, buf: &mut BytesMut) -> Result, Self::Error> { - println!("XMPPCodec.decode {:?}", buf.len()); match from_utf8(buf.take().as_ref()) { - Ok(s) => - self.parser.feed_str(s), + Ok(s) => { + if s.len() > 0 { + println!("<< {}", s); + self.parser.feed_str(s); + } + }, Err(e) => return Err(Error::new(ErrorKind::InvalidInput, e)), } @@ -110,7 +112,7 @@ impl Decoder for XMPPCodec { match root.handle_event(event) { None => (), Some(Ok(stanza)) => { - println!("stanza: {}", stanza); + // Emit the stanza result = Some(Packet::Stanza(stanza)); break }, @@ -151,13 +153,18 @@ impl Encoder for XMPPCodec { } write!(buf, ">\n").unwrap(); - println!("Encode start to {}", buf); + print!(">> {}", buf); write!(dst, "{}", buf) }, - Packet::Stanza(stanza) => - write!(dst, "{}", stanza), - Packet::Text(text) => - write!(dst, "{}", xml::escape(&text)), + Packet::Stanza(stanza) => { + println!(">> {}", stanza); + write!(dst, "{}", stanza) + }, + Packet::Text(text) => { + let escaped = xml::escape(&text); + println!(">> {}", escaped); + write!(dst, "{}", escaped) + }, // TODO: Implement all _ => Ok(()) }