80 lines
4.8 KiB
C++
80 lines
4.8 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/>.
|
|
*/
|
|
|
|
#include "matrix/room_url_list.hpp"
|
|
|
|
namespace matrix{
|
|
|
|
room_url_list::room_url_list(const raii::string_base& homeserver, const raii::string_base& access_token, const raii::string_base& roomid, const raii::string_base& userid):
|
|
m_join(s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/join?access_token=" + access_token),
|
|
m_leave(s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/leave?access_token=" + access_token),
|
|
m_typing(s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/typing/" + userid + "?access_token=" + access_token),
|
|
m_kick(s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/kick?access_token=" + access_token),
|
|
m_ban(s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/ban?access_token=" + access_token),
|
|
m_unban(s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/unban?access_token=" + access_token),
|
|
m_invite(s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/invite?access_token=" + access_token),
|
|
m_members(s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/members?access_token=" + access_token){}
|
|
const raii::string& room_url_list::join_room(void)const{
|
|
return m_join;
|
|
}
|
|
const raii::string& room_url_list::leave_room(void)const{
|
|
return m_leave;
|
|
}
|
|
raii::string room_url_list::read_receipt(const raii::string_base& homeserver, const raii::string_base& access_token, const raii::string_base& roomid, const raii::string_base& eventid)const{
|
|
return raii::string(s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/receipt/m.read/" + eventid + "?access_token=" + access_token);
|
|
}
|
|
raii::string room_url_list::send(const raii::string_base& homeserver, const raii::string_base& access_token, const raii::string_base& roomid, const raii::string_base& eventtype)const{
|
|
return raii::string(s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/send/" + eventtype + "?access_token=" + access_token);
|
|
}
|
|
raii::string room_url_list::redact(const raii::string_base& homeserver, const raii::string_base& access_token, const raii::string_base& roomid, const raii::string_base& eventid)const{
|
|
return raii::string(s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/redact/" + eventid + "/0?access_token=" + access_token);
|
|
}
|
|
/*raii::string room_url_list::power_level(const raii::string_base& homeserver, const raii::string_base& access_token, const raii::string_base& roomid)const{
|
|
return raii::string(s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/state/m.room.power_levels?access_token=" + access_token);
|
|
}*/
|
|
const raii::string& room_url_list::typing(void)const{
|
|
return m_typing;
|
|
}
|
|
const raii::string& room_url_list::kick(void)const{
|
|
return m_kick;
|
|
}
|
|
const raii::string& room_url_list::ban(void)const{
|
|
return m_ban;
|
|
}
|
|
const raii::string& room_url_list::unban(void)const{
|
|
return m_unban;
|
|
}
|
|
const raii::string& room_url_list::invite(void)const{
|
|
return m_invite;
|
|
}
|
|
const raii::string& room_url_list::room_members(void)const{
|
|
return m_members;
|
|
}
|
|
void room_url_list::repopulate(const raii::string_base& homeserver, const raii::string_base& access_token, const raii::string_base& userid, const raii::string_base& roomid){
|
|
m_join = s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/join?access_token=" + access_token;
|
|
m_leave = s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/leave?access_token=" + access_token;
|
|
m_typing = s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/typing/" + userid + "?access_token=" + access_token;
|
|
m_kick = s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/kick?access_token=" + access_token;
|
|
m_ban = s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/ban?access_token=" + access_token;
|
|
m_unban = s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/unban?access_token=" + access_token;
|
|
m_invite = s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/invite?access_token=" + access_token;
|
|
m_members = s_proto + homeserver + "/_matrix/client/r0/rooms/" + roomid + "/members?access_token=" + access_token;
|
|
}
|
|
|
|
}
|