mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -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
|
@ -52,9 +52,9 @@
|
|||
#include "turtle/p3turtle.h"
|
||||
|
||||
#include "util/rsdir.h"
|
||||
#include "rsserver/p3face.h"
|
||||
|
||||
#include "pqi/p3linkmgr.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
|
@ -722,7 +722,7 @@ bool ftController::moveFile(const std::string& source,const std::string& dest)
|
|||
return true ;
|
||||
else
|
||||
{
|
||||
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "File erase error", "Error while removing hash file " + dest + "\nRead-only file system ?");
|
||||
RsServer::notify()->AddSysMessage(0, RS_SYS_WARNING, "File erase error", "Error while removing hash file " + dest + "\nRead-only file system ?");
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
@ -733,7 +733,7 @@ bool ftController::copyFile(const std::string& source,const std::string& dest)
|
|||
|
||||
if(in == NULL)
|
||||
{
|
||||
//getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "File copy error", "Error while copying file " + dest + "\nCannot open input file "+source);
|
||||
//RsServer::notify()->AddSysMessage(0, RS_SYS_WARNING, "File copy error", "Error while copying file " + dest + "\nCannot open input file "+source);
|
||||
std::cerr << "******************** FT CONTROLLER ERROR ************************" << std::endl;
|
||||
std::cerr << "Error while copying file " + dest + "\nCannot open input file "+source << std::endl;
|
||||
std::cerr << "*****************************************************************" << std::endl;
|
||||
|
@ -744,7 +744,7 @@ bool ftController::copyFile(const std::string& source,const std::string& dest)
|
|||
|
||||
if(out == NULL)
|
||||
{
|
||||
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "File copy error", "Error while copying file " + dest + "\nCheck for disk full, or write permission ?\nOriginal file kept under the name "+source);
|
||||
RsServer::notify()->AddSysMessage(0, RS_SYS_WARNING, "File copy error", "Error while copying file " + dest + "\nCheck for disk full, or write permission ?\nOriginal file kept under the name "+source);
|
||||
fclose (in);
|
||||
return false ;
|
||||
}
|
||||
|
@ -764,7 +764,7 @@ bool ftController::copyFile(const std::string& source,const std::string& dest)
|
|||
|
||||
if(t != s)
|
||||
{
|
||||
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "File copy error", "Error while copying file " + dest + "\nIs your disc full ?\nOriginal file kept under the name "+source);
|
||||
RsServer::notify()->AddSysMessage(0, RS_SYS_WARNING, "File copy error", "Error while copying file " + dest + "\nIs your disc full ?\nOriginal file kept under the name "+source);
|
||||
bRet = false ;
|
||||
break;
|
||||
}
|
||||
|
@ -965,12 +965,10 @@ bool ftController::completeFile(std::string hash)
|
|||
|
||||
/* Notify GUI */
|
||||
if ((flags & RS_FILE_REQ_CACHE) == 0) {
|
||||
pqiNotify *notify = getPqiNotify();
|
||||
if (notify) {
|
||||
notify->AddPopupMessage(RS_POPUP_DOWNLOAD, hash, name, "");
|
||||
}
|
||||
rsicontrol->getNotify().notifyDownloadComplete(hash);
|
||||
rsicontrol->getNotify().notifyDownloadCompleteCount(completeCount);
|
||||
RsServer::notify()->AddPopupMessage(RS_POPUP_DOWNLOAD, hash, name, "");
|
||||
|
||||
RsServer::notify()->notifyDownloadComplete(hash);
|
||||
RsServer::notify()->notifyDownloadCompleteCount(completeCount);
|
||||
|
||||
rsFiles->ForceDirectoryCheck() ;
|
||||
}
|
||||
|
@ -1523,7 +1521,7 @@ bool ftController::FileClearCompleted()
|
|||
IndicateConfigChanged();
|
||||
} /******* UNLOCKED ********/
|
||||
|
||||
rsicontrol->getNotify().notifyDownloadCompleteCount(0);
|
||||
RsServer::notify()->notifyDownloadCompleteCount(0);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
|
||||
//#define DB_DEBUG 1
|
||||
|
||||
ftFiStore::ftFiStore(CacheStrapper *cs, CacheTransfer *cft, NotifyBase *cb_in,p3PeerMgr *pm,
|
||||
ftFiStore::ftFiStore(CacheStrapper *cs, CacheTransfer *cft, p3PeerMgr *pm,
|
||||
RsPeerId ownid, std::string cachedir)
|
||||
:FileIndexStore(cs, cft, cb_in, pm, ownid, cachedir)
|
||||
:FileIndexStore(cs, cft, pm, ownid, cachedir)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -122,8 +122,8 @@ bool ftFiStore::search(const std::string &hash, FileSearchFlags hintflags, FileI
|
|||
}
|
||||
|
||||
|
||||
ftFiMonitor::ftFiMonitor(CacheStrapper *cs,NotifyBase *cb_in, std::string cachedir, std::string pid,const std::string& config_dir)
|
||||
:FileIndexMonitor(cs,cb_in, cachedir, pid,config_dir), p3Config(CONFIG_TYPE_FT_SHARED)
|
||||
ftFiMonitor::ftFiMonitor(CacheStrapper *cs,std::string cachedir, std::string pid,const std::string& config_dir)
|
||||
:FileIndexMonitor(cs,cachedir, pid,config_dir), p3Config(CONFIG_TYPE_FT_SHARED)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ class p3PeerMgr ;
|
|||
class ftFiStore: public FileIndexStore, public ftSearch
|
||||
{
|
||||
public:
|
||||
ftFiStore(CacheStrapper *cs, CacheTransfer *cft, NotifyBase *cb_in, p3PeerMgr *pm,
|
||||
ftFiStore(CacheStrapper *cs, CacheTransfer *cft, p3PeerMgr *pm,
|
||||
RsPeerId ownid, std::string cachedir);
|
||||
|
||||
/* overloaded search function */
|
||||
|
@ -58,7 +58,7 @@ virtual bool search(const std::string &hash, FileSearchFlags hintflags, FileInfo
|
|||
class ftFiMonitor: public FileIndexMonitor, public ftSearch, public p3Config
|
||||
{
|
||||
public:
|
||||
ftFiMonitor(CacheStrapper *cs,NotifyBase *cb_in, std::string cachedir, std::string pid,const std::string& config_dir);
|
||||
ftFiMonitor(CacheStrapper *cs,std::string cachedir, std::string pid,const std::string& config_dir);
|
||||
|
||||
/* overloaded search function */
|
||||
virtual bool search(const std::string &hash, FileSearchFlags hintflags, FileInfo &info) const;
|
||||
|
|
|
@ -41,6 +41,8 @@ const int ftserverzone = 29539;
|
|||
#include "ft/ftdatamultiplex.h"
|
||||
//#include "ft/ftdwlqueue.h"
|
||||
#include "turtle/p3turtle.h"
|
||||
#include "pqi/p3notify.h"
|
||||
#include "rsserver/p3face.h"
|
||||
|
||||
|
||||
// Includes CacheStrapper / FiMonitor / FiStore for us.
|
||||
|
@ -108,7 +110,7 @@ std::string ftServer::OwnId()
|
|||
}
|
||||
|
||||
/* Final Setup (once everything is assigned) */
|
||||
void ftServer::SetupFtServer(NotifyBase *cb)
|
||||
void ftServer::SetupFtServer()
|
||||
{
|
||||
|
||||
/* setup FiStore/Monitor */
|
||||
|
@ -132,8 +134,8 @@ void ftServer::SetupFtServer(NotifyBase *cb)
|
|||
|
||||
|
||||
/* Make Cache Source/Store */
|
||||
mFiStore = new ftFiStore(mCacheStrapper, mFtController, cb, mPeerMgr, ownId, remotecachedir);
|
||||
mFiMon = new ftFiMonitor(mCacheStrapper,cb, localcachedir, ownId,mConfigPath);
|
||||
mFiStore = new ftFiStore(mCacheStrapper, mFtController, mPeerMgr, ownId, remotecachedir);
|
||||
mFiMon = new ftFiMonitor(mCacheStrapper,localcachedir, ownId,mConfigPath);
|
||||
|
||||
/* now add the set to the cachestrapper */
|
||||
CachePair cp(mFiMon, mFiStore, CacheId(RS_SERVICE_TYPE_FILE_INDEX, 0));
|
||||
|
@ -282,7 +284,7 @@ bool ftServer::FileRequest(const std::string& fname, const std::string& hash, ui
|
|||
|
||||
if(!checkHash(hash,error_string))
|
||||
{
|
||||
rsicontrol->getNotify().notifyErrorMsg(0,0,"Error handling hash \""+hash+"\". This hash appears to be invalid(Error string=\""+error_string+"\"). This is probably due an bad handling of strings.") ;
|
||||
RsServer::notify()->notifyErrorMsg(0,0,"Error handling hash \""+hash+"\". This hash appears to be invalid(Error string=\""+error_string+"\"). This is probably due an bad handling of strings.") ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class p3ConnectMgr;
|
|||
class CacheStrapper;
|
||||
class CacheTransfer;
|
||||
|
||||
class NotifyBase; /* needed by FiStore */
|
||||
class pqiNotify; /* needed by FiStore */
|
||||
class ftCacheStrapper;
|
||||
class ftFiStore;
|
||||
class ftFiMonitor;
|
||||
|
@ -98,8 +98,7 @@ class ftServer: public RsFiles, public ftDataSend, public RsTurtleClientService,
|
|||
std::string OwnId();
|
||||
|
||||
/* Final Setup (once everything is assigned) */
|
||||
//void SetupFtServer();
|
||||
void SetupFtServer(NotifyBase *cb);
|
||||
void SetupFtServer() ;
|
||||
virtual void connectToTurtleRouter(p3turtle *p) ;
|
||||
|
||||
void StartupThreads();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue