mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-17 02:21:03 -04:00
Improve async distant chat, fix chat msg receiving
DistantChatService::initiateDistantChatConnexion(...) made notification message optional (enabled by default) p3ChatService removed duplicion avoidance as it is not necessary p3ChatService::sendStatusString(...) send status only if peer is online protect p3ChatService::mDistantGxsMap with mutex as operation on it may be done by different threads p3ChatService::receiveGxsMai(...) set chat message item peer id with distant tunnel id, so it is recognized as a distant message later made p3GxsTunnelService::makeGxsTunnelId(...) static as it need no access to this, now it can be used easier by other components rename RsGxsMailItem::recipientsHint to recipientHint as for now only one recipient is possible (TODO: update documentation too) GxsMailsClient::receiveGxsMail(...) changed paramethers for better abstracion, now destination id is passed too because it is usually a very useful information ChatWidget some adaptation to async chat, a couple of method have been deprecated too PopupDistantChatDialog::updateDisplay(...) adapt message shown to the user to the new async chat paradigm (TODO: need review)
This commit is contained in:
parent
0f1106fd8f
commit
953b70fbe4
14 changed files with 212 additions and 212 deletions
|
@ -104,41 +104,52 @@ void PopupDistantChatDialog::updateDisplay()
|
|||
|
||||
QString msg;
|
||||
|
||||
switch(tinfo.status)
|
||||
{
|
||||
case RS_DISTANT_CHAT_STATUS_UNKNOWN: //std::cerr << "Unknown hash. Error!" << std::endl;
|
||||
_status_label->setIcon(QIcon(IMAGE_GRY_LED)) ;
|
||||
msg = tr("Chat remotely closed. Please close this window.");
|
||||
_status_label->setToolTip(msg) ;
|
||||
getChatWidget()->updateStatusString("%1", msg, true);
|
||||
getChatWidget()->blockSending(tr("Can't send message, because there is no tunnel."));
|
||||
setPeerStatus(RS_STATUS_OFFLINE) ;
|
||||
break ;
|
||||
case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED: std::cerr << "Chat remotely closed. " << std::endl;
|
||||
_status_label->setIcon(QIcon(IMAGE_RED_LED)) ;
|
||||
_status_label->setToolTip(QObject::tr("Distant peer has closed the chat")) ;
|
||||
|
||||
getChatWidget()->updateStatusString("%1", tr("The person you're talking to has deleted the secured chat tunnel. You may remove the chat window now."), true);
|
||||
getChatWidget()->blockSending(tr("Can't send message, because the chat partner deleted the secure tunnel."));
|
||||
setPeerStatus(RS_STATUS_OFFLINE) ;
|
||||
|
||||
break ;
|
||||
case RS_DISTANT_CHAT_STATUS_TUNNEL_DN: //std::cerr << "Tunnel asked. Waiting for reponse. " << std::endl;
|
||||
_status_label->setIcon(QIcon(IMAGE_RED_LED)) ;
|
||||
msg = QObject::tr("Tunnel is pending...");
|
||||
_status_label->setToolTip(msg) ;
|
||||
getChatWidget()->updateStatusString("%1", msg, true);
|
||||
getChatWidget()->blockSending(msg);
|
||||
setPeerStatus(RS_STATUS_OFFLINE) ;
|
||||
break ;
|
||||
case RS_DISTANT_CHAT_STATUS_CAN_TALK: //std::cerr << "Tunnel is ok and data is transmitted." << std::endl;
|
||||
_status_label->setIcon(QIcon(IMAGE_GRN_LED)) ;
|
||||
msg = QObject::tr("Secured tunnel is working. You can talk!");
|
||||
_status_label->setToolTip(msg) ;
|
||||
getChatWidget()->unblockSending();
|
||||
setPeerStatus(RS_STATUS_ONLINE) ;
|
||||
break ;
|
||||
}
|
||||
switch(tinfo.status)
|
||||
{
|
||||
case RS_DISTANT_CHAT_STATUS_UNKNOWN:
|
||||
//std::cerr << "Unknown hash. Error!" << std::endl;
|
||||
_status_label->setIcon(QIcon(IMAGE_GRY_LED));
|
||||
msg = tr("Remote status unknown.");
|
||||
_status_label->setToolTip(msg);
|
||||
getChatWidget()->updateStatusString("%1", msg, true);
|
||||
getChatWidget()->blockSending(tr( "Can't send message immediately, "
|
||||
"because there is no tunnel "
|
||||
"available." ));
|
||||
setPeerStatus(RS_STATUS_OFFLINE);
|
||||
break ;
|
||||
case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED:
|
||||
std::cerr << "Chat remotely closed. " << std::endl;
|
||||
_status_label->setIcon(QIcon(IMAGE_RED_LED));
|
||||
_status_label->setToolTip(
|
||||
QObject::tr("Distant peer has closed the chat") );
|
||||
getChatWidget()->updateStatusString(
|
||||
"%1", tr( "The person you're talking to has deleted the"
|
||||
"secured chat tunnel." ), true );
|
||||
getChatWidget()->blockSending(tr( "The chat partner deleted the secure"
|
||||
" tunnel, messages will be delivered"
|
||||
" as soon as possible"));
|
||||
setPeerStatus(RS_STATUS_OFFLINE) ;
|
||||
break ;
|
||||
case RS_DISTANT_CHAT_STATUS_TUNNEL_DN:
|
||||
//std::cerr << "Tunnel asked. Waiting for reponse. " << std::endl;
|
||||
_status_label->setIcon(QIcon(IMAGE_RED_LED));
|
||||
msg = QObject::tr( "Tunnel is pending... Messages will be delivered as"
|
||||
" soon as possible" );
|
||||
_status_label->setToolTip(msg);
|
||||
getChatWidget()->updateStatusString("%1", msg, true);
|
||||
getChatWidget()->blockSending(msg);
|
||||
setPeerStatus(RS_STATUS_OFFLINE);
|
||||
break;
|
||||
case RS_DISTANT_CHAT_STATUS_CAN_TALK:
|
||||
//std::cerr << "Tunnel is ok and data is transmitted." << std::endl;
|
||||
_status_label->setIcon(QIcon(IMAGE_GRN_LED));
|
||||
msg = QObject::tr( "Secured tunnel is working."
|
||||
"Messages are delivered immediately!" );
|
||||
_status_label->setToolTip(msg);
|
||||
getChatWidget()->unblockSending();
|
||||
setPeerStatus(RS_STATUS_ONLINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void PopupDistantChatDialog::closeEvent(QCloseEvent *e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue