mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
Renamed GxsMails to GxsTrans
GxsTrans is a generic transport service, use more generic name trans instead of mail to avoid confusion Renamed size(...) to seria_size(...) for costistence whit the codebase Moved GxsTrans and related things to gxstrans directory Removed outdated and now uncompatible gxsmail test service Avoid expose internal items in public interface methods
This commit is contained in:
parent
08161db43b
commit
da459c884e
14 changed files with 427 additions and 500 deletions
|
@ -40,6 +40,7 @@
|
|||
#include "pqi/p3historymgr.h"
|
||||
#include "rsserver/p3face.h"
|
||||
#include "services/p3idservice.h"
|
||||
#include "gxstrans/p3gxstrans.h"
|
||||
|
||||
#include "chat/p3chatservice.h"
|
||||
#include "serialiser/rsconfigitems.h"
|
||||
|
@ -55,16 +56,16 @@ static const uint32_t MAX_AVATAR_JPEG_SIZE = 32767; // Maximum size
|
|||
|
||||
p3ChatService::p3ChatService( p3ServiceControl *sc, p3IdService *pids,
|
||||
p3LinkMgr *lm, p3HistoryMgr *historyMgr,
|
||||
p3GxsMails& gxsMailService ) :
|
||||
p3GxsTrans& gxsTransService ) :
|
||||
DistributedChatService(getServiceInfo().mServiceType, sc, historyMgr,pids),
|
||||
mChatMtx("p3ChatService"), mServiceCtrl(sc), mLinkMgr(lm),
|
||||
mHistoryMgr(historyMgr), _own_avatar(NULL),
|
||||
_serializer(new RsChatSerialiser()),
|
||||
mDGMutex("p3ChatService distant id - gxs id map mutex"),
|
||||
mGxsTransport(gxsMailService)
|
||||
mGxsTransport(gxsTransService)
|
||||
{
|
||||
addSerialType(_serializer);
|
||||
mGxsTransport.registerGxsMailsClient( GxsMailSubServices::P3_CHAT_SERVICE,
|
||||
mGxsTransport.registerGxsTransClient( GxsTransSubServices::P3_CHAT_SERVICE,
|
||||
this );
|
||||
}
|
||||
|
||||
|
@ -335,7 +336,7 @@ bool p3ChatService::sendChat(ChatId destination, std::string msg)
|
|||
// this is not very nice, because the user may think the message was send, while it is still in the queue
|
||||
mHistoryMgr->addMessage(message);
|
||||
|
||||
RsGxsMailId tId = RSRandom::random_u64();
|
||||
RsGxsTransId tId = RSRandom::random_u64();
|
||||
|
||||
if(destination.isDistantChatId())
|
||||
{
|
||||
|
@ -348,7 +349,7 @@ bool p3ChatService::sendChat(ChatId destination, std::string msg)
|
|||
uint32_t sz = ci->serial_size();
|
||||
std::vector<uint8_t> data; data.resize(sz);
|
||||
ci->serialise(&data[0], sz);
|
||||
mGxsTransport.sendMail(tId, GxsMailSubServices::P3_CHAT_SERVICE,
|
||||
mGxsTransport.sendMail(tId, GxsTransSubServices::P3_CHAT_SERVICE,
|
||||
de.from, de.to, &data[0], sz);
|
||||
}
|
||||
else
|
||||
|
@ -706,9 +707,10 @@ bool p3ChatService::initiateDistantChatConnexion( const RsGxsId& to_gxs_id,
|
|||
return false;
|
||||
}
|
||||
|
||||
bool p3ChatService::receiveGxsMail( const RsGxsId& authorId,
|
||||
const RsGxsId& recipientId,
|
||||
const uint8_t* data, uint32_t dataSize )
|
||||
bool p3ChatService::receiveGxsTransMail( const RsGxsId& authorId,
|
||||
const RsGxsId& recipientId,
|
||||
const uint8_t* data,
|
||||
uint32_t dataSize )
|
||||
{
|
||||
DistantChatPeerId pid;
|
||||
uint32_t error_code;
|
||||
|
@ -724,22 +726,22 @@ bool p3ChatService::receiveGxsMail( const RsGxsId& authorId,
|
|||
return true;
|
||||
}
|
||||
|
||||
std::cerr << "p3ChatService::receiveGxsMail(...) (EE) failed initiating"
|
||||
std::cerr << __PRETTY_FUNCTION__ << " (EE) failed initiating"
|
||||
<< " distant chat connection error: "<< error_code
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool p3ChatService::notifySendMailStatus( const RsGxsMailItem& originalMessage,
|
||||
GxsMailStatus status )
|
||||
bool p3ChatService::notifyGxsTransSendStatus(RsGxsTransId mailId,
|
||||
GxsTransSendStatus status )
|
||||
{
|
||||
if ( status != GxsMailStatus::RECEIPT_RECEIVED ) return true;
|
||||
if ( status != GxsTransSendStatus::RECEIPT_RECEIVED ) return true;
|
||||
|
||||
bool changed = false;
|
||||
|
||||
{
|
||||
RS_STACK_MUTEX(mChatMtx);
|
||||
auto it = privateOutgoingMap.find(originalMessage.mailId);
|
||||
auto it = privateOutgoingMap.find(mailId);
|
||||
if( it != privateOutgoingMap.end() )
|
||||
{
|
||||
privateOutgoingMap.erase(it);
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "chat/distantchat.h"
|
||||
#include "chat/distributedchat.h"
|
||||
#include "retroshare/rsmsgs.h"
|
||||
#include "services/p3gxsmails.h"
|
||||
#include "gxstrans/p3gxstrans.h"
|
||||
#include "util/rsdeprecate.h"
|
||||
|
||||
class p3ServiceControl;
|
||||
|
@ -55,10 +55,10 @@ typedef RsPeerId ChatLobbyVirtualPeerId ;
|
|||
*/
|
||||
struct p3ChatService :
|
||||
p3Service, DistantChatService, DistributedChatService, p3Config,
|
||||
pqiServiceMonitor, GxsMailsClient
|
||||
pqiServiceMonitor, GxsTransClient
|
||||
{
|
||||
p3ChatService( p3ServiceControl *cs, p3IdService *pids,p3LinkMgr *cm,
|
||||
p3HistoryMgr *historyMgr, p3GxsMails& gxsMailService );
|
||||
p3ChatService(p3ServiceControl *cs, p3IdService *pids, p3LinkMgr *cm,
|
||||
p3HistoryMgr *historyMgr, p3GxsTrans& gxsTransService );
|
||||
|
||||
virtual RsServiceInfo getServiceInfo();
|
||||
|
||||
|
@ -171,14 +171,14 @@ struct p3ChatService :
|
|||
uint32_t& error_code,
|
||||
bool notify = true );
|
||||
|
||||
/// @see GxsMailsClient::receiveGxsMail(...)
|
||||
virtual bool receiveGxsMail( const RsGxsId& authorId,
|
||||
const RsGxsId& recipientId,
|
||||
const uint8_t* data, uint32_t dataSize );
|
||||
/// @see GxsTransClient::receiveGxsTransMail(...)
|
||||
virtual bool receiveGxsTransMail( const RsGxsId& authorId,
|
||||
const RsGxsId& recipientId,
|
||||
const uint8_t* data, uint32_t dataSize );
|
||||
|
||||
/// @see GxsMailsClient::notifySendMailStatus(...)
|
||||
virtual bool notifySendMailStatus( const RsGxsMailItem& originalMessage,
|
||||
GxsMailStatus status );
|
||||
/// @see GxsTransClient::notifySendMailStatus(...)
|
||||
virtual bool notifyGxsTransSendStatus( RsGxsTransId mailId,
|
||||
GxsTransSendStatus status );
|
||||
|
||||
|
||||
protected:
|
||||
|
@ -270,7 +270,7 @@ private:
|
|||
DIDEMap mDistantGxsMap;
|
||||
RsMutex mDGMutex;
|
||||
|
||||
p3GxsMails& mGxsTransport;
|
||||
p3GxsTrans& mGxsTransport;
|
||||
};
|
||||
|
||||
class p3ChatService::StateStringInfo
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue