mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-08 06:32:55 -04:00
Moved the chat history into the libretroshare.
Now the history is saved encrypted. Please delete all files with "chat*.xml" in your profile folder. Added new config p3HistoryMgr and interface p3History. Added new option to limit the count of the saved history items. Added new simple html optimizer "RsHtml::optimizeHtml" to reduce the size of the html strings. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4623 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c6a68fe05e
commit
29c090fb44
45 changed files with 1721 additions and 1406 deletions
|
@ -81,6 +81,7 @@ const uint32_t CONFIG_TYPE_AUTHSSL = 0x000C;
|
|||
const uint32_t CONFIG_TYPE_CHAT = 0x0012;
|
||||
const uint32_t CONFIG_TYPE_STATUS = 0x0013;
|
||||
const uint32_t CONFIG_TYPE_PLUGINS = 0x0014;
|
||||
const uint32_t CONFIG_TYPE_HISTORY = 0x0015;
|
||||
|
||||
/// turtle router
|
||||
const uint32_t CONFIG_TYPE_TURTLE = 0x0020;
|
||||
|
|
417
libretroshare/src/pqi/p3historymgr.cc
Normal file
417
libretroshare/src/pqi/p3historymgr.cc
Normal file
|
@ -0,0 +1,417 @@
|
|||
/*
|
||||
* libretroshare/src/services: p3HistoryMgr.cc
|
||||
*
|
||||
* RetroShare C++ .
|
||||
*
|
||||
* Copyright 2011 by Thunder.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include "p3historymgr.h"
|
||||
#include "serialiser/rshistoryitems.h"
|
||||
#include "serialiser/rsconfigitems.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "serialiser/rsmsgitems.h"
|
||||
|
||||
RsHistory *rsHistory = NULL;
|
||||
|
||||
p3HistoryMgr::p3HistoryMgr()
|
||||
: p3Config(CONFIG_TYPE_HISTORY), mHistoryMtx("p3HistoryMgr")
|
||||
{
|
||||
nextMsgId = 1;
|
||||
|
||||
mPublicEnable = false;
|
||||
mPrivateEnable = true;
|
||||
|
||||
mPublicSaveCount = 0;
|
||||
mPrivateSaveCount = 0;
|
||||
}
|
||||
|
||||
p3HistoryMgr::~p3HistoryMgr()
|
||||
{
|
||||
}
|
||||
|
||||
/***** p3HistoryMgr *****/
|
||||
|
||||
void p3HistoryMgr::addMessage(bool incoming, const std::string &chatPeerId, const std::string &peerId, const RsChatMsgItem *chatItem)
|
||||
{
|
||||
RsStackMutex stack(mHistoryMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
if (mPublicEnable == false && chatPeerId.empty()) {
|
||||
// public chat not enabled
|
||||
return;
|
||||
}
|
||||
|
||||
if (mPrivateEnable == false && chatPeerId.empty() == false) {
|
||||
// private chat not enabled
|
||||
return;
|
||||
}
|
||||
|
||||
RsHistoryMsgItem* item = new RsHistoryMsgItem;
|
||||
item->chatPeerId = chatPeerId;
|
||||
item->incoming = incoming;
|
||||
item->peerId = peerId;
|
||||
item->peerName = rsPeers->getPeerName(item->peerId);
|
||||
item->sendTime = chatItem->sendTime;
|
||||
item->recvTime = chatItem->recvTime;
|
||||
item->message.assign(chatItem->message.begin(), chatItem->message.end());
|
||||
|
||||
std::map<std::string, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit = mMessages.find(item->chatPeerId);
|
||||
if (mit != mMessages.end()) {
|
||||
item->msgId = nextMsgId++;
|
||||
mit->second.insert(std::make_pair(item->msgId, item));
|
||||
|
||||
// check the limit
|
||||
uint32_t limit;
|
||||
if (chatPeerId.empty()) {
|
||||
limit = mPublicSaveCount;
|
||||
} else {
|
||||
limit = mPrivateSaveCount;
|
||||
}
|
||||
|
||||
if (limit) {
|
||||
while (mit->second.size() > limit) {
|
||||
delete(mit->second.begin()->second);
|
||||
mit->second.erase(mit->second.begin());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
std::map<uint32_t, RsHistoryMsgItem*> msgs;
|
||||
item->msgId = nextMsgId++;
|
||||
msgs.insert(std::make_pair(item->msgId, item));
|
||||
mMessages.insert(std::make_pair(item->chatPeerId, msgs));
|
||||
|
||||
// no need to check the limit
|
||||
}
|
||||
|
||||
IndicateConfigChanged();
|
||||
|
||||
rsicontrol->getNotify().notifyHistoryChanged(item->msgId, NOTIFY_TYPE_ADD);
|
||||
}
|
||||
|
||||
/***** p3Config *****/
|
||||
|
||||
RsSerialiser* p3HistoryMgr::setupSerialiser()
|
||||
{
|
||||
RsSerialiser *rss = new RsSerialiser;
|
||||
rss->addSerialType(new RsHistorySerialiser);
|
||||
rss->addSerialType(new RsGeneralConfigSerialiser());
|
||||
|
||||
return rss;
|
||||
}
|
||||
|
||||
bool p3HistoryMgr::saveList(bool& cleanup, std::list<RsItem*>& saveData)
|
||||
{
|
||||
cleanup = false;
|
||||
|
||||
mHistoryMtx.lock(); /********** STACK LOCKED MTX ******/
|
||||
|
||||
std::map<std::string, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit;
|
||||
std::map<uint32_t, RsHistoryMsgItem*>::iterator lit;
|
||||
for (mit = mMessages.begin(); mit != mMessages.end(); mit++) {
|
||||
for (lit = mit->second.begin(); lit != mit->second.end(); lit++) {
|
||||
saveData.push_back(lit->second);
|
||||
}
|
||||
}
|
||||
|
||||
RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet;
|
||||
|
||||
RsTlvKeyValue kv;
|
||||
kv.key = "PUBLIC_ENABLE";
|
||||
kv.value = mPublicEnable ? "TRUE" : "FALSE";
|
||||
vitem->tlvkvs.pairs.push_back(kv);
|
||||
|
||||
kv.key = "PRIVATE_ENABLE";
|
||||
kv.value = mPrivateEnable ? "TRUE" : "FALSE";
|
||||
vitem->tlvkvs.pairs.push_back(kv);
|
||||
|
||||
kv.key = "PUBLIC_SAVECOUNT";
|
||||
std::ostringstream s1;
|
||||
s1 << mPublicSaveCount;
|
||||
kv.value = s1.str();
|
||||
vitem->tlvkvs.pairs.push_back(kv);
|
||||
|
||||
kv.key = "PRIVATE_SAVECOUNT";
|
||||
std::ostringstream s2;
|
||||
s2 << mPrivateSaveCount;
|
||||
kv.value = s2.str();
|
||||
vitem->tlvkvs.pairs.push_back(kv);
|
||||
|
||||
saveData.push_back(vitem);
|
||||
saveCleanupList.push_back(vitem);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void p3HistoryMgr::saveDone()
|
||||
{
|
||||
/* clean up the save List */
|
||||
std::list<RsItem*>::iterator it;
|
||||
for (it = saveCleanupList.begin(); it != saveCleanupList.end(); ++it) {
|
||||
delete (*it);
|
||||
}
|
||||
|
||||
saveCleanupList.clear();
|
||||
|
||||
/* unlock mutex */
|
||||
mHistoryMtx.unlock(); /****** MUTEX UNLOCKED *******/
|
||||
}
|
||||
|
||||
bool p3HistoryMgr::loadList(std::list<RsItem*>& load)
|
||||
{
|
||||
RsStackMutex stack(mHistoryMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
RsHistoryMsgItem *msgItem;
|
||||
std::list<RsItem*>::iterator it;
|
||||
|
||||
for (it = load.begin(); it != load.end(); it++) {
|
||||
if (NULL != (msgItem = dynamic_cast<RsHistoryMsgItem*>(*it))) {
|
||||
std::map<std::string, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit = mMessages.find(msgItem->chatPeerId);
|
||||
msgItem->msgId = nextMsgId++;
|
||||
if (mit != mMessages.end()) {
|
||||
mit->second.insert(std::make_pair(msgItem->msgId, msgItem));
|
||||
} else {
|
||||
std::map<uint32_t, RsHistoryMsgItem*> msgs;
|
||||
msgs.insert(std::make_pair(msgItem->msgId, msgItem));
|
||||
mMessages.insert(std::make_pair(msgItem->chatPeerId, msgs));
|
||||
}
|
||||
|
||||
// don't delete the item !!
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
RsConfigKeyValueSet *rskv ;
|
||||
if (NULL != (rskv = dynamic_cast<RsConfigKeyValueSet*>(*it))) {
|
||||
for (std::list<RsTlvKeyValue>::const_iterator kit = rskv->tlvkvs.pairs.begin(); kit != rskv->tlvkvs.pairs.end(); kit++) {
|
||||
if (kit->key == "PUBLIC_ENABLE") {
|
||||
mPublicEnable = (kit->value == "TRUE") ? TRUE : FALSE;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (kit->key == "PRIVATE_ENABLE") {
|
||||
mPrivateEnable = (kit->value == "TRUE") ? TRUE : FALSE;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (kit->key == "PUBLIC_SAVECOUNT") {
|
||||
mPublicSaveCount = atoi(kit->value.c_str());
|
||||
continue;
|
||||
}
|
||||
if (kit->key == "PRIVATE_SAVECOUNT") {
|
||||
mPrivateSaveCount = atoi(kit->value.c_str());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
delete (*it);
|
||||
continue;
|
||||
}
|
||||
|
||||
// delete unknown items
|
||||
delete (*it);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/***** p3History *****/
|
||||
|
||||
static void convertMsg(const RsHistoryMsgItem* item, HistoryMsg &msg)
|
||||
{
|
||||
msg.msgId = item->msgId;
|
||||
msg.chatPeerId = item->chatPeerId;
|
||||
msg.incoming = item->incoming;
|
||||
msg.peerId = item->peerId;
|
||||
msg.peerName = item->peerName;
|
||||
msg.sendTime = item->sendTime;
|
||||
msg.recvTime = item->recvTime;
|
||||
msg.message = item->message;
|
||||
}
|
||||
|
||||
//static void convertMsg(const HistoryMsg &msg, RsHistoryMsgItem* item)
|
||||
//{
|
||||
// item->msgId = msg.msgId;
|
||||
// item->chatPeerId = msg.chatPeerId;
|
||||
// item->incoming = msg.incoming;
|
||||
// item->peerId = msg.peerId;
|
||||
// item->peerName = msg.peerName;
|
||||
// item->sendTime = msg.sendTime;
|
||||
// item->recvTime = msg.recvTime;
|
||||
// item->message = msg.message;
|
||||
//}
|
||||
|
||||
bool p3HistoryMgr::getMessages(const std::string &chatPeerId, std::list<HistoryMsg> &msgs, uint32_t loadCount)
|
||||
{
|
||||
msgs.clear();
|
||||
|
||||
RsStackMutex stack(mHistoryMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
if (mPublicEnable == false && chatPeerId.empty()) {
|
||||
// public chat not enabled
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mPrivateEnable == false && chatPeerId.empty() == false) {
|
||||
// private chat not enabled
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t foundCount = 0;
|
||||
|
||||
std::map<std::string, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit = mMessages.find(chatPeerId);
|
||||
if (mit != mMessages.end()) {
|
||||
std::map<uint32_t, RsHistoryMsgItem*>::reverse_iterator lit;
|
||||
for (lit = mit->second.rbegin(); lit != mit->second.rend(); lit++) {
|
||||
HistoryMsg msg;
|
||||
convertMsg(lit->second, msg);
|
||||
msgs.insert(msgs.begin(), msg);
|
||||
foundCount++;
|
||||
if (loadCount && foundCount >= loadCount) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3HistoryMgr::getMessage(uint32_t msgId, HistoryMsg &msg)
|
||||
{
|
||||
RsStackMutex stack(mHistoryMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
std::map<std::string, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit;
|
||||
for (mit = mMessages.begin(); mit != mMessages.end(); mit++) {
|
||||
std::map<uint32_t, RsHistoryMsgItem*>::iterator lit = mit->second.find(msgId);
|
||||
if (lit != mit->second.end()) {
|
||||
convertMsg(lit->second, msg);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void p3HistoryMgr::clear(const std::string &chatPeerId)
|
||||
{
|
||||
RsStackMutex stack(mHistoryMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
std::map<std::string, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit = mMessages.find(chatPeerId);
|
||||
if (mit == mMessages.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<uint32_t, RsHistoryMsgItem*>::iterator lit;
|
||||
for (lit = mit->second.begin(); lit != mit->second.end(); lit++) {
|
||||
delete(lit->second);
|
||||
}
|
||||
mit->second.clear();
|
||||
mMessages.erase(mit);
|
||||
|
||||
IndicateConfigChanged();
|
||||
|
||||
rsicontrol->getNotify().notifyHistoryChanged(0, NOTIFY_TYPE_MOD);
|
||||
}
|
||||
|
||||
void p3HistoryMgr::removeMessages(const std::list<uint32_t> &msgIds)
|
||||
{
|
||||
std::list<uint32_t> ids = msgIds;
|
||||
std::list<uint32_t> removedIds;
|
||||
std::list<uint32_t>::iterator iit;
|
||||
|
||||
{
|
||||
RsStackMutex stack(mHistoryMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
std::map<std::string, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit;
|
||||
for (mit = mMessages.begin(); mit != mMessages.end(); ++mit) {
|
||||
iit = ids.begin();
|
||||
while (iit != ids.end()) {
|
||||
std::map<uint32_t, RsHistoryMsgItem*>::iterator lit = mit->second.find(*iit);
|
||||
if (lit != mit->second.end()) {
|
||||
delete(lit->second);
|
||||
mit->second.erase(lit);
|
||||
|
||||
removedIds.push_back(*iit);
|
||||
iit = ids.erase(iit);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
++iit;
|
||||
}
|
||||
|
||||
if (ids.empty()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (removedIds.empty() == false) {
|
||||
IndicateConfigChanged();
|
||||
|
||||
for (iit = removedIds.begin(); iit != removedIds.end(); ++iit) {
|
||||
rsicontrol->getNotify().notifyHistoryChanged(*iit, NOTIFY_TYPE_DEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool p3HistoryMgr::getEnable(bool ofPublic)
|
||||
{
|
||||
return ofPublic ? mPublicEnable : mPrivateEnable;
|
||||
}
|
||||
|
||||
void p3HistoryMgr::setEnable(bool forPublic, bool enable)
|
||||
{
|
||||
bool oldValue;
|
||||
|
||||
if (forPublic) {
|
||||
oldValue = mPublicEnable;
|
||||
mPublicEnable = enable;
|
||||
} else {
|
||||
oldValue = mPrivateEnable;
|
||||
mPrivateEnable = enable;
|
||||
}
|
||||
|
||||
if (oldValue != enable) {
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t p3HistoryMgr::getSaveCount(bool ofPublic)
|
||||
{
|
||||
return ofPublic ? mPublicSaveCount : mPrivateSaveCount;
|
||||
}
|
||||
|
||||
void p3HistoryMgr::setSaveCount(bool forPublic, uint32_t count)
|
||||
{
|
||||
uint32_t oldValue;
|
||||
|
||||
if (forPublic) {
|
||||
oldValue = mPublicSaveCount;
|
||||
mPublicSaveCount = count;
|
||||
} else {
|
||||
oldValue = mPrivateSaveCount;
|
||||
mPrivateSaveCount = count;
|
||||
}
|
||||
|
||||
if (oldValue != count) {
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
}
|
86
libretroshare/src/pqi/p3historymgr.h
Normal file
86
libretroshare/src/pqi/p3historymgr.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
#ifndef RS_P3_HISTORY_MGR_H
|
||||
#define RS_P3_HISTORY_MGR_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/services: p3historymgr.h
|
||||
*
|
||||
* RetroShare C++
|
||||
*
|
||||
* Copyright 2011 by Thunder.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
#include <list>
|
||||
|
||||
#include "serialiser/rshistoryitems.h"
|
||||
#include "retroshare/rshistory.h"
|
||||
#include "pqi/p3cfgmgr.h"
|
||||
|
||||
class RsChatMsgItem;
|
||||
|
||||
//! handles history
|
||||
/*!
|
||||
* The is a retroshare service which allows peers
|
||||
* to store the history of the chat messages
|
||||
*/
|
||||
class p3HistoryMgr: public p3Config
|
||||
{
|
||||
public:
|
||||
p3HistoryMgr();
|
||||
virtual ~p3HistoryMgr();
|
||||
|
||||
/******** p3HistoryMgr *********/
|
||||
|
||||
void addMessage(bool incoming, const std::string &chatPeerId, const std::string &peerId, const RsChatMsgItem *chatItem);
|
||||
|
||||
/********* RsHistory ***********/
|
||||
|
||||
bool getMessages(const std::string &chatPeerId, std::list<HistoryMsg> &msgs, uint32_t loadCount);
|
||||
bool getMessage(uint32_t msgId, HistoryMsg &msg);
|
||||
void clear(const std::string &chatPeerId);
|
||||
void removeMessages(const std::list<uint32_t> &msgIds);
|
||||
bool getEnable(bool ofPublic);
|
||||
void setEnable(bool forPublic, bool enable);
|
||||
uint32_t getSaveCount(bool ofPublic);
|
||||
void setSaveCount(bool forPublic, uint32_t count);
|
||||
|
||||
/********* p3config ************/
|
||||
|
||||
virtual RsSerialiser *setupSerialiser();
|
||||
virtual bool saveList(bool& cleanup, std::list<RsItem*>& saveData);
|
||||
virtual void saveDone();
|
||||
virtual bool loadList(std::list<RsItem*>& load);
|
||||
|
||||
private:
|
||||
uint32_t nextMsgId;
|
||||
std::map<std::string, std::map<uint32_t, RsHistoryMsgItem*> > mMessages;
|
||||
|
||||
bool mPublicEnable;
|
||||
bool mPrivateEnable;
|
||||
|
||||
uint32_t mPublicSaveCount;
|
||||
uint32_t mPrivateSaveCount;
|
||||
|
||||
std::list<RsItem*> saveCleanupList; /* TEMPORARY LIST WHEN SAVING */
|
||||
|
||||
RsMutex mHistoryMtx;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -30,6 +30,7 @@
|
|||
#include "pqi/p3peermgr.h"
|
||||
#include "pqi/p3linkmgr.h"
|
||||
#include "pqi/p3netmgr.h"
|
||||
#include "pqi/p3historymgr.h"
|
||||
|
||||
//#include "pqi/p3dhtmgr.h" // Only need it for constants.
|
||||
//#include "tcponudp/tou.h"
|
||||
|
@ -109,6 +110,10 @@ p3PeerMgrIMPL::p3PeerMgrIMPL()
|
|||
{
|
||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
mLinkMgr = NULL;
|
||||
mNetMgr = NULL;
|
||||
mHistoryMgr = NULL;
|
||||
|
||||
/* setup basics of own state */
|
||||
mOwnState.id = AuthSSL::getAuthSSL()->OwnId();
|
||||
mOwnState.gpg_id = AuthGPG::getAuthGPG()->getGPGOwnId();
|
||||
|
@ -130,10 +135,11 @@ p3PeerMgrIMPL::p3PeerMgrIMPL()
|
|||
return;
|
||||
}
|
||||
|
||||
void p3PeerMgrIMPL::setManagers(p3LinkMgrIMPL *linkMgr, p3NetMgrIMPL *netMgr)
|
||||
void p3PeerMgrIMPL::setManagers(p3LinkMgrIMPL *linkMgr, p3NetMgrIMPL *netMgr, p3HistoryMgr *historyMgr)
|
||||
{
|
||||
mLinkMgr = linkMgr;
|
||||
mNetMgr = netMgr;
|
||||
mHistoryMgr = historyMgr;
|
||||
}
|
||||
|
||||
void p3PeerMgrIMPL::setOwnNetworkMode(uint32_t netMode)
|
||||
|
@ -537,6 +543,7 @@ bool p3PeerMgrIMPL::removeFriend(const std::string &id)
|
|||
{
|
||||
if (mFriendList.end() != (it = mFriendList.find(*rit)))
|
||||
{
|
||||
mHistoryMgr->clear(it->second.id);
|
||||
mFriendList.erase(it);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,6 +113,7 @@ class p3NetMgr;
|
|||
|
||||
class p3LinkMgrIMPL;
|
||||
class p3NetMgrIMPL;
|
||||
class p3HistoryMgr;
|
||||
|
||||
class p3PeerMgr
|
||||
{
|
||||
|
@ -279,7 +280,7 @@ virtual bool haveOnceConnected();
|
|||
|
||||
p3PeerMgrIMPL();
|
||||
|
||||
void setManagers(p3LinkMgrIMPL *linkMgr, p3NetMgrIMPL *netMgr);
|
||||
void setManagers(p3LinkMgrIMPL *linkMgr, p3NetMgrIMPL *netMgr, p3HistoryMgr *historyMgr);
|
||||
|
||||
void tick();
|
||||
|
||||
|
@ -314,7 +315,7 @@ void printPeerLists(std::ostream &out);
|
|||
|
||||
p3LinkMgrIMPL *mLinkMgr;
|
||||
p3NetMgrIMPL *mNetMgr;
|
||||
|
||||
p3HistoryMgr *mHistoryMgr;
|
||||
|
||||
private:
|
||||
RsMutex mPeerMtx; /* protects below */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue