diff --git a/libretroshare/src/retroshare/rsplugin.h b/libretroshare/src/retroshare/rsplugin.h index d2343d945..4f6d09cec 100644 --- a/libretroshare/src/retroshare/rsplugin.h +++ b/libretroshare/src/retroshare/rsplugin.h @@ -26,6 +26,7 @@ #pragma once #include +#include #include #include #include @@ -37,6 +38,10 @@ class RsPluginHandler ; extern RsPluginHandler *rsPlugins ; class p3Service ; +class RsTurtle ; +class RsDht ; +class RsDisc ; +class RsMsgs ; class p3LinkMgr ; class MainPage ; class QIcon ; @@ -82,10 +87,16 @@ class RsPlugInInterfaces { public: - RsPlugInInterfaces() { mPeers = NULL; mFiles = NULL; } - RsPeers* mPeers; - RsFiles* mFiles; - + RsPlugInInterfaces() + { + memset(this,0,sizeof(RsPlugInInterfaces)) ; // zero all pointers. + } + RsPeers *mPeers; + RsFiles *mFiles; + RsMsgs *mMsgs; + RsTurtle *mTurtle; + RsDisc *mDisc; + RsDht *mDht; }; class RsPlugin diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 7cb83d6c0..f1fd1a646 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -2194,12 +2194,6 @@ int RsServer::StartupRetroShare() // mPluginsManager->loadPlugins(programatically_inserted_plugins) ; - // set interfaces for plugins - RsPlugInInterfaces interfaces; - interfaces.mFiles = rsFiles; - interfaces.mPeers = rsPeers; - mPluginsManager->setInterfaces(interfaces); - /* create Services */ ad = new p3disc(mPeerMgr, mLinkMgr, mNetMgr, pqih); msgSrv = new p3MsgService(mLinkMgr); @@ -2222,6 +2216,23 @@ int RsServer::StartupRetroShare() rsTurtle = tr ; pqih -> addService(tr); + rsDisc = new p3Discovery(ad); + rsMsgs = new p3Msgs(msgSrv, chatSrv); + + // set interfaces for plugins + // + RsPlugInInterfaces interfaces; + interfaces.mFiles = rsFiles; + interfaces.mPeers = rsPeers; + interfaces.mMsgs = rsMsgs; + interfaces.mTurtle = rsTurtle; + interfaces.mDisc = rsDisc; + interfaces.mDht = rsDht; + + mPluginsManager->setInterfaces(interfaces); + + // connect components to turtle router. + ftserver->connectToTurtleRouter(tr) ; chatSrv->connectToTurtleRouter(tr) ; msgSrv->connectToTurtleRouter(tr) ; @@ -2724,16 +2735,12 @@ int RsServer::StartupRetroShare() /* Setup GUI Interfaces. */ - rsDisc = new p3Discovery(ad); rsBandwidthControl = mBwCtrl; rsConfig = serverConfig; - rsMsgs = new p3Msgs(msgSrv, chatSrv); rsForums = mForums; rsChannels = mChannels; - - #ifdef RS_USE_BLOGS rsBlogs = mBlogs; #endif