__init__.py 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # -*- coding: utf-8 -*-
  2. # Copyright 2014-2016 OpenMarket Ltd
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. from synapse.appservice.scheduler import AppServiceScheduler
  16. from synapse.appservice.api import ApplicationServiceApi
  17. from .register import RegistrationHandler
  18. from .room import (
  19. RoomCreationHandler, RoomListHandler, RoomContextHandler,
  20. )
  21. from .room_member import RoomMemberHandler
  22. from .message import MessageHandler
  23. from .events import EventStreamHandler, EventHandler
  24. from .federation import FederationHandler
  25. from .profile import ProfileHandler
  26. from .presence import PresenceHandler
  27. from .directory import DirectoryHandler
  28. from .typing import TypingNotificationHandler
  29. from .admin import AdminHandler
  30. from .appservice import ApplicationServicesHandler
  31. from .sync import SyncHandler
  32. from .auth import AuthHandler
  33. from .identity import IdentityHandler
  34. from .receipts import ReceiptsHandler
  35. from .search import SearchHandler
  36. class Handlers(object):
  37. """ A collection of all the event handlers.
  38. There's no need to lazily create these; we'll just make them all eagerly
  39. at construction time.
  40. """
  41. def __init__(self, hs):
  42. self.registration_handler = RegistrationHandler(hs)
  43. self.message_handler = MessageHandler(hs)
  44. self.room_creation_handler = RoomCreationHandler(hs)
  45. self.room_member_handler = RoomMemberHandler(hs)
  46. self.event_stream_handler = EventStreamHandler(hs)
  47. self.event_handler = EventHandler(hs)
  48. self.federation_handler = FederationHandler(hs)
  49. self.profile_handler = ProfileHandler(hs)
  50. self.presence_handler = PresenceHandler(hs)
  51. self.room_list_handler = RoomListHandler(hs)
  52. self.directory_handler = DirectoryHandler(hs)
  53. self.typing_notification_handler = TypingNotificationHandler(hs)
  54. self.admin_handler = AdminHandler(hs)
  55. self.receipts_handler = ReceiptsHandler(hs)
  56. asapi = ApplicationServiceApi(hs)
  57. self.appservice_handler = ApplicationServicesHandler(
  58. hs, asapi, AppServiceScheduler(
  59. clock=hs.get_clock(),
  60. store=hs.get_datastore(),
  61. as_api=asapi
  62. )
  63. )
  64. self.sync_handler = SyncHandler(hs)
  65. self.auth_handler = AuthHandler(hs)
  66. self.identity_handler = IdentityHandler(hs)
  67. self.search_handler = SearchHandler(hs)
  68. self.room_context_handler = RoomContextHandler(hs)