constants.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. # -*- coding: utf-8 -*-
  2. # Copyright 2014-2016 OpenMarket Ltd
  3. # Copyright 2017 Vector Creations Ltd
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. """Contains constants from the specification."""
  17. # the "depth" field on events is limited to 2**63 - 1
  18. MAX_DEPTH = 2**63 - 1
  19. class Membership(object):
  20. """Represents the membership states of a user in a room."""
  21. INVITE = u"invite"
  22. JOIN = u"join"
  23. KNOCK = u"knock"
  24. LEAVE = u"leave"
  25. BAN = u"ban"
  26. LIST = (INVITE, JOIN, KNOCK, LEAVE, BAN)
  27. class PresenceState(object):
  28. """Represents the presence state of a user."""
  29. OFFLINE = u"offline"
  30. UNAVAILABLE = u"unavailable"
  31. ONLINE = u"online"
  32. class JoinRules(object):
  33. PUBLIC = u"public"
  34. KNOCK = u"knock"
  35. INVITE = u"invite"
  36. PRIVATE = u"private"
  37. class LoginType(object):
  38. PASSWORD = u"m.login.password"
  39. EMAIL_IDENTITY = u"m.login.email.identity"
  40. MSISDN = u"m.login.msisdn"
  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. ThirdPartyInvite = "m.room.third_party_invite"
  54. RoomHistoryVisibility = "m.room.history_visibility"
  55. CanonicalAlias = "m.room.canonical_alias"
  56. RoomAvatar = "m.room.avatar"
  57. GuestAccess = "m.room.guest_access"
  58. # These are used for validation
  59. Message = "m.room.message"
  60. Topic = "m.room.topic"
  61. Name = "m.room.name"
  62. ServerACL = "m.room.server_acl"
  63. class RejectedReason(object):
  64. AUTH_ERROR = "auth_error"
  65. REPLACED = "replaced"
  66. NOT_ANCESTOR = "not_ancestor"
  67. class RoomCreationPreset(object):
  68. PRIVATE_CHAT = "private_chat"
  69. PUBLIC_CHAT = "public_chat"
  70. TRUSTED_PRIVATE_CHAT = "trusted_private_chat"
  71. class ThirdPartyEntityKind(object):
  72. USER = "user"
  73. LOCATION = "location"