summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-08-18 10:30:07 +0100
committerErik Johnston <erik@matrix.org>2015-08-18 10:30:07 +0100
commit776ee6d92b8672c36723b0b8dc9ae3467f34c08f (patch)
treecc0347326672f2570937601a04bad4980c516268
parentRemove debug try/catch (diff)
downloadsynapse-776ee6d92b8672c36723b0b8dc9ae3467f34c08f.tar.xz
Doc strings
-rw-r--r--synapse/handlers/presence.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py
index b7664e30f8..1177cbe51b 100644
--- a/synapse/handlers/presence.py
+++ b/synapse/handlers/presence.py
@@ -192,6 +192,20 @@ class PresenceHandler(BaseHandler):
 
     @defer.inlineCallbacks
     def get_state(self, target_user, auth_user, as_event=False, check_auth=True):
+        """Get the current presence state of the given user.
+
+        Args:
+            target_user (UserID): The user whose presence we want
+            auth_user (UserID): The user requesting the presence, used for
+                checking if said user is allowed to see the persence of the
+                `target_user`
+            as_event (bool): Format the return as an event or not?
+            check_auth (bool): Perform the auth checks or not?
+
+        Returns:
+            dict: The presence state of the `target_user`, whose format depends
+            on the `as_event` argument.
+        """
         if self.hs.is_mine(target_user):
             if check_auth:
                 visible = yield self.is_presence_visible(
@@ -234,6 +248,20 @@ class PresenceHandler(BaseHandler):
 
     @defer.inlineCallbacks
     def get_states(self, target_users, auth_user, as_event=False, check_auth=True):
+        """A batched version of the `get_state` method that accepts a list of
+        `target_users`
+
+        Args:
+            target_users (list): The list of UserID's whose presence we want
+            auth_user (UserID): The user requesting the presence, used for
+                checking if said user is allowed to see the persence of the
+                `target_users`
+            as_event (bool): Format the return as an event or not?
+            check_auth (bool): Perform the auth checks or not?
+
+        Returns:
+            dict: A mapping from user -> presence_state
+        """
         local_users, remote_users = partitionbool(
             target_users,
             lambda u: self.hs.is_mine(u)