mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
Merge pull request #389 from PhenomRetroShare/Fix_ClearWebAPIWhenClearChatHistory
Fix Clear WebAPI when clear chat history in GUI and server is not running.
This commit is contained in:
commit
9f560696e9
@ -172,8 +172,20 @@ void ChatHandler::notifyChatMessage(const ChatMessage &msg)
|
|||||||
void ChatHandler::notifyChatCleared(const ChatId &chat_id)
|
void ChatHandler::notifyChatCleared(const ChatId &chat_id)
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||||
|
//Remove processed messages
|
||||||
std::list<Msg>& msgs = mMsgs[chat_id];
|
std::list<Msg>& msgs = mMsgs[chat_id];
|
||||||
msgs.clear();
|
msgs.clear();
|
||||||
|
//Remove unprocessed messages
|
||||||
|
for(std::list<ChatMessage>::iterator lit = mRawMsgs.begin(); lit != mRawMsgs.end();)
|
||||||
|
{
|
||||||
|
ChatMessage& msg = *lit;
|
||||||
|
if (msg.chat_id == chat_id)
|
||||||
|
{
|
||||||
|
lit = mRawMsgs.erase(lit);
|
||||||
|
} else {
|
||||||
|
++lit;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatHandler::notifyChatStatus(const ChatId &chat_id, const std::string &status)
|
void ChatHandler::notifyChatStatus(const ChatId &chat_id, const std::string &status)
|
||||||
|
Loading…
Reference in New Issue
Block a user