- implemented DH protocol for PFS encryption in distant chat between GXS ids.

- changed format of keyId in rstlvkeys.{h,cc}, but kept the serialisation for backward compatibility (A #define needs to be removed to fix it for good). Updated rsrecogn, rsmsgitems, gxssecurity accordingly
- added "chat peer" in IdDialog to help testing distant chat.

Distant chat works and is now encrypted. The GUI still needs some smoothing: display of correct peer names
in chat window, remove the need to add a message in p3chatservice.cc:3217 to force poping up the chat window.

- added MsgAddress class to handle generic address types while keeping type separation in Messages. Not used yet.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7403 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-06-12 10:28:23 +00:00
parent 114352c0d6
commit 80f4401e88
21 changed files with 720 additions and 182 deletions

View file

@ -27,10 +27,12 @@
#include "IdDialog.h"
#include "gui/gxs/GxsIdTreeWidgetItem.h"
#include "gui/common/UIStateHelper.h"
#include "gui/chat/ChatDialog.h"
#include <retroshare/rspeers.h>
#include <retroshare/rsidentity.h>
#include "retroshare/rsgxsflags.h"
#include "retroshare/rsmsgs.h"
#include <iostream>
@ -131,6 +133,7 @@ IdDialog::IdDialog(QWidget *parent)
connect(ui.toolButton_EditId, SIGNAL(clicked()), this, SLOT(editIdentity()));
connect(ui.removeIdentity, SIGNAL(triggered()), this, SLOT(removeIdentity()));
connect(ui.editIdentity, SIGNAL(triggered()), this, SLOT(editIdentity()));
connect(ui.chatIdentity, SIGNAL(triggered()), this, SLOT(chatIdentity()));
connect(ui.treeWidget_IdList, SIGNAL(itemSelectionChanged()), this, SLOT(updateSelection()));
connect(ui.treeWidget_IdList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(IdListCustomPopupMenu(QPoint)));
@ -505,6 +508,7 @@ void IdDialog::insertIdDetails(uint32_t token)
mStateHelper->setWidgetEnabled(ui.toolButton_EditId, true);
ui.editIdentity->setEnabled(true);
ui.removeIdentity->setEnabled(true);
ui.chatIdentity->setEnabled(false);
}
else
{
@ -514,6 +518,7 @@ void IdDialog::insertIdDetails(uint32_t token)
mStateHelper->setWidgetEnabled(ui.toolButton_EditId, false);
ui.editIdentity->setEnabled(false);
ui.removeIdentity->setEnabled(false);
ui.chatIdentity->setEnabled(true);
}
/* now fill in the reputation information */
@ -779,7 +784,31 @@ void IdDialog::IdListCustomPopupMenu( QPoint )
QMenu contextMnu( this );
contextMnu.addAction(ui.editIdentity);
contextMnu.addAction(ui.removeIdentity);
contextMnu.addAction(ui.removeIdentity);
contextMnu.addAction(ui.chatIdentity);
contextMnu.exec(QCursor::pos());
}
void IdDialog::chatIdentity()
{
QTreeWidgetItem *item = ui.treeWidget_IdList->currentItem();
if (!item)
{
std::cerr << "IdDialog::editIdentity() Invalid item";
std::cerr << std::endl;
return;
}
std::string keyId = item->text(RSID_COL_KEYID).toStdString();
DistantChatPeerId virtual_peer_id ;
uint32_t error_code ;
if(!rsMsgs->initiateDistantChatConnexion(RsGxsId(keyId), virtual_peer_id, error_code))
QMessageBox::information(NULL,"Distant cannot work","Distant chat refused with this peer. Reason: "+QString::number(error_code)) ;
else
ChatDialog::chatFriend(virtual_peer_id);
}

View file

@ -61,6 +61,7 @@ private slots:
void addIdentity();
void removeIdentity();
void editIdentity();
void chatIdentity();
void updateSelection();

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>605</width>
<height>442</height>
<height>497</height>
</rect>
</property>
<property name="sizePolicy">
@ -676,6 +676,18 @@
<string>Delete Identity</string>
</property>
</action>
<action name="chatIdentity">
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/toaster/chat.png</normaloff>:/images/toaster/chat.png</iconset>
</property>
<property name="text">
<string>Chat with this peer</string>
</property>
<property name="toolTip">
<string>Launches a distant chat with this peer</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>