__init__.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 .admin import AdminHandler
  16. from .directory import DirectoryHandler
  17. from .federation import FederationHandler
  18. from .identity import IdentityHandler
  19. from .message import MessageHandler
  20. from .register import RegistrationHandler
  21. from .room import RoomContextHandler
  22. from .search import SearchHandler
  23. class Handlers(object):
  24. """ Deprecated. A collection of handlers.
  25. At some point most of the classes whose name ended "Handler" were
  26. accessed through this class.
  27. However this makes it painful to unit test the handlers and to run cut
  28. down versions of synapse that only use specific handlers because using a
  29. single handler required creating all of the handlers. So some of the
  30. handlers have been lifted out of the Handlers object and are now accessed
  31. directly through the homeserver object itself.
  32. Any new handlers should follow the new pattern of being accessed through
  33. the homeserver object and should not be added to the Handlers object.
  34. The remaining handlers should be moved out of the handlers object.
  35. """
  36. def __init__(self, hs):
  37. self.registration_handler = RegistrationHandler(hs)
  38. self.message_handler = MessageHandler(hs)
  39. self.federation_handler = FederationHandler(hs)
  40. self.directory_handler = DirectoryHandler(hs)
  41. self.admin_handler = AdminHandler(hs)
  42. self.identity_handler = IdentityHandler(hs)
  43. self.search_handler = SearchHandler(hs)
  44. self.room_context_handler = RoomContextHandler(hs)