constants.py 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # -*- coding: utf-8 -*-
  2. # Copyright 2014, 2015 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. """Contains constants from the specification."""
  16. class Membership(object):
  17. """Represents the membership states of a user in a room."""
  18. INVITE = u"invite"
  19. JOIN = u"join"
  20. KNOCK = u"knock"
  21. LEAVE = u"leave"
  22. BAN = u"ban"
  23. LIST = (INVITE, JOIN, KNOCK, LEAVE, BAN)
  24. class PresenceState(object):
  25. """Represents the presence state of a user."""
  26. OFFLINE = u"offline"
  27. UNAVAILABLE = u"unavailable"
  28. ONLINE = u"online"
  29. FREE_FOR_CHAT = u"free_for_chat"
  30. class JoinRules(object):
  31. PUBLIC = u"public"
  32. KNOCK = u"knock"
  33. INVITE = u"invite"
  34. PRIVATE = u"private"
  35. class LoginType(object):
  36. PASSWORD = u"m.login.password"
  37. OAUTH = u"m.login.oauth2"
  38. EMAIL_CODE = u"m.login.email.code"
  39. EMAIL_URL = u"m.login.email.url"
  40. EMAIL_IDENTITY = u"m.login.email.identity"
  41. RECAPTCHA = u"m.login.recaptcha"
  42. DUMMY = u"m.login.dummy"
  43. # Only for C/S API v1
  44. APPLICATION_SERVICE = u"m.login.application_service"
  45. SHARED_SECRET = u"org.matrix.login.shared_secret"
  46. class EventTypes(object):
  47. Member = "m.room.member"
  48. Create = "m.room.create"
  49. JoinRules = "m.room.join_rules"
  50. PowerLevels = "m.room.power_levels"
  51. Aliases = "m.room.aliases"
  52. Redaction = "m.room.redaction"
  53. RoomHistoryVisibility = "m.room.history_visibility"
  54. CanonicalAlias = "m.room.canonical_alias"
  55. RoomAvatar = "m.room.avatar"
  56. # These are used for validation
  57. Message = "m.room.message"
  58. Topic = "m.room.topic"
  59. Name = "m.room.name"
  60. class RejectedReason(object):
  61. AUTH_ERROR = "auth_error"
  62. REPLACED = "replaced"
  63. NOT_ANCESTOR = "not_ancestor"
  64. class RoomCreationPreset(object):
  65. PRIVATE_CHAT = "private_chat"
  66. PUBLIC_CHAT = "public_chat"