constants.py 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. class Membership(object):
  18. """Represents the membership states of a user in a room."""
  19. INVITE = u"invite"
  20. JOIN = u"join"
  21. KNOCK = u"knock"
  22. LEAVE = u"leave"
  23. BAN = u"ban"
  24. LIST = (INVITE, JOIN, KNOCK, LEAVE, BAN)
  25. class PresenceState(object):
  26. """Represents the presence state of a user."""
  27. OFFLINE = u"offline"
  28. UNAVAILABLE = u"unavailable"
  29. ONLINE = u"online"
  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. EMAIL_IDENTITY = u"m.login.email.identity"
  38. MSISDN = u"m.login.msisdn"
  39. RECAPTCHA = u"m.login.recaptcha"
  40. DUMMY = u"m.login.dummy"
  41. # Only for C/S API v1
  42. APPLICATION_SERVICE = u"m.login.application_service"
  43. SHARED_SECRET = u"org.matrix.login.shared_secret"
  44. class EventTypes(object):
  45. Member = "m.room.member"
  46. Create = "m.room.create"
  47. JoinRules = "m.room.join_rules"
  48. PowerLevels = "m.room.power_levels"
  49. Aliases = "m.room.aliases"
  50. Redaction = "m.room.redaction"
  51. ThirdPartyInvite = "m.room.third_party_invite"
  52. RoomHistoryVisibility = "m.room.history_visibility"
  53. CanonicalAlias = "m.room.canonical_alias"
  54. RoomAvatar = "m.room.avatar"
  55. GuestAccess = "m.room.guest_access"
  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"
  67. TRUSTED_PRIVATE_CHAT = "trusted_private_chat"
  68. class ThirdPartyEntityKind(object):
  69. USER = "user"
  70. LOCATION = "location"