mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-13 19:42:28 -04:00
- 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:
parent
114352c0d6
commit
80f4401e88
21 changed files with 720 additions and 182 deletions
|
@ -31,6 +31,7 @@
|
|||
#include <iostream>
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <assert.h>
|
||||
|
||||
#include "rstypes.h"
|
||||
#include "rsgxsifacetypes.h"
|
||||
|
@ -86,12 +87,77 @@ const ChatLobbyFlags RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE( 0x00000001 ) ;
|
|||
|
||||
typedef uint64_t ChatLobbyId ;
|
||||
typedef uint64_t ChatLobbyMsgId ;
|
||||
typedef std::string ChatLobbyNickName ;
|
||||
typedef std::string ChatLobbyNickName ;
|
||||
|
||||
typedef RsPeerId DistantChatPeerId ;
|
||||
typedef GRouterKeyIdType DistantMsgPeerId ;
|
||||
|
||||
class MessageInfo
|
||||
typedef uint64_t MessageId ;
|
||||
|
||||
class MsgAddress
|
||||
{
|
||||
public:
|
||||
typedef enum { MSG_ADDRESS_TYPE_UNKNOWN = 0x00,
|
||||
MSG_ADDRESS_TYPE_RSPEERID = 0x01,
|
||||
MSG_ADDRESS_TYPE_RSGXSID = 0x02,
|
||||
MSG_ADDRESS_TYPE_EMAIL = 0x03 } AddressType;
|
||||
|
||||
typedef enum { MSG_ADDRESS_MODE_UNKNOWN = 0x00,
|
||||
MSG_ADDRESS_MODE_TO = 0x01,
|
||||
MSG_ADDRESS_MODE_CC = 0x02,
|
||||
MSG_ADDRESS_MODE_BCC = 0x03 } AddressMode;
|
||||
|
||||
explicit MsgAddress(const RsGxsId& gid, MsgAddress::AddressMode mmode)
|
||||
: _type(MSG_ADDRESS_TYPE_RSGXSID), _mode(mmode), _addr_string(gid.toStdString()){}
|
||||
|
||||
explicit MsgAddress(const RsPeerId& pid, MsgAddress::AddressMode mmode)
|
||||
: _type(MSG_ADDRESS_TYPE_RSPEERID), _mode(mmode), _addr_string(pid.toStdString()){}
|
||||
|
||||
explicit MsgAddress(const std::string& email, MsgAddress::AddressMode mmode)
|
||||
: _type(MSG_ADDRESS_TYPE_EMAIL), _mode(mmode), _addr_string(email){}
|
||||
|
||||
MsgAddress::AddressType type() { return _type ;}
|
||||
MsgAddress::AddressMode mode() { return _mode ;}
|
||||
|
||||
RsGxsId toGxsId() const { assert(_type==MSG_ADDRESS_TYPE_RSGXSID );return RsGxsId (_addr_string);}
|
||||
RsPeerId toRsPeerId() const { assert(_type==MSG_ADDRESS_TYPE_RSPEERID);return RsPeerId(_addr_string);}
|
||||
std::string toEmail() const { assert(_type==MSG_ADDRESS_TYPE_EMAIL );return _addr_string ;}
|
||||
|
||||
private:
|
||||
AddressType _type ;
|
||||
AddressMode _mode ;
|
||||
std::string _addr_string ;
|
||||
};
|
||||
|
||||
class MessageInfo_v2
|
||||
{
|
||||
public:
|
||||
//MessageInfo_v2() {}
|
||||
|
||||
unsigned int msgflags;
|
||||
|
||||
//RsMessageId msgId;
|
||||
MsgAddress from ;
|
||||
|
||||
std::list<MsgAddress> rcpt ;
|
||||
|
||||
// Headers
|
||||
//
|
||||
std::string subject;
|
||||
std::string msg;
|
||||
time_t time_stamp ;
|
||||
|
||||
//std::list<MessageHeader> headers ;
|
||||
|
||||
std::string attach_title;
|
||||
std::string attach_comment;
|
||||
std::list<FileInfo> files;
|
||||
|
||||
int size; /* total of files */
|
||||
int count; /* file count */
|
||||
};
|
||||
|
||||
class MessageInfo
|
||||
{
|
||||
public:
|
||||
MessageInfo() {}
|
||||
|
@ -127,6 +193,7 @@ public:
|
|||
int ts;
|
||||
};
|
||||
|
||||
|
||||
class MsgInfoSummary
|
||||
{
|
||||
public:
|
||||
|
@ -171,6 +238,7 @@ public:
|
|||
#define RS_DISTANT_CHAT_STATUS_TUNNEL_OK 0x0002
|
||||
#define RS_DISTANT_CHAT_STATUS_CAN_TALK 0x0003
|
||||
#define RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED 0x0004
|
||||
#define RS_DISTANT_CHAT_STATUS_WAITING_DH 0x0005
|
||||
|
||||
#define RS_DISTANT_CHAT_ERROR_NO_ERROR 0x0000
|
||||
#define RS_DISTANT_CHAT_ERROR_DECRYPTION_FAILED 0x0001
|
||||
|
@ -356,7 +424,7 @@ virtual ChatLobbyId createChatLobby(const std::string& lobby_name,const std::str
|
|||
/* Distant chat */
|
||||
/****************************************/
|
||||
|
||||
virtual bool initiateDistantChatConnexion(const RsGxsId& pid,DistantChatPeerId& id,uint32_t& error_code) = 0;
|
||||
virtual bool initiateDistantChatConnexion(const RsGxsId& pid,uint32_t& error_code) = 0;
|
||||
virtual bool getDistantChatStatus(const DistantChatPeerId& pid,RsGxsId& gxs_id,uint32_t& status) = 0;
|
||||
virtual bool closeDistantChatConnexion(const DistantChatPeerId& pid) = 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue