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) void DistantChatService::handleRecvChatStatusItem(RsChatStatusItem *cs)
{ {
if(cs->flags & RS_CHAT_FLAG_CLOSING_DISTANT_CONNECTION) 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. // 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; 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) bool DistantChatService::initiateDistantChatConnexion(const RsGxsId& to_gxs_id, const RsGxsId& from_gxs_id, DistantChatPeerId& dcpid, uint32_t& error_code)
{ {
RsGxsTunnelId tunnel_id ; RsGxsTunnelId tunnel_id ;
@ -130,7 +154,7 @@ bool DistantChatService::getDistantChatStatus(const DistantChatPeerId& tunnel_id
RsGxsTunnelService::GxsTunnelInfo tinfo ; RsGxsTunnelService::GxsTunnelInfo tinfo ;
if(!mGxsTunnels->getGxsTunnelInfo(RsGxsTunnelId(tunnel_id),tinfo)) if(!mGxsTunnels->getTunnelInfo(RsGxsTunnelId(tunnel_id),tinfo))
return false; return false;
cinfo.to_id = tinfo.destination_gxs_id; cinfo.to_id = tinfo.destination_gxs_id;

View File

@ -44,6 +44,8 @@ public:
mGxsTunnels = NULL ; mGxsTunnels = NULL ;
} }
// Overloaded methods from RsGxsTunnelClientService
virtual void connectToGxsTunnelService(RsGxsTunnelService *tunnel_service) ; virtual void connectToGxsTunnelService(RsGxsTunnelService *tunnel_service) ;
// Creates the invite if the public key of the distant peer is available. // Creates the invite if the public key of the distant peer is available.
@ -79,8 +81,7 @@ private:
// Utility functions. // Utility functions.
void markDistantChatAsClosed(const RsGxsId &gxs_id) ; void markDistantChatAsClosed(const DistantChatPeerId& dcpid) ;
void startClientDistantChatConnection(const RsGxsId &to_gxs_id,const RsGxsId& from_gxs_id) ;
RsGxsTunnelService *mGxsTunnels ; 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. return ; // don't delete! It's handled by handleRecvChatMsgItem in some specific cases only.
} }
if(DistantChatService::handleRecvItem(dynamic_cast<RsChatItem*>(item))) // if(DistantChatService::handleRecvItem(dynamic_cast<RsChatItem*>(item)))
{ // {
delete item ; // delete item ;
return ; // return ;
} // }
if(DistributedChatService::handleRecvItem(dynamic_cast<RsChatItem*>(item))) if(DistributedChatService::handleRecvItem(dynamic_cast<RsChatItem*>(item)))
{ {

View File

@ -58,6 +58,8 @@ static const uint32_t RS_GXS_TUNNEL_DELAY_BETWEEN_RESEND = 10 ; // re-send ever
static const uint32_t GXS_TUNNEL_ENCRYPTION_HMAC_SIZE = SHA_DIGEST_LENGTH ; static const uint32_t GXS_TUNNEL_ENCRYPTION_HMAC_SIZE = SHA_DIGEST_LENGTH ;
static const uint32_t GXS_TUNNEL_ENCRYPTION_IV_SIZE = 8 ; static const uint32_t GXS_TUNNEL_ENCRYPTION_IV_SIZE = 8 ;
RsGxsTunnelService *rsGxsTunnel = NULL ;
p3GxsTunnelService::p3GxsTunnelService(RsGixs *pids) p3GxsTunnelService::p3GxsTunnelService(RsGixs *pids)
: mGixs(pids), mGxsTunnelMtx("GXS tunnel") : mGixs(pids), mGxsTunnelMtx("GXS tunnel")
{ {
@ -73,6 +75,22 @@ void p3GxsTunnelService::connectToTurtleRouter(p3turtle *tr)
tr->registerTunnelService(this) ; tr->registerTunnelService(this) ;
} }
bool p3GxsTunnelService::registerClientService(uint32_t service_id,RsGxsTunnelService::RsGxsTunnelClientService *service)
{
RS_STACK_MUTEX(mGxsTunnelMtx); /********** STACK LOCKED MTX ******/
if(mRegisteredServices.find(service_id) != mRegisteredServices.end())
{
std::cerr << "(EE) p3GxsTunnelService::registerClientService(): trying to register client " << std::hex << service_id << std::dec << ", which is already registered!" << std::endl;
return false;
}
std::cerr << "p3GxsTunnelService::registerClientService(): registering client service " << std::hex << service_id << std::dec << std::endl;
mRegisteredServices[service_id] = service ;
return true ;
}
void p3GxsTunnelService::flush() void p3GxsTunnelService::flush()
{ {
// Flush pending DH items. This is a higher priority, so we deal with them first. // Flush pending DH items. This is a higher priority, so we deal with them first.
@ -1193,6 +1211,31 @@ RsGxsId p3GxsTunnelService::destinationGxsIdFromHash(const TurtleFileHash& sum)
return RsGxsId(sum.toByteArray());// takes the first 16 bytes return RsGxsId(sum.toByteArray());// takes the first 16 bytes
} }
bool p3GxsTunnelService::getTunnelInfo(const RsGxsTunnelId& tunnel_id,GxsTunnelInfo& info)
{
RsStackMutex stack(mGxsTunnelMtx); /********** STACK LOCKED MTX ******/
std::map<RsGxsTunnelId,GxsTunnelPeerInfo>::const_iterator it = _gxs_tunnel_contacts.find(tunnel_id) ;
if(it == _gxs_tunnel_contacts.end())
return false ;
info.destination_gxs_id = it->second.to_gxs_id;
info.source_gxs_id = it->second.own_gxs_id;
info.tunnel_status = it->second.status;
#warning data missing here
info.total_size_sent = 0;
info.total_size_received= 0;
// Data packets
info.pending_data_packets = 0;
info.total_data_packets_sent=0 ;
info.total_data_packets_received=0 ;
return true ;
}
bool p3GxsTunnelService::getTunnelStatus(const RsGxsTunnelId& tunnel_id,uint32_t& status) bool p3GxsTunnelService::getTunnelStatus(const RsGxsTunnelId& tunnel_id,uint32_t& status)
{ {
RsStackMutex stack(mGxsTunnelMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mGxsTunnelMtx); /********** STACK LOCKED MTX ******/

View File

@ -126,6 +126,7 @@ public:
virtual bool closeExistingTunnel(const RsGxsTunnelId &tunnel_id) ; virtual bool closeExistingTunnel(const RsGxsTunnelId &tunnel_id) ;
virtual bool getTunnelStatus(const RsGxsTunnelId& tunnel_id,uint32_t &status); virtual bool getTunnelStatus(const RsGxsTunnelId& tunnel_id,uint32_t &status);
virtual bool getTunnelInfo(const RsGxsTunnelId& tunnel_id,GxsTunnelInfo& info);
virtual bool sendData(const RsGxsTunnelId& tunnel_id,uint32_t service_id,const uint8_t *data,uint32_t size) ; virtual bool sendData(const RsGxsTunnelId& tunnel_id,uint32_t service_id,const uint8_t *data,uint32_t size) ;
virtual bool registerClientService(uint32_t service_id,RsGxsTunnelClientService *service) ; virtual bool registerClientService(uint32_t service_id,RsGxsTunnelClientService *service) ;

View File

@ -333,7 +333,7 @@ bool RsGxsTunnelDataAckItem::serialise(void *data, uint32_t& pktsize)
/*************************************************************************/ /*************************************************************************/
RsGxsTunnelDHPublicKeyItem *deserialise_RsGxsTunnelDHPublicKeyItem(void *data,uint32_t /*size*/) RsGxsTunnelDHPublicKeyItem *RsGxsTunnelSerialiser::deserialise_RsGxsTunnelDHPublicKeyItem(void *data,uint32_t /*size*/)
{ {
uint32_t offset = 8; // skip the header uint32_t offset = 8; // skip the header
uint32_t rssize = getRsItemSize(data); uint32_t rssize = getRsItemSize(data);
@ -367,7 +367,7 @@ RsGxsTunnelDHPublicKeyItem *deserialise_RsGxsTunnelDHPublicKeyItem(void *data,ui
return item ; return item ;
} }
RsGxsTunnelDataItem *deserialise_RsGxsTunnelDataItem(void *dat,uint32_t size) RsGxsTunnelDataItem *RsGxsTunnelSerialiser::deserialise_RsGxsTunnelDataItem(void *dat,uint32_t size)
{ {
uint32_t offset = 8; // skip the header uint32_t offset = 8; // skip the header
uint32_t rssize = getRsItemSize(dat); uint32_t rssize = getRsItemSize(dat);
@ -415,7 +415,7 @@ RsGxsTunnelDataItem *deserialise_RsGxsTunnelDataItem(void *dat,uint32_t size)
return item ; return item ;
} }
RsGxsTunnelDataAckItem *deserialise_RsGxsTunnelDataAckItem(void *dat,uint32_t /* size */) RsGxsTunnelDataAckItem *RsGxsTunnelSerialiser::deserialise_RsGxsTunnelDataAckItem(void *dat,uint32_t /* size */)
{ {
uint32_t offset = 8; // skip the header uint32_t offset = 8; // skip the header
uint32_t rssize = getRsItemSize(dat); uint32_t rssize = getRsItemSize(dat);
@ -443,7 +443,7 @@ RsGxsTunnelDataAckItem *deserialise_RsGxsTunnelDataAckItem(void *dat,uint32_t /*
return item ; return item ;
} }
RsGxsTunnelStatusItem *deserialise_RsGxsTunnelStatusItem(void *dat,uint32_t size) RsGxsTunnelStatusItem *RsGxsTunnelSerialiser::deserialise_RsGxsTunnelStatusItem(void *dat,uint32_t size)
{ {
uint32_t offset = 8; // skip the header uint32_t offset = 8; // skip the header
uint32_t rssize = getRsItemSize(dat); uint32_t rssize = getRsItemSize(dat);

View File

@ -86,7 +86,7 @@ public:
//===================================================// //===================================================//
//virtual bool getGxsTunnelsInfo(std::vector<GxsTunnelInfo>& infos) =0; //virtual bool getGxsTunnelsInfo(std::vector<GxsTunnelInfo>& infos) =0;
//virtual bool getGxsTunnelInfo(const RsGxsTunnelId& tunnel_id,GxsTunnelInfo& info) =0; virtual bool getTunnelInfo(const RsGxsTunnelId& tunnel_id,GxsTunnelInfo& info) =0;
// retrieve the routing probabilities // retrieve the routing probabilities

View File

@ -1014,8 +1014,9 @@ void IdDialog::chatIdentity()
RsGxsId from_gxs_id(action->data().toString().toStdString()); RsGxsId from_gxs_id(action->data().toString().toStdString());
uint32_t error_code ; uint32_t error_code ;
DistantChatPeerId did ;
if(!rsMsgs->initiateDistantChatConnexion(RsGxsId(keyId), from_gxs_id, error_code)) if(!rsMsgs->initiateDistantChatConnexion(RsGxsId(keyId), from_gxs_id, did, error_code))
QMessageBox::information(NULL, tr("Distant chat cannot work"), QString("%1 %2: %3").arg(tr("Distant chat refused with this person.")).arg(tr("Error code")).arg(error_code)) ; QMessageBox::information(NULL, tr("Distant chat cannot work"), QString("%1 %2: %3").arg(tr("Distant chat refused with this person.")).arg(tr("Error code")).arg(error_code)) ;
} }

View File

@ -93,6 +93,7 @@ void ChatDialog::init(ChatId id, const QString &title)
/* see if it already exists */ /* see if it already exists */
ChatDialog *cd = getExistingChat(id); ChatDialog *cd = getExistingChat(id);
DistantChatPeerInfo pinfo ;
if (cd == NULL) { if (cd == NULL) {
@ -104,11 +105,15 @@ void ChatDialog::init(ChatId id, const QString &title)
ChatLobbyDialog* cld = new ChatLobbyDialog(id.toLobbyId()); ChatLobbyDialog* cld = new ChatLobbyDialog(id.toLobbyId());
cld->init(); cld->init();
cd = cld; cd = cld;
} else if(id.isGxsTunnelId()) { }
PopupDistantChatDialog* pdcd = new PopupDistantChatDialog(id.toGxsTunnelId()); else if(id.isPeerId() && rsMsgs->getDistantChatStatus(id.toPeerId(),pinfo))
pdcd->init() ; {
PopupDistantChatDialog* pdcd = new PopupDistantChatDialog(id.toPeerId());
pdcd->init(pinfo.peer_id, QString("This is a distant chat")) ;
cd = pdcd; cd = pdcd;
} else { }
else
{
RsPeerDetails sslDetails; RsPeerDetails sslDetails;
if (rsPeers->getPeerDetails(id.toPeerId(), sslDetails)) { if (rsPeers->getPeerDetails(id.toPeerId(), sslDetails)) {
PopupChatDialog* pcd = new PopupChatDialog(); PopupChatDialog* pcd = new PopupChatDialog();

View File

@ -553,7 +553,7 @@ void ChatLobbyDialog::distantChatParticipant()
rsMsgs->getIdentityForChatLobby(lobbyId, own_id); rsMsgs->getIdentityForChatLobby(lobbyId, own_id);
uint32_t error_code ; uint32_t error_code ;
RsGxsTunnelService::RsGxsTunnelId tunnel_id; DistantChatPeerId tunnel_id;
if(! rsMsgs->initiateDistantChatConnexion(gxs_id,own_id,tunnel_id,error_code)) if(! rsMsgs->initiateDistantChatConnexion(gxs_id,own_id,tunnel_id,error_code))
{ {

View File

@ -43,7 +43,7 @@ PopupDistantChatDialog::~PopupDistantChatDialog()
delete _update_timer ; delete _update_timer ;
} }
PopupDistantChatDialog::PopupDistantChatDialog(const RsGxsTunnelService::RsGxsTunnelId& tunnel_id,QWidget *parent, Qt::WindowFlags flags) PopupDistantChatDialog::PopupDistantChatDialog(const DistantChatPeerId& tunnel_id,QWidget *parent, Qt::WindowFlags flags)
: PopupChatDialog(parent,flags) : PopupChatDialog(parent,flags)
{ {
_tunnel_id = tunnel_id ; _tunnel_id = tunnel_id ;
@ -60,19 +60,20 @@ PopupDistantChatDialog::PopupDistantChatDialog(const RsGxsTunnelService::RsGxsTu
updateDisplay() ; updateDisplay() ;
} }
void PopupDistantChatDialog::init() void PopupDistantChatDialog::init(const DistantChatPeerId &peer_id, const QString &title)
{ {
RsGxsTunnelService::GxsTunnelInfo tinfo; _tunnel_id = peer_id;
DistantChatPeerInfo tinfo;
if(!rsGxsTunnels->getDistantChatStatus(tunnel_id,tinfo)) if(!rsMsgs->getDistantChatStatus(_tunnel_id,tinfo))
return ; return ;
PopupChatDialog::init(ChatId(tinfo.destination_gxs_id), title) ; PopupChatDialog::init(ChatId(tinfo.to_id), title) ;
// Do not use setOwnId, because we don't want the user to change the GXS avatar from the chat window // Do not use setOwnId, because we don't want the user to change the GXS avatar from the chat window
// it will not be transmitted. // it will not be transmitted.
ui.ownAvatarWidget->setId(ChatId(tinfo.source_gxs_id)); ui.ownAvatarWidget->setId(ChatId(tinfo.own_id));
} }
void PopupDistantChatDialog::updateDisplay() void PopupDistantChatDialog::updateDisplay()
@ -87,15 +88,15 @@ void PopupDistantChatDialog::updateDisplay()
// make sure about the tunnel status // make sure about the tunnel status
// //
RsGxsTunnelService::GxsTunnelInfo tinfo; DistantChatPeerInfo tinfo;
rsMsgs->getDistantChatStatus(_tunnel_id,tinfo) ; rsMsgs->getDistantChatStatus(_tunnel_id,tinfo) ;
ui.avatarWidget->setId(ChatId(tinfo.destination_gxs_id)); ui.avatarWidget->setId(ChatId(tinfo.to_id));
QString msg; QString msg;
switch(tinfo.tunnel_status) switch(tinfo.status)
{ {
case RsGxsTunnelService::RS_DISTANT_CHAT_STATUS_UNKNOWN: //std::cerr << "Unknown hash. Error!" << std::endl; case RS_DISTANT_CHAT_STATUS_UNKNOWN: //std::cerr << "Unknown hash. Error!" << std::endl;
_status_label->setPixmap(QPixmap(IMAGE_GRY_LED)) ; _status_label->setPixmap(QPixmap(IMAGE_GRY_LED)) ;
msg = tr("Hash Error. No tunnel."); msg = tr("Hash Error. No tunnel.");
_status_label->setToolTip(msg) ; _status_label->setToolTip(msg) ;
@ -103,7 +104,7 @@ void PopupDistantChatDialog::updateDisplay()
getChatWidget()->blockSending(tr("Can't send message, because there is no tunnel.")); getChatWidget()->blockSending(tr("Can't send message, because there is no tunnel."));
setPeerStatus(RS_STATUS_OFFLINE) ; setPeerStatus(RS_STATUS_OFFLINE) ;
break ; break ;
case RsGxsTunnelService::RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED: std::cerr << "Chat remotely closed. " << std::endl; case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED: std::cerr << "Chat remotely closed. " << std::endl;
_status_label->setPixmap(QPixmap(IMAGE_RED_LED)) ; _status_label->setPixmap(QPixmap(IMAGE_RED_LED)) ;
_status_label->setToolTip(QObject::tr("Distant peer has closed the chat")) ; _status_label->setToolTip(QObject::tr("Distant peer has closed the chat")) ;
@ -112,7 +113,7 @@ void PopupDistantChatDialog::updateDisplay()
setPeerStatus(RS_STATUS_OFFLINE) ; setPeerStatus(RS_STATUS_OFFLINE) ;
break ; break ;
case RsGxsTunnelService::RS_DISTANT_CHAT_STATUS_TUNNEL_DN: //std::cerr << "Tunnel asked. Waiting for reponse. " << std::endl; case RS_DISTANT_CHAT_STATUS_TUNNEL_DN: //std::cerr << "Tunnel asked. Waiting for reponse. " << std::endl;
_status_label->setPixmap(QPixmap(IMAGE_RED_LED)) ; _status_label->setPixmap(QPixmap(IMAGE_RED_LED)) ;
msg = QObject::tr("Tunnel is pending..."); msg = QObject::tr("Tunnel is pending...");
_status_label->setToolTip(msg) ; _status_label->setToolTip(msg) ;
@ -120,7 +121,7 @@ void PopupDistantChatDialog::updateDisplay()
getChatWidget()->blockSending(msg); getChatWidget()->blockSending(msg);
setPeerStatus(RS_STATUS_OFFLINE) ; setPeerStatus(RS_STATUS_OFFLINE) ;
break ; break ;
case RsGxsTunnelService::RS_DISTANT_CHAT_STATUS_CAN_TALK: //std::cerr << "Tunnel is ok and data is transmitted." << std::endl; case RS_DISTANT_CHAT_STATUS_CAN_TALK: //std::cerr << "Tunnel is ok and data is transmitted." << std::endl;
_status_label->setPixmap(QPixmap(IMAGE_GRN_LED)) ; _status_label->setPixmap(QPixmap(IMAGE_GRN_LED)) ;
msg = QObject::tr("Secured tunnel is working. You can talk!"); msg = QObject::tr("Secured tunnel is working. You can talk!");
_status_label->setToolTip(msg) ; _status_label->setToolTip(msg) ;
@ -134,10 +135,11 @@ void PopupDistantChatDialog::closeEvent(QCloseEvent *e)
{ {
//std::cerr << "Closing window => closing distant chat for hash " << _pid << std::endl; //std::cerr << "Closing window => closing distant chat for hash " << _pid << std::endl;
uint32_t status= RS_DISTANT_CHAT_STATUS_UNKNOWN; DistantChatPeerInfo tinfo ;
rsMsgs->getDistantChatStatus(_pid,status) ;
rsMsgs->getDistantChatStatus(_tunnel_id,tinfo) ;
if(status != RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED) if(tinfo.status != RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED)
{ {
QString msg = tr("Closing this window will end the conversation, notify the peer and remove the encrypted tunnel.") ; QString msg = tr("Closing this window will end the conversation, notify the peer and remove the encrypted tunnel.") ;
@ -157,26 +159,26 @@ void PopupDistantChatDialog::closeEvent(QCloseEvent *e)
QString PopupDistantChatDialog::getPeerName(const ChatId &id) const QString PopupDistantChatDialog::getPeerName(const ChatId &id) const
{ {
RsGxsTunnelService::GxsTunnelInfo tinfo; DistantChatPeerInfo tinfo;
rsMsgs->getDistantChatStatus(_tunnel_id,tinfo) ; rsMsgs->getDistantChatStatus(_tunnel_id,tinfo) ;
RsIdentityDetails details ; RsIdentityDetails details ;
if(rsIdentity->getIdDetails(destination_gxs_id,details)) if(rsIdentity->getIdDetails(tinfo.to_id,details))
return QString::fromUtf8( details.mNickname.c_str() ) ; return QString::fromUtf8( details.mNickname.c_str() ) ;
else else
return QString::fromStdString(destination_gxs_id.toStdString()) ; return QString::fromStdString(tinfo.to_id.toStdString()) ;
} }
QString PopupDistantChatDialog::getOwnName() const QString PopupDistantChatDialog::getOwnName() const
{ {
RsGxsTunnelService::GxsTunnelInfo tinfo; DistantChatPeerInfo tinfo;
rsMsgs->getDistantChatStatus(_tunnel_id,tinfo) ; rsMsgs->getDistantChatStatus(_tunnel_id,tinfo) ;
RsIdentityDetails details ; RsIdentityDetails details ;
if(rsIdentity->getIdDetails(source_gxs_id,details)) if(rsIdentity->getIdDetails(tinfo.own_id,details))
return QString::fromUtf8( details.mNickname.c_str() ) ; return QString::fromUtf8( details.mNickname.c_str() ) ;
else else
return QString::fromStdString(source_gxs_id.toStdString()) ; return QString::fromStdString(tinfo.own_id.toStdString()) ;
} }

View File

@ -34,11 +34,11 @@ class PopupDistantChatDialog: public PopupChatDialog
protected: protected:
/** Default constructor */ /** Default constructor */
PopupDistantChatDialog(const RsGxsTunnelService::RsGxsTunnelId &tunnel_id, QWidget *parent = 0, Qt::WindowFlags flags = 0); PopupDistantChatDialog(const DistantChatPeerId &tunnel_id, QWidget *parent = 0, Qt::WindowFlags flags = 0);
/** Default destructor */ /** Default destructor */
virtual ~PopupDistantChatDialog(); virtual ~PopupDistantChatDialog();
virtual void init(const RsGxsId &gxs_id, const QString &title); virtual void init(const DistantChatPeerId& peer_id, const QString &title);
virtual void closeEvent(QCloseEvent *e) ; virtual void closeEvent(QCloseEvent *e) ;
virtual QString getPeerName(const ChatId &id) const ; virtual QString getPeerName(const ChatId &id) const ;
@ -49,7 +49,7 @@ class PopupDistantChatDialog: public PopupChatDialog
private: private:
QTimer *_update_timer ; QTimer *_update_timer ;
RsGxsTunnelService::RsGxsTunnelId _tunnel_id ; DistantChatPeerId _tunnel_id ;
QLabel *_status_label ; QLabel *_status_label ;
friend class ChatDialog; friend class ChatDialog;

View File

@ -200,8 +200,9 @@ void AvatarWidget::refreshStatus()
} }
else if(mId.isGxsId()) else if(mId.isGxsId())
{ {
if(!rsMsgs->getDistantChatStatus(mId.toGxsId(),status)) //if(!rsMsgs->getDistantChatStatus(mId.toGxsId(),status))
status = RS_STATUS_OFFLINE ; status = RS_STATUS_OFFLINE ;
#warning we need to do something clever here
} }
else else
{ {