From 61e8d588a892a9cd2c4e9eb34bc1b91f68838a39 Mon Sep 17 00:00:00 2001 From: drbob Date: Sun, 23 May 2010 16:35:42 +0000 Subject: [PATCH] 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 --- libretroshare/src/pqi/p3notify.cc | 19 +++++++++++++++++++ libretroshare/src/pqi/p3notify.h | 1 + libretroshare/src/pqi/pqinotify.h | 2 +- libretroshare/src/rsserver/rsinit.cc | 21 +++++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/libretroshare/src/pqi/p3notify.cc b/libretroshare/src/pqi/p3notify.cc index b2412bce9..95e48fa35 100644 --- a/libretroshare/src/pqi/p3notify.cc +++ b/libretroshare/src/pqi/p3notify.cc @@ -195,3 +195,22 @@ bool p3Notify::AddFeedItem(uint32_t type, std::string id1, std::string id2, std: return true; } + +bool p3Notify::ClearFeedItems(uint32_t type) +{ + RsStackMutex stack(noteMtx); /************* LOCK MUTEX ************/ + + std::list::iterator it; + for(it = pendingNewsFeed.begin(); it != pendingNewsFeed.end(); ) + { + if (it->mType == type) + { + it = pendingNewsFeed.erase(it); + } + else + { + it++; + } + } + return true; +} diff --git a/libretroshare/src/pqi/p3notify.h b/libretroshare/src/pqi/p3notify.h index 69c3d7e6f..4479a2551 100644 --- a/libretroshare/src/pqi/p3notify.h +++ b/libretroshare/src/pqi/p3notify.h @@ -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 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 ClearFeedItems(uint32_t type); private: diff --git a/libretroshare/src/pqi/pqinotify.h b/libretroshare/src/pqi/pqinotify.h index 2660822c2..5d5237943 100644 --- a/libretroshare/src/pqi/pqinotify.h +++ b/libretroshare/src/pqi/pqinotify.h @@ -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 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 ClearFeedItems(uint32_t type) = 0; }; extern pqiNotify *getPqiNotify(); diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 569fb6e5e..0a8daae45 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -2208,6 +2208,27 @@ int RsServer::StartupRetroShare() /* 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 */