xmpp-parsers: Convert MUC to xso
This commit is contained in:
parent
57c2eeadfc
commit
9e9186ef7b
1 changed files with 14 additions and 13 deletions
|
|
@ -63,17 +63,18 @@ impl History {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_element!(
|
|
||||||
/// Represents a room join request.
|
/// Represents a room join request.
|
||||||
#[derive(Default)]
|
#[derive(FromXml, AsXml, PartialEq, Debug, Clone, Default)]
|
||||||
Muc, "x", MUC, children: [
|
#[xml(namespace = ns::MUC, name = "x")]
|
||||||
|
pub struct Muc {
|
||||||
/// Password to use when the room is protected by a password.
|
/// Password to use when the room is protected by a password.
|
||||||
password: Option<String> = ("password", MUC) => String,
|
#[xml(extract(default, fields(text(type_ = String))))]
|
||||||
|
pub password: Option<String>,
|
||||||
|
|
||||||
/// Controls how much and how old we want to receive history on join.
|
/// Controls how much and how old we want to receive history on join.
|
||||||
history: Option<History> = ("history", MUC) => History
|
#[xml(child(default))]
|
||||||
]
|
pub history: Option<History>,
|
||||||
);
|
}
|
||||||
|
|
||||||
impl PresencePayload for Muc {}
|
impl PresencePayload for Muc {}
|
||||||
|
|
||||||
|
|
@ -121,7 +122,7 @@ mod tests {
|
||||||
FromElementError::Invalid(Error::Other(string)) => string,
|
FromElementError::Invalid(Error::Other(string)) => string,
|
||||||
_ => panic!(),
|
_ => panic!(),
|
||||||
};
|
};
|
||||||
assert_eq!(message, "Unknown child in x element.");
|
assert_eq!(message, "Unknown child in Muc element.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
@ -148,7 +149,7 @@ mod tests {
|
||||||
FromElementError::Invalid(Error::Other(string)) => string,
|
FromElementError::Invalid(Error::Other(string)) => string,
|
||||||
_ => panic!(),
|
_ => panic!(),
|
||||||
};
|
};
|
||||||
assert_eq!(message, "Unknown attribute in x element.");
|
assert_eq!(message, "Unknown attribute in Muc element.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue