mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
xmpp_codec: add Packet::Text
This commit is contained in:
parent
014633d119
commit
2e0dff5153
1 changed files with 3 additions and 0 deletions
|
@ -50,6 +50,7 @@ pub enum Packet {
|
||||||
Error(Box<std::error::Error>),
|
Error(Box<std::error::Error>),
|
||||||
StreamStart(HashMap<String, String>),
|
StreamStart(HashMap<String, String>),
|
||||||
Stanza(xml::Element),
|
Stanza(xml::Element),
|
||||||
|
Text(String),
|
||||||
StreamEnd,
|
StreamEnd,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,6 +156,8 @@ impl Encoder for XMPPCodec {
|
||||||
},
|
},
|
||||||
Packet::Stanza(stanza) =>
|
Packet::Stanza(stanza) =>
|
||||||
write!(dst, "{}", stanza),
|
write!(dst, "{}", stanza),
|
||||||
|
Packet::Text(text) =>
|
||||||
|
write!(dst, "{}", xml::escape(&text)),
|
||||||
// TODO: Implement all
|
// TODO: Implement all
|
||||||
_ => Ok(())
|
_ => Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue