mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-17 21:40:36 -04:00
New read status for forum messages.
New mail messages are marked with a new icon in front of the title. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3352 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
1ad871a3e9
commit
86ae9983d1
22 changed files with 1425 additions and 355 deletions
|
@ -271,14 +271,43 @@ bool p3Forums::ForumMessageSend(ForumMsgInfo &info)
|
|||
|
||||
bool p3Forums::setMessageStatus(const std::string& fId,const std::string& mId,const uint32_t status, const uint32_t statusMask)
|
||||
{
|
||||
setReadStatus(fId, mId, (status & statusMask));
|
||||
RsStackMutex stack(distribMtx);
|
||||
|
||||
std::list<RsForumReadStatus *>::iterator lit = mReadStatus.begin();
|
||||
|
||||
for(; lit != mReadStatus.end(); lit++)
|
||||
{
|
||||
|
||||
if((*lit)->forumId == fId)
|
||||
{
|
||||
RsForumReadStatus* rsi = *lit;
|
||||
rsi->msgReadStatus[mId] &= ~statusMask;
|
||||
rsi->msgReadStatus[mId] |= (status & statusMask);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if forum id does not exist create one
|
||||
if(lit == mReadStatus.end())
|
||||
{
|
||||
RsForumReadStatus* rsi = new RsForumReadStatus();
|
||||
rsi->forumId = fId;
|
||||
rsi->msgReadStatus[mId] = status & statusMask;
|
||||
mReadStatus.push_back(rsi);
|
||||
mSaveList.push_back(rsi);
|
||||
}
|
||||
|
||||
IndicateConfigChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool p3Forums::getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status, uint32_t statusMask)
|
||||
bool p3Forums::getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status)
|
||||
{
|
||||
|
||||
status = 0;
|
||||
|
||||
RsStackMutex stack(distribMtx);
|
||||
|
||||
std::list<RsForumReadStatus *>::iterator lit = mReadStatus.begin();
|
||||
|
@ -293,22 +322,17 @@ bool p3Forums::getMessageStatus(const std::string& fId, const std::string& mId,
|
|||
|
||||
}
|
||||
|
||||
std::map<std::string, uint32_t >::iterator mit;
|
||||
|
||||
if(lit == mReadStatus.end())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
||||
std::map<std::string, uint32_t >::iterator mit = (*lit)->msgReadStatus.find(mId);
|
||||
|
||||
if(mit != (*lit)->msgReadStatus.end())
|
||||
{
|
||||
mit = (*lit)->msgReadStatus.find(mId);
|
||||
|
||||
if(mit != (*lit)->msgReadStatus.end())
|
||||
{
|
||||
status = (mit->second & statusMask);
|
||||
return true;
|
||||
}
|
||||
|
||||
status = mit->second;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -573,36 +597,6 @@ std::list<RsItem* > p3Forums::childSaveList()
|
|||
return mSaveList;
|
||||
}
|
||||
|
||||
void p3Forums::setReadStatus(const std::string& forumId, const std::string& msgId, const uint32_t status)
|
||||
{
|
||||
RsStackMutex stack(distribMtx);
|
||||
|
||||
std::list<RsForumReadStatus *>::iterator lit = mReadStatus.begin();
|
||||
|
||||
for(; lit != mReadStatus.end(); lit++)
|
||||
{
|
||||
|
||||
if((*lit)->forumId == forumId)
|
||||
{
|
||||
(*lit)->msgReadStatus[msgId] = status;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// if forum id does not exist create one
|
||||
if(lit == mReadStatus.end())
|
||||
{
|
||||
RsForumReadStatus* rsi = new RsForumReadStatus();
|
||||
rsi->forumId = forumId;
|
||||
rsi->msgReadStatus[msgId] = status;
|
||||
mReadStatus.push_back(rsi);
|
||||
mSaveList.push_back(rsi);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
bool p3Forums::childLoadList(std::list<RsItem* >& configSaves)
|
||||
{
|
||||
RsForumReadStatus* drs = NULL;
|
||||
|
|
|
@ -54,10 +54,9 @@ virtual bool getForumList(std::list<ForumInfo> &forumList);
|
|||
virtual bool getForumThreadList(std::string fId, std::list<ThreadInfoSummary> &msgs);
|
||||
virtual bool getForumThreadMsgList(std::string fId, std::string tId, std::list<ThreadInfoSummary> &msgs);
|
||||
virtual bool getForumMessage(std::string fId, std::string mId, ForumMsgInfo &msg);
|
||||
virtual void setReadStatus(const std::string& forumId,const std::string& msgId,const uint32_t status);
|
||||
virtual bool ForumMessageSend(ForumMsgInfo &info);
|
||||
virtual bool setMessageStatus(const std::string& fId, const std::string& mId, const uint32_t status, const uint32_t statusMask);
|
||||
virtual bool getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status, const uint32_t statusMask);
|
||||
virtual bool getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status);
|
||||
|
||||
virtual bool forumSubscribe(std::string fId, bool subscribe);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue