most of the protocol for distant chat works! Still needs some testing.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-GenericTunneling@6315 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-04-18 21:41:13 +00:00
parent d4a7c9ce2e
commit ff867d0fe5
11 changed files with 118 additions and 41 deletions

View file

@ -41,6 +41,7 @@
#include "gui/connect/ConfCertDialog.h"
#include <retroshare/rsfiles.h>
#include <retroshare/rsmsgs.h>
#include <retroshare/rspeers.h>
#include <retroshare/rsforums.h>
#include <retroshare/rschannels.h>
@ -1202,17 +1203,30 @@ static void processList(const QStringList &list, const QString &textSingular, co
if(link._time_stamp < time(NULL))
{
QMessageBox::information(NULL,tr("Chat link is expired"),tr("This chat link is expired. The destination peer will not answer.")) ;
QMessageBox::information(NULL,QObject::tr("Chat link is expired"),QObject::tr("This chat link is expired. The destination peer will not answer.")) ;
break ;
}
if(link._GPGid.toStdString() != rsPeers->getGPGOwnId())
{
QMessageBox::information(NULL,tr("Chat link cannot be decrypted"),tr("This chat link is encrypted with a key that is not yours. You can't used it. Key ID = ")+link._GPGId) ;
QMessageBox::information(NULL,QObject::tr("Chat link cannot be decrypted"),QObject::tr("This chat link is encrypted with a key that is not yours. You can't used it. Key ID = ")+link._GPGid) ;
break ;
}
if(!rsMsgs->initiateDistantChatConnexion(link._encrypted_chat_info.toStdString()))
QMessageBox::information(NULL,tr("Chat connexion is not possible"),tr("The distant chat connexion cannot be openned. Sorry.")) ;
std::string hash ;
uint32_t error_code ;
if(!rsMsgs->initiateDistantChatConnexion(link._encrypted_chat_info.toStdString(),hash,error_code))
{
QString error_msg ;
switch(error_code)
{
default:
case RS_DISTANT_CHAT_ERROR_DECRYPTION_FAILED: error_msg = QObject::tr("The link could not be decrypted.") ; break ;
case RS_DISTANT_CHAT_ERROR_SIGNATURE_MISMATCH: error_msg = QObject::tr("The link signature cannot be checked.") ; break ;
case RS_DISTANT_CHAT_ERROR_UNKNOWN_KEY: error_msg = QObject::tr("The link is signed by an unknown key.") ; break ;
}
QMessageBox::information(NULL,QObject::tr("Chat connexion is not possible"),error_msg) ;
}
}
break ;

View file

@ -98,9 +98,10 @@ void ChatDialog::init(const std::string &peerId, const QString &title)
if (rsMsgs->isLobbyId(peerId, lobby_id)) {
chatflags = RS_CHAT_OPEN | RS_CHAT_FOCUS; // use own flags
}
std::string distant_pgp_id = "" ;
if(distant_peer = rsMsgs->isDistantId(peerId,distant_pgp_id)) {
uint32_t distant_peer_status ;
if(distant_peer_status = rsMsgs->getDistantChatStatus(peerId)) {
chatflags = RS_CHAT_OPEN | RS_CHAT_FOCUS; // use own flags
}
@ -116,10 +117,10 @@ void ChatDialog::init(const std::string &peerId, const QString &title)
cd->init(peerId, QString::fromUtf8((*it).lobby_name.c_str()));
}
}
} else if(distant_peer) {
} else if(distant_peer_status > 0) {
cd = new PopupDistantChatDialog();
chatDialogs[peerId] = cd;
cd->init(peerId, tr("Distant peer (PGP id=%1)").arg(distant_pgp_id));
cd->init(peerId, tr("Distant peer (PGP id=%1)")) ;
} else {
RsPeerDetails sslDetails;
if (rsPeers->getPeerDetails(peerId, sslDetails)) {

View file

@ -1,6 +1,32 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2013, Cyril Soler
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QTimer>
#include "PopupDistantChatDialog.h"
PopupDistantChatDialog::~PopupDistantChatDialog()
{
delete _tunnel_check_timer ;
}
PopupDistantChatDialog::PopupDistantChatDialog(QWidget *parent, Qt::WFlags flags)
: PopupChatDialog(parent,flags)
{

View file

@ -2,7 +2,7 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006, crypton
* Copyright (C) 2013, Cyril Soler
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License