mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-25 23:45:49 -04:00
merged with upstream/master
This commit is contained in:
commit
5d9272055f
2052 changed files with 8495 additions and 3638 deletions
|
@ -39,6 +39,7 @@
|
|||
#include "util/rsthreads.h"
|
||||
|
||||
#include "chat/p3chatservice.h"
|
||||
#include "gxstunnel/p3gxstunnel.h"
|
||||
|
||||
#include "services/p3msgservice.h"
|
||||
#include "services/p3statusservice.h"
|
||||
|
@ -160,6 +161,7 @@ class RsServer: public RsControl, public RsTickingThread
|
|||
p3MsgService *msgSrv;
|
||||
p3ChatService *chatSrv;
|
||||
p3StatusService *mStatusSrv;
|
||||
p3GxsTunnelService *mGxsTunnels;
|
||||
|
||||
// This list contains all threaded services. It will be used to shut them down properly.
|
||||
|
||||
|
|
|
@ -65,11 +65,11 @@ ChatId::ChatId(RsPeerId id):
|
|||
peer_id = id;
|
||||
}
|
||||
|
||||
ChatId::ChatId(RsGxsId id):
|
||||
ChatId::ChatId(DistantChatPeerId id):
|
||||
lobby_id(0)
|
||||
{
|
||||
type = TYPE_PRIVATE_DISTANT;
|
||||
gxs_id = id;
|
||||
distant_chat_id = id;
|
||||
}
|
||||
|
||||
ChatId::ChatId(ChatLobbyId id):
|
||||
|
@ -93,7 +93,7 @@ ChatId::ChatId(std::string str):
|
|||
else if(str[0] == 'D')
|
||||
{
|
||||
type = TYPE_PRIVATE_DISTANT;
|
||||
gxs_id == GXSId(str.substr(1));
|
||||
distant_chat_id == DistantChatPeerId(str.substr(1));
|
||||
}
|
||||
else if(str[0] == 'L')
|
||||
{
|
||||
|
@ -143,7 +143,7 @@ std::string ChatId::toStdString() const
|
|||
else if(type == TYPE_PRIVATE_DISTANT)
|
||||
{
|
||||
str += "D";
|
||||
str += gxs_id.toStdString();
|
||||
str += distant_chat_id.toStdString();
|
||||
}
|
||||
else if(type == TYPE_LOBBY)
|
||||
{
|
||||
|
@ -186,7 +186,7 @@ bool ChatId::operator <(const ChatId& other) const
|
|||
case TYPE_PRIVATE:
|
||||
return peer_id < other.peer_id;
|
||||
case TYPE_PRIVATE_DISTANT:
|
||||
return gxs_id < other.gxs_id;
|
||||
return distant_chat_id < other.distant_chat_id;
|
||||
case TYPE_LOBBY:
|
||||
return lobby_id < other.lobby_id;
|
||||
case TYPE_BROADCAST:
|
||||
|
@ -210,7 +210,7 @@ bool ChatId::isSameEndpoint(const ChatId &other) const
|
|||
case TYPE_PRIVATE:
|
||||
return peer_id == other.peer_id;
|
||||
case TYPE_PRIVATE_DISTANT:
|
||||
return gxs_id == other.gxs_id;
|
||||
return distant_chat_id == other.distant_chat_id;
|
||||
case TYPE_LOBBY:
|
||||
return lobby_id == other.lobby_id;
|
||||
case TYPE_BROADCAST:
|
||||
|
@ -229,7 +229,7 @@ bool ChatId::isPeerId() const
|
|||
{
|
||||
return type == TYPE_PRIVATE;
|
||||
}
|
||||
bool ChatId::isGxsId() const
|
||||
bool ChatId::isDistantChatId() const
|
||||
{
|
||||
return type == TYPE_PRIVATE_DISTANT;
|
||||
}
|
||||
|
@ -251,14 +251,15 @@ RsPeerId ChatId::toPeerId() const
|
|||
return RsPeerId();
|
||||
}
|
||||
}
|
||||
RsGxsId ChatId::toGxsId() const
|
||||
|
||||
DistantChatPeerId ChatId::toDistantChatId() const
|
||||
{
|
||||
if(type == TYPE_PRIVATE_DISTANT)
|
||||
return gxs_id;
|
||||
return distant_chat_id;
|
||||
else
|
||||
{
|
||||
std::cerr << "ChatId Warning: conversation to RsGxsId requested, but type is different. Current value=\"" << toStdString() << "\"" << std::endl;
|
||||
return RsGxsId();
|
||||
std::cerr << "ChatId Warning: conversation to DistantChatPeerId requested, but type is different. Current value=\"" << toStdString() << "\"" << std::endl;
|
||||
return DistantChatPeerId();
|
||||
}
|
||||
}
|
||||
ChatLobbyId ChatId::toLobbyId() const
|
||||
|
@ -524,15 +525,15 @@ void p3Msgs::getPendingChatLobbyInvites(std::list<ChatLobbyInvite>& invites)
|
|||
{
|
||||
mChatSrv->getPendingChatLobbyInvites(invites) ;
|
||||
}
|
||||
bool p3Msgs::initiateDistantChatConnexion(const RsGxsId& to_gxs_id,const RsGxsId& from_gxs_id,uint32_t& error_code)
|
||||
bool p3Msgs::initiateDistantChatConnexion(const RsGxsId& to_gxs_id,const RsGxsId& from_gxs_id,DistantChatPeerId& pid,uint32_t& error_code)
|
||||
{
|
||||
return mChatSrv->initiateDistantChatConnexion(to_gxs_id,from_gxs_id,error_code) ;
|
||||
return mChatSrv->initiateDistantChatConnexion(to_gxs_id,from_gxs_id,pid,error_code) ;
|
||||
}
|
||||
bool p3Msgs::getDistantChatStatus(const RsGxsId &gxs_id,uint32_t &status,RsGxsId *from_gxs_id)
|
||||
bool p3Msgs::getDistantChatStatus(const DistantChatPeerId& pid,DistantChatPeerInfo& info)
|
||||
{
|
||||
return mChatSrv->getDistantChatStatus(gxs_id,status,from_gxs_id) ;
|
||||
return mChatSrv->getDistantChatStatus(pid,info) ;
|
||||
}
|
||||
bool p3Msgs::closeDistantChatConnexion(const RsGxsId& pid)
|
||||
bool p3Msgs::closeDistantChatConnexion(const DistantChatPeerId &pid)
|
||||
{
|
||||
return mChatSrv->closeDistantChatConnexion(pid) ;
|
||||
}
|
||||
|
|
|
@ -155,9 +155,9 @@ class p3Msgs: public RsMsgs
|
|||
virtual bool getLobbyAutoSubscribe(const ChatLobbyId& lobby_id);
|
||||
virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const RsGxsId& lobby_identity,const std::string& lobby_topic,const std::set<RsPeerId>& invited_friends,ChatLobbyFlags privacy_type) ;
|
||||
|
||||
virtual bool initiateDistantChatConnexion(const RsGxsId& to_gxs_id,const RsGxsId& from_gxs_id,uint32_t& error_code) ;
|
||||
virtual bool getDistantChatStatus(const RsGxsId& gxs_id,uint32_t& status, RsGxsId *from_gxs_id=NULL) ;
|
||||
virtual bool closeDistantChatConnexion(const RsGxsId &pid) ;
|
||||
virtual bool initiateDistantChatConnexion(const RsGxsId& to_gxs_id, const RsGxsId& from_gxs_id, DistantChatPeerId &pid, uint32_t& error_code) ;
|
||||
virtual bool getDistantChatStatus(const DistantChatPeerId& gxs_id,DistantChatPeerInfo& info);
|
||||
virtual bool closeDistantChatConnexion(const DistantChatPeerId &pid) ;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -56,6 +56,8 @@
|
|||
#include <openssl/rand.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <gxstunnel/p3gxstunnel.h>
|
||||
|
||||
#define ENABLE_GROUTER
|
||||
|
||||
#if (defined(__unix__) || defined(unix)) && !defined(USG)
|
||||
|
@ -264,7 +266,7 @@ bool doPortRestrictions = false;
|
|||
|
||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||
#ifndef WINDOWS_SYS
|
||||
int RsInit::InitRetroShare(int argc, char **argv, bool strictCheck)
|
||||
int RsInit::InitRetroShare(int argc, char **argv, bool /* strictCheck */)
|
||||
{
|
||||
/******************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||
#else
|
||||
|
@ -1486,13 +1488,17 @@ int RsServer::StartupRetroShare()
|
|||
pqih -> addService(tr,true);
|
||||
pqih -> addService(ftserver,true);
|
||||
|
||||
mGxsTunnels = new p3GxsTunnelService(mGxsIdService) ;
|
||||
mGxsTunnels->connectToTurtleRouter(tr) ;
|
||||
rsGxsTunnel = mGxsTunnels;
|
||||
|
||||
rsDisc = mDisc;
|
||||
rsMsgs = new p3Msgs(msgSrv, chatSrv);
|
||||
|
||||
// connect components to turtle router.
|
||||
|
||||
ftserver->connectToTurtleRouter(tr) ;
|
||||
chatSrv->connectToTurtleRouter(tr) ;
|
||||
chatSrv->connectToGxsTunnelService(mGxsTunnels) ;
|
||||
gr->connectToTurtleRouter(tr) ;
|
||||
#ifdef ENABLE_GROUTER
|
||||
msgSrv->connectToGlobalRouter(gr) ;
|
||||
|
@ -1504,6 +1510,7 @@ int RsServer::StartupRetroShare()
|
|||
pqih -> addService(msgSrv,true);
|
||||
pqih -> addService(chatSrv,true);
|
||||
pqih -> addService(mStatusSrv,true);
|
||||
pqih -> addService(mGxsTunnels,true);
|
||||
pqih -> addService(mReputations,true);
|
||||
|
||||
// set interfaces for plugins
|
||||
|
@ -1516,6 +1523,8 @@ int RsServer::StartupRetroShare()
|
|||
interfaces.mDisc = rsDisc;
|
||||
interfaces.mDht = rsDht;
|
||||
interfaces.mNotify = mNotify;
|
||||
interfaces.mServiceControl = serviceCtrl;
|
||||
interfaces.mPluginHandler = mPluginsManager;
|
||||
// gxs
|
||||
interfaces.mGxsDir = currGxsDir;
|
||||
interfaces.mIdentity = mGxsIdService;
|
||||
|
@ -1525,6 +1534,7 @@ int RsServer::StartupRetroShare()
|
|||
interfaces.mPgpAuxUtils = pgpAuxUtils;
|
||||
interfaces.mGxsForums = mGxsForums;
|
||||
interfaces.mGxsChannels = mGxsChannels;
|
||||
interfaces.mGxsTunnels = mGxsTunnels;
|
||||
interfaces.mReputations = mReputations;
|
||||
|
||||
mPluginsManager->setInterfaces(interfaces);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue