xmpp-parsers: Simplify the page-flip logic for MAM
This only has to be a bool, no need for this Option<bool>.
This commit is contained in:
parent
fa2846024f
commit
62b2966b9d
1 changed files with 4 additions and 4 deletions
|
@ -53,7 +53,7 @@ impl TryFrom<Element> for Query {
|
||||||
|
|
||||||
let mut form = None;
|
let mut form = None;
|
||||||
let mut set = None;
|
let mut set = None;
|
||||||
let mut flip_page = None;
|
let mut flip_page = false;
|
||||||
for child in elem.children() {
|
for child in elem.children() {
|
||||||
if child.is("x", ns::DATA_FORMS) {
|
if child.is("x", ns::DATA_FORMS) {
|
||||||
if form.is_some() {
|
if form.is_some() {
|
||||||
|
@ -75,13 +75,13 @@ impl TryFrom<Element> for Query {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if child.is("flip-page", ns::MAM) {
|
if child.is("flip-page", ns::MAM) {
|
||||||
if flip_page.is_some() {
|
if flip_page {
|
||||||
return Err(Error::Other(
|
return Err(Error::Other(
|
||||||
"Element query must not have more than one flip-page child.",
|
"Element query must not have more than one flip-page child.",
|
||||||
)
|
)
|
||||||
.into());
|
.into());
|
||||||
}
|
}
|
||||||
flip_page = Some(true);
|
flip_page = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
return Err(Error::Other("Unknown child in query element.").into());
|
return Err(Error::Other("Unknown child in query element.").into());
|
||||||
|
@ -97,7 +97,7 @@ impl TryFrom<Element> for Query {
|
||||||
},
|
},
|
||||||
form,
|
form,
|
||||||
set,
|
set,
|
||||||
flip_page: flip_page.is_some(),
|
flip_page,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue