/** This file is a part of rexy's matrix client Copyright (C) 2019-2020 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 #include "raii/rjp_string.hpp" #include "matrix/rest/room_url_list.hpp" #include "matrix/iterable.hpp" #include "matrix/netreturn.hpp" #include namespace matrix{ class roomcxn : public connection { private: rexy::string m_roomid; room_url_list m_urls; public: roomcxn(const std::shared_ptr&, const rexy::string_base& roomid); roomcxn(const std::shared_ptr& ses, rexy::string&& roomid); roomcxn(const roomcxn&) = default; roomcxn(roomcxn&&) = default; ~roomcxn(void) = default; roomcxn& operator=(const roomcxn&) = default; roomcxn& operator=(roomcxn&&) = default; //membership netreturn join(void)const; netreturn leave(void)const; netreturn forget(void)const; [[deprecated("Use roomcxn::join_room instead")]] netreturn accept_invite(void)const; [[deprecated("Use roomcxn::leave_room instead")]] netreturn reject_invite(void)const; netreturn> members(void)const; //member management netreturn invite(const rexy::string_base& userid); [[deprecated("Use roomcxn::kick instead")]] netreturn uninvite(const rexy::string_base& userid, const rexy::string_base& reason = rexy::string()); netreturn kick(const rexy::string_base& userid, const rexy::string_base& reason = rexy::string()); netreturn ban(const rexy::string_base& userid, const rexy::string_base& reason = rexy::string()); netreturn unban(const rexy::string_base& userid); //sending events netreturn send_custom_event(const rexy::string_base& event, const rexy::string_base& eventtype)const; netreturn send_message(const rexy::string_base& text)const; netreturn send_notice(const rexy::string_base& text)const; netreturn send_file(const uploaded_file& file)const; netreturn send_image(const uploaded_image& image)const; netreturn send_video(const uploaded_video& video)const; netreturn send_audio(const uploaded_audio& audio)const; netreturn forward_event(const sync::room_event&)const; netreturn send_typing(bool active, int timeout = 5000)const; netreturn send_read_receipt(const rexy::string_base& eventid)const; netreturn get_event(const rexy::string_base& eventid)const; netreturn redact_event(const rexy::string_base& eventid, const rexy::string_base& reason)const; netreturn redact_event(const rexy::string_base& eventid)const; //recieve events netreturn get_events_forward(int amount); netreturn get_events_backward(int amount); netreturn get_events_forward(int amount, const rexy::string_base& from, const rexy::string_base& to); netreturn get_events_backward(int amount, const rexy::string_base& from, const rexy::string_base& to); //meta stuff void regenerate_urls(void); netreturn upgrade(int version)const; private: netreturn _get_events(int amount, rexy::static_string direction, const rexy::string_base& from, const rexy::string_base& to); netreturn _send_message(const rexy::string_base& msg)const; }; } #endif