mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-24 23:15:41 -04:00
Added: Handling requests to invite peers to lobby
This commit is contained in:
parent
8e62a8b1b2
commit
aca6233dbf
2 changed files with 21 additions and 0 deletions
|
@ -169,6 +169,7 @@ ChatHandler::ChatHandler(StateTokenServer *sts, RsNotify *notify, RsMsgs *msgs,
|
||||||
addResourceHandler("unsubscribe_lobby", this, &ChatHandler::handleUnsubscribeLobby);
|
addResourceHandler("unsubscribe_lobby", this, &ChatHandler::handleUnsubscribeLobby);
|
||||||
addResourceHandler("autosubscribe_lobby", this, &ChatHandler::handleAutoSubsribeLobby);
|
addResourceHandler("autosubscribe_lobby", this, &ChatHandler::handleAutoSubsribeLobby);
|
||||||
addResourceHandler("clear_lobby", this, &ChatHandler::handleClearLobby);
|
addResourceHandler("clear_lobby", this, &ChatHandler::handleClearLobby);
|
||||||
|
addResourceHandler("invite_to_lobby", this, &ChatHandler::handleInviteToLobby);
|
||||||
addResourceHandler("lobby_participants", this, &ChatHandler::handleLobbyParticipants);
|
addResourceHandler("lobby_participants", this, &ChatHandler::handleLobbyParticipants);
|
||||||
addResourceHandler("messages", this, &ChatHandler::handleMessages);
|
addResourceHandler("messages", this, &ChatHandler::handleMessages);
|
||||||
addResourceHandler("send_message", this, &ChatHandler::handleSendMessage);
|
addResourceHandler("send_message", this, &ChatHandler::handleSendMessage);
|
||||||
|
@ -936,6 +937,25 @@ void ChatHandler::handleClearLobby(Request &req, Response &resp)
|
||||||
resp.setOk();
|
resp.setOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatHandler::handleInviteToLobby(Request& req, Response& resp)
|
||||||
|
{
|
||||||
|
std::string chat_id;
|
||||||
|
std::string pgp_id;
|
||||||
|
req.mStream << makeKeyValueReference("chat_id", chat_id);
|
||||||
|
req.mStream << makeKeyValueReference("pgp_id", pgp_id);
|
||||||
|
|
||||||
|
ChatId chatId(chat_id);
|
||||||
|
RsPgpId pgpId(pgp_id);
|
||||||
|
|
||||||
|
std::list<RsPeerId> peerIds;
|
||||||
|
mRsPeers->getAssociatedSSLIds(pgpId, peerIds);
|
||||||
|
|
||||||
|
for(std::list<RsPeerId>::iterator it = peerIds.begin(); it != peerIds.end(); it++)
|
||||||
|
mRsMsgs->invitePeerToLobby(chatId.toLobbyId(), (*it));
|
||||||
|
|
||||||
|
resp.setOk();
|
||||||
|
}
|
||||||
|
|
||||||
ResponseTask* ChatHandler::handleLobbyParticipants(Request &req, Response &resp)
|
ResponseTask* ChatHandler::handleLobbyParticipants(Request &req, Response &resp)
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||||
|
|
|
@ -122,6 +122,7 @@ private:
|
||||||
void handleSubscribeLobby(Request& req, Response& resp);
|
void handleSubscribeLobby(Request& req, Response& resp);
|
||||||
void handleUnsubscribeLobby(Request& req, Response& resp);
|
void handleUnsubscribeLobby(Request& req, Response& resp);
|
||||||
void handleAutoSubsribeLobby(Request& req, Response& resp);
|
void handleAutoSubsribeLobby(Request& req, Response& resp);
|
||||||
|
void handleInviteToLobby(Request& req, Response& resp);
|
||||||
void handleClearLobby(Request& req, Response& resp);
|
void handleClearLobby(Request& req, Response& resp);
|
||||||
ResponseTask* handleLobbyParticipants(Request& req, Response& resp);
|
ResponseTask* handleLobbyParticipants(Request& req, Response& resp);
|
||||||
void handleMessages(Request& req, Response& resp);
|
void handleMessages(Request& req, Response& resp);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue