75 lines
2.4 KiB
C++

/**
This file is a part of r0nk, atlas_moon, and 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 <http://www.gnu.org/licenses/>.
*/
#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"
namespace matrix{
class roomcxn : public connection
{
private:
raii::string m_roomid;
room_url_list m_urls;
public:
roomcxn(const std::shared_ptr<internal::session_info>&, const raii::string_base& roomid);
roomcxn(const std::shared_ptr<internal::session_info>& ses, raii::string&& roomid);
roomcxn(const roomcxn&) = default;
roomcxn(roomcxn&&) = default;
~roomcxn(void) = default;
roomcxn& operator=(const roomcxn&) = default;
roomcxn& operator=(roomcxn&&) = default;
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;
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 file_info& file)const;
raii::rjp_string send_image(const image_info& image)const;
raii::rjp_string send_video(const video_info& video)const;
raii::rjp_string send_audio(const audio_info& 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;
private:
raii::rjp_string _send_message(const raii::string_base& msg)const;
};
}
#endif