iq: Wire up the IBB parser and serialiser.
This commit is contained in:
parent
846148d618
commit
45b38bcef9
1 changed files with 5 additions and 0 deletions
|
@ -8,6 +8,7 @@ use error::Error;
|
||||||
use ns;
|
use ns;
|
||||||
|
|
||||||
use disco;
|
use disco;
|
||||||
|
use ibb;
|
||||||
use jingle;
|
use jingle;
|
||||||
use ping;
|
use ping;
|
||||||
|
|
||||||
|
@ -15,6 +16,7 @@ use ping;
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum IqPayload {
|
pub enum IqPayload {
|
||||||
Disco(disco::Disco),
|
Disco(disco::Disco),
|
||||||
|
IBB(ibb::IBB),
|
||||||
Jingle(jingle::Jingle),
|
Jingle(jingle::Jingle),
|
||||||
Ping(ping::Ping),
|
Ping(ping::Ping),
|
||||||
}
|
}
|
||||||
|
@ -81,6 +83,8 @@ pub fn parse_iq(root: &Element) -> Result<Iq, Error> {
|
||||||
} else {
|
} else {
|
||||||
let parsed_payload = if let Ok(disco) = disco::parse_disco(elem) {
|
let parsed_payload = if let Ok(disco) = disco::parse_disco(elem) {
|
||||||
Some(IqPayload::Disco(disco))
|
Some(IqPayload::Disco(disco))
|
||||||
|
} else if let Ok(ibb) = ibb::parse_ibb(elem) {
|
||||||
|
Some(IqPayload::IBB(ibb))
|
||||||
} else if let Ok(jingle) = jingle::parse_jingle(elem) {
|
} else if let Ok(jingle) = jingle::parse_jingle(elem) {
|
||||||
Some(IqPayload::Jingle(jingle))
|
Some(IqPayload::Jingle(jingle))
|
||||||
} else if let Ok(ping) = ping::parse_ping(elem) {
|
} else if let Ok(ping) = ping::parse_ping(elem) {
|
||||||
|
@ -135,6 +139,7 @@ pub fn parse_iq(root: &Element) -> Result<Iq, Error> {
|
||||||
pub fn serialise_payload(payload: &IqPayload) -> Element {
|
pub fn serialise_payload(payload: &IqPayload) -> Element {
|
||||||
match *payload {
|
match *payload {
|
||||||
IqPayload::Disco(ref disco) => disco::serialise_disco(disco),
|
IqPayload::Disco(ref disco) => disco::serialise_disco(disco),
|
||||||
|
IqPayload::IBB(ref ibb) => ibb::serialise(ibb),
|
||||||
IqPayload::Jingle(ref jingle) => jingle::serialise(jingle),
|
IqPayload::Jingle(ref jingle) => jingle::serialise(jingle),
|
||||||
IqPayload::Ping(_) => ping::serialise_ping(),
|
IqPayload::Ping(_) => ping::serialise_ping(),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue