forked from lavina/lavina
use macro in muc parsing
This commit is contained in:
parent
7b2bfae147
commit
63704d6010
|
@ -124,30 +124,10 @@ impl FromXml for X {
|
||||||
_ => return Err(ffail!("Unexpected XML event: {event:?}")),
|
_ => return Err(ffail!("Unexpected XML event: {event:?}")),
|
||||||
};
|
};
|
||||||
if bytes.name().0 == Password::NAME.as_bytes() {
|
if bytes.name().0 == Password::NAME.as_bytes() {
|
||||||
let mut parser = Password::parse().consume(namespace, event);
|
let password = delegate_parsing!(Password, namespace, event)?;
|
||||||
let password = loop {
|
|
||||||
match parser {
|
|
||||||
Continuation::Final(Ok(res)) => break Ok(res),
|
|
||||||
Continuation::Final(Err(err)) => break Err(err),
|
|
||||||
Continuation::Continue(p) => {
|
|
||||||
let (namespace, event) = yield;
|
|
||||||
parser = p.consume(namespace, event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}?;
|
|
||||||
res.password = Some(password);
|
res.password = Some(password);
|
||||||
} else if bytes.name().0 == History::NAME.as_bytes() {
|
} else if bytes.name().0 == History::NAME.as_bytes() {
|
||||||
let mut parser = History::parse().consume(namespace, event);
|
let history = delegate_parsing!(History, namespace, event)?;
|
||||||
let history = loop {
|
|
||||||
match parser {
|
|
||||||
Continuation::Final(Ok(res)) => break Ok(res),
|
|
||||||
Continuation::Final(Err(err)) => break Err(err),
|
|
||||||
Continuation::Continue(p) => {
|
|
||||||
let (namespace, event) = yield;
|
|
||||||
parser = p.consume(namespace, event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}?;
|
|
||||||
res.history = Some(history);
|
res.history = Some(history);
|
||||||
} else {
|
} else {
|
||||||
return Err(ffail!("Unexpected XML event: {event:?}"));
|
return Err(ffail!("Unexpected XML event: {event:?}"));
|
||||||
|
|
Loading…
Reference in New Issue