mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge pull request #1680 from csoler/v0.6-DistantChat
enabled buffering for distant chat, so that msgs are sent when the tu…
This commit is contained in:
commit
52b675fb6d
@ -341,7 +341,7 @@ bool p3ChatService::sendChat(ChatId destination, std::string msg)
|
||||
message.incoming = false;
|
||||
message.online = true;
|
||||
|
||||
if(!isOnline(vpid))
|
||||
if(!isOnline(vpid) && !destination.isDistantChatId())
|
||||
{
|
||||
message.online = false;
|
||||
RsServer::notify()->notifyChatMessage(message);
|
||||
@ -352,11 +352,15 @@ bool p3ChatService::sendChat(ChatId destination, std::string msg)
|
||||
|
||||
RsGxsTransId tId = RSRandom::random_u64();
|
||||
|
||||
#ifdef SUSPENDED_CODE
|
||||
// this part of the code was formerly used to send the traffic over GxsTransport. The problem is that
|
||||
// gxstunnel takes care of reaching the peer already, so GxsTransport would only be needed when the
|
||||
// current peer is offline. So we need to fin a way to quickly push the items to friends when quitting RS.
|
||||
|
||||
if(destination.isDistantChatId())
|
||||
{
|
||||
RS_STACK_MUTEX(mDGMutex);
|
||||
DIDEMap::const_iterator it =
|
||||
mDistantGxsMap.find(destination.toDistantChatId());
|
||||
DIDEMap::const_iterator it = mDistantGxsMap.find(destination.toDistantChatId());
|
||||
if(it != mDistantGxsMap.end())
|
||||
{
|
||||
const DistantEndpoints& de(it->second);
|
||||
@ -371,6 +375,7 @@ bool p3ChatService::sendChat(ChatId destination, std::string msg)
|
||||
<< "chat id in mDistantGxsMap this is unxpected!"
|
||||
<< std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
// peer is offline, add to outgoing list
|
||||
{
|
||||
@ -412,10 +417,10 @@ bool p3ChatService::sendChat(ChatId destination, std::string msg)
|
||||
|
||||
RsServer::notify()->notifyChatMessage(message);
|
||||
|
||||
// cyril: history is temporarily diabled for distant chat, since we need to store the full tunnel ID, but then
|
||||
// cyril: history is temporarily disabled for distant chat, since we need to store the full tunnel ID, but then
|
||||
// at loading time, the ID is not known so that chat window shows 00000000 as a peer.
|
||||
|
||||
if(!message.chat_id.isDistantChatId())
|
||||
//if(!message.chat_id.isDistantChatId())
|
||||
mHistoryMgr->addMessage(message);
|
||||
|
||||
checkSizeAndSendMessage(ci);
|
||||
@ -871,10 +876,6 @@ bool p3ChatService::handleRecvChatMsgItem(RsChatMsgItem *& ci)
|
||||
cm.online = true;
|
||||
RsServer::notify()->notifyChatMessage(cm);
|
||||
|
||||
// cyril: history is temporarily diabled for distant chat, since we need to store the full tunnel ID, but then
|
||||
// at loading time, the ID is not known so that chat window shows 00000000 as a peer.
|
||||
|
||||
if(!cm.chat_id.isDistantChatId())
|
||||
mHistoryMgr->addMessage(cm);
|
||||
|
||||
return true ;
|
||||
|
@ -112,6 +112,8 @@ int p3GxsTunnelService::tick()
|
||||
#endif
|
||||
|
||||
flush() ;
|
||||
|
||||
rstime::rs_usleep(1000*500);
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
@ -1294,8 +1296,7 @@ bool p3GxsTunnelService::locked_sendEncryptedTunnelData(RsGxsTunnelItem *item)
|
||||
}
|
||||
if(it->second.status != RS_GXS_TUNNEL_STATUS_CAN_TALK)
|
||||
{
|
||||
std::cerr << "(EE) Cannot talk to tunnel id " << tunnel_id
|
||||
<< ". Tunnel status is: " << it->second.status << std::endl;
|
||||
std::cerr << "(EE) Cannot talk to tunnel id " << tunnel_id << ". Tunnel status is: " << it->second.status << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,21 @@ void p3HistoryMgr::addMessage(const ChatMessage& cm)
|
||||
{
|
||||
DistantChatPeerInfo dcpinfo;
|
||||
if (rsMsgs->getDistantChatStatus(cm.chat_id.toDistantChatId(), dcpinfo))
|
||||
peerName = cm.chat_id.toPeerId().toStdString();
|
||||
{
|
||||
RsIdentityDetails det;
|
||||
RsGxsId writer_id = cm.incoming?(dcpinfo.to_id):(dcpinfo.own_id);
|
||||
|
||||
if(rsIdentity->getIdDetails(writer_id,det))
|
||||
peerName = det.mNickname;
|
||||
else
|
||||
peerName = writer_id.toStdString();
|
||||
}
|
||||
else
|
||||
{
|
||||
RsErr() << "Cannot retrieve friend name for distant chat " << cm.chat_id.toDistantChatId() << std::endl;
|
||||
peerName = "";
|
||||
}
|
||||
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
|
@ -435,8 +435,8 @@ ChatWidget::ChatType ChatWidget::chatType()
|
||||
void ChatWidget::blockSending(QString msg)
|
||||
{
|
||||
#ifndef RS_ASYNC_CHAT
|
||||
sendingBlocked = true;
|
||||
ui->sendButton->setEnabled(false);
|
||||
// sendingBlocked = true;
|
||||
// ui->sendButton->setEnabled(false);
|
||||
#endif
|
||||
ui->sendButton->setToolTip(msg);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user