diff options
author | Matias Linares <matiaslina@openmailbox.org> | 2018-06-09 16:43:35 -0300 |
---|---|---|
committer | Matias Linares <matiaslina@openmailbox.org> | 2018-06-09 16:43:35 -0300 |
commit | 5611f785dc62d7af68adc3ba9bd2c5199c38d96a (patch) | |
tree | 03e37d3ba928ec209c9b23383cae0bbfd31e2320 /lib/Matrix/Client.pm6 | |
parent | 3968265131adb2f12dfa80f291069d01df4c341a (diff) | |
download | perl6-matrix-client-5611f785dc62d7af68adc3ba9bd2c5199c38d96a.tar.gz |
Add presence methods.
This adds a way to change and query the presence for users.
Closes #4
Diffstat (limited to 'lib/Matrix/Client.pm6')
-rw-r--r-- | lib/Matrix/Client.pm6 | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Matrix/Client.pm6 b/lib/Matrix/Client.pm6 index 56be81c..0d4f400 100644 --- a/lib/Matrix/Client.pm6 +++ b/lib/Matrix/Client.pm6 @@ -106,6 +106,17 @@ method whoami { $!user-id } +method presence(Matrix::Client:D: $user-id? --> Matrix::Response::Presence) { + my $id = $user-id // $.whoami; + my $data = from-json($.get("/presence/$id/status").content); + Matrix::Response::Presence.new(|$data) +} + +method set-presence(Matrix::Client:D: Str $presence, Str :$status-message = "") { + $.put("/presence/$.whoami/status", + :$presence, :status_msg($status-message)); +} + # Syncronization multi method sync(Hash :$sync-filter is copy, :$since = "") { |