mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -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
@ -26,11 +26,12 @@
|
||||
#include "util/rswin.h"
|
||||
#endif
|
||||
|
||||
#include "rsserver/p3face.h"
|
||||
#include "dbase/fimonitor.h"
|
||||
#include "util/rsdir.h"
|
||||
#include "serialiser/rsserviceids.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "retroshare/rsnotify.h"
|
||||
#include "pqi/p3notify.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "util/folderiterator.h"
|
||||
#include <errno.h>
|
||||
@ -51,10 +52,10 @@
|
||||
//#define FIM_DEBUG 1
|
||||
// ***********/
|
||||
|
||||
FileIndexMonitor::FileIndexMonitor(CacheStrapper *cs, NotifyBase *cb_in,std::string cachedir, std::string pid,const std::string& config_dir)
|
||||
FileIndexMonitor::FileIndexMonitor(CacheStrapper *cs, std::string cachedir, std::string pid,const std::string& config_dir)
|
||||
:CacheSource(RS_SERVICE_TYPE_FILE_INDEX, false, cs, cachedir), fiMutex("FileIndexMonitor"), fi(pid),
|
||||
pendingDirs(false), pendingForceCacheWrite(false),
|
||||
mForceCheck(false), mInCheck(false),cb(cb_in), hashCache(config_dir+"/" + "file_cache.lst"),useHashCache(true)
|
||||
mForceCheck(false), mInCheck(false), hashCache(config_dir+"/" + "file_cache.lst"),useHashCache(true)
|
||||
|
||||
{
|
||||
updatePeriod = 15 * 60; // 15 minutes
|
||||
@ -604,7 +605,7 @@ void FileIndexMonitor::updateCycle()
|
||||
mInCheck = true;
|
||||
}
|
||||
|
||||
cb->notifyHashingInfo(NOTIFY_HASHTYPE_EXAMINING_FILES, "") ;
|
||||
RsServer::notify()->notifyHashingInfo(NOTIFY_HASHTYPE_EXAMINING_FILES, "") ;
|
||||
|
||||
std::vector<DirContentToHash> to_hash ;
|
||||
|
||||
@ -857,7 +858,7 @@ void FileIndexMonitor::updateCycle()
|
||||
if(isRunning() && !to_hash.empty())
|
||||
hashFiles(to_hash) ;
|
||||
|
||||
cb->notifyHashingInfo(NOTIFY_HASHTYPE_FINISH, "") ;
|
||||
RsServer::notify()->notifyHashingInfo(NOTIFY_HASHTYPE_FINISH, "") ;
|
||||
|
||||
int cleanedCount = 0;
|
||||
|
||||
@ -906,7 +907,7 @@ void FileIndexMonitor::updateCycle()
|
||||
|
||||
if (cleanedCount > 0) {
|
||||
// cb->notifyListPreChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
cb->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -936,7 +937,7 @@ void FileIndexMonitor::hashFiles(const std::vector<DirContentToHash>& to_hash)
|
||||
// Size interval at which we save the file lists
|
||||
static const uint64_t MAX_SIZE_WITHOUT_SAVING = 10737418240ull ; // 10 GB
|
||||
|
||||
cb->notifyListPreChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
RsServer::notify()->notifyListPreChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
|
||||
time_t stamp = time(NULL);
|
||||
|
||||
@ -1000,7 +1001,7 @@ void FileIndexMonitor::hashFiles(const std::vector<DirContentToHash>& to_hash)
|
||||
std::string tmpout;
|
||||
rs_sprintf(tmpout, "%lu/%lu (%s - %d%%) : %s", cnt+1, n_files, friendlyUnit(size).c_str(), int(size/double(total_size)*100.0), fe.name.c_str()) ;
|
||||
|
||||
cb->notifyHashingInfo(NOTIFY_HASHTYPE_HASH_FILE, tmpout) ;
|
||||
RsServer::notify()->notifyHashingInfo(NOTIFY_HASHTYPE_HASH_FILE, tmpout) ;
|
||||
|
||||
std::string real_path = RsDirUtil::makePath(to_hash[i].realpath, fe.name);
|
||||
|
||||
@ -1064,7 +1065,7 @@ void FileIndexMonitor::hashFiles(const std::vector<DirContentToHash>& to_hash)
|
||||
|
||||
if(hashed_size > last_save_size + MAX_SIZE_WITHOUT_SAVING)
|
||||
{
|
||||
cb->notifyHashingInfo(NOTIFY_HASHTYPE_SAVE_FILE_INDEX, "") ;
|
||||
RsServer::notify()->notifyHashingInfo(NOTIFY_HASHTYPE_SAVE_FILE_INDEX, "") ;
|
||||
#ifdef WINDOWS_SYS
|
||||
Sleep(1000) ;
|
||||
#else
|
||||
@ -1085,7 +1086,7 @@ void FileIndexMonitor::hashFiles(const std::vector<DirContentToHash>& to_hash)
|
||||
|
||||
fi.updateHashIndex() ;
|
||||
|
||||
cb->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -1288,7 +1289,7 @@ bool FileIndexMonitor::cachesAvailable(RsPeerId pid,std::map<CacheId, RsCacheDat
|
||||
|
||||
void FileIndexMonitor::updateShareFlags(const SharedDirInfo& dir)
|
||||
{
|
||||
cb->notifyListPreChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
RsServer::notify()->notifyListPreChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
|
||||
bool fimods = false ;
|
||||
#ifdef FIM_DEBUG
|
||||
@ -1335,12 +1336,12 @@ void FileIndexMonitor::updateShareFlags(const SharedDirInfo& dir)
|
||||
RsStackMutex stack(fiMutex) ; /* LOCKED DIRS */
|
||||
locked_saveFileIndexes(true) ;
|
||||
}
|
||||
cb->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
}
|
||||
/* interface */
|
||||
void FileIndexMonitor::setSharedDirectories(const std::list<SharedDirInfo>& dirs)
|
||||
{
|
||||
cb->notifyListPreChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
RsServer::notify()->notifyListPreChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
|
||||
std::list<SharedDirInfo> checkeddirs;
|
||||
|
||||
@ -1386,7 +1387,7 @@ void FileIndexMonitor::setSharedDirectories(const std::list<SharedDirInfo>& d
|
||||
pendingDirList = checkeddirs;
|
||||
}
|
||||
|
||||
cb->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
}
|
||||
|
||||
/* interface */
|
||||
|
@ -60,7 +60,6 @@ std::string FileIndexMonitor::findRealRoot(std::string base);
|
||||
|
||||
******************************************************************************************/
|
||||
|
||||
class NotifyBase ;
|
||||
|
||||
class DirContentToHash
|
||||
{
|
||||
@ -107,7 +106,7 @@ class HashCache
|
||||
class FileIndexMonitor: public CacheSource, public RsThread
|
||||
{
|
||||
public:
|
||||
FileIndexMonitor(CacheStrapper *cs, NotifyBase *cb_in, std::string cachedir, std::string pid, const std::string& config_dir);
|
||||
FileIndexMonitor(CacheStrapper *cs, std::string cachedir, std::string pid, const std::string& config_dir);
|
||||
virtual ~FileIndexMonitor();
|
||||
|
||||
/* external interface for filetransfer */
|
||||
@ -204,8 +203,6 @@ class FileIndexMonitor: public CacheSource, public RsThread
|
||||
std::list<SharedDirInfo> pendingDirList;
|
||||
bool internal_setSharedDirectories();
|
||||
|
||||
NotifyBase *cb ;
|
||||
|
||||
HashCache hashCache ;
|
||||
bool useHashCache ;
|
||||
|
||||
|
@ -23,16 +23,18 @@
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "rsserver/p3face.h"
|
||||
#include "dbase/fistore.h"
|
||||
#include "retroshare/rsexpr.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "serialiser/rsserviceids.h"
|
||||
#include "pqi/p3peermgr.h"
|
||||
#include "pqi/p3notify.h"
|
||||
|
||||
FileIndexStore::FileIndexStore(CacheStrapper *cs, CacheTransfer *cft,
|
||||
NotifyBase *cb_in,p3PeerMgr *cnmgr, RsPeerId ownid, std::string cachedir)
|
||||
p3PeerMgr *cnmgr, RsPeerId ownid, std::string cachedir)
|
||||
:CacheStore(RS_SERVICE_TYPE_FILE_INDEX, false, cs, cft, cachedir),
|
||||
localId(ownid), localindex(NULL), cb(cb_in),mPeerMgr(cnmgr)
|
||||
localId(ownid), localindex(NULL), mPeerMgr(cnmgr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -442,8 +444,7 @@ int FileIndexStore::searchBoolExp(Expression * exp, std::list<DirDetails> &resul
|
||||
|
||||
int FileIndexStore::AboutToModify()
|
||||
{
|
||||
if (cb)
|
||||
cb->notifyListPreChange(NOTIFY_LIST_DIRLIST_FRIENDS, 0);
|
||||
RsServer::notify()->notifyListPreChange(NOTIFY_LIST_DIRLIST_FRIENDS, 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -451,8 +452,7 @@ int FileIndexStore::AboutToModify()
|
||||
|
||||
int FileIndexStore::ModCompleted()
|
||||
{
|
||||
if (cb)
|
||||
cb->notifyListChange(NOTIFY_LIST_DIRLIST_FRIENDS, 0);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_DIRLIST_FRIENDS, 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
*/
|
||||
|
||||
class p3PeerMgr ;
|
||||
class pqiNotify ;
|
||||
|
||||
#include "dbase/findex.h"
|
||||
#include "dbase/cachestrapper.h"
|
||||
@ -65,7 +66,7 @@ class FileIndexStore: public CacheStore
|
||||
{
|
||||
public:
|
||||
|
||||
FileIndexStore(CacheStrapper *cs, CacheTransfer *cft, NotifyBase *cb_in,p3PeerMgr *pmgr, RsPeerId ownid, std::string cachedir);
|
||||
FileIndexStore(CacheStrapper *cs, CacheTransfer *cft, p3PeerMgr *pmgr, RsPeerId ownid, std::string cachedir);
|
||||
virtual ~FileIndexStore();
|
||||
|
||||
/* virtual functions overloaded by cache implementor */
|
||||
@ -95,7 +96,6 @@ virtual int loadCache(const RsCacheData &data); /* actual load, once data avai
|
||||
RsPeerId localId;
|
||||
FileIndex *localindex;
|
||||
|
||||
NotifyBase *cb;
|
||||
p3PeerMgr *mPeerMgr ;
|
||||
};
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
|
||||
#include "rsserver/p3face.h"
|
||||
#include "retroshare/rsdistrib.h"
|
||||
#include "distrib/p3distrib.h"
|
||||
#include "distrib/p3distribsecurity.h"
|
||||
@ -44,7 +45,6 @@
|
||||
#include "serialiser/rstlvkeys.h"
|
||||
|
||||
#include "util/rsdir.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
#include "pqi/pqibin.h"
|
||||
#include "pqi/sslfns.h"
|
||||
#include "pqi/authssl.h"
|
||||
@ -1198,7 +1198,7 @@ void p3GroupDistrib::locked_publishPendingMsgs()
|
||||
#else
|
||||
rs_sprintf(errlog, "Error %d", errno);
|
||||
#endif
|
||||
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "File rename error", "Error while renaming file " + filename + ": got error " + errlog);
|
||||
RsServer::notify()->AddSysMessage(0, RS_SYS_WARNING, "File rename error", "Error while renaming file " + filename + ": got error " + errlog);
|
||||
}
|
||||
|
||||
/* indicate not to save for a while */
|
||||
@ -1346,7 +1346,7 @@ void p3GroupDistrib::publishDistribGroups()
|
||||
#else
|
||||
rs_sprintf(errlog, "Error %d", errno);
|
||||
#endif
|
||||
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "File rename error", "Error while renaming file " + filename + ": got error " + errlog);
|
||||
RsServer::notify()->AddSysMessage(0, RS_SYS_WARNING, "File rename error", "Error while renaming file " + filename + ": got error " + errlog);
|
||||
}
|
||||
|
||||
/* push file to CacheSource */
|
||||
@ -2169,7 +2169,7 @@ bool p3GroupDistrib::backUpKeys(const std::list<RsDistribGrpKey* >& keysToBackUp
|
||||
#else
|
||||
rs_sprintf(errlog, "Error %d", errno);
|
||||
#endif
|
||||
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "File rename error", "Error while renaming file " + filename + ": got error " + errlog);
|
||||
RsServer::notify()->AddSysMessage(0, RS_SYS_WARNING, "File rename error", "Error while renaming file " + filename + ": got error " + errlog);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -382,7 +382,6 @@ HEADERS += pqi/authssl.h \
|
||||
pqi/pqiloopback.h \
|
||||
pqi/pqimonitor.h \
|
||||
pqi/pqinetwork.h \
|
||||
pqi/pqinotify.h \
|
||||
pqi/pqiperson.h \
|
||||
pqi/pqipersongrp.h \
|
||||
pqi/pqisecurity.h \
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <serialiser/rstlvbase.h>
|
||||
#include <serialiser/rstlvtypes.h>
|
||||
#include <serialiser/rspluginitems.h>
|
||||
#include <retroshare/rsiface.h>
|
||||
#include <rsserver/p3face.h>
|
||||
#include <util/rsdir.h>
|
||||
#include <util/folderiterator.h>
|
||||
#include <ft/ftserver.h>
|
||||
@ -267,7 +267,7 @@ bool RsPluginManager::loadPlugin(const std::string& plugin_name)
|
||||
if(!_allow_all_plugins)
|
||||
{
|
||||
if(_accepted_hashes.find(pinfo.file_hash) == _accepted_hashes.end() && _rejected_hashes.find(pinfo.file_hash) == _rejected_hashes.end() )
|
||||
if(!rsicontrol->getNotify().askForPluginConfirmation(pinfo.file_name,pinfo.file_hash))
|
||||
if(!RsServer::notify()->askForPluginConfirmation(pinfo.file_name,pinfo.file_hash))
|
||||
_rejected_hashes.insert(pinfo.file_hash) ; // accepted hashes are treated at the end, for security.
|
||||
|
||||
if(_rejected_hashes.find(pinfo.file_hash) != _rejected_hashes.end() )
|
||||
|
@ -30,7 +30,8 @@
|
||||
#ifdef WINDOWS_SYS
|
||||
#include "retroshare/rsinit.h"
|
||||
#endif
|
||||
#include "pqi/pqinotify.h"
|
||||
#include "rsserver/p3face.h"
|
||||
#include "pqi/p3notify.h"
|
||||
#include "pgp/pgphandler.h"
|
||||
|
||||
#include <util/rsdir.h>
|
||||
@ -92,7 +93,7 @@ std::string pgp_pwd_callback(void * /*hook*/, const char *uid_hint, const char *
|
||||
fprintf(stderr, "pgp_pwd_callback() called.\n");
|
||||
#endif
|
||||
std::string password;
|
||||
rsicontrol->getNotify().askForPassword(std::string("Please enter your PGP password for key:\n ")+uid_hint+" :", prev_was_bad, password) ;
|
||||
RsServer::notify()->askForPassword(std::string("Please enter your PGP password for key:\n ")+uid_hint+" :", prev_was_bad, password) ;
|
||||
|
||||
return password ;
|
||||
}
|
||||
@ -621,7 +622,7 @@ bool AuthGPG::AllowConnection(const std::string &gpg_id, bool accept)
|
||||
|
||||
IndicateConfigChanged();
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FRIENDS, accept ? NOTIFY_TYPE_ADD : NOTIFY_TYPE_DEL);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_FRIENDS, accept ? NOTIFY_TYPE_ADD : NOTIFY_TYPE_DEL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -42,13 +42,11 @@
|
||||
#include "util/rsstring.h"
|
||||
|
||||
#include "retroshare/rspeers.h" // for RsPeerDetails structure
|
||||
#include "rsserver/p3face.h"
|
||||
|
||||
/******************** notify of new Cert **************************/
|
||||
#include "pqinotify.h"
|
||||
|
||||
#include <openssl/err.h>
|
||||
//#include <openssl/evp.h>
|
||||
//#include <openssl/pem.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/x509.h>
|
||||
|
||||
@ -1395,8 +1393,8 @@ bool AuthSSLimpl::FailedCertificate(X509 *x509, const std::string& gpgid,
|
||||
#endif
|
||||
if (incoming)
|
||||
{
|
||||
getPqiNotify()->AddPopupMessage(RS_POPUP_CONNECT_ATTEMPT, gpgid, sslcn, sslid);
|
||||
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_SEC_CONNECT_ATTEMPT, gpgid, sslid, sslcn, ip_address);
|
||||
RsServer::notify()->AddPopupMessage(RS_POPUP_CONNECT_ATTEMPT, gpgid, sslcn, sslid);
|
||||
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_CONNECT_ATTEMPT, gpgid, sslid, sslcn, ip_address);
|
||||
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cerr << " Incoming from: ";
|
||||
@ -1405,9 +1403,9 @@ bool AuthSSLimpl::FailedCertificate(X509 *x509, const std::string& gpgid,
|
||||
else
|
||||
{
|
||||
if(authed)
|
||||
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_SEC_AUTH_DENIED, gpgid, sslid, sslcn, ip_address);
|
||||
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_AUTH_DENIED, gpgid, sslid, sslcn, ip_address);
|
||||
else
|
||||
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_SEC_UNKNOWN_OUT, gpgid, sslid, sslcn, ip_address);
|
||||
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_UNKNOWN_OUT, gpgid, sslid, sslcn, ip_address);
|
||||
|
||||
#ifdef AUTHSSL_DEBUG
|
||||
std::cerr << " Outgoing to: ";
|
||||
|
@ -30,8 +30,8 @@
|
||||
#include "pqi/pqibin.h"
|
||||
#include "pqi/pqistore.h"
|
||||
#include "pqi/pqiarchive.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
#include <errno.h>
|
||||
#include <rsserver/p3face.h>
|
||||
#include <util/rsdiscspace.h>
|
||||
#include "util/rsstring.h"
|
||||
|
||||
@ -335,10 +335,10 @@ bool p3ConfigMgr::backedUpFileSave(const std::string& fname, const std::string&
|
||||
}
|
||||
|
||||
if(size_file != (int) fwrite(config_buff,1, size_file, file))
|
||||
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "Write error", "Error while writing backup configuration file " + fname_backup + "\nIs your disc full or out of quota ?");
|
||||
RsServer::notify()->AddSysMessage(0, RS_SYS_WARNING, "Write error", "Error while writing backup configuration file " + fname_backup + "\nIs your disc full or out of quota ?");
|
||||
|
||||
if(size_sign != (int) fwrite(sign_buff, 1, size_sign, sign))
|
||||
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "Write error", "Error while writing main signature file " + sign_fname_backup + "\nIs your disc full or out of quota ?");
|
||||
RsServer::notify()->AddSysMessage(0, RS_SYS_WARNING, "Write error", "Error while writing main signature file " + sign_fname_backup + "\nIs your disc full or out of quota ?");
|
||||
|
||||
fclose(file);
|
||||
fclose(sign);
|
||||
@ -1146,7 +1146,7 @@ bool p3Config::backedUpFileSave(const std::string& cfg_fname, const std::string&
|
||||
|
||||
if(size_file != (int) fwrite(buff, 1, size_file, cfg_file))
|
||||
{
|
||||
getPqiNotify()->AddSysMessage(0, RS_SYS_WARNING, "Write error", "Error while writing backup configuration file " + cfg_fname_backup + "\nIs your disc full or out of quota ?");
|
||||
RsServer::notify()->AddSysMessage(0, RS_SYS_WARNING, "Write error", "Error while writing backup configuration file " + cfg_fname_backup + "\nIs your disc full or out of quota ?");
|
||||
fclose(cfg_file);
|
||||
delete[] buff;
|
||||
return false ;
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "serialiser/rsmsgitems.h"
|
||||
#include "rsserver/p3face.h"
|
||||
#include "util/rsstring.h"
|
||||
|
||||
// clean too old messages every 5 minutes
|
||||
@ -145,7 +146,7 @@ void p3HistoryMgr::addMessage(bool incoming, const std::string &chatPeerId, cons
|
||||
}
|
||||
|
||||
if (addMsgId) {
|
||||
rsicontrol->getNotify().notifyHistoryChanged(addMsgId, NOTIFY_TYPE_ADD);
|
||||
RsServer::notify()->notifyHistoryChanged(addMsgId, NOTIFY_TYPE_ADD);
|
||||
}
|
||||
}
|
||||
|
||||
@ -450,7 +451,7 @@ void p3HistoryMgr::clear(const std::string &chatPeerId)
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
|
||||
rsicontrol->getNotify().notifyHistoryChanged(0, NOTIFY_TYPE_MOD);
|
||||
RsServer::notify()->notifyHistoryChanged(0, NOTIFY_TYPE_MOD);
|
||||
}
|
||||
|
||||
void p3HistoryMgr::removeMessages(const std::list<uint32_t> &msgIds)
|
||||
@ -492,7 +493,7 @@ void p3HistoryMgr::removeMessages(const std::list<uint32_t> &msgIds)
|
||||
IndicateConfigChanged();
|
||||
|
||||
for (iit = removedIds.begin(); iit != removedIds.end(); ++iit) {
|
||||
rsicontrol->getNotify().notifyHistoryChanged(*iit, NOTIFY_TYPE_DEL);
|
||||
RsServer::notify()->notifyHistoryChanged(*iit, NOTIFY_TYPE_DEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "pqi/p3peermgr.h"
|
||||
#include "pqi/p3netmgr.h"
|
||||
|
||||
#include "rsserver/p3face.h"
|
||||
#include "pqi/authssl.h"
|
||||
#include "pqi/p3dhtmgr.h" // Only need it for constants.
|
||||
#include "tcponudp/tou.h"
|
||||
@ -43,7 +44,6 @@
|
||||
const int p3connectzone = 3431;
|
||||
|
||||
#include "serialiser/rsconfigitems.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
@ -478,7 +478,7 @@ void p3LinkMgrIMPL::tickMonitors()
|
||||
/* notify GUI */
|
||||
if (peer.actions & RS_PEER_CONNECTED)
|
||||
{
|
||||
pqiNotify *notify = getPqiNotify();
|
||||
p3Notify *notify = RsServer::notify();
|
||||
if (notify)
|
||||
{
|
||||
notify->AddPopupMessage(RS_POPUP_CONNECT, peer.id,"", "Online: ");
|
||||
|
@ -42,7 +42,6 @@
|
||||
const int p3netmgrzone = 7563;
|
||||
|
||||
#include "serialiser/rsconfigitems.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "retroshare/rsconfig.h"
|
||||
|
||||
|
@ -27,15 +27,9 @@
|
||||
#include "pqi/p3notify.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* external reference point */
|
||||
RsNotify *rsNotify = NULL;
|
||||
RsNotify *rsNotify = NULL ;
|
||||
|
||||
pqiNotify *getPqiNotify()
|
||||
{
|
||||
return ((p3Notify *) rsNotify);
|
||||
}
|
||||
|
||||
/* Output for retroshare-gui */
|
||||
/* Output for retroshare-gui */
|
||||
bool p3Notify::NotifySysMessage(uint32_t &sysid, uint32_t &type,
|
||||
std::string &title, std::string &msg)
|
||||
{
|
||||
@ -228,3 +222,64 @@ bool p3Notify::ClearFeedItems(uint32_t type)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#define FOR_ALL_NOTIFY_CLIENTS for(std::list<NotifyClient*>::const_iterator it(notifyClients.begin());it!=notifyClients.end();++it)
|
||||
|
||||
void p3Notify::notifyChatLobbyEvent(uint64_t lobby_id, uint32_t event_type,const std::string& nickname,const std::string& any_string) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyChatLobbyEvent(lobby_id,event_type,nickname,any_string) ; }
|
||||
|
||||
void p3Notify::notifyListPreChange(int list, int type) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyListPreChange(list,type) ; }
|
||||
void p3Notify::notifyListChange (int list, int type) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyListChange (list,type) ; }
|
||||
|
||||
void p3Notify::notifyErrorMsg (int list, int sev, std::string msg) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyErrorMsg(list,sev,msg) ; }
|
||||
void p3Notify::notifyChatStatus (const std::string& peer_id , const std::string& status_string ,bool is_private) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyChatStatus(peer_id,status_string,is_private) ; }
|
||||
|
||||
void p3Notify::notifyChatLobbyTimeShift (int time_shift) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyChatLobbyTimeShift(time_shift) ; }
|
||||
void p3Notify::notifyCustomState (const std::string& peer_id , const std::string& status_string ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyCustomState (peer_id,status_string) ; }
|
||||
void p3Notify::notifyHashingInfo (uint32_t type , const std::string& fileinfo ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyHashingInfo (type,fileinfo) ; }
|
||||
void p3Notify::notifyTurtleSearchResult (uint32_t search_id , const std::list<TurtleFileInfo>& files ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyTurtleSearchResult(search_id,files) ; }
|
||||
void p3Notify::notifyPeerHasNewAvatar (std::string peer_id ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyPeerHasNewAvatar(peer_id) ; }
|
||||
void p3Notify::notifyOwnAvatarChanged () { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyOwnAvatarChanged() ; }
|
||||
void p3Notify::notifyOwnStatusMessageChanged() { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyOwnStatusMessageChanged() ; }
|
||||
void p3Notify::notifyDiskFull (uint32_t location , uint32_t size_limit_in_MB ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyDiskFull (location,size_limit_in_MB) ; }
|
||||
void p3Notify::notifyPeerStatusChanged (const std::string& peer_id , uint32_t status ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyPeerStatusChanged (peer_id,status) ; }
|
||||
|
||||
void p3Notify::notifyPeerStatusChangedSummary () { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyPeerStatusChangedSummary() ; }
|
||||
void p3Notify::notifyDiscInfoChanged () { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyDiscInfoChanged () ; }
|
||||
|
||||
void p3Notify::notifyForumMsgReadSatusChanged (const std::string& channelId, const std::string& msgId, uint32_t status) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyForumMsgReadSatusChanged (channelId,msgId,status) ; }
|
||||
void p3Notify::notifyChannelMsgReadSatusChanged (const std::string& channelId, const std::string& msgId, uint32_t status) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyChannelMsgReadSatusChanged (channelId,msgId,status) ; }
|
||||
|
||||
void p3Notify::notifyDownloadComplete (const std::string& fileHash ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyDownloadComplete (fileHash) ; }
|
||||
void p3Notify::notifyDownloadCompleteCount (uint32_t count ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyDownloadCompleteCount (count) ; }
|
||||
void p3Notify::notifyHistoryChanged (uint32_t msgId , int type) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyHistoryChanged (msgId,type) ; }
|
||||
|
||||
bool p3Notify::askForPassword (const std::string& key_details , bool prev_is_bad , std::string& password)
|
||||
{
|
||||
FOR_ALL_NOTIFY_CLIENTS
|
||||
if( (*it)->askForPassword(key_details,prev_is_bad,password))
|
||||
return true ;
|
||||
|
||||
return false ;
|
||||
}
|
||||
bool p3Notify::askForPluginConfirmation (const std::string& plugin_filename, const std::string& plugin_file_hash)
|
||||
{
|
||||
FOR_ALL_NOTIFY_CLIENTS
|
||||
if( (*it)->askForPluginConfirmation(plugin_filename,plugin_file_hash))
|
||||
return true ;
|
||||
|
||||
return false ;
|
||||
}
|
||||
bool p3Notify::askForDeferredSelfSignature (const void * data , const uint32_t len , unsigned char *sign, unsigned int *signlen,int& signature_result )
|
||||
{
|
||||
FOR_ALL_NOTIFY_CLIENTS
|
||||
if( (*it)->askForDeferredSelfSignature(data,len,sign,signlen,signature_result))
|
||||
return true ;
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
void p3Notify::registerNotifyClient(NotifyClient *cl)
|
||||
{
|
||||
notifyClients.push_back(cl) ;
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include "retroshare/rsnotify.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
#include "retroshare/rsturtle.h"
|
||||
|
||||
#include "util/rsthreads.h"
|
||||
|
||||
@ -62,43 +62,76 @@ class p3NotifyPopupMsg
|
||||
};
|
||||
|
||||
|
||||
class p3Notify: public RsNotify, public pqiNotify
|
||||
class p3Notify: public RsNotify
|
||||
{
|
||||
public:
|
||||
|
||||
p3Notify() : noteMtx("p3Notify") { return; }
|
||||
virtual ~p3Notify() { return; }
|
||||
p3Notify() : noteMtx("p3Notify") { return; }
|
||||
virtual ~p3Notify() { return; }
|
||||
|
||||
/* Output for retroshare-gui */
|
||||
virtual bool NotifySysMessage(uint32_t &sysid, uint32_t &type, std::string &title, std::string &msg);
|
||||
virtual bool NotifyPopupMessage(uint32_t &ptype, std::string &name, std::string &title, std::string &msg);
|
||||
virtual bool NotifyLogMessage(uint32_t &sysid, uint32_t &type, std::string &title, std::string &msg);
|
||||
virtual void registerNotifyClient(NotifyClient *nc) ;
|
||||
|
||||
/* Control over Messages */
|
||||
virtual bool GetSysMessageList(std::map<uint32_t, std::string> &list);
|
||||
virtual bool GetPopupMessageList(std::map<uint32_t, std::string> &list);
|
||||
/* Pull output methods for retroshare-gui */
|
||||
virtual bool NotifySysMessage(uint32_t &sysid, uint32_t &type, std::string &title, std::string &msg);
|
||||
virtual bool NotifyPopupMessage(uint32_t &ptype, std::string &name, std::string &title, std::string &msg);
|
||||
virtual bool NotifyLogMessage(uint32_t &sysid, uint32_t &type, std::string &title, std::string &msg);
|
||||
|
||||
virtual bool SetSysMessageMode(uint32_t sysid, uint32_t mode);
|
||||
virtual bool SetPopupMessageMode(uint32_t ptype, uint32_t mode);
|
||||
virtual bool GetFeedItem(RsFeedItem &item);
|
||||
|
||||
virtual bool GetFeedItem(RsFeedItem &item);
|
||||
/* Control over Messages */
|
||||
bool GetSysMessageList(std::map<uint32_t, std::string> &list);
|
||||
bool GetPopupMessageList(std::map<uint32_t, std::string> &list);
|
||||
|
||||
/* Overloaded from pqiNotify */
|
||||
virtual bool AddPopupMessage(uint32_t ptype, const std::string& name, const std::string& title, const std::string& msg);
|
||||
virtual bool AddSysMessage(uint32_t sysid, uint32_t type, const std::string& title, const std::string& msg);
|
||||
virtual bool AddLogMessage(uint32_t sysid, uint32_t type, const std::string& title, const std::string& msg);
|
||||
virtual bool AddFeedItem(uint32_t type, const std::string& id1, const std::string& id2, const std::string& id3);
|
||||
virtual bool AddFeedItem(uint32_t type, const std::string& id1, const std::string& id2, const std::string& id3,const std::string& id4);
|
||||
virtual bool ClearFeedItems(uint32_t type);
|
||||
bool SetSysMessageMode(uint32_t sysid, uint32_t mode);
|
||||
bool SetPopupMessageMode(uint32_t ptype, uint32_t mode);
|
||||
|
||||
/* Overloaded from pqiNotify */
|
||||
virtual bool AddPopupMessage(uint32_t ptype, const std::string& name, const std::string& title, const std::string& msg);
|
||||
virtual bool AddSysMessage(uint32_t sysid, uint32_t type, const std::string& title, const std::string& msg);
|
||||
virtual bool AddLogMessage(uint32_t sysid, uint32_t type, const std::string& title, const std::string& msg);
|
||||
virtual bool AddFeedItem(uint32_t type, const std::string& id1, const std::string& id2, const std::string& id3);
|
||||
virtual bool AddFeedItem(uint32_t type, const std::string& id1, const std::string& id2, const std::string& id3,const std::string& id4);
|
||||
virtual bool ClearFeedItems(uint32_t type);
|
||||
|
||||
// Notifications of clients. Can be called from anywhere inside libretroshare.
|
||||
//
|
||||
void notifyListPreChange (int /* list */, int /* type */) ;
|
||||
void notifyListChange (int /* list */, int /* type */) ;
|
||||
void notifyErrorMsg (int /* list */, int /* sev */, std::string /* msg */) ;
|
||||
void notifyChatStatus (const std::string& /* peer_id */, const std::string& /* status_string */ ,bool /* is_private */) ;
|
||||
void notifyChatLobbyEvent (uint64_t /* lobby id */, uint32_t /* event type */ ,const std::string& /* nickname */,const std::string& /* any string */) ;
|
||||
void notifyChatLobbyTimeShift (int /* time_shift*/) ;
|
||||
void notifyCustomState (const std::string& /* peer_id */, const std::string& /* status_string */) ;
|
||||
void notifyHashingInfo (uint32_t /* type */, const std::string& /* fileinfo */) ;
|
||||
void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list<TurtleFileInfo>& /* files */) ;
|
||||
void notifyPeerHasNewAvatar (std::string /* peer_id */) ;
|
||||
void notifyOwnAvatarChanged () ;
|
||||
void notifyOwnStatusMessageChanged () ;
|
||||
void notifyDiskFull (uint32_t /* location */, uint32_t /* size limit in MB */) ;
|
||||
void notifyPeerStatusChanged (const std::string& /* peer_id */, uint32_t /* status */) ;
|
||||
|
||||
void notifyPeerStatusChangedSummary () ;
|
||||
void notifyDiscInfoChanged () ;
|
||||
void notifyForumMsgReadSatusChanged (const std::string& /* channelId */, const std::string& /* msgId */, uint32_t /* status */) ;
|
||||
void notifyChannelMsgReadSatusChanged (const std::string& /* channelId */, const std::string& /* msgId */, uint32_t /* status */) ;
|
||||
bool askForDeferredSelfSignature (const void * /* data */, const uint32_t /* len */, unsigned char * /* sign */, unsigned int * /* signlen */,int& signature_result ) ;
|
||||
void notifyDownloadComplete (const std::string& /* fileHash */) ;
|
||||
void notifyDownloadCompleteCount (uint32_t /* count */) ;
|
||||
void notifyHistoryChanged (uint32_t /* msgId */, int /* type */) ;
|
||||
|
||||
bool askForPassword (const std::string& /* key_details */, bool /* prev_is_bad */, std::string& /* password */ ) ;
|
||||
bool askForPluginConfirmation (const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */) ;
|
||||
|
||||
private:
|
||||
|
||||
RsMutex noteMtx;
|
||||
RsMutex noteMtx;
|
||||
|
||||
std::list<p3NotifySysMsg> pendingSysMsgs;
|
||||
std::list<p3NotifyLogMsg> pendingLogMsgs;
|
||||
std::list<p3NotifyPopupMsg> pendingPopupMsgs;
|
||||
std::list<RsFeedItem> pendingNewsFeed;
|
||||
std::list<p3NotifySysMsg> pendingSysMsgs;
|
||||
std::list<p3NotifyLogMsg> pendingLogMsgs;
|
||||
std::list<p3NotifyPopupMsg> pendingPopupMsgs;
|
||||
std::list<RsFeedItem> pendingNewsFeed;
|
||||
|
||||
std::list<NotifyClient*> notifyClients ;
|
||||
};
|
||||
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "rsserver/p3face.h"
|
||||
#include "util/rsnet.h"
|
||||
#include "pqi/authgpg.h"
|
||||
#include "pqi/authssl.h"
|
||||
@ -43,7 +44,6 @@
|
||||
const int p3peermgrzone = 9531;
|
||||
|
||||
#include "serialiser/rsconfigitems.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
|
||||
#include "retroshare/rsiface.h" // Needed for rsicontrol (should remove this dependancy)
|
||||
#include "retroshare/rspeers.h" // Needed for Group Parameters.
|
||||
@ -1689,7 +1689,7 @@ bool p3PeerMgrIMPL::addGroup(RsGroupInfo &groupInfo)
|
||||
groupInfo.id = groupItem->id;
|
||||
}
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_ADD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_ADD);
|
||||
|
||||
IndicateConfigChanged();
|
||||
|
||||
@ -1725,7 +1725,7 @@ bool p3PeerMgrIMPL::editGroup(const std::string &groupId, RsGroupInfo &groupInfo
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_MOD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_MOD);
|
||||
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
@ -1763,7 +1763,7 @@ bool p3PeerMgrIMPL::removeGroup(const std::string &groupId)
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_DEL);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_DEL);
|
||||
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
@ -1850,7 +1850,7 @@ bool p3PeerMgrIMPL::assignPeersToGroup(const std::string &groupId, const std::li
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_MOD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_GROUPLIST, NOTIFY_TYPE_MOD);
|
||||
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
|
@ -1,53 +0,0 @@
|
||||
#ifndef PQI_NOTIFY_INTERFACE_H
|
||||
#define PQI_NOTIFY_INTERFACE_H
|
||||
|
||||
/*
|
||||
* libretroshare/src/rsserver: pqinotify.h
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2007-2008 by Robert Fernie.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include "retroshare/rsnotify.h" /* for ids */
|
||||
|
||||
/* Interface for System Notification: Implemented in rsserver */
|
||||
/* Global Access -> so we don't need everyone to have a pointer to this! */
|
||||
|
||||
|
||||
class pqiNotify
|
||||
{
|
||||
public:
|
||||
|
||||
pqiNotify() { return; }
|
||||
virtual ~pqiNotify() { return; }
|
||||
|
||||
/* Input from libretroshare */
|
||||
virtual bool AddPopupMessage(uint32_t ptype, const std::string& name, const std::string& title, const std::string& msg) = 0;
|
||||
virtual bool AddSysMessage(uint32_t sysid, uint32_t type, const std::string& title, const std::string& msg) = 0;
|
||||
virtual bool AddLogMessage(uint32_t sysid, uint32_t type, const std::string& title, const std::string& msg) = 0;
|
||||
virtual bool AddFeedItem(uint32_t type, const std::string& id1, const std::string& id2, const std::string& id3) = 0;
|
||||
virtual bool AddFeedItem(uint32_t type, const std::string& id1, const std::string& id2, const std::string& id3, const std::string& id4) = 0;
|
||||
virtual bool ClearFeedItems(uint32_t type) = 0;
|
||||
};
|
||||
|
||||
extern pqiNotify *getPqiNotify();
|
||||
|
||||
#endif
|
@ -31,7 +31,7 @@
|
||||
#include "util/rsstring.h"
|
||||
|
||||
#include "pqi/pqistreamer.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
#include "rsserver/p3face.h"
|
||||
|
||||
#include "serialiser/rsserial.h"
|
||||
#include "serialiser/rsbaseitems.h" /***** For RsFileData *****/
|
||||
@ -550,7 +550,7 @@ continue_packet:
|
||||
{
|
||||
pqioutput(PQL_ALERT, pqistreamerzone, "ERROR: Read Packet too Big!");
|
||||
|
||||
pqiNotify *notify = getPqiNotify();
|
||||
p3Notify *notify = RsServer::notify();
|
||||
if (notify)
|
||||
{
|
||||
std::string title =
|
||||
@ -625,7 +625,7 @@ continue_packet:
|
||||
std::cerr << out << std::endl ;
|
||||
pqioutput(PQL_ALERT, pqistreamerzone, out);
|
||||
|
||||
pqiNotify *notify = getPqiNotify();
|
||||
p3Notify *notify = RsServer::notify();
|
||||
if (notify)
|
||||
{
|
||||
std::string title = "Warning: Error Completing Read";
|
||||
|
@ -27,19 +27,17 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "retroshare/rsnotify.h"
|
||||
#include "rstypes.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
class NotifyBase;
|
||||
class RsControl;
|
||||
class RsServer;
|
||||
class RsInit;
|
||||
class RsPeerCryptoParams;
|
||||
struct TurtleFileInfo ;
|
||||
|
||||
/* declare single RsIface for everyone to use! */
|
||||
extern RsControl *rsicontrol;
|
||||
|
||||
/* RsInit -> Configuration Parameters for RetroShare Startup
|
||||
*/
|
||||
|
||||
@ -53,32 +51,11 @@ void CleanupRsConfig(RsInit *);
|
||||
// Called First... (handles comandline options)
|
||||
int InitRetroShare(int argc, char **argv, RsInit *config);
|
||||
|
||||
// This Functions are used for Login.
|
||||
bool ValidateCertificate(RsInit *config, std::string &userName);
|
||||
bool ValidateTrustedUser(RsInit *config, std::string fname, std::string &userName);
|
||||
bool LoadPassword(RsInit *config, std::string passwd);
|
||||
bool RsGenerateCertificate(RsInit *config, std::string name, std::string org,
|
||||
std::string loc, std::string country, std::string passwd, std::string &errString);
|
||||
|
||||
/* Auto Login Fns */
|
||||
bool RsTryAutoLogin(RsInit *config);
|
||||
bool RsStoreAutoLogin(RsInit *config);
|
||||
bool RsClearAutoLogin(std::string basedir);
|
||||
|
||||
// Handle actual Login.
|
||||
int LoadCertificates(RsInit *config, bool autoLoginNT);
|
||||
|
||||
RsControl *createRsControl(NotifyBase ¬ify);
|
||||
|
||||
|
||||
class RsControl /* The Main Interface Class - for controlling the server */
|
||||
{
|
||||
public:
|
||||
|
||||
RsControl(NotifyBase &callback)
|
||||
:cb(callback) { return; }
|
||||
|
||||
virtual ~RsControl() { return; }
|
||||
static RsControl *instance() ;
|
||||
static void earlyInitNotificationSystem() { instance() ; }
|
||||
|
||||
/* Real Startup Fn */
|
||||
virtual int StartupRetroShare() = 0;
|
||||
@ -100,80 +77,11 @@ class RsControl /* The Main Interface Class - for controlling the server */
|
||||
|
||||
/****************************************/
|
||||
|
||||
NotifyBase & getNotify() { return cb; }
|
||||
|
||||
virtual bool getPeerCryptoDetails(const std::string& ssl_id,RsPeerCryptoParams& params) = 0;
|
||||
|
||||
private:
|
||||
NotifyBase &cb;
|
||||
protected:
|
||||
RsControl() {} // should not be used, hence it's private.
|
||||
};
|
||||
|
||||
|
||||
/********************** Overload this Class for callback *****************/
|
||||
|
||||
|
||||
class NotifyBase
|
||||
{
|
||||
public:
|
||||
NotifyBase() { return; }
|
||||
virtual ~NotifyBase() { return; }
|
||||
virtual void notifyListPreChange(int list, int type) { (void) list; (void) type; return; }
|
||||
virtual void notifyListChange(int list, int type) { (void) list; (void) type; return; }
|
||||
virtual void notifyErrorMsg(int list, int sev, std::string msg) { (void) list; (void) sev; (void) msg; return; }
|
||||
virtual void notifyChatStatus(const std::string& /* peer_id */, const std::string& /* status_string */ ,bool /* is_private */) {}
|
||||
virtual void notifyChatLobbyEvent(uint64_t /* lobby id */,uint32_t /* event type */,const std::string& /* nickname */,const std::string& /* any string */) {}
|
||||
virtual void notifyChatLobbyTimeShift(int /* time_shift */) {}
|
||||
virtual void notifyCustomState(const std::string& /* peer_id */, const std::string& /* status_string */) {}
|
||||
virtual void notifyHashingInfo(uint32_t type, const std::string& fileinfo) { (void) type; (void)fileinfo; }
|
||||
virtual void notifyTurtleSearchResult(uint32_t /* search_id */ ,const std::list<TurtleFileInfo>& files) { (void)files; }
|
||||
virtual void notifyPeerHasNewAvatar(std::string peer_id) { (void)peer_id; }
|
||||
virtual void notifyOwnAvatarChanged() {}
|
||||
virtual void notifyOwnStatusMessageChanged() {}
|
||||
virtual void notifyDiskFull(uint32_t /* location */,uint32_t /* size limit in MB */) {}
|
||||
/* peer has changed the status */
|
||||
virtual void notifyPeerStatusChanged(const std::string& /* peer_id */, uint32_t /* status */) {}
|
||||
/* one or more peers has changed the states */
|
||||
virtual void notifyPeerStatusChangedSummary() {}
|
||||
virtual void notifyForumMsgReadSatusChanged(const std::string& /* channelId */, const std::string& /* msgId */, uint32_t /* status */) {}
|
||||
virtual void notifyChannelMsgReadSatusChanged(const std::string& /* channelId */, const std::string& /* msgId */, uint32_t /* status */) {}
|
||||
virtual void notifyDiscInfoChanged() {}
|
||||
virtual void notifyDownloadComplete(const std::string& /* fileHash */) {};
|
||||
virtual void notifyDownloadCompleteCount(uint32_t /* count */) {};
|
||||
virtual void notifyHistoryChanged(uint32_t /* msgId */, int /* type */) {}
|
||||
|
||||
virtual bool askForPassword(const std::string& /* key_details */, bool /* prev_is_bad */, std::string& /* password */ ) { return false ;}
|
||||
virtual bool askForPluginConfirmation(const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */) { return false ;}
|
||||
virtual bool askForDeferredSelfSignature(const void * /* data */, const uint32_t /* len */, unsigned char * /* sign */, unsigned int * /* signlen */,int& signature_result ) { signature_result = false ;return true; }
|
||||
|
||||
};
|
||||
|
||||
const int NOTIFY_LIST_NEIGHBOURS = 1;
|
||||
const int NOTIFY_LIST_FRIENDS = 2;
|
||||
const int NOTIFY_LIST_SEARCHLIST = 4;
|
||||
const int NOTIFY_LIST_MESSAGELIST = 5;
|
||||
const int NOTIFY_LIST_CHANNELLIST = 6;
|
||||
const int NOTIFY_LIST_TRANSFERLIST = 7;
|
||||
const int NOTIFY_LIST_CONFIG = 8;
|
||||
const int NOTIFY_LIST_DIRLIST_LOCAL = 9;
|
||||
const int NOTIFY_LIST_DIRLIST_FRIENDS = 10;
|
||||
const int NOTIFY_LIST_FORUMLIST_LOCKED = 11; // use connect with Qt::QueuedConnection
|
||||
const int NOTIFY_LIST_MESSAGE_TAGS = 12;
|
||||
const int NOTIFY_LIST_PUBLIC_CHAT = 13;
|
||||
const int NOTIFY_LIST_PRIVATE_INCOMING_CHAT = 14;
|
||||
const int NOTIFY_LIST_PRIVATE_OUTGOING_CHAT = 15;
|
||||
const int NOTIFY_LIST_GROUPLIST = 16;
|
||||
const int NOTIFY_LIST_CHANNELLIST_LOCKED = 17; // use connect with Qt::QueuedConnection
|
||||
const int NOTIFY_LIST_CHAT_LOBBY_INVITATION = 18;
|
||||
const int NOTIFY_LIST_CHAT_LOBBY_LIST = 19;
|
||||
|
||||
const int NOTIFY_TYPE_SAME = 0x01;
|
||||
const int NOTIFY_TYPE_MOD = 0x02; /* general purpose, check all */
|
||||
const int NOTIFY_TYPE_ADD = 0x04; /* flagged additions */
|
||||
const int NOTIFY_TYPE_DEL = 0x08; /* flagged deletions */
|
||||
|
||||
const uint32_t NOTIFY_HASHTYPE_EXAMINING_FILES = 1; /* Examining shared files */
|
||||
const uint32_t NOTIFY_HASHTYPE_FINISH = 2; /* Finish */
|
||||
const uint32_t NOTIFY_HASHTYPE_HASH_FILE = 3; /* Hashing file */
|
||||
const uint32_t NOTIFY_HASHTYPE_SAVE_FILE_INDEX = 4; /* Hashing file */
|
||||
|
||||
#endif
|
||||
|
@ -33,6 +33,8 @@
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "rsturtle.h"
|
||||
|
||||
class RsNotify;
|
||||
extern RsNotify *rsNotify;
|
||||
|
||||
@ -97,50 +99,124 @@ const uint32_t RS_FEED_ITEM_FILES_NEW = RS_FEED_TYPE_FILES | 0x0001;
|
||||
|
||||
const uint32_t RS_MESSAGE_CONNECT_ATTEMPT = 0x0001;
|
||||
|
||||
const int NOTIFY_LIST_NEIGHBOURS = 1;
|
||||
const int NOTIFY_LIST_FRIENDS = 2;
|
||||
const int NOTIFY_LIST_SEARCHLIST = 4;
|
||||
const int NOTIFY_LIST_MESSAGELIST = 5;
|
||||
const int NOTIFY_LIST_CHANNELLIST = 6;
|
||||
const int NOTIFY_LIST_TRANSFERLIST = 7;
|
||||
const int NOTIFY_LIST_CONFIG = 8;
|
||||
const int NOTIFY_LIST_DIRLIST_LOCAL = 9;
|
||||
const int NOTIFY_LIST_DIRLIST_FRIENDS = 10;
|
||||
const int NOTIFY_LIST_FORUMLIST_LOCKED = 11; // use connect with Qt::QueuedConnection
|
||||
const int NOTIFY_LIST_MESSAGE_TAGS = 12;
|
||||
const int NOTIFY_LIST_PUBLIC_CHAT = 13;
|
||||
const int NOTIFY_LIST_PRIVATE_INCOMING_CHAT = 14;
|
||||
const int NOTIFY_LIST_PRIVATE_OUTGOING_CHAT = 15;
|
||||
const int NOTIFY_LIST_GROUPLIST = 16;
|
||||
const int NOTIFY_LIST_CHANNELLIST_LOCKED = 17; // use connect with Qt::QueuedConnection
|
||||
const int NOTIFY_LIST_CHAT_LOBBY_INVITATION = 18;
|
||||
const int NOTIFY_LIST_CHAT_LOBBY_LIST = 19;
|
||||
|
||||
const int NOTIFY_TYPE_SAME = 0x01;
|
||||
const int NOTIFY_TYPE_MOD = 0x02; /* general purpose, check all */
|
||||
const int NOTIFY_TYPE_ADD = 0x04; /* flagged additions */
|
||||
const int NOTIFY_TYPE_DEL = 0x08; /* flagged deletions */
|
||||
|
||||
const uint32_t NOTIFY_HASHTYPE_EXAMINING_FILES = 1; /* Examining shared files */
|
||||
const uint32_t NOTIFY_HASHTYPE_FINISH = 2; /* Finish */
|
||||
const uint32_t NOTIFY_HASHTYPE_HASH_FILE = 3; /* Hashing file */
|
||||
const uint32_t NOTIFY_HASHTYPE_SAVE_FILE_INDEX = 4; /* Hashing file */
|
||||
|
||||
class RsFeedItem
|
||||
{
|
||||
public:
|
||||
RsFeedItem(uint32_t type, const std::string& id1, const std::string& id2, const std::string& id3)
|
||||
:mType(type), mId1(id1), mId2(id2), mId3(id3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
public:
|
||||
RsFeedItem(uint32_t type, const std::string& id1, const std::string& id2, const std::string& id3)
|
||||
:mType(type), mId1(id1), mId2(id2), mId3(id3)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RsFeedItem(uint32_t type, const std::string& id1, const std::string& id2, const std::string& id3,const std::string& id4)
|
||||
:mType(type), mId1(id1), mId2(id2), mId3(id3), mId4(id4) {}
|
||||
RsFeedItem(uint32_t type, const std::string& id1, const std::string& id2, const std::string& id3,const std::string& id4)
|
||||
:mType(type), mId1(id1), mId2(id2), mId3(id3), mId4(id4) {}
|
||||
|
||||
RsFeedItem() :mType(0) { return; }
|
||||
RsFeedItem() :mType(0) { return; }
|
||||
|
||||
uint32_t mType;
|
||||
std::string mId1, mId2, mId3, mId4;
|
||||
uint32_t mType;
|
||||
std::string mId1, mId2, mId3, mId4;
|
||||
};
|
||||
|
||||
// This class implements a generic notify client. To have your own components being notified by
|
||||
// the Retroshare library, sub-class NotifyClient, and overload the methods you want to make use of
|
||||
// (The other methods will just ignore the call), and register your ownclient into RsNotify, as:
|
||||
//
|
||||
// myNotifyClient: public NotifyClient
|
||||
// {
|
||||
// public:
|
||||
// virtual void void notifyPeerHasNewAvatar(std::string peer_id)
|
||||
// {
|
||||
// doMyOwnThing() ;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// myNotifyClient *client = new myNotifyClient() ;
|
||||
//
|
||||
// rsNotify->registerNotifyClient(client) ;
|
||||
//
|
||||
// This mechanism can be used in plugins, new services, etc.
|
||||
//
|
||||
|
||||
class NotifyClient ;
|
||||
|
||||
class RsNotify
|
||||
{
|
||||
public:
|
||||
/* registration of notifies clients */
|
||||
virtual void registerNotifyClient(NotifyClient *nc) = 0;
|
||||
|
||||
RsNotify() { return; }
|
||||
virtual ~RsNotify() { return; }
|
||||
|
||||
/* Output for retroshare-gui */
|
||||
virtual bool NotifySysMessage(uint32_t &sysid, uint32_t &type,
|
||||
std::string &title, std::string &msg) = 0;
|
||||
virtual bool NotifyPopupMessage(uint32_t &ptype, std::string &name, std::string &title, std::string &msg) = 0;
|
||||
virtual bool NotifyLogMessage(uint32_t &sysid, uint32_t &type,
|
||||
std::string &title, std::string &msg) = 0;
|
||||
|
||||
/* Control over Messages */
|
||||
virtual bool GetSysMessageList(std::map<uint32_t, std::string> &list) = 0;
|
||||
virtual bool GetPopupMessageList(std::map<uint32_t, std::string> &list) = 0;
|
||||
|
||||
virtual bool SetSysMessageMode(uint32_t sysid, uint32_t mode) = 0;
|
||||
virtual bool SetPopupMessageMode(uint32_t ptype, uint32_t mode) = 0;
|
||||
|
||||
/* Feed Output */
|
||||
virtual bool GetFeedItem(RsFeedItem &item) = 0;
|
||||
/* Pull methods for retroshare-gui */
|
||||
/* this should probably go into a different service. */
|
||||
|
||||
virtual bool NotifySysMessage(uint32_t &sysid, uint32_t &type, std::string &title, std::string &msg) = 0;
|
||||
virtual bool NotifyPopupMessage(uint32_t &ptype, std::string &name, std::string &title, std::string &msg) = 0;
|
||||
virtual bool NotifyLogMessage(uint32_t &sysid, uint32_t &type, std::string &title, std::string &msg) = 0;
|
||||
|
||||
virtual bool GetFeedItem(RsFeedItem &item) = 0;
|
||||
};
|
||||
|
||||
class NotifyClient
|
||||
{
|
||||
public:
|
||||
NotifyClient() {}
|
||||
virtual ~NotifyClient() {}
|
||||
|
||||
virtual void notifyListPreChange (int /* list */, int /* type */) {}
|
||||
virtual void notifyListChange (int /* list */, int /* type */) {}
|
||||
virtual void notifyErrorMsg (int /* list */, int /* sev */, std::string /* msg */) {}
|
||||
virtual void notifyChatStatus (const std::string& /* peer_id */, const std::string& /* status_string */ ,bool /* is_private */) {}
|
||||
virtual void notifyChatLobbyEvent (uint64_t /* lobby id */, uint32_t /* event type */ ,const std::string& /* nickname */,const std::string& /* any string */) {}
|
||||
virtual void notifyChatLobbyTimeShift (int /* time_shift*/) {}
|
||||
virtual void notifyCustomState (const std::string& /* peer_id */, const std::string& /* status_string */) {}
|
||||
virtual void notifyHashingInfo (uint32_t /* type */, const std::string& /* fileinfo */) {}
|
||||
virtual void notifyTurtleSearchResult (uint32_t /* search_id */, const std::list<TurtleFileInfo>& /* files */) {}
|
||||
virtual void notifyPeerHasNewAvatar (std::string /* peer_id */) {}
|
||||
virtual void notifyOwnAvatarChanged () {}
|
||||
virtual void notifyOwnStatusMessageChanged () {}
|
||||
virtual void notifyDiskFull (uint32_t /* location */, uint32_t /* size limit in MB */) {}
|
||||
virtual void notifyPeerStatusChanged (const std::string& /* peer_id */, uint32_t /* status */) {}
|
||||
|
||||
/* one or more peers has changed the states */
|
||||
virtual void notifyPeerStatusChangedSummary () {}
|
||||
virtual void notifyDiscInfoChanged () {}
|
||||
virtual void notifyForumMsgReadSatusChanged (const std::string& /* channelId */, const std::string& /* msgId */, uint32_t /* status */) {}
|
||||
virtual void notifyChannelMsgReadSatusChanged (const std::string& /* channelId */, const std::string& /* msgId */, uint32_t /* status */) {}
|
||||
virtual bool askForDeferredSelfSignature (const void * /* data */, const uint32_t /* len */, unsigned char * /* sign */, unsigned int * /* signlen */,int& signature_result ) { signature_result = false ;return true; }
|
||||
virtual void notifyDownloadComplete (const std::string& /* fileHash */) {};
|
||||
virtual void notifyDownloadCompleteCount (uint32_t /* count */) {};
|
||||
virtual void notifyHistoryChanged (uint32_t /* msgId */, int /* type */) {}
|
||||
|
||||
virtual bool askForPassword (const std::string& /* key_details */, bool /* prev_is_bad */, std::string& /* password */ ) { return false ;}
|
||||
virtual bool askForPluginConfirmation (const std::string& /* plugin_filename */, const std::string& /* plugin_file_hash */) { return false ;}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
@ -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 */
|
||||
|
@ -297,8 +297,6 @@ bool p3Blogs::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, const
|
||||
return true;
|
||||
}
|
||||
|
||||
#include "pqi/pqinotify.h"
|
||||
|
||||
bool p3Blogs::locked_eventNewMsg(GroupInfo *grp, RsDistribMsg *msg, const std::string& id, bool historical)
|
||||
{
|
||||
std::string grpId = msg->grpId;
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include "services/p3channels.h"
|
||||
#include "util/rsdir.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "rsserver/p3face.h"
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const ChannelInfo &info)
|
||||
{
|
||||
@ -342,8 +342,8 @@ bool p3Channels::setMessageStatus(const std::string& cId,const std::string& mId,
|
||||
} /******* UNLOCKED ********/
|
||||
|
||||
if (changed) {
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_MOD);
|
||||
rsicontrol->getNotify().notifyChannelMsgReadSatusChanged(cId, mId, newStatus);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_MOD);
|
||||
RsServer::notify()->notifyChannelMsgReadSatusChanged(cId, mId, newStatus);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -898,8 +898,6 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, con
|
||||
return true;
|
||||
}
|
||||
|
||||
#include "pqi/pqinotify.h"
|
||||
|
||||
bool p3Channels::locked_eventNewMsg(GroupInfo *grp, RsDistribMsg *msg, const std::string& id, bool historical)
|
||||
{
|
||||
std::string grpId = msg->grpId;
|
||||
@ -908,7 +906,7 @@ bool p3Channels::locked_eventNewMsg(GroupInfo *grp, RsDistribMsg *msg, const std
|
||||
|
||||
if (!historical)
|
||||
{
|
||||
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_CHAN_MSG, grpId, msgId, nullId);
|
||||
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_CHAN_MSG, grpId, msgId, nullId);
|
||||
}
|
||||
|
||||
/* request the files
|
||||
@ -935,9 +933,9 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags, bool
|
||||
#endif
|
||||
if (!historical)
|
||||
{
|
||||
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_CHAN_NEW, grpId, msgId, nullId);
|
||||
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_CHAN_NEW, grpId, msgId, nullId);
|
||||
}
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||
break;
|
||||
case GRP_UPDATE:
|
||||
#ifdef CHANNEL_DEBUG
|
||||
@ -945,9 +943,9 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags, bool
|
||||
#endif
|
||||
if (!historical)
|
||||
{
|
||||
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_CHAN_UPDATE, grpId, msgId, nullId);
|
||||
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_CHAN_UPDATE, grpId, msgId, nullId);
|
||||
}
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_MOD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_MOD);
|
||||
break;
|
||||
case GRP_LOAD_KEY:
|
||||
#ifdef CHANNEL_DEBUG
|
||||
@ -958,7 +956,7 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags, bool
|
||||
#ifdef CHANNEL_DEBUG
|
||||
std::cerr << "p3Channels::locked_notifyGroupChanged() NEW MSG" << std::endl;
|
||||
#endif
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||
break;
|
||||
case GRP_SUBSCRIBED:
|
||||
#ifdef CHANNEL_DEBUG
|
||||
@ -978,13 +976,13 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags, bool
|
||||
/* check if downloads need to be started? */
|
||||
}
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||
break;
|
||||
case GRP_UNSUBSCRIBED:
|
||||
#ifdef CHANNEL_DEBUG
|
||||
std::cerr << "p3Channels::locked_notifyGroupChanged() UNSUBSCRIBED" << std::endl;
|
||||
#endif
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_DEL);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHANNELLIST_LOCKED, NOTIFY_TYPE_DEL);
|
||||
|
||||
/* won't stop downloads... */
|
||||
|
||||
|
@ -38,10 +38,10 @@
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "retroshare/rsstatus.h"
|
||||
#include "pqi/pqibin.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
#include "pqi/pqistore.h"
|
||||
#include "pqi/p3linkmgr.h"
|
||||
#include "pqi/p3historymgr.h"
|
||||
#include "rsserver/p3face.h"
|
||||
|
||||
#include "services/p3chatservice.h"
|
||||
#include "serialiser/rsconfigitems.h"
|
||||
@ -499,7 +499,7 @@ bool p3ChatService::sendPrivateChat(const std::string &id, const std::wstrin
|
||||
privateOutgoingList.push_back(ci);
|
||||
}
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_ADD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_ADD);
|
||||
|
||||
IndicateConfigChanged();
|
||||
|
||||
@ -912,7 +912,7 @@ void p3ChatService::handleRecvChatLobbyList(RsChatLobbyListItem_deprecated *item
|
||||
}
|
||||
}
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
_should_reset_lobby_counts = false ;
|
||||
}
|
||||
void p3ChatService::handleRecvChatLobbyList(RsChatLobbyListItem_deprecated2 *item)
|
||||
@ -944,7 +944,7 @@ void p3ChatService::handleRecvChatLobbyList(RsChatLobbyListItem_deprecated2 *ite
|
||||
}
|
||||
}
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
_should_reset_lobby_counts = false ;
|
||||
}
|
||||
void p3ChatService::handleRecvChatLobbyList(RsChatLobbyListItem *item)
|
||||
@ -990,7 +990,7 @@ void p3ChatService::handleRecvChatLobbyList(RsChatLobbyListItem *item)
|
||||
for (it = chatLobbyToSubscribe.begin(); it != chatLobbyToSubscribe.end(); it++)
|
||||
joinVisibleChatLobby(*it);
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
_should_reset_lobby_counts = false ;
|
||||
}
|
||||
|
||||
@ -1037,7 +1037,7 @@ void p3ChatService::addTimeShiftStatistics(int D)
|
||||
#endif
|
||||
|
||||
if(expected > 9) // if more than 20 samples
|
||||
rsicontrol->getNotify().notifyChatLobbyTimeShift( (int)pow(2.0f,expected)) ;
|
||||
RsServer::notify()->notifyChatLobbyTimeShift( (int)pow(2.0f,expected)) ;
|
||||
|
||||
total = 0.0f ;
|
||||
log_delay_histogram.clear() ;
|
||||
@ -1144,7 +1144,7 @@ void p3ChatService::handleRecvChatLobbyEventItem(RsChatLobbyEventItem *item)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
rsicontrol->getNotify().notifyChatLobbyEvent(item->lobby_id,item->event_type,item->nick,item->string1) ;
|
||||
RsServer::notify()->notifyChatLobbyEvent(item->lobby_id,item->event_type,item->nick,item->string1) ;
|
||||
}
|
||||
|
||||
void p3ChatService::handleRecvChatAvatarItem(RsChatAvatarItem *ca)
|
||||
@ -1154,7 +1154,7 @@ void p3ChatService::handleRecvChatAvatarItem(RsChatAvatarItem *ca)
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "Received avatar data for peer " << ca->PeerId() << ". Notifying." << std::endl ;
|
||||
#endif
|
||||
rsicontrol->getNotify().notifyPeerHasNewAvatar(ca->PeerId()) ;
|
||||
RsServer::notify()->notifyPeerHasNewAvatar(ca->PeerId()) ;
|
||||
}
|
||||
|
||||
bool p3ChatService::checkForMessageSecurity(RsChatMsgItem *ci)
|
||||
@ -1356,11 +1356,11 @@ bool p3ChatService::handleRecvChatMsgItem(RsChatMsgItem *ci)
|
||||
librs::util::ConvertUtf16ToUtf8(ci->message, message);
|
||||
if (ci->chatFlags & RS_CHAT_FLAG_PRIVATE) {
|
||||
/* notify private chat message */
|
||||
getPqiNotify()->AddPopupMessage(popupChatFlag, ci->PeerId(), name, message);
|
||||
RsServer::notify()->AddPopupMessage(popupChatFlag, ci->PeerId(), name, message);
|
||||
} else {
|
||||
/* notify public chat message */
|
||||
getPqiNotify()->AddPopupMessage(RS_POPUP_GROUPCHAT, ci->PeerId(), "", message);
|
||||
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_CHAT_NEW, ci->PeerId(), message, "");
|
||||
RsServer::notify()->AddPopupMessage(RS_POPUP_GROUPCHAT, ci->PeerId(), "", message);
|
||||
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_CHAT_NEW, ci->PeerId(), message, "");
|
||||
}
|
||||
|
||||
{
|
||||
@ -1390,10 +1390,10 @@ bool p3ChatService::handleRecvChatMsgItem(RsChatMsgItem *ci)
|
||||
}
|
||||
|
||||
if (publicChanged) {
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_PUBLIC_CHAT, NOTIFY_TYPE_ADD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_PUBLIC_CHAT, NOTIFY_TYPE_ADD);
|
||||
}
|
||||
if (privateChanged) {
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_PRIVATE_INCOMING_CHAT, NOTIFY_TYPE_ADD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_PRIVATE_INCOMING_CHAT, NOTIFY_TYPE_ADD);
|
||||
|
||||
IndicateConfigChanged(); // only private chat messages are saved
|
||||
}
|
||||
@ -1411,7 +1411,7 @@ void p3ChatService::handleRecvChatStatusItem(RsChatStatusItem *cs)
|
||||
else if(cs->flags & RS_CHAT_FLAG_CUSTOM_STATE) // Check if new custom string is available at peer's.
|
||||
{ // If so, send a request to get the custom string.
|
||||
receiveStateString(cs->PeerId(),cs->status_string) ; // store it
|
||||
rsicontrol->getNotify().notifyCustomState(cs->PeerId(), cs->status_string) ;
|
||||
RsServer::notify()->notifyCustomState(cs->PeerId(), cs->status_string) ;
|
||||
}
|
||||
else if(cs->flags & RS_CHAT_FLAG_CUSTOM_STATE_AVAILABLE)
|
||||
{
|
||||
@ -1422,13 +1422,13 @@ void p3ChatService::handleRecvChatStatusItem(RsChatStatusItem *cs)
|
||||
}
|
||||
else if(cs->flags & RS_CHAT_FLAG_PRIVATE)
|
||||
{
|
||||
rsicontrol->getNotify().notifyChatStatus(cs->PeerId(),cs->status_string,true) ;
|
||||
RsServer::notify()->notifyChatStatus(cs->PeerId(),cs->status_string,true) ;
|
||||
|
||||
if(cs->flags & RS_CHAT_FLAG_CLOSING_DISTANT_CONNECTION)
|
||||
markDistantChatAsClosed(cs->PeerId()) ;
|
||||
}
|
||||
else if(cs->flags & RS_CHAT_FLAG_PUBLIC)
|
||||
rsicontrol->getNotify().notifyChatStatus(cs->PeerId(),cs->status_string,false) ;
|
||||
RsServer::notify()->notifyChatStatus(cs->PeerId(),cs->status_string,false) ;
|
||||
}
|
||||
|
||||
void p3ChatService::getListOfNearbyChatLobbies(std::vector<VisibleChatLobbyRecord>& visible_lobbies)
|
||||
@ -1499,7 +1499,7 @@ bool p3ChatService::getPublicChatQueue(std::list<ChatInfo> &chats)
|
||||
} /* UNLOCKED */
|
||||
|
||||
if (changed) {
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_PUBLIC_CHAT, NOTIFY_TYPE_DEL);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_PUBLIC_CHAT, NOTIFY_TYPE_DEL);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1620,7 +1620,7 @@ bool p3ChatService::clearPrivateChatQueue(bool incoming, const std::string &id)
|
||||
} /* UNLOCKED */
|
||||
|
||||
if (changed) {
|
||||
rsicontrol->getNotify().notifyListChange(incoming ? NOTIFY_LIST_PRIVATE_INCOMING_CHAT : NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_DEL);
|
||||
RsServer::notify()->notifyListChange(incoming ? NOTIFY_LIST_PRIVATE_INCOMING_CHAT : NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_DEL);
|
||||
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
@ -1664,7 +1664,7 @@ void p3ChatService::setOwnCustomStateString(const std::string& s)
|
||||
mLinkMgr->getOnlineList(onlineList);
|
||||
}
|
||||
|
||||
rsicontrol->getNotify().notifyOwnStatusMessageChanged() ;
|
||||
RsServer::notify()->notifyOwnStatusMessageChanged() ;
|
||||
|
||||
// alert your online peers to your newly set status
|
||||
std::list<std::string>::iterator it(onlineList.begin());
|
||||
@ -1704,7 +1704,7 @@ void p3ChatService::setOwnAvatarJpegData(const unsigned char *data,int size)
|
||||
}
|
||||
IndicateConfigChanged();
|
||||
|
||||
rsicontrol->getNotify().notifyOwnAvatarChanged() ;
|
||||
RsServer::notify()->notifyOwnAvatarChanged() ;
|
||||
|
||||
#ifdef CHAT_DEBUG
|
||||
std::cerr << "p3chatservice:setOwnAvatarJpegData() done." << std::endl ;
|
||||
@ -2175,7 +2175,7 @@ void p3ChatService::statusChange(const std::list<pqipeer> &plist)
|
||||
checkSizeAndSendMessage_deprecated(to_send[i]); // delete item
|
||||
|
||||
if (changed) {
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_DEL);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_DEL);
|
||||
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
@ -2616,7 +2616,7 @@ void p3ChatService::handleRecvLobbyInvite(RsChatLobbyInviteItem *item)
|
||||
_lobby_invites_queue[item->lobby_id] = invite ;
|
||||
}
|
||||
// 2 - notify the gui to ask the user.
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_INVITATION, NOTIFY_TYPE_ADD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_INVITATION, NOTIFY_TYPE_ADD);
|
||||
}
|
||||
|
||||
void p3ChatService::getPendingChatLobbyInvites(std::list<ChatLobbyInvite>& invites)
|
||||
@ -2694,8 +2694,8 @@ bool p3ChatService::acceptLobbyInvite(const ChatLobbyId& lobby_id)
|
||||
std::cerr << " Notifying of new recvd msg." << std::endl ;
|
||||
#endif
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_PRIVATE_INCOMING_CHAT, NOTIFY_TYPE_ADD);
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_PRIVATE_INCOMING_CHAT, NOTIFY_TYPE_ADD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD);
|
||||
|
||||
// send AKN item
|
||||
sendLobbyStatusNewPeer(lobby_id) ;
|
||||
@ -2793,7 +2793,7 @@ bool p3ChatService::joinVisibleChatLobby(const ChatLobbyId& lobby_id)
|
||||
for(std::list<std::string>::const_iterator it(invited_friends.begin());it!=invited_friends.end();++it)
|
||||
invitePeerToLobby(lobby_id,*it) ;
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
sendLobbyStatusNewPeer(lobby_id) ;
|
||||
|
||||
return true ;
|
||||
@ -2837,7 +2837,7 @@ ChatLobbyId p3ChatService::createChatLobby(const std::string& lobby_name,const s
|
||||
for(std::list<std::string>::const_iterator it(invited_friends.begin());it!=invited_friends.end();++it)
|
||||
invitePeerToLobby(lobby_id,*it) ;
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
|
||||
return lobby_id ;
|
||||
}
|
||||
@ -2870,7 +2870,7 @@ void p3ChatService::handleFriendUnsubscribeLobby(RsChatLobbyUnsubscribeItem *ite
|
||||
}
|
||||
}
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_MOD) ;
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_MOD) ;
|
||||
}
|
||||
|
||||
void p3ChatService::unsubscribeChatLobby(const ChatLobbyId& id)
|
||||
@ -2921,7 +2921,7 @@ void p3ChatService::unsubscribeChatLobby(const ChatLobbyId& id)
|
||||
}
|
||||
}
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_DEL) ;
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_DEL) ;
|
||||
|
||||
// done!
|
||||
}
|
||||
@ -3027,7 +3027,7 @@ void p3ChatService::setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const boo
|
||||
else
|
||||
_known_lobbies_flags[lobby_id] &= ~RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE ;
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
|
||||
IndicateConfigChanged();
|
||||
}
|
||||
|
||||
@ -3137,7 +3137,7 @@ void p3ChatService::cleanLobbyCaches()
|
||||
|
||||
// update the gui
|
||||
for(std::list<ChatLobbyId>::const_iterator it(changed_lobbies.begin());it!=changed_lobbies.end();++it)
|
||||
rsicontrol->getNotify().notifyChatLobbyEvent(*it,RS_CHAT_LOBBY_EVENT_KEEP_ALIVE,"------------","") ;
|
||||
RsServer::notify()->notifyChatLobbyEvent(*it,RS_CHAT_LOBBY_EVENT_KEEP_ALIVE,"------------","") ;
|
||||
|
||||
// send connection challenges
|
||||
//
|
||||
@ -3245,7 +3245,7 @@ void p3ChatService::addVirtualPeer(const TurtleFileHash& hash,const TurtleVirtua
|
||||
|
||||
// Notify the GUI that the tunnel is up.
|
||||
//
|
||||
rsicontrol->getNotify().notifyChatStatus(hash,"tunnel is up again!",true) ;
|
||||
RsServer::notify()->notifyChatStatus(hash,"tunnel is up again!",true) ;
|
||||
}
|
||||
|
||||
void p3ChatService::removeVirtualPeer(const TurtleFileHash& hash,const TurtleVirtualPeerId& virtual_peer_id)
|
||||
@ -3263,8 +3263,8 @@ void p3ChatService::removeVirtualPeer(const TurtleFileHash& hash,const TurtleVir
|
||||
|
||||
it->second.status = RS_DISTANT_CHAT_STATUS_TUNNEL_DN ;
|
||||
}
|
||||
rsicontrol->getNotify().notifyChatStatus(hash,"tunnel is down...",true) ;
|
||||
rsicontrol->getNotify().notifyPeerStatusChanged(hash,RS_STATUS_OFFLINE) ;
|
||||
RsServer::notify()->notifyChatStatus(hash,"tunnel is down...",true) ;
|
||||
RsServer::notify()->notifyPeerStatusChanged(hash,RS_STATUS_OFFLINE) ;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_DISTANT_CHAT
|
||||
@ -3366,7 +3366,7 @@ void p3ChatService::receiveTurtleData( RsTurtleGenericTunnelItem *gitem,const st
|
||||
// Setup the virtual peer to be the origin, and pass it on.
|
||||
//
|
||||
citem->PeerId(hash) ;
|
||||
//rsicontrol->getNotify().notifyPeerStatusChanged(hash,RS_STATUS_ONLINE) ;
|
||||
//RsServer::notify()->notifyPeerStatusChanged(hash,RS_STATUS_ONLINE) ;
|
||||
|
||||
handleIncomingItem(citem) ; // Treats the item, and deletes it
|
||||
}
|
||||
@ -3625,7 +3625,7 @@ bool p3ChatService::initiateDistantChatConnexion(const std::string& encrypted_st
|
||||
|
||||
error_code = signature_checked ? RS_DISTANT_CHAT_ERROR_NO_ERROR : RS_DISTANT_CHAT_ERROR_UNKNOWN_KEY;
|
||||
|
||||
getPqiNotify()->AddPopupMessage(RS_POPUP_CHAT, hash, "Distant peer", "Conversation starts...");
|
||||
RsServer::notify()->AddPopupMessage(RS_POPUP_CHAT, hash, "Distant peer", "Conversation starts...");
|
||||
|
||||
// Save config, since a new invite was added.
|
||||
//
|
||||
@ -3656,7 +3656,7 @@ bool p3ChatService::initiateDistantChatConnexion(const std::string& hash,uint32_
|
||||
|
||||
startClientDistantChatConnection(hash,pgp_id,aes_key) ;
|
||||
|
||||
getPqiNotify()->AddPopupMessage(RS_POPUP_CHAT, hash, "Distant peer", "Conversation starts...");
|
||||
RsServer::notify()->AddPopupMessage(RS_POPUP_CHAT, hash, "Distant peer", "Conversation starts...");
|
||||
|
||||
error_code = RS_DISTANT_CHAT_ERROR_NO_ERROR ;
|
||||
return true ;
|
||||
|
@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "rsserver/p3face.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "services/p3disc.h"
|
||||
|
||||
@ -796,10 +796,10 @@ void p3disc::recvPeerDetails(RsDiscReply *item, const std::string &certGpgId)
|
||||
|
||||
}
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_NEIGHBOURS, NOTIFY_TYPE_MOD);
|
||||
|
||||
if(should_notify_discovery)
|
||||
rsicontrol->getNotify().notifyDiscInfoChanged();
|
||||
RsServer::notify()->notifyDiscInfoChanged();
|
||||
|
||||
/* cleanup (handled by caller) */
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "services/p3forums.h"
|
||||
#include "pqi/authssl.h"
|
||||
#include "util/rsdir.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "rsserver/p3face.h"
|
||||
|
||||
uint32_t convertToInternalFlags(uint32_t extFlags);
|
||||
uint32_t convertToExternalFlags(uint32_t intFlags);
|
||||
@ -401,8 +401,8 @@ bool p3Forums::setMessageStatus(const std::string& fId,const std::string& mId,co
|
||||
} /******* UNLOCKED ********/
|
||||
|
||||
if (changed) {
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_MOD);
|
||||
rsicontrol->getNotify().notifyForumMsgReadSatusChanged(fId, mId, newStatus);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_MOD);
|
||||
RsServer::notify()->notifyForumMsgReadSatusChanged(fId, mId, newStatus);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -613,8 +613,6 @@ bool p3Forums::getMessageCount(const std::string &fId, unsigned int &newCount, u
|
||||
/****************** Event Feedback (Overloaded form p3distrib) *************************/
|
||||
/***************************************************************************************/
|
||||
|
||||
#include "pqi/pqinotify.h"
|
||||
|
||||
void p3Forums::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags, bool historical)
|
||||
{
|
||||
const std::string &grpId = grp.grpId;
|
||||
@ -626,27 +624,27 @@ void p3Forums::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags, bool h
|
||||
case GRP_NEW_UPDATE:
|
||||
if (!historical)
|
||||
{
|
||||
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_FORUM_NEW, grpId, msgId, nullId);
|
||||
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_FORUM_NEW, grpId, msgId, nullId);
|
||||
}
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||
break;
|
||||
case GRP_UPDATE:
|
||||
if (!historical)
|
||||
{
|
||||
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_FORUM_UPDATE, grpId, msgId, nullId);
|
||||
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_FORUM_UPDATE, grpId, msgId, nullId);
|
||||
}
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_MOD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_MOD);
|
||||
break;
|
||||
case GRP_LOAD_KEY:
|
||||
break;
|
||||
case GRP_NEW_MSG:
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||
break;
|
||||
case GRP_SUBSCRIBED:
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_ADD);
|
||||
break;
|
||||
case GRP_UNSUBSCRIBED:
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_DEL);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_FORUMLIST_LOCKED, NOTIFY_TYPE_DEL);
|
||||
break;
|
||||
}
|
||||
return p3GroupDistrib::locked_notifyGroupChanged(grp, flags, historical);
|
||||
@ -675,7 +673,7 @@ bool p3Forums::locked_eventNewMsg(GroupInfo */*grp*/, RsDistribMsg *msg, const s
|
||||
|
||||
if (!historical)
|
||||
{
|
||||
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_FORUM_MSG, grpId, msgId, nullId);
|
||||
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_FORUM_MSG, grpId, msgId, nullId);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "services/p3msgservice.h"
|
||||
#include "pgp/pgpkeyutil.h"
|
||||
#include "pqi/p3cfgmgr.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
#include "rsserver/p3face.h"
|
||||
#include "serialiser/rsconfigitems.h"
|
||||
|
||||
#include "util/rsdebug.h"
|
||||
@ -140,7 +140,7 @@ void p3MsgService::processMsg(RsMsgItem *mi, bool incoming)
|
||||
mi->msgFlags &= (RS_MSG_FLAGS_ENCRYPTED | RS_MSG_FLAGS_SYSTEM); // remove flags except those
|
||||
mi->msgFlags |= RS_MSG_FLAGS_NEW;
|
||||
|
||||
pqiNotify *notify = getPqiNotify();
|
||||
p3Notify *notify = RsServer::notify();
|
||||
if (notify)
|
||||
{
|
||||
std::string title, message;
|
||||
@ -170,7 +170,7 @@ void p3MsgService::processMsg(RsMsgItem *mi, bool incoming)
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
}
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_ADD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_ADD);
|
||||
|
||||
/**** STACK UNLOCKED ***/
|
||||
}
|
||||
@ -241,7 +241,7 @@ void p3MsgService::handleIncomingItem(RsMsgItem *mi)
|
||||
changed = true ;
|
||||
}
|
||||
if(changed)
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
}
|
||||
|
||||
void p3MsgService::statusChange(const std::list<pqipeer> &/*plist*/)
|
||||
@ -409,7 +409,7 @@ int p3MsgService::checkOutgoingMessages()
|
||||
}
|
||||
|
||||
if(changed)
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -847,7 +847,7 @@ bool p3MsgService::removeMsgId(const std::string &mid)
|
||||
setMessageTag(mid, 0, false);
|
||||
setMsgParentId(msgId, 0);
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
}
|
||||
|
||||
return changed;
|
||||
@ -890,7 +890,7 @@ bool p3MsgService::markMsgIdRead(const std::string &mid, bool unreadByUser)
|
||||
} /* UNLOCKED */
|
||||
|
||||
if (changed) {
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -928,7 +928,7 @@ bool p3MsgService::setMsgFlag(const std::string &mid, uint32_t flag, uint32_t
|
||||
} /* UNLOCKED */
|
||||
|
||||
if (changed) {
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1021,7 +1021,7 @@ int p3MsgService::sendMessage(RsMsgItem *item)
|
||||
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST, NOTIFY_TYPE_ADD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST, NOTIFY_TYPE_ADD);
|
||||
|
||||
checkOutgoingMessages();
|
||||
|
||||
@ -1166,7 +1166,7 @@ bool p3MsgService::MessageToDraft(MessageInfo &info, const std::string &msgParen
|
||||
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1236,7 +1236,7 @@ bool p3MsgService::setMessageTagType(uint32_t tagId, std::string& text, uint32
|
||||
if (nNotifyType) {
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGE_TAGS, nNotifyType);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGE_TAGS, nNotifyType);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1292,7 +1292,7 @@ bool p3MsgService::removeMessageTagType(uint32_t tagId)
|
||||
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGE_TAGS, NOTIFY_TYPE_DEL);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGE_TAGS, NOTIFY_TYPE_DEL);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1400,7 +1400,7 @@ bool p3MsgService::setMessageTag(const std::string &msgId, uint32_t tagId, bool
|
||||
if (nNotifyType) {
|
||||
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGE_TAGS, nNotifyType);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGE_TAGS, nNotifyType);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1467,7 +1467,7 @@ bool p3MsgService::MessageToTrash(const std::string &mid, bool bTrash)
|
||||
|
||||
checkOutgoingMessages();
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
}
|
||||
|
||||
return bFound;
|
||||
@ -2058,7 +2058,7 @@ bool p3MsgService::decryptMessage(const std::string& mId)
|
||||
delete item ;
|
||||
|
||||
IndicateConfigChanged() ;
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_MOD);
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "services/p3statusservice.h"
|
||||
#include "serialiser/rsstatusitems.h"
|
||||
#include "rsserver/p3face.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
|
||||
#include <iostream>
|
||||
@ -183,7 +184,7 @@ bool p3StatusService::sendStatus(const std::string &id, uint32_t status)
|
||||
}
|
||||
|
||||
/* send notify of own status change */
|
||||
rsicontrol->getNotify().notifyPeerStatusChanged(statusInfo.id, statusInfo.status);
|
||||
RsServer::notify()->notifyPeerStatusChanged(statusInfo.id, statusInfo.status);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -242,9 +243,9 @@ void p3StatusService::receiveStatusQueue()
|
||||
if (changed.size()) {
|
||||
std::map<std::string, uint32_t>::iterator it;
|
||||
for (it = changed.begin(); it != changed.end(); it++) {
|
||||
rsicontrol->getNotify().notifyPeerStatusChanged(it->first, it->second);
|
||||
RsServer::notify()->notifyPeerStatusChanged(it->first, it->second);
|
||||
}
|
||||
rsicontrol->getNotify().notifyPeerStatusChangedSummary();
|
||||
RsServer::notify()->notifyPeerStatusChangedSummary();
|
||||
}
|
||||
}
|
||||
|
||||
@ -361,7 +362,7 @@ void p3StatusService::statusChange(const std::list<pqipeer> &plist)
|
||||
} /* UNLOCKED */
|
||||
|
||||
changedState = true;
|
||||
rsicontrol->getNotify().notifyPeerStatusChanged(it->id, RS_STATUS_OFFLINE);
|
||||
RsServer::notify()->notifyPeerStatusChanged(it->id, RS_STATUS_OFFLINE);
|
||||
}
|
||||
|
||||
if (it->actions & RS_PEER_CONNECTED) {
|
||||
@ -383,7 +384,7 @@ void p3StatusService::statusChange(const std::list<pqipeer> &plist)
|
||||
} /* UNLOCKED */
|
||||
|
||||
changedState = true;
|
||||
rsicontrol->getNotify().notifyPeerStatusChanged(it->id, RS_STATUS_ONLINE);
|
||||
RsServer::notify()->notifyPeerStatusChanged(it->id, RS_STATUS_ONLINE);
|
||||
}
|
||||
} else if (it->actions & RS_PEER_MOVED) {
|
||||
/* now handle remove */
|
||||
@ -394,12 +395,12 @@ void p3StatusService::statusChange(const std::list<pqipeer> &plist)
|
||||
} /* UNLOCKED */
|
||||
|
||||
changedState = true;
|
||||
rsicontrol->getNotify().notifyPeerStatusChanged(it->id, RS_STATUS_OFFLINE);
|
||||
RsServer::notify()->notifyPeerStatusChanged(it->id, RS_STATUS_OFFLINE);
|
||||
}
|
||||
}
|
||||
|
||||
if (changedState)
|
||||
{
|
||||
rsicontrol->getNotify().notifyPeerStatusChangedSummary();
|
||||
RsServer::notify()->notifyPeerStatusChangedSummary();
|
||||
}
|
||||
}
|
||||
|
@ -33,12 +33,11 @@
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "rsserver/p3face.h"
|
||||
|
||||
#include "pqi/authssl.h"
|
||||
#include "pqi/p3linkmgr.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
|
||||
#include "ft/ftserver.h"
|
||||
#include "ft/ftdatamultiplex.h"
|
||||
@ -1884,7 +1883,7 @@ void p3turtle::returnSearchResult(RsTurtleSearchResultItem *item)
|
||||
std::cerr << " Returning result for search request " << (void*)item->request_id << " upwards." << std::endl ;
|
||||
#endif
|
||||
|
||||
rsicontrol->getNotify().notifyTurtleSearchResult(item->request_id,item->result) ;
|
||||
RsServer::notify()->notifyTurtleSearchResult(item->request_id,item->result) ;
|
||||
}
|
||||
|
||||
/// Warning: this function should never be called while the turtle mutex is locked.
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "util/rsdir.h"
|
||||
#include "util/rsstring.h"
|
||||
#include "util/rsrandom.h"
|
||||
#include "pqi/pqinotify.h"
|
||||
#include "retroshare/rstypes.h"
|
||||
#include "rsthreads.h"
|
||||
#include <iostream>
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <time.h>
|
||||
#include "rsserver/p3face.h"
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "retroshare/rsiface.h"
|
||||
#include "retroshare/rsinit.h"
|
||||
@ -194,7 +195,7 @@ bool RsDiscSpace::checkForDiscSpace(RsDiscSpace::DiscLocation loc)
|
||||
bool res = _current_size[loc] > _size_limit_mb ;
|
||||
|
||||
if(_last_res[loc] && !res)
|
||||
rsicontrol->getNotify().notifyDiskFull(loc,_size_limit_mb) ;
|
||||
RsServer::notify()->notifyDiskFull(loc,_size_limit_mb) ;
|
||||
|
||||
_last_res[loc] = res ;
|
||||
|
||||
|
@ -204,7 +204,7 @@ void ConfCertDialog::load()
|
||||
ui.version->setText(QString::fromStdString(vit->second));
|
||||
|
||||
RsPeerCryptoParams cdet ;
|
||||
if(rsicontrol->getPeerCryptoDetails(detail.id,cdet) && cdet.connexion_state!=0)
|
||||
if(RsControl::instance()->getPeerCryptoDetails(detail.id,cdet) && cdet.connexion_state!=0)
|
||||
{
|
||||
QString ct ;
|
||||
ct += QString::fromStdString(cdet.cipher_name) ;
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "ConnectFriendWizard.h"
|
||||
#include "ui_ConnectFriendWizard.h"
|
||||
#include "gui/common/PeerDefs.h"
|
||||
#include "gui/notifyqt.h"
|
||||
#include "gui/common/GroupDefs.h"
|
||||
#include "gui/GetStartedDialog.h"
|
||||
#include "gui/msgs/MessageComposer.h"
|
||||
@ -713,7 +714,7 @@ void ConnectFriendWizard::accept()
|
||||
ConnectProgressDialog::showProgress(ssl_id);
|
||||
}
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_NEIGHBOURS,1) ;
|
||||
NotifyQt::getInstance()->notifyListChange(NOTIFY_LIST_NEIGHBOURS,1) ;
|
||||
|
||||
QDialog::accept();
|
||||
}
|
||||
@ -1018,8 +1019,8 @@ void ConnectFriendWizard::signAllSelectedUsers()
|
||||
ui->selectedPeersTW->setEnabled(false);
|
||||
ui->makeFriendButton->setEnabled(false);
|
||||
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_NEIGHBOURS,0);
|
||||
rsicontrol->getNotify().notifyListChange(NOTIFY_LIST_FRIENDS,0);
|
||||
NotifyQt::getInstance()->notifyListChange(NOTIFY_LIST_NEIGHBOURS,0);
|
||||
NotifyQt::getInstance()->notifyListChange(NOTIFY_LIST_FRIENDS,0);
|
||||
}
|
||||
|
||||
//============================= RsidPage =====================================
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <retroshare/rsiface.h>
|
||||
#include <retroshare/rsturtle.h>
|
||||
#include <retroshare/rsnotify.h>
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QPoint>
|
||||
@ -24,7 +25,7 @@ class SignatureEventData ;
|
||||
struct TurtleFileInfo;
|
||||
|
||||
//class NotifyQt: public NotifyBase, public QObject
|
||||
class NotifyQt: public QObject, public NotifyBase
|
||||
class NotifyQt: public QObject, public NotifyClient
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@ -143,47 +144,23 @@ class NotifyQt: public QObject, public NotifyBase
|
||||
|
||||
static NotifyQt *_instance;
|
||||
|
||||
/* system notifications */
|
||||
|
||||
void startWaitingToasters();
|
||||
|
||||
// QMutex waitingToasterMutex; // for lock of the waiting toaster list
|
||||
QList<Toaster*> waitingToasterList;
|
||||
|
||||
QTimer *runningToasterTimer;
|
||||
// QMutex runningToasterMutex; // for lock of the running toaster list
|
||||
QList<Toaster*> runningToasterList;
|
||||
|
||||
bool _enabled ;
|
||||
QMutex _mutex ;
|
||||
|
||||
std::map<std::string,SignatureEventData*> _deferred_signature_queue ;
|
||||
// void displayNeighbours();
|
||||
// void displayFriends();
|
||||
// void displayDirectories();
|
||||
// void displaySearch();
|
||||
// void displayChat();
|
||||
// void displayMessages();
|
||||
// void displayChannels();
|
||||
// void displayTransfers();
|
||||
|
||||
// void preDisplayNeighbours();
|
||||
// void preDisplayFriends();
|
||||
// void preDisplayDirectories();
|
||||
// void preDisplaySearch();
|
||||
// void preDisplayMessages();
|
||||
// void preDisplayChannels();
|
||||
// void preDisplayTransfers();
|
||||
|
||||
/* so we can update windows */
|
||||
NetworkDialog *cDialog;
|
||||
// FriendsDialog *fDialog;
|
||||
// SharedFilesDialog *dDialog;
|
||||
// TransfersDialog *tDialog;
|
||||
// ChatDialog *hDialog;
|
||||
// MessagesDialog *mDialog;
|
||||
// ChannelsDialog *sDialog;
|
||||
// MessengerWindow *mWindow;
|
||||
|
||||
// RsIface *iface;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -155,8 +155,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
Q_INIT_RESOURCE(images);
|
||||
|
||||
// This is needed to allocate rsNotify, so that it can be used to ask for PGP passphrase
|
||||
//
|
||||
RsControl::earlyInitNotificationSystem() ;
|
||||
|
||||
NotifyQt *notify = NotifyQt::Create();
|
||||
createRsControl(*notify);
|
||||
rsNotify->registerNotifyClient(notify);
|
||||
|
||||
/* RetroShare Core Objects */
|
||||
RsInit::InitRsConfig();
|
||||
@ -303,7 +307,7 @@ int main(int argc, char *argv[])
|
||||
splashScreen.showMessage(rshare.translate("SplashScreen", "Load configuration"), Qt::AlignHCenter | Qt::AlignBottom);
|
||||
|
||||
/* stop Retroshare if startup fails */
|
||||
if (!rsicontrol->StartupRetroShare())
|
||||
if (!RsControl::instance()->StartupRetroShare())
|
||||
{
|
||||
std::cerr << "libretroshare failed to startup!" << std::endl;
|
||||
return 1;
|
||||
@ -419,7 +423,7 @@ int main(int argc, char *argv[])
|
||||
RsGxsUpdateBroadcast::cleanup();
|
||||
#endif
|
||||
|
||||
rsicontrol->rsGlobalShutDown();
|
||||
RsControl::instance()->rsGlobalShutDown();
|
||||
|
||||
delete(soundManager);
|
||||
soundManager = NULL;
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
class NotifyTxt: public NotifyBase
|
||||
class NotifyTxt: public NotifyClient
|
||||
{
|
||||
public:
|
||||
NotifyTxt():mNotifyMtx("NotifyMtx") { return; }
|
||||
|
@ -29,6 +29,7 @@ linux-* {
|
||||
LIBS += ../../openpgpsdk/src/lib/libops.a -lbz2
|
||||
LIBS += -lssl -lupnp -lixml -lgnome-keyring
|
||||
LIBS *= -lcrypto -ldl -lz
|
||||
LIBS *= -rdynamic
|
||||
|
||||
gxs {
|
||||
# We need a explicit path here, to force using the home version of sqlite3 that really encrypts the database.
|
||||
|
@ -233,9 +233,12 @@ int main(int argc, char **argv)
|
||||
* You will need to create you own NotifyXXX class
|
||||
* if you want to receive notifications of events */
|
||||
|
||||
NotifyTxt *notify = new NotifyTxt();
|
||||
RsControl *rsServer = createRsControl(*notify);
|
||||
rsicontrol = rsServer ;
|
||||
// This is needed to allocate rsNotify, so that it can be used to ask for PGP passphrase
|
||||
//
|
||||
RsControl::earlyInitNotificationSystem() ;
|
||||
|
||||
NotifyTxt *notify = new NotifyTxt() ;
|
||||
rsNotify->registerNotifyClient(notify);
|
||||
|
||||
std::string preferredId, gpgId, gpgName, gpgEmail, sslName;
|
||||
RsInit::getPreferedAccountId(preferredId);
|
||||
@ -295,7 +298,7 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
/* Start-up libretroshare server threads */
|
||||
rsServer -> StartupRetroShare();
|
||||
RsControl::instance() -> StartupRetroShare();
|
||||
|
||||
#ifdef RS_INTRO_SERVER
|
||||
RsIntroServer rsIS;
|
||||
|
@ -255,7 +255,7 @@ int RpcProtoSystem::processSystemQuit(uint32_t chan_id, uint32_t /* msg_id */, u
|
||||
}
|
||||
case rsctrl::system::RequestSystemQuit::SHUTDOWN_RS:
|
||||
{
|
||||
rsicontrol->rsGlobalShutDown();
|
||||
RsControl::instance()->rsGlobalShutDown();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ class RsSshd: public RsThread, public RpcComms
|
||||
public:
|
||||
|
||||
// NB: This must be called EARLY before all the threads are launched.
|
||||
static RsSshd *InitRsSshd(const std::string &portstr, const std::string &rsakeyfile);
|
||||
static RsSshd *InitRsSshd(const std::string& portStr, const std::string &rsakeyfile);
|
||||
|
||||
|
||||
// Interface.
|
||||
|
Loading…
Reference in New Issue
Block a user