mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 08:05:18 -04:00
Add a Clear button on WebUI
And Fix clear history update from GUI.
This commit is contained in:
parent
c8cae4c33c
commit
24b3f0de0e
4 changed files with 40 additions and 16 deletions
|
@ -113,7 +113,7 @@ public:
|
|||
private:
|
||||
ChatHandler::LobbyParticipantsInfo mParticipantsInfo;
|
||||
protected:
|
||||
virtual void gxsDoWork(Request &req, Response &resp)
|
||||
virtual void gxsDoWork(Request &/*req*/, Response &resp)
|
||||
{
|
||||
resp.mDataStream.getStreamToMember();
|
||||
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("subscribe_lobby", this, &ChatHandler::handleSubscribeLobby);
|
||||
addResourceHandler("unsubscribe_lobby", this, &ChatHandler::handleUnsubscribeLobby);
|
||||
addResourceHandler("clear_lobby", this, &ChatHandler::handleClearLobby);
|
||||
addResourceHandler("lobby_participants", this, &ChatHandler::handleLobbyParticipants);
|
||||
addResourceHandler("messages", this, &ChatHandler::handleMessages);
|
||||
addResourceHandler("send_message", this, &ChatHandler::handleSendMessage);
|
||||
|
@ -167,13 +168,13 @@ void ChatHandler::notifyChatMessage(const ChatMessage &msg)
|
|||
mRawMsgs.push_back(msg);
|
||||
}
|
||||
|
||||
void ChatHandler::notifyChatCleared(const ChatId &chat_id)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
std::list<Msg>& msgs = mMsgs[chat_id];
|
||||
msgs.clear();
|
||||
}
|
||||
|
||||
void ChatHandler::notifyChatCleared(const ChatId &chat_id)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
std::list<Msg>& msgs = mMsgs[chat_id];
|
||||
msgs.clear();
|
||||
}
|
||||
|
||||
void ChatHandler::notifyChatStatus(const ChatId &chat_id, const std::string &status)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
|
@ -593,6 +594,14 @@ void ChatHandler::handleUnsubscribeLobby(Request &req, Response &resp)
|
|||
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)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue