presence: Add status and payload insertion helpers.

This commit is contained in:
Emmanuel Gil Peyrot 2018-11-02 16:29:11 +01:00
parent c420c87bf5
commit 3f4586caba

View file

@ -239,6 +239,16 @@ impl Presence {
self.payloads = payloads; self.payloads = payloads;
self self
} }
/// Set the availability information of this presence.
pub fn set_status(&mut self, lang: Lang, status: Status) {
self.statuses.insert(lang, status);
}
/// Add a payload to this presence.
pub fn add_payload<P: PresencePayload>(&mut self, payload: P) {
self.payloads.push(payload.into());
}
} }
impl TryFrom<Element> for Presence { impl TryFrom<Element> for Presence {