/** This file is a part of rexy's matrix client Copyright (C) 2019 rexy712 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ #ifndef MATRIX_ROOMCXN_HPP #define MATRIX_ROOMCXN_HPP #include "matrix/connection.hpp" #include "matrix/upload_info.hpp" #include "raii/string.hpp" #include "raii/rjp_string.hpp" #include "matrix/room_url_list.hpp" #include "matrix/iterable.hpp" #include namespace matrix{ class roomcxn : public connection { private: raii::string m_roomid; room_url_list m_urls; public: roomcxn(const std::shared_ptr&, const raii::string_base& roomid); roomcxn(const std::shared_ptr& ses, raii::string&& roomid); roomcxn(const roomcxn&) = default; roomcxn(roomcxn&&) = default; ~roomcxn(void) = default; roomcxn& operator=(const roomcxn&) = default; roomcxn& operator=(roomcxn&&) = default; //membership bool join_room(void)const; bool leave_room(void)const; [[deprecated("Use client::join_room instead")]] bool accept_invite(void)const; [[deprecated("Use client::leave_room instead")]] bool reject_invite(void)const; std::vector members(void)const; //sending events raii::rjp_string send_custom_event(const raii::string_base& event, const raii::string_base& eventtype)const; raii::rjp_string send_message(const raii::string_base& text)const; raii::rjp_string send_file(const uploaded_file& file)const; raii::rjp_string send_image(const uploaded_image& image)const; raii::rjp_string send_video(const uploaded_video& video)const; raii::rjp_string send_audio(const uploaded_audio& audio)const; bool send_typing(bool active, int timeout = 5000)const; bool send_read_receipt(const raii::string_base& eventid)const; raii::rjp_string redact_event(const raii::string_base& eventid, const raii::string_base& reason)const; raii::rjp_string redact_event(const raii::string_base& eventid)const; //recieve events sync::roomcxn_message_event_list get_events_forward(int amount); sync::roomcxn_message_event_list get_events_backward(int amount); sync::roomcxn_message_event_list get_events_forward(int amount, const raii::string_base& from, const raii::string_base& to); sync::roomcxn_message_event_list get_events_backward(int amount, const raii::string_base& from, const raii::string_base& to); //meta stuff void regenerate_urls(void); raii::rjp_string upgrade(int version)const; private: sync::roomcxn_message_event_list _get_events(int amount, raii::static_string direction, const raii::string_base& from, const raii::string_base& to); raii::rjp_string _send_message(const raii::string_base& msg)const; }; } #endif