From 3f4586cabad93314659553c6e11931396cf91ad3 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 2 Nov 2018 16:29:11 +0100 Subject: [PATCH] presence: Add status and payload insertion helpers. --- src/presence.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/presence.rs b/src/presence.rs index db6ac7a6..2cb115f5 100644 --- a/src/presence.rs +++ b/src/presence.rs @@ -239,6 +239,16 @@ impl Presence { self.payloads = payloads; 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(&mut self, payload: P) { + self.payloads.push(payload.into()); + } } impl TryFrom for Presence {