summary refs log tree commit diff
path: root/synapse/notifier.py
diff options
context:
space:
mode:
authorDavid Baker <dave@matrix.org>2014-12-18 15:15:22 +0000
committerDavid Baker <dave@matrix.org>2014-12-18 15:15:22 +0000
commitb56730bb6e549e6b22c95858cae50e091de96844 (patch)
tree0eb011bc6b32a44df8c343ffedbc15e2ddd046e9 /synapse/notifier.py
parentschema version is now 10 (diff)
parentUpdate README.rst (diff)
downloadsynapse-b56730bb6e549e6b22c95858cae50e091de96844.tar.xz
Merge branch 'develop' into pushers
Conflicts:
	synapse/api/errors.py
	synapse/server.py
	synapse/storage/__init__.py
Diffstat (limited to 'synapse/notifier.py')
-rw-r--r--synapse/notifier.py32
1 files changed, 25 insertions, 7 deletions
diff --git a/synapse/notifier.py b/synapse/notifier.py
index 5e14950449..383230caf1 100644
--- a/synapse/notifier.py
+++ b/synapse/notifier.py
@@ -146,7 +146,11 @@ class Notifier(object):
         Will wake up all listeners for the given users and rooms.
         """
         yield run_on_reactor()
+
+        # TODO(paul): This is horrible, having to manually list every event
+        # source here individually
         presence_source = self.event_sources.sources["presence"]
+        typing_source = self.event_sources.sources["typing"]
 
         listeners = set()
 
@@ -158,19 +162,33 @@ class Notifier(object):
 
         @defer.inlineCallbacks
         def notify(listener):
-            events, end_key = yield presence_source.get_new_events_for_user(
-                listener.user,
-                listener.from_token.presence_key,
-                listener.limit,
+            presence_events, presence_end_key = (
+                yield presence_source.get_new_events_for_user(
+                    listener.user,
+                    listener.from_token.presence_key,
+                    listener.limit,
+                )
+            )
+            typing_events, typing_end_key = (
+                yield typing_source.get_new_events_for_user(
+                    listener.user,
+                    listener.from_token.typing_key,
+                    listener.limit,
+                )
             )
 
-            if events:
+            if presence_events or typing_events:
                 end_token = listener.from_token.copy_and_replace(
-                    "presence_key", end_key
+                    "presence_key", presence_end_key
+                ).copy_and_replace(
+                    "typing_key", typing_end_key
                 )
 
                 listener.notify(
-                    self, events, listener.from_token, end_token
+                    self,
+                    presence_events + typing_events,
+                    listener.from_token,
+                    end_token
                 )
 
         def eb(failure):