mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-13 03:22:34 -04:00
Updated the notification system. Main changes are:
- the notification system is now a service, p3Notify, that is a public RsNotify. - RsNotify does nothing except providing a registration system for new notify clients. - Clients should derive a notify client from the NotifyClient class and register it to rsNotify - all registered clients get all notifications, so only derive the needed methods. This should allow plugins to get notifications as well. - updated the code to call RsServer::notify()->[notification method] from inside libretroshare - pqiNotify has been removed. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6996 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
3cc8c144a8
commit
630824aa1b
47 changed files with 482 additions and 484 deletions
|
@ -51,9 +51,14 @@ int rsserverzone = 101;
|
|||
#define WARN_BIG_CYCLE_TIME (0.2)
|
||||
|
||||
|
||||
RsServer::RsServer(NotifyBase &callback)
|
||||
:RsControl(callback), coreMutex("RsServer")
|
||||
RsServer::RsServer()
|
||||
: coreMutex("RsServer")
|
||||
{
|
||||
// This is needed asap.
|
||||
//
|
||||
mNotify = new p3Notify() ;
|
||||
rsNotify = mNotify ;
|
||||
|
||||
ftserver = NULL;
|
||||
|
||||
mPeerMgr = NULL;
|
||||
|
@ -71,23 +76,23 @@ RsServer::RsServer(NotifyBase &callback)
|
|||
mStatusSrv = NULL;
|
||||
mChannels = NULL;
|
||||
mForums = NULL;
|
||||
|
||||
/* caches (that need ticking) */
|
||||
|
||||
/* Config */
|
||||
mConfigMgr = NULL;
|
||||
mGeneralConfig = NULL;
|
||||
|
||||
/* GXS - Amazingly we can still initialise these
|
||||
* even without knowing the data-types (they are just pointers???)
|
||||
/* GXS - Amazingly we can still initialise these
|
||||
* even without knowing the data-types (they are just pointers???)
|
||||
*/
|
||||
mPhoto = NULL;
|
||||
mWiki = NULL;
|
||||
mPosted = NULL;
|
||||
mGxsCircles = NULL;
|
||||
mGxsIdService = NULL;
|
||||
mGxsForums = NULL;
|
||||
mWire = NULL;
|
||||
|
||||
mPhoto = NULL;
|
||||
mWiki = NULL;
|
||||
mPosted = NULL;
|
||||
mGxsCircles = NULL;
|
||||
mGxsIdService = NULL;
|
||||
mGxsForums = NULL;
|
||||
mWire = NULL;
|
||||
}
|
||||
|
||||
RsServer::~RsServer()
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
//#include "pqi/pqissl.h"
|
||||
|
||||
#include "pqi/p3cfgmgr.h"
|
||||
#include "pqi/p3notify.h"
|
||||
#include "pqi/pqipersongrp.h"
|
||||
|
||||
#include "retroshare/rsiface.h"
|
||||
|
@ -73,27 +74,22 @@ class RsPluginManager;
|
|||
//int InitRetroShare(int argc, char **argv, RsInit *config);
|
||||
//int LoadCertificates(RsInit *config);
|
||||
|
||||
RsControl *createRsControl(NotifyBase ¬ify);
|
||||
|
||||
|
||||
class RsServer: public RsControl, public RsThread
|
||||
{
|
||||
public:
|
||||
/****************************************/
|
||||
/* p3face-startup.cc: init... */
|
||||
virtual int StartupRetroShare();
|
||||
virtual int StartupRetroShare();
|
||||
|
||||
public:
|
||||
/****************************************/
|
||||
/* p3face.cc: main loop / util fns / locking. */
|
||||
|
||||
RsServer(NotifyBase &callback);
|
||||
RsServer() ;
|
||||
virtual ~RsServer();
|
||||
|
||||
/* Thread Fn: Run the Core */
|
||||
virtual void run();
|
||||
|
||||
public: // no longer private:!!!
|
||||
/* locking stuff */
|
||||
void lockRsCore()
|
||||
{
|
||||
|
@ -107,6 +103,8 @@ class RsServer: public RsControl, public RsThread
|
|||
coreMutex.unlock();
|
||||
}
|
||||
|
||||
static p3Notify *notify() { return dynamic_cast<RsServer*>(instance())->mNotify ; }
|
||||
|
||||
private:
|
||||
|
||||
/* mutex */
|
||||
|
@ -186,20 +184,23 @@ class RsServer: public RsControl, public RsThread
|
|||
p3Forums *mForums;
|
||||
/* caches (that need ticking) */
|
||||
|
||||
/* GXS */
|
||||
p3Wiki *mWiki;
|
||||
p3Posted *mPosted;
|
||||
p3PhotoService *mPhoto;
|
||||
p3GxsCircles *mGxsCircles;
|
||||
p3IdService *mGxsIdService;
|
||||
p3GxsForums *mGxsForums;
|
||||
p3GxsChannels *mGxsChannels;
|
||||
p3Wire *mWire;
|
||||
/* GXS */
|
||||
p3Wiki *mWiki;
|
||||
p3Posted *mPosted;
|
||||
p3PhotoService *mPhoto;
|
||||
p3GxsCircles *mGxsCircles;
|
||||
p3IdService *mGxsIdService;
|
||||
p3GxsForums *mGxsForums;
|
||||
p3GxsChannels *mGxsChannels;
|
||||
p3Wire *mWire;
|
||||
|
||||
/* Config */
|
||||
p3ConfigMgr *mConfigMgr;
|
||||
p3GeneralConfig *mGeneralConfig;
|
||||
|
||||
// notify
|
||||
p3Notify *mNotify ;
|
||||
|
||||
// Worker Data.....
|
||||
|
||||
};
|
||||
|
|
|
@ -1739,7 +1739,6 @@ void RsInit::setAutoLogin(bool autoLogin){
|
|||
* ft/ code so variable defined here.
|
||||
*/
|
||||
|
||||
RsControl *rsicontrol = NULL;
|
||||
RsFiles *rsFiles = NULL;
|
||||
RsTurtle *rsTurtle = NULL ;
|
||||
#ifdef GROUTER
|
||||
|
@ -1852,12 +1851,14 @@ RsGRouter *rsGRouter = NULL ;
|
|||
#include "services/p3dsdv.h"
|
||||
#endif
|
||||
|
||||
|
||||
RsControl *createRsControl(NotifyBase ¬ify)
|
||||
RsControl *RsControl::instance()
|
||||
{
|
||||
RsServer *srv = new RsServer(notify);
|
||||
rsicontrol = srv;
|
||||
return srv;
|
||||
static RsServer *rsicontrol = NULL ;
|
||||
|
||||
if(rsicontrol == NULL)
|
||||
rsicontrol = new RsServer();
|
||||
|
||||
return rsicontrol;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1921,8 +1922,6 @@ int RsServer::StartupRetroShare()
|
|||
/**************************************************************************/
|
||||
std::cerr << "setup classes / structures" << std::endl;
|
||||
|
||||
|
||||
|
||||
/* History Manager */
|
||||
mHistoryMgr = new p3HistoryMgr();
|
||||
mPeerMgr = new p3PeerMgrIMPL( AuthSSL::getAuthSSL()->OwnId(),
|
||||
|
@ -1933,7 +1932,6 @@ int RsServer::StartupRetroShare()
|
|||
mLinkMgr = new p3LinkMgrIMPL(mPeerMgr, mNetMgr);
|
||||
|
||||
/* Setup Notify Early - So we can use it. */
|
||||
rsNotify = new p3Notify();
|
||||
rsPeers = new p3Peers(mLinkMgr, mPeerMgr, mNetMgr);
|
||||
|
||||
mPeerMgr->setManagers(mLinkMgr, mNetMgr);
|
||||
|
@ -2128,7 +2126,7 @@ int RsServer::StartupRetroShare()
|
|||
ftserver->setP3Interface(pqih);
|
||||
ftserver->setConfigDirectory(RsInitConfig::configDir);
|
||||
|
||||
ftserver->SetupFtServer(&(getNotify()));
|
||||
ftserver->SetupFtServer() ;
|
||||
CacheStrapper *mCacheStrapper = ftserver->getCacheStrapper();
|
||||
CacheTransfer *mCacheTransfer = ftserver->getCacheTransfer();
|
||||
|
||||
|
@ -2642,20 +2640,20 @@ int RsServer::StartupRetroShare()
|
|||
/* 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);
|
||||
mNotify->ClearFeedItems(RS_FEED_ITEM_CHAN_NEW);
|
||||
mNotify->ClearFeedItems(RS_FEED_ITEM_CHAN_UPDATE);
|
||||
mNotify->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);
|
||||
mNotify->ClearFeedItems(RS_FEED_ITEM_FORUM_NEW);
|
||||
mNotify->ClearFeedItems(RS_FEED_ITEM_FORUM_UPDATE);
|
||||
mNotify->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);
|
||||
mNotify->ClearFeedItems(RS_FEED_ITEM_BLOG_NEW);
|
||||
mNotify->ClearFeedItems(RS_FEED_ITEM_BLOG_UPDATE);
|
||||
mNotify->ClearFeedItems(RS_FEED_ITEM_BLOG_MSG);
|
||||
|
||||
//getPqiNotify()->ClearFeedItems(RS_FEED_ITEM_CHAT_NEW);
|
||||
getPqiNotify()->ClearFeedItems(RS_FEED_ITEM_MESSAGE);
|
||||
mNotify->ClearFeedItems(RS_FEED_ITEM_MESSAGE);
|
||||
//getPqiNotify()->ClearFeedItems(RS_FEED_ITEM_FILES_NEW);
|
||||
|
||||
/* flag that the basic Caches are now in the pending Queues */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue