mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-28 00:49:28 -05:00
Add a Clear button on WebUI
And Fix clear history update from GUI.
This commit is contained in:
parent
c8cae4c33c
commit
24b3f0de0e
@ -113,7 +113,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
ChatHandler::LobbyParticipantsInfo mParticipantsInfo;
|
ChatHandler::LobbyParticipantsInfo mParticipantsInfo;
|
||||||
protected:
|
protected:
|
||||||
virtual void gxsDoWork(Request &req, Response &resp)
|
virtual void gxsDoWork(Request &/*req*/, Response &resp)
|
||||||
{
|
{
|
||||||
resp.mDataStream.getStreamToMember();
|
resp.mDataStream.getStreamToMember();
|
||||||
const std::map<RsGxsId, time_t>& map = mParticipantsInfo.participants;
|
const std::map<RsGxsId, time_t>& map = mParticipantsInfo.participants;
|
||||||
@ -145,6 +145,7 @@ ChatHandler::ChatHandler(StateTokenServer *sts, RsNotify *notify, RsMsgs *msgs,
|
|||||||
addResourceHandler("lobbies", this, &ChatHandler::handleLobbies);
|
addResourceHandler("lobbies", this, &ChatHandler::handleLobbies);
|
||||||
addResourceHandler("subscribe_lobby", this, &ChatHandler::handleSubscribeLobby);
|
addResourceHandler("subscribe_lobby", this, &ChatHandler::handleSubscribeLobby);
|
||||||
addResourceHandler("unsubscribe_lobby", this, &ChatHandler::handleUnsubscribeLobby);
|
addResourceHandler("unsubscribe_lobby", this, &ChatHandler::handleUnsubscribeLobby);
|
||||||
|
addResourceHandler("clear_lobby", this, &ChatHandler::handleClearLobby);
|
||||||
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);
|
||||||
@ -593,6 +594,14 @@ void ChatHandler::handleUnsubscribeLobby(Request &req, Response &resp)
|
|||||||
resp.setOk();
|
resp.setOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatHandler::handleClearLobby(Request &req, Response &resp)
|
||||||
|
{
|
||||||
|
ChatLobbyId id = 0;
|
||||||
|
req.mStream << makeKeyValueReference("id", id);
|
||||||
|
notifyChatCleared(ChatId(id));
|
||||||
|
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 **********/
|
||||||
|
@ -119,6 +119,7 @@ private:
|
|||||||
void handleLobbies(Request& req, Response& resp);
|
void handleLobbies(Request& req, Response& resp);
|
||||||
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 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);
|
||||||
void handleSendMessage(Request& req, Response& resp);
|
void handleSendMessage(Request& req, Response& resp);
|
||||||
|
@ -24,6 +24,7 @@ void handlePaginationRequest(Request& req, Response& resp, C& data)
|
|||||||
// set result type to list
|
// set result type to list
|
||||||
resp.mDataStream.getStreamToMember();
|
resp.mDataStream.getStreamToMember();
|
||||||
resp.mDebug << "note: list is empty" << std::endl;
|
resp.mDebug << "note: list is empty" << std::endl;
|
||||||
|
resp.setOk();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,13 +115,15 @@ function lobby(lobbyid){
|
|||||||
}
|
}
|
||||||
|
|
||||||
rs.request("chat/messages/" + lobbyid, reqData, function (data) {
|
rs.request("chat/messages/" + lobbyid, reqData, function (data) {
|
||||||
|
if (data.length > 0 ) {
|
||||||
mem.msg = mem.msg.concat(data);
|
mem.msg = mem.msg.concat(data);
|
||||||
if (mem.msg.length > 0) {
|
if (mem.msg.length > 0) {
|
||||||
mem.lastKnownMsg = mem.msg[mem.msg.length -1].id;
|
mem.lastKnownMsg = mem.msg[mem.msg.length -1].id;
|
||||||
}
|
}
|
||||||
if (data.length > 0 ) {
|
|
||||||
rs.request("chat/mark_chat_as_read/" + lobbyid,{}, null,
|
rs.request("chat/mark_chat_as_read/" + lobbyid,{}, null,
|
||||||
{allow: "ok|not_set"});
|
{allow: "ok|not_set"});
|
||||||
|
} else {
|
||||||
|
mem.msg = [];
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
onmismatch: function (){},
|
onmismatch: function (){},
|
||||||
@ -187,6 +189,17 @@ function lobby(lobbyid){
|
|||||||
m.route("/chat");
|
m.route("/chat");
|
||||||
}
|
}
|
||||||
},"unsubscribe"),
|
},"unsubscribe"),
|
||||||
|
m("div.btn", {
|
||||||
|
style: {
|
||||||
|
"text-align":"center"
|
||||||
|
},
|
||||||
|
onclick: function (){
|
||||||
|
rs.request("chat/clear_lobby",{
|
||||||
|
id:lobdt.id,
|
||||||
|
});
|
||||||
|
m.route("/chat?lobby=" + lobbyid);
|
||||||
|
}
|
||||||
|
},"clear"),
|
||||||
m("h3","participants:"),
|
m("h3","participants:"),
|
||||||
rs.list(
|
rs.list(
|
||||||
"chat/lobby_participants/" + lobbyid,
|
"chat/lobby_participants/" + lobbyid,
|
||||||
|
Loading…
Reference in New Issue
Block a user