Change Chat History Dialog to no modal.

It will be updated when new message comes.
This commit is contained in:
Phenom 2020-11-07 18:09:50 +01:00
parent e0ce5632ef
commit b1129df077
10 changed files with 81 additions and 56 deletions

View file

@ -416,7 +416,7 @@ bool p3HistoryMgr::loadList(std::list<RsItem*>& load)
}
// have to convert to virtual peer id, to be able to use existing serialiser and file format
bool p3HistoryMgr::chatIdToVirtualPeerId(ChatId chat_id, RsPeerId &peer_id)
bool p3HistoryMgr::chatIdToVirtualPeerId(const ChatId& chat_id, RsPeerId &peer_id)
{
if (chat_id.isBroadcast()) {
peer_id = RsPeerId();

View file

@ -68,9 +68,9 @@ public:
virtual void saveDone();
virtual bool loadList(std::list<RsItem*>& load);
private:
static bool chatIdToVirtualPeerId(ChatId chat_id, RsPeerId& peer_id);
static bool chatIdToVirtualPeerId(const ChatId& chat_id, RsPeerId& peer_id);
private:
uint32_t nextMsgId;
std::map<RsPeerId, std::map<uint32_t, RsHistoryMsgItem*> > mMessages;

View file

@ -1876,7 +1876,9 @@ bool p3PeerMgrIMPL::getExtAddressReportedByFriends(sockaddr_storage &addr, uint8
static bool cleanIpList(std::list<pqiIpAddress>& lst,const RsPeerId& pid,p3LinkMgr *link_mgr)
{
bool changed = false ;
#ifdef PEER_DEBUG
rstime_t now = time(NULL) ;
#endif
for(std::list<pqiIpAddress>::iterator it2(lst.begin());it2 != lst.end();)
{

View file

@ -70,15 +70,17 @@ public:
class RsHistory
{
public:
virtual bool getMessages(const ChatId &chatPeerId, std::list<HistoryMsg> &msgs, uint32_t loadCount) = 0;
virtual bool chatIdToVirtualPeerId(const ChatId &chat_id, RsPeerId &peer_id) = 0;
virtual bool getMessages(const ChatId &chatPeerId, std::list<HistoryMsg> &msgs, uint32_t loadCount) = 0;
virtual bool getMessage(uint32_t msgId, HistoryMsg &msg) = 0;
virtual void removeMessages(const std::list<uint32_t> &msgIds) = 0;
virtual void clear(const ChatId &chatPeerId) = 0;
virtual void clear(const ChatId &chatPeerId) = 0;
virtual bool getEnable(uint32_t chat_type) = 0;
virtual void setEnable(uint32_t chat_type, bool enable) = 0;
virtual uint32_t getMaxStorageDuration() = 0 ;
virtual void setMaxStorageDuration(uint32_t seconds) = 0 ;
virtual uint32_t getMaxStorageDuration() = 0;
virtual void setMaxStorageDuration(uint32_t seconds) = 0;
// 0 = no limit, >0 count of saved messages
virtual uint32_t getSaveCount(uint32_t chat_type) = 0;

View file

@ -31,6 +31,11 @@ p3History::~p3History()
{
}
bool p3History::chatIdToVirtualPeerId(const ChatId &chat_id, RsPeerId &peer_id)
{
return mHistoryMgr->chatIdToVirtualPeerId(chat_id, peer_id);
}
void p3History::setMaxStorageDuration(uint32_t seconds)
{
mHistoryMgr->setMaxStorageDuration(seconds) ;

View file

@ -37,16 +37,21 @@ public:
p3History(p3HistoryMgr* historyMgr);
virtual ~p3History();
virtual bool getMessages(const ChatId &chatPeerId, std::list<HistoryMsg> &msgs, uint32_t loadCount);
virtual bool chatIdToVirtualPeerId(const ChatId &chat_id, RsPeerId &peer_id);
virtual bool getMessages(const ChatId &chatPeerId, std::list<HistoryMsg> &msgs, uint32_t loadCount);
virtual bool getMessage(uint32_t msgId, HistoryMsg &msg);
virtual void removeMessages(const std::list<uint32_t> &msgIds);
virtual void clear(const ChatId &chatPeerId);
virtual void clear(const ChatId &chatPeerId);
virtual bool getEnable(uint32_t chat_type);
virtual void setEnable(uint32_t chat_type, bool enable);
virtual uint32_t getMaxStorageDuration();
virtual void setMaxStorageDuration(uint32_t seconds);
// 0 = no limit, >0 count of saved messages
virtual uint32_t getSaveCount(uint32_t chat_type);
virtual void setSaveCount(uint32_t chat_type, uint32_t count);
virtual void setMaxStorageDuration(uint32_t seconds) ;
virtual uint32_t getMaxStorageDuration() ;
virtual void setSaveCount(uint32_t chat_type, uint32_t count);
private:
p3HistoryMgr* mHistoryMgr;