summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <paul@matrix.org>2014-08-20 16:04:01 +0100
committerPaul "LeoNerd" Evans <paul@matrix.org>2014-08-20 16:06:47 +0100
commit583add34fe6908f642a78be9d08a15e0b47498d0 (patch)
tree8b3361e2855b6348f9bdff719e8fe9c853293c43 /synapse
parentFix exception name in _fill_out_join_content() exception (diff)
downloadsynapse-583add34fe6908f642a78be9d08a15e0b47498d0.tar.xz
Use the "collect_presencelike_data" distributor signal instead of re-implementing its behaviour
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/room.py32
1 files changed, 2 insertions, 30 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index 4c297dbe33..6229ee9bfa 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -581,8 +581,8 @@ class RoomMemberHandler(BaseHandler):
         room_id = event.room_id
 
         # If event doesn't include a display name, add one.
-        yield self._fill_out_join_content(
-            joinee, event.content
+        yield self.distributor.fire(
+            "collect_presencelike_data", joinee, event.content
         )
 
         # XXX: We don't do an auth check if we are doing an invite
@@ -638,34 +638,6 @@ class RoomMemberHandler(BaseHandler):
         )
 
     @defer.inlineCallbacks
-    def _fill_out_join_content(self, user_id, content):
-        # If event doesn't include a display name, add one.
-        # TODO(paul): This really ought to use the distributor's
-        #   collect_presencelike_data signal instead.
-        profile_handler = self.hs.get_handlers().profile_handler
-        if "displayname" not in content:
-            try:
-                display_name = yield profile_handler.get_displayname(
-                    user_id
-                )
-
-                if display_name:
-                    content["displayname"] = display_name
-            except:
-                logger.exception("Failed to set display_name")
-
-        if "avatar_url" not in content:
-            try:
-                avatar_url = yield profile_handler.get_avatar_url(
-                    user_id
-                )
-
-                if avatar_url:
-                    content["avatar_url"] = avatar_url
-            except:
-                logger.exception("Failed to set avatar_url")
-
-    @defer.inlineCallbacks
     def _should_invite_join(self, room_id, prev_state, do_auth):
         logger.debug("_should_invite_join: room_id: %s", room_id)