fixed compilation, added missing methods for new distant chat

This commit is contained in:
csoler 2015-11-28 14:55:56 -05:00
parent 6ca49a2d98
commit a29f15ae32
13 changed files with 124 additions and 46 deletions

View file

@ -97,7 +97,7 @@ bool DistantChatService::handleOutgoingItem(RsChatItem *item)
void DistantChatService::handleRecvChatStatusItem(RsChatStatusItem *cs)
{
if(cs->flags & RS_CHAT_FLAG_CLOSING_DISTANT_CONNECTION)
markDistantChatAsClosed(RsGxsId(cs->PeerId())) ;
markDistantChatAsClosed(DistantChatPeerId(cs->PeerId())) ;
// nothing more to do, because the decryption routing will update the last_contact time when decrypting.
@ -105,6 +105,30 @@ void DistantChatService::handleRecvChatStatusItem(RsChatStatusItem *cs)
std::cerr << "DistantChatService::handleRecvChatStatusItem(): received keep alive packet for inactive chat! peerId=" << cs->PeerId() << std::endl;
}
void DistantChatService::notifyTunnelStatus(const RsGxsTunnelService::RsGxsTunnelId &tunnel_id, uint32_t tunnel_status)
{
std::cerr << "DistantChatService::notifyTunnelStatus(): got notification " << std::hex << tunnel_status << std::dec << " for tunnel " << tunnel_id << std::endl;
#warning do something here
}
void DistantChatService::receiveData(const RsGxsTunnelService::RsGxsTunnelId &tunnel_id, unsigned char *data, uint32_t data_size)
{
std::cerr << "DistantChatService::receiveData(): got data of size " << data_size << " for tunnel " << tunnel_id << std::endl;
#warning do something here
}
void DistantChatService::markDistantChatAsClosed(const DistantChatPeerId& dcpid)
{
mGxsTunnels->closeExistingTunnel(RsGxsTunnelService::RsGxsTunnelId(dcpid)) ;
RS_STACK_MUTEX(mDistantChatMtx) ;
std::map<DistantChatPeerId,DistantChatContact>::iterator it = mDistantChatContacts.find(dcpid) ;
if(it != mDistantChatContacts.end())
mDistantChatContacts.erase(it) ;
}
bool DistantChatService::initiateDistantChatConnexion(const RsGxsId& to_gxs_id, const RsGxsId& from_gxs_id, DistantChatPeerId& dcpid, uint32_t& error_code)
{
RsGxsTunnelId tunnel_id ;
@ -130,7 +154,7 @@ bool DistantChatService::getDistantChatStatus(const DistantChatPeerId& tunnel_id
RsGxsTunnelService::GxsTunnelInfo tinfo ;
if(!mGxsTunnels->getGxsTunnelInfo(RsGxsTunnelId(tunnel_id),tinfo))
if(!mGxsTunnels->getTunnelInfo(RsGxsTunnelId(tunnel_id),tinfo))
return false;
cinfo.to_id = tinfo.destination_gxs_id;

View file

@ -44,6 +44,8 @@ public:
mGxsTunnels = NULL ;
}
// Overloaded methods from RsGxsTunnelClientService
virtual void connectToGxsTunnelService(RsGxsTunnelService *tunnel_service) ;
// Creates the invite if the public key of the distant peer is available.
@ -79,8 +81,7 @@ private:
// Utility functions.
void markDistantChatAsClosed(const RsGxsId &gxs_id) ;
void startClientDistantChatConnection(const RsGxsId &to_gxs_id,const RsGxsId& from_gxs_id) ;
void markDistantChatAsClosed(const DistantChatPeerId& dcpid) ;
RsGxsTunnelService *mGxsTunnels ;

View file

@ -500,11 +500,11 @@ void p3ChatService::handleIncomingItem(RsItem *item)
return ; // don't delete! It's handled by handleRecvChatMsgItem in some specific cases only.
}
if(DistantChatService::handleRecvItem(dynamic_cast<RsChatItem*>(item)))
{
delete item ;
return ;
}
// if(DistantChatService::handleRecvItem(dynamic_cast<RsChatItem*>(item)))
// {
// delete item ;
// return ;
// }
if(DistributedChatService::handleRecvItem(dynamic_cast<RsChatItem*>(item)))
{