Prototype send to device
This commit is contained in:
parent
021274fbf6
commit
8150c15e8c
2 changed files with 8 additions and 0 deletions
|
@ -84,6 +84,7 @@ public:
|
||||||
std::string sendText(std::string roomId, std::string text);
|
std::string sendText(std::string roomId, std::string text);
|
||||||
std::string sendMessage(std::string roomId, json_t* content);
|
std::string sendMessage(std::string roomId, json_t* content);
|
||||||
std::string sendEvent(std::string roomId, std::string eventType, json_t* content);
|
std::string sendEvent(std::string roomId, std::string eventType, json_t* content);
|
||||||
|
void sendEventToDevice(const std::string& eventType, json_t* devices, json_t* content);
|
||||||
json_t* getStateEvent(std::string roomId, std::string type, std::string stateKey);
|
json_t* getStateEvent(std::string roomId, std::string type, std::string stateKey);
|
||||||
std::string sendStateEvent(std::string roomId, std::string type, std::string stateKey, json_t* content);
|
std::string sendStateEvent(std::string roomId, std::string type, std::string stateKey, json_t* content);
|
||||||
std::string redactEvent(std::string roomId, std::string eventId, std::string reason = "");
|
std::string redactEvent(std::string roomId, std::string eventId, std::string reason = "");
|
||||||
|
|
|
@ -369,6 +369,13 @@ std::string Client::sendMessage(std::string roomId, json_t* content) {
|
||||||
return sendEvent(roomId, "m.room.message", content);
|
return sendEvent(roomId, "m.room.message", content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::sendEventToDevice(const std::string& eventType, json_t* devices, json_t* content){
|
||||||
|
std::string txid = std::to_string(time(nullptr)) + "_REQ_" + std::to_string(requestId);
|
||||||
|
std::string path = "/_matrix/client/v3/sendToDevice/" + urlencode(eventType) + "/" + urlencode(txid);
|
||||||
|
json_t* ret = doRequest("PUT", path, content);
|
||||||
|
if (ret) json_decref(ret);
|
||||||
|
}
|
||||||
|
|
||||||
std::string Client::sendEvent(std::string roomId, std::string eventType, json_t* content) {
|
std::string Client::sendEvent(std::string roomId, std::string eventType, json_t* content) {
|
||||||
roomId = resolveRoom(roomId);
|
roomId = resolveRoom(roomId);
|
||||||
std::string txid = std::to_string(time(NULL)) + "_REQ_" + std::to_string(requestId);
|
std::string txid = std::to_string(time(NULL)) + "_REQ_" + std::to_string(requestId);
|
||||||
|
|
Loading…
Reference in a new issue