Added ClearFeedItems() function to pqinotify interface.

Clear NewsFeeds after Cache loading so we only see new stuff.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2974 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2010-05-23 16:35:42 +00:00
parent a5cc8d7ba2
commit 61e8d588a8
4 changed files with 42 additions and 1 deletions

View File

@ -195,3 +195,22 @@ bool p3Notify::AddFeedItem(uint32_t type, std::string id1, std::string id2, std:
return true; return true;
} }
bool p3Notify::ClearFeedItems(uint32_t type)
{
RsStackMutex stack(noteMtx); /************* LOCK MUTEX ************/
std::list<RsFeedItem>::iterator it;
for(it = pendingNewsFeed.begin(); it != pendingNewsFeed.end(); )
{
if (it->mType == type)
{
it = pendingNewsFeed.erase(it);
}
else
{
it++;
}
}
return true;
}

View File

@ -88,6 +88,7 @@ virtual bool AddPopupMessage(uint32_t ptype, std::string name, std::string msg);
virtual bool AddSysMessage(uint32_t sysid, uint32_t type, std::string title, std::string msg); virtual bool AddSysMessage(uint32_t sysid, uint32_t type, std::string title, std::string msg);
virtual bool AddLogMessage(uint32_t sysid, uint32_t type, std::string title, std::string msg); virtual bool AddLogMessage(uint32_t sysid, uint32_t type, std::string title, std::string msg);
virtual bool AddFeedItem(uint32_t type, std::string id1, std::string id2, std::string id3); virtual bool AddFeedItem(uint32_t type, std::string id1, std::string id2, std::string id3);
virtual bool ClearFeedItems(uint32_t type);
private: private:

View File

@ -44,7 +44,7 @@ virtual bool AddPopupMessage(uint32_t ptype, std::string name, std::string msg)
virtual bool AddSysMessage(uint32_t sysid, uint32_t type, std::string title, std::string msg) = 0; virtual bool AddSysMessage(uint32_t sysid, uint32_t type, std::string title, std::string msg) = 0;
virtual bool AddLogMessage(uint32_t sysid, uint32_t type, std::string title, std::string msg) = 0; virtual bool AddLogMessage(uint32_t sysid, uint32_t type, std::string title, std::string msg) = 0;
virtual bool AddFeedItem(uint32_t type, std::string id1, std::string id2, std::string id3) = 0; virtual bool AddFeedItem(uint32_t type, std::string id1, std::string id2, std::string id3) = 0;
virtual bool ClearFeedItems(uint32_t type) = 0;
}; };
extern pqiNotify *getPqiNotify(); extern pqiNotify *getPqiNotify();

View File

@ -2208,6 +2208,27 @@ int RsServer::StartupRetroShare()
/* load caches and secondary data */ /* load caches and secondary data */
/**************************************************************************/ /**************************************************************************/
// Clear the News Feeds that are generated by Initial Cache Loading.
/* Peer stuff is up to date */
/* Channel/Forum/Blog stuff will all come from Caches */
getPqiNotify()->ClearFeedItems(RS_FEED_ITEM_CHAN_NEW);
getPqiNotify()->ClearFeedItems(RS_FEED_ITEM_CHAN_UPDATE);
getPqiNotify()->ClearFeedItems(RS_FEED_ITEM_CHAN_MSG);
getPqiNotify()->ClearFeedItems(RS_FEED_ITEM_FORUM_NEW);
getPqiNotify()->ClearFeedItems(RS_FEED_ITEM_FORUM_UPDATE);
getPqiNotify()->ClearFeedItems(RS_FEED_ITEM_FORUM_MSG);
getPqiNotify()->ClearFeedItems(RS_FEED_ITEM_BLOG_NEW);
getPqiNotify()->ClearFeedItems(RS_FEED_ITEM_BLOG_UPDATE);
getPqiNotify()->ClearFeedItems(RS_FEED_ITEM_BLOG_MSG);
//getPqiNotify()->ClearFeedItems(RS_FEED_ITEM_CHAT_NEW);
getPqiNotify()->ClearFeedItems(RS_FEED_ITEM_MESSAGE);
//getPqiNotify()->ClearFeedItems(RS_FEED_ITEM_FILES_NEW);
/**************************************************************************/ /**************************************************************************/
/* Force Any Last Configuration Options */ /* Force Any Last Configuration Options */