matrixroom.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef MATRIXROOM_H
  2. #define MATRIXROOM_H
  3. #include "core/reference.h"
  4. #include "core/ustring.h"
  5. #include "matrix.h"
  6. class MatrixClient;
  7. class MatrixRoom : public Reference {
  8. friend class MatrixClient;
  9. GDCLASS(MatrixRoom,Reference);
  10. MatrixClient *client;
  11. String room_id;
  12. String prev_batch;
  13. Dictionary aliases; // HS name -> array of aliases
  14. Dictionary members;
  15. Dictionary tags;
  16. Set<String> event_ids; //all the events that have been received
  17. Array events;
  18. String backfill_prev_batch;
  19. void _put_event(Dictionary event); //insert new event
  20. void _put_old_event(Dictionary event); //insert old event (backwards in time)
  21. void _put_ephemeral_event(Dictionary event);
  22. Error _process_state_event(Dictionary event);
  23. void _state_sync(Variant userdata);
  24. protected:
  25. static void _bind_methods();
  26. public:
  27. String name;
  28. String topic;
  29. Error get_old_events(int amount);
  30. String get_name(bool sync=false);
  31. String get_friendly_name(bool sync=false);
  32. String get_topic(bool sync=false);
  33. Array get_events() const;
  34. Dictionary get_aliases() const;
  35. Dictionary get_members(bool sync=false);
  36. String get_member_display_name(String id, bool sync=false);
  37. Variant state_sync();
  38. Error send_text_message(String text);
  39. Error send_event(String event_type, Dictionary event);
  40. Error set_typing(bool typing, int timeout_ms);
  41. Variant leave_room();
  42. MatrixRoom();
  43. void init(MatrixClient *client, String room_id);
  44. };
  45. #endif