summary refs log tree commit diff
path: root/synapse/util
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2016-04-08 11:39:34 +0100
committerMark Haines <mjark@negativecurvature.net>2016-04-08 11:39:34 +0100
commitd63b49137a473164d5de13be0da62cf03af8a90e (patch)
treea7a8bac8d9fd7277bd19907dfe25c24f7c48524c /synapse/util
parentMerge pull request #708 from matrix-org/markjh/remove_collect_presencelike_data (diff)
parentMove all the wrapper functions for distributor.fire (diff)
downloadsynapse-d63b49137a473164d5de13be0da62cf03af8a90e.tar.xz
Merge pull request #710 from matrix-org/markjh/move_fire
Move all the wrapper functions for distributor.fire
Diffstat (limited to 'synapse/util')
-rw-r--r--synapse/util/distributor.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/synapse/util/distributor.py b/synapse/util/distributor.py
index 8875813de4..d7cccc06b1 100644
--- a/synapse/util/distributor.py
+++ b/synapse/util/distributor.py
@@ -15,7 +15,9 @@
 
 from twisted.internet import defer
 
-from synapse.util.logcontext import PreserveLoggingContext
+from synapse.util.logcontext import (
+    PreserveLoggingContext, preserve_context_over_fn
+)
 
 from synapse.util import unwrapFirstError
 
@@ -25,6 +27,24 @@ import logging
 logger = logging.getLogger(__name__)
 
 
+def registered_user(distributor, user):
+    return distributor.fire("registered_user", user)
+
+
+def user_left_room(distributor, user, room_id):
+    return preserve_context_over_fn(
+        distributor.fire,
+        "user_left_room", user=user, room_id=room_id
+    )
+
+
+def user_joined_room(distributor, user, room_id):
+    return preserve_context_over_fn(
+        distributor.fire,
+        "user_joined_room", user=user, room_id=room_id
+    )
+
+
 class Distributor(object):
     """A central dispatch point for loosely-connected pieces of code to
     register, observe, and fire signals.