Added: function for handling autosubscribing lobbies

This commit is contained in:
Konrad 2017-03-29 16:06:39 +02:00
parent 22956be00f
commit fbc1bb4e82
2 changed files with 11 additions and 0 deletions

View File

@ -147,6 +147,7 @@ ChatHandler::ChatHandler(StateTokenServer *sts, RsNotify *notify, RsMsgs *msgs,
addResourceHandler("lobbies", this, &ChatHandler::handleLobbies);
addResourceHandler("subscribe_lobby", this, &ChatHandler::handleSubscribeLobby);
addResourceHandler("unsubscribe_lobby", this, &ChatHandler::handleUnsubscribeLobby);
addResourceHandler("autosubscribe_lobby", this, &ChatHandler::handleAutoSubsribeLobby);
addResourceHandler("clear_lobby", this, &ChatHandler::handleClearLobby);
addResourceHandler("lobby_participants", this, &ChatHandler::handleLobbyParticipants);
addResourceHandler("messages", this, &ChatHandler::handleMessages);
@ -890,6 +891,15 @@ void ChatHandler::handleUnsubscribeLobby(Request &req, Response &resp)
resp.setOk();
}
void ChatHandler::handleAutoSubsribeLobby(Request& req, Response& resp)
{
ChatLobbyId chatId = 0;
bool autosubsribe;
req.mStream << makeKeyValueReference("chatid", chatId) << makeKeyValueReference("autosubsribe", autosubsribe);
mRsMsgs->setLobbyAutoSubscribe(chatId, autosubsribe);
resp.setOk();
}
void ChatHandler::handleClearLobby(Request &req, Response &resp)
{
ChatLobbyId id = 0;

View File

@ -120,6 +120,7 @@ private:
void handleLobbies(Request& req, Response& resp);
void handleSubscribeLobby(Request& req, Response& resp);
void handleUnsubscribeLobby(Request& req, Response& resp);
void handleAutoSubsribeLobby(Request& req, Response& resp);
void handleClearLobby(Request& req, Response& resp);
ResponseTask* handleLobbyParticipants(Request& req, Response& resp);
void handleMessages(Request& req, Response& resp);