add sending read reciept

This commit is contained in:
Sorunome 2019-10-26 14:24:09 +02:00
parent d6f56e8b2d
commit 0d18f93410
No known key found for this signature in database
GPG key ID: 63E31F7B5993A9C4
2 changed files with 9 additions and 0 deletions

View file

@ -83,6 +83,7 @@ public:
std::string getRoomTopic(std::string roomId); std::string getRoomTopic(std::string roomId);
std::string getRoomAvatar(std::string roomId); std::string getRoomAvatar(std::string roomId);
std::string getCanonicalAlias(std::string roomId); std::string getCanonicalAlias(std::string roomId);
void sendReadReceipt(std::string roomId, std::string eventId);
std::string sendEmote(std::string roomId, std::string text); std::string sendEmote(std::string roomId, std::string text);
std::string sendNotice(std::string roomId, std::string text); std::string sendNotice(std::string roomId, std::string text);
std::string sendText(std::string roomId, std::string text); std::string sendText(std::string roomId, std::string text);

View file

@ -280,6 +280,14 @@ std::string Client::getCanonicalAlias(std::string roomId) {
return aliasStr; return aliasStr;
} }
void Client::sendReadReceipt(std::string roomId, std::string eventId) {
std::string path = "/_matrix/client/r0/rooms/" + urlencode(roomId) + "/receipt/m.read/" + urlencode(eventId);
json_t* ret = doRequest("POST", path);
if (ret) {
json_decref(ret);
}
}
std::string Client::sendEmote(std::string roomId, std::string text) { std::string Client::sendEmote(std::string roomId, std::string text) {
json_t* request = json_object(); json_t* request = json_object();
json_object_set_new(request, "msgtype", json_string("m.emote")); json_object_set_new(request, "msgtype", json_string("m.emote"));