libresapi: added chat/send_status

usage:
$ curl --data "{\"chat_id\":\"<chat_id>\",\"status\":\"Hi there\"}" http://<host:port>/api/v2/chat/send_status
This commit is contained in:
electron128 2016-02-07 14:23:01 +01:00
parent 2c2c7936e5
commit 3d814b7926

View File

@ -771,9 +771,20 @@ void ChatHandler::handleTypingLabel(Request &/*req*/, Response &/*resp*/)
}
void ChatHandler::handleSendStatus(Request &/*req*/, Response &/*resp*/)
void ChatHandler::handleSendStatus(Request &req, Response &resp)
{
std::string chat_id;
std::string status;
req.mStream << makeKeyValueReference("chat_id", chat_id)
<< makeKeyValueReference("status", status);
ChatId id(chat_id);
if(id.isNotSet())
{
resp.setFail("chat_id is invalid");
return;
}
mRsMsgs->sendStatusString(id, status);
resp.setOk();
}
void ChatHandler::handleUnreadMsgs(Request &/*req*/, Response &resp)