fixed compilation of RsNxsTransaction encryption code

This commit is contained in:
csoler 2016-01-01 21:37:27 -05:00
parent 6ecd2991e7
commit 9da8a8abc3
10 changed files with 454 additions and 898 deletions

View file

@ -405,7 +405,7 @@ bool GxsSecurity::validateNxsMsg(const RsNxsMsg& msg, const RsTlvKeySignature& s
return false; return false;
} }
bool GxsSecurity::initEncryption(GxsSecurity::MultiEncryptionContext& encryption_context, const std::list<RsTlvSecurityKey>& keys) bool GxsSecurity::initEncryption(GxsSecurity::MultiEncryptionContext& encryption_context, const std::vector<RsTlvSecurityKey>& keys)
{ {
// prepare an array of encrypted keys ek and public keys puk // prepare an array of encrypted keys ek and public keys puk
@ -439,7 +439,7 @@ bool GxsSecurity::initEncryption(GxsSecurity::MultiEncryptionContext& encryption
encryption_context.ek [i] = (unsigned char*)malloc(max_evp_key_size); encryption_context.ek [i] = (unsigned char*)malloc(max_evp_key_size);
encryption_context.ekl[i] = max_evp_key_size ; encryption_context.ekl[i] = max_evp_key_size ;
encryption_context.ids[i] = keys[i] ; encryption_context.ids[i] = keys[i].keyId ;
} }
EVP_CIPHER_CTX_init(&encryption_context.ctx); EVP_CIPHER_CTX_init(&encryption_context.ctx);
@ -455,7 +455,7 @@ bool GxsSecurity::initEncryption(GxsSecurity::MultiEncryptionContext& encryption
} }
catch(std::exception& e) catch(std::exception& e)
{ {
std::cerr << "(EE) cannot init encryption context: " << e.what << std::endl; std::cerr << "(EE) cannot init encryption context: " << e.what() << std::endl;
encryption_context.clear() ; encryption_context.clear() ;
return false ; return false ;
} }
@ -475,6 +475,7 @@ bool GxsSecurity::encrypt(uint8_t *& out, uint32_t &outlen, const uint8_t *in, u
int size_net_ekl = sizeof(net_ekl); int size_net_ekl = sizeof(net_ekl);
const EVP_CIPHER *cipher = EVP_CIPHER_CTX_cipher(&encryption_context.ctx) ;
int cipher_block_size = EVP_CIPHER_block_size(cipher); int cipher_block_size = EVP_CIPHER_block_size(cipher);
int max_outlen = inlen + cipher_block_size ; int max_outlen = inlen + cipher_block_size ;
@ -523,6 +524,11 @@ bool GxsSecurity::encrypt(uint8_t *& out, uint32_t &outlen, const uint8_t *in, u
#ifdef DISTRIB_DEBUG #ifdef DISTRIB_DEBUG
std::cerr << "GxsSecurity::encrypt() " << std::endl; std::cerr << "GxsSecurity::encrypt() " << std::endl;
#endif #endif
// Encrypts (in,inlen) into (out,outlen) using the given RSA public key.
// The format of the encrypted data is:
//
// [--- Encrypted session key length ---|--- Encrypted session key ---|--- IV ---|---- Encrypted data ---]
//
RSA *tmpkey = ::extractPublicKey(key) ; RSA *tmpkey = ::extractPublicKey(key) ;
RSA *rsa_publish_pub = RSAPublicKey_dup(tmpkey) ; RSA *rsa_publish_pub = RSAPublicKey_dup(tmpkey) ;
@ -667,7 +673,7 @@ bool GxsSecurity::initDecryption(GxsSecurity::MultiEncryptionContext& encryption
} }
catch(std::exception& e) catch(std::exception& e)
{ {
std::cerr << "(EE) cannot init decryption context: " << e.what << std::endl; std::cerr << "(EE) cannot init decryption context: " << e.what() << std::endl;
encryption_context.clear() ; encryption_context.clear() ;
return false ; return false ;
} }
@ -696,7 +702,7 @@ bool GxsSecurity::decrypt(uint8_t *&out, uint32_t &outlen, const uint8_t *in, ui
outlen = out_currOffset; outlen = out_currOffset;
if(!EVP_OpenFinal(&ctx, (unsigned char*)out + out_currOffset, &out_currOffset)) if(!EVP_OpenFinal(&encryption_context.ctx, (unsigned char*)out + out_currOffset, &out_currOffset))
{ {
free(out) ; free(out) ;
out = NULL ; out = NULL ;
@ -711,6 +717,12 @@ bool GxsSecurity::decrypt(uint8_t *&out, uint32_t &outlen, const uint8_t *in, ui
bool GxsSecurity::decrypt(uint8_t *& out, uint32_t & outlen, const uint8_t *in, uint32_t inlen, const RsTlvSecurityKey& key) bool GxsSecurity::decrypt(uint8_t *& out, uint32_t & outlen, const uint8_t *in, uint32_t inlen, const RsTlvSecurityKey& key)
{ {
// Decrypts (in,inlen) into (out,outlen) using the given RSA public key.
// The format of the encrypted data (in) is:
//
// [--- Encrypted session key length ---|--- Encrypted session key ---|--- IV ---|---- Encrypted data ---]
//
// This method can be used to decrypt multi-encrypted data, if passing he correct encrypted key block (corresponding to the given key)
#ifdef DISTRIB_DEBUG #ifdef DISTRIB_DEBUG
std::cerr << "GxsSecurity::decrypt() " << std::endl; std::cerr << "GxsSecurity::decrypt() " << std::endl;

View file

@ -84,6 +84,8 @@ class GxsSecurity
unsigned char **ek ; // array of encrypted keys unsigned char **ek ; // array of encrypted keys
EVP_CIPHER_CTX ctx; // EVP encryption context EVP_CIPHER_CTX ctx; // EVP encryption context
unsigned char iv[EVP_MAX_IV_LENGTH]; // initialization vector of the cipher. unsigned char iv[EVP_MAX_IV_LENGTH]; // initialization vector of the cipher.
friend class GxsSecurity ;
}; };
/*! /*!
* Extracts a public key from a private key. * Extracts a public key from a private key.
@ -112,7 +114,7 @@ class GxsSecurity
* Encrypts/decrypt data using envelope encryption using the key pre-computed in the encryption context passed as * Encrypts/decrypt data using envelope encryption using the key pre-computed in the encryption context passed as
* parameter. * parameter.
*/ */
static bool initEncryption(MultiEncryptionContext& encryption_context, const std::list<RsTlvSecurityKey> &keys) ; static bool initEncryption(MultiEncryptionContext& encryption_context, const std::vector<RsTlvSecurityKey> &keys) ;
static bool initDecryption(MultiEncryptionContext& encryption_context, const RsTlvSecurityKey& key, unsigned char *IV, uint32_t IV_size, unsigned char *encrypted_session_key, uint32_t encrypted_session_key_size) ; static bool initDecryption(MultiEncryptionContext& encryption_context, const RsTlvSecurityKey& key, unsigned char *IV, uint32_t IV_size, unsigned char *encrypted_session_key, uint32_t encrypted_session_key_size) ;
/*! /*!

View file

@ -284,10 +284,10 @@ const uint32_t RsGxsNetService::FRAGMENT_SIZE = 150000;
RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds, RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds,
RsNxsNetMgr *netMgr, RsNxsObserver *nxsObs, RsNxsNetMgr *netMgr, RsNxsObserver *nxsObs,
const RsServiceInfo serviceInfo, const RsServiceInfo serviceInfo,
RsGixsReputation* reputations, RsGcxs* circles, RsGixsReputation* reputations, RsGcxs* circles, RsGixs *gixs,
PgpAuxUtils *pgpUtils, bool grpAutoSync,bool msgAutoSync) PgpAuxUtils *pgpUtils, bool grpAutoSync,bool msgAutoSync)
: p3ThreadedService(), p3Config(), mTransactionN(0), : p3ThreadedService(), p3Config(), mTransactionN(0),
mObserver(nxsObs), mDataStore(gds), mServType(servType), mObserver(nxsObs),mGixs(gixs), mDataStore(gds), mServType(servType),
mTransactionTimeOut(TRANSAC_TIMEOUT), mNetMgr(netMgr), mNxsMutex("RsGxsNetService"), mTransactionTimeOut(TRANSAC_TIMEOUT), mNetMgr(netMgr), mNxsMutex("RsGxsNetService"),
mSyncTs(0), mLastKeyPublishTs(0),mLastCleanRejectedMessages(0), mSYNC_PERIOD(SYNC_PERIOD), mCircles(circles), mReputations(reputations), mSyncTs(0), mLastKeyPublishTs(0),mLastCleanRejectedMessages(0), mSYNC_PERIOD(SYNC_PERIOD), mCircles(circles), mReputations(reputations),
mPgpUtils(pgpUtils), mPgpUtils(pgpUtils),
@ -3275,13 +3275,13 @@ bool RsGxsNetService::encryptTransaction(NxsTransaction *tr)
} }
std::cerr << " Dest Ids: " << std::endl; std::cerr << " Dest Ids: " << std::endl;
std::list<RsTlvSecurityKey> recipient_keys ; std::vector<RsTlvSecurityKey> recipient_keys ;
for(std::list<RsGxsId>::const_iterator it(recipients.begin());it!=recipients.end();++it) for(std::list<RsGxsId>::const_iterator it(recipients.begin());it!=recipients.end();++it)
{ {
RsTlvSecurityKey pkey ; RsTlvSecurityKey pkey ;
if(!rsIdentity->getKey(*it,pkey)) if(!mGixs->getKey(*it,pkey))
{ {
std::cerr << "(EE) Cannot retrieve public key " << *it << " for circle encryption." << std::endl; std::cerr << "(EE) Cannot retrieve public key " << *it << " for circle encryption." << std::endl;
// we should probably request the key. // we should probably request the key.
@ -3314,7 +3314,7 @@ bool RsGxsNetService::encryptTransaction(NxsTransaction *tr)
unsigned char *encrypted_data = NULL ; unsigned char *encrypted_data = NULL ;
uint32_t encrypted_len = 0 ; uint32_t encrypted_len = 0 ;
if(!GxsSecurity::encrypt(muctx,tempmem,size,encrypted_data, encrypted_len)) if(!GxsSecurity::encrypt(encrypted_data, encrypted_len,tempmem,size,muctx))
{ {
std::cerr << " (EE) Cannot multi-encrypt item. Something went wrong." << std::endl; std::cerr << " (EE) Cannot multi-encrypt item. Something went wrong." << std::endl;
continue ; continue ;
@ -3382,6 +3382,8 @@ bool RsGxsNetService::decryptTransaction(NxsTransaction *tr)
GxsSecurity::MultiEncryptionContext muctx ; GxsSecurity::MultiEncryptionContext muctx ;
RsGxsId private_key_id ; RsGxsId private_key_id ;
RsTlvBinaryData ek ;
RsTlvSecurityKey private_key;
bool found = false ; bool found = false ;
for(std::map<RsGxsId,RsTlvBinaryData>::const_iterator it(esk->encrypted_session_keys.begin());it!=esk->encrypted_session_keys.end();++it) for(std::map<RsGxsId,RsTlvBinaryData>::const_iterator it(esk->encrypted_session_keys.begin());it!=esk->encrypted_session_keys.end();++it)
@ -3389,6 +3391,13 @@ bool RsGxsNetService::decryptTransaction(NxsTransaction *tr)
{ {
found = true ; found = true ;
private_key_id = it->first ; private_key_id = it->first ;
ek = it->second ;
if(!mGixs->getPrivateKey(private_key_id,private_key))
{
std::cerr << "(EE) Cannot find private key to decrypt incoming transaction, for ID " << it->first << ". This is a bug since the key is supposed ot be here." << std::endl;
return false;
}
std::cerr << " found appropriate private key to decrypt session key: " << it->first << std::endl; std::cerr << " found appropriate private key to decrypt session key: " << it->first << std::endl;
break ; break ;
@ -3400,7 +3409,7 @@ bool RsGxsNetService::decryptTransaction(NxsTransaction *tr)
return false ; return false ;
} }
if(!GxsSecurity::initDecryption(private_key_id,esk->iv,EVP_MAX_IV_LENGTH,ek.bin_data,ek.bin_len)) if(!GxsSecurity::initDecryption(muctx,private_key,esk->iv,EVP_MAX_IV_LENGTH,(unsigned char*)ek.bin_data,ek.bin_len))
{ {
std::cerr << " (EE) cannot decrypt transaction. initDecryption() failed." << std::endl; std::cerr << " (EE) cannot decrypt transaction. initDecryption() failed." << std::endl;
return false ; return false ;
@ -3418,7 +3427,7 @@ bool RsGxsNetService::decryptTransaction(NxsTransaction *tr)
unsigned char *tempmem; unsigned char *tempmem;
uint32_t tempmemsize ; uint32_t tempmemsize ;
if(!GxsSecurity::decrypt(muctx,tempmem,tempmemsize,encrypted_item->aes_encrypted_data.bin_data, encrypted_item->aes_encrypted_data.bin_len)) if(!GxsSecurity::decrypt(tempmem,tempmemsize,(uint8_t*)encrypted_item->aes_encrypted_data.bin_data, encrypted_item->aes_encrypted_data.bin_len,muctx))
{ {
std::cerr << " (EE) Cannot decrypt item. Something went wrong. Skipping this item." << std::endl; std::cerr << " (EE) Cannot decrypt item. Something went wrong. Skipping this item." << std::endl;
continue ; continue ;

View file

@ -91,7 +91,7 @@ public:
RsNxsNetMgr *netMgr, RsNxsNetMgr *netMgr,
RsNxsObserver *nxsObs, // used to be = NULL. RsNxsObserver *nxsObs, // used to be = NULL.
const RsServiceInfo serviceInfo, const RsServiceInfo serviceInfo,
RsGixsReputation* reputations = NULL, RsGcxs* circles = NULL, RsGixsReputation* reputations = NULL, RsGcxs* circles = NULL, RsGixs *gixs=NULL,
PgpAuxUtils *pgpUtils = NULL, PgpAuxUtils *pgpUtils = NULL,
bool grpAutoSync = true, bool msgAutoSync = true); bool grpAutoSync = true, bool msgAutoSync = true);
@ -501,6 +501,7 @@ private:
int mUpdateCounter ; int mUpdateCounter ;
RsGcxs* mCircles; RsGcxs* mCircles;
RsGixs *mGixs;
RsGixsReputation* mReputations; RsGixsReputation* mReputations;
PgpAuxUtils *mPgpUtils; PgpAuxUtils *mPgpUtils;
bool mGrpAutoSync; bool mGrpAutoSync;

View file

@ -1331,7 +1331,7 @@ int RsServer::StartupRetroShare()
RsGxsNetService* gxsid_ns = new RsGxsNetService( RsGxsNetService* gxsid_ns = new RsGxsNetService(
RS_SERVICE_GXS_TYPE_GXSID, gxsid_ds, nxsMgr, RS_SERVICE_GXS_TYPE_GXSID, gxsid_ds, nxsMgr,
mGxsIdService, mGxsIdService->getServiceInfo(), mGxsIdService, mGxsIdService->getServiceInfo(),
mGxsIdService, mGxsCircles, mGxsIdService, mGxsCircles,mGxsIdService,
pgpAuxUtils, pgpAuxUtils,
false,false); // don't synchronise group automatic (need explicit group request) false,false); // don't synchronise group automatic (need explicit group request)
// don't sync messages at all. // don't sync messages at all.
@ -1343,7 +1343,7 @@ int RsServer::StartupRetroShare()
RsGxsNetService* gxscircles_ns = new RsGxsNetService( RsGxsNetService* gxscircles_ns = new RsGxsNetService(
RS_SERVICE_GXS_TYPE_GXSCIRCLE, gxscircles_ds, nxsMgr, RS_SERVICE_GXS_TYPE_GXSCIRCLE, gxscircles_ds, nxsMgr,
mGxsCircles, mGxsCircles->getServiceInfo(), mGxsCircles, mGxsCircles->getServiceInfo(),
mGxsIdService, mGxsCircles, mGxsIdService, mGxsCircles,mGxsIdService,
pgpAuxUtils); pgpAuxUtils);
/**** Posted GXS service ****/ /**** Posted GXS service ****/
@ -1360,7 +1360,7 @@ int RsServer::StartupRetroShare()
RsGxsNetService* posted_ns = new RsGxsNetService( RsGxsNetService* posted_ns = new RsGxsNetService(
RS_SERVICE_GXS_TYPE_POSTED, posted_ds, nxsMgr, RS_SERVICE_GXS_TYPE_POSTED, posted_ds, nxsMgr,
mPosted, mPosted->getServiceInfo(), mPosted, mPosted->getServiceInfo(),
mGxsIdService, mGxsCircles, mGxsIdService, mGxsCircles,mGxsIdService,
pgpAuxUtils); pgpAuxUtils);
mPosted->setNetworkExchangeService(posted_ns) ; mPosted->setNetworkExchangeService(posted_ns) ;
@ -1401,7 +1401,7 @@ int RsServer::StartupRetroShare()
RsGxsNetService* gxsforums_ns = new RsGxsNetService( RsGxsNetService* gxsforums_ns = new RsGxsNetService(
RS_SERVICE_GXS_TYPE_FORUMS, gxsforums_ds, nxsMgr, RS_SERVICE_GXS_TYPE_FORUMS, gxsforums_ds, nxsMgr,
mGxsForums, mGxsForums->getServiceInfo(), mGxsForums, mGxsForums->getServiceInfo(),
mGxsIdService, mGxsCircles, mGxsIdService, mGxsCircles,mGxsIdService,
pgpAuxUtils); pgpAuxUtils);
mGxsForums->setNetworkExchangeService(gxsforums_ns) ; mGxsForums->setNetworkExchangeService(gxsforums_ns) ;
@ -1417,7 +1417,7 @@ int RsServer::StartupRetroShare()
RsGxsNetService* gxschannels_ns = new RsGxsNetService( RsGxsNetService* gxschannels_ns = new RsGxsNetService(
RS_SERVICE_GXS_TYPE_CHANNELS, gxschannels_ds, nxsMgr, RS_SERVICE_GXS_TYPE_CHANNELS, gxschannels_ds, nxsMgr,
mGxsChannels, mGxsChannels->getServiceInfo(), mGxsChannels, mGxsChannels->getServiceInfo(),
mGxsIdService, mGxsCircles, mGxsIdService, mGxsCircles,mGxsIdService,
pgpAuxUtils); pgpAuxUtils);
mGxsChannels->setNetworkExchangeService(gxschannels_ns) ; mGxsChannels->setNetworkExchangeService(gxschannels_ns) ;
@ -1434,7 +1434,7 @@ int RsServer::StartupRetroShare()
RsGxsNetService* photo_ns = new RsGxsNetService( RsGxsNetService* photo_ns = new RsGxsNetService(
RS_SERVICE_GXS_TYPE_PHOTO, photo_ds, nxsMgr, RS_SERVICE_GXS_TYPE_PHOTO, photo_ds, nxsMgr,
mPhoto, mPhoto->getServiceInfo(), mPhoto, mPhoto->getServiceInfo(),
mGxsIdService, mGxsCircles, mGxsIdService, mGxsCircles,mGxsIdService,
pgpAuxUtils); pgpAuxUtils);
#endif #endif
@ -1450,7 +1450,7 @@ int RsServer::StartupRetroShare()
RsGxsNetService* wire_ns = new RsGxsNetService( RsGxsNetService* wire_ns = new RsGxsNetService(
RS_SERVICE_GXS_TYPE_WIRE, wire_ds, nxsMgr, RS_SERVICE_GXS_TYPE_WIRE, wire_ds, nxsMgr,
mWire, mWire->getServiceInfo(), mWire, mWire->getServiceInfo(),
mGxsIdService, mGxsCircles, mGxsIdService, mGxsCircles,mGxsIdService,
pgpAuxUtils); pgpAuxUtils);
#endif #endif
// now add to p3service // now add to p3service

View file

@ -79,6 +79,18 @@ RsItem* RsNxsSerialiser::deserialise(void *data, uint32_t *size)
} }
uint32_t RsNxsSerialiser::size(RsItem *item)
{
RsNxsItem *nxs_item = dynamic_cast<RsNxsItem*>(item) ;
if(nxs_item != NULL)
return nxs_item->serial_size() ;
else
{
std::cerr << "RsNxsSerialiser::serialise(): Not an RsNxsItem!" << std::endl;
return 0;
}
}
bool RsNxsSerialiser::serialise(RsItem *item, void *data, uint32_t *size) bool RsNxsSerialiser::serialise(RsItem *item, void *data, uint32_t *size)
{ {

View file

@ -390,7 +390,7 @@ bool p3GxsCircles::recipients(const RsGxsCircleId& circleId, std::list<RsGxsId>&
if(!getCircleDetails(circleId, details)) if(!getCircleDetails(circleId, details))
return false; return false;
for(std::set<RsGxsId>::const_iterator it(details.mUnknownPeers.begin());it!=details.mUnknownPeers.end();+it) for(std::set<RsGxsId>::const_iterator it(details.mUnknownPeers.begin());it!=details.mUnknownPeers.end();++it)
gxs_ids.push_back(*it) ; gxs_ids.push_back(*it) ;
return true; return true;

View file

@ -572,24 +572,6 @@ void IdDialog::updateSelection()
} }
} }
static QString getHumanReadableDuration(uint32_t seconds)
{
if(seconds < 60)
return QString(QObject::tr("%1 seconds ago")).arg(seconds) ;
else if(seconds < 120)
return QString(QObject::tr("%1 minute ago")).arg(seconds/60) ;
else if(seconds < 3600)
return QString(QObject::tr("%1 minutes ago")).arg(seconds/60) ;
else if(seconds < 7200)
return QString(QObject::tr("%1 hour ago")).arg(seconds/3600) ;
else if(seconds < 24*3600)
return QString(QObject::tr("%1 hours ago")).arg(seconds/3600) ;
else if(seconds < 2*24*3600)
return QString(QObject::tr("%1 day ago")).arg(seconds/86400) ;
else
return QString(QObject::tr("%1 days ago")).arg(seconds/86400) ;
}
void IdDialog::requestIdList() void IdDialog::requestIdList()
{ {
//Disable by default, will be enable by insertIdDetails() //Disable by default, will be enable by insertIdDetails()
@ -663,8 +645,8 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
item->setText(RSID_COL_NICKNAME, QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE)); item->setText(RSID_COL_NICKNAME, QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE));
item->setText(RSID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId.toStdString())); item->setText(RSID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId.toStdString()));
time_t now = time(NULL) ; //time_t now = time(NULL) ;
item->setText(RSID_COL_LASTUSED, getHumanReadableDuration(now - data.mLastUsageTS)) ; //item->setText(RSID_COL_LASTUSED, getHumanReadableDuration(now - data.mLastUsageTS)) ;
item->setData(RSID_COL_KEYID, Qt::UserRole,QVariant(item_flags)) ; item->setData(RSID_COL_KEYID, Qt::UserRole,QVariant(item_flags)) ;

View file

@ -6,12 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>826</width> <width>1484</width>
<<<<<<< HEAD <height>791</height>
<height>579</height>
=======
<height>630</height>
>>>>>>> upstream/master
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -23,25 +19,8 @@
<property name="windowTitle"> <property name="windowTitle">
<string/> <string/>
</property> </property>
<<<<<<< HEAD
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
=======
<layout class="QVBoxLayout" name="verticalLayout_6"> <layout class="QVBoxLayout" name="verticalLayout_6">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
>>>>>>> upstream/master
<widget class="QFrame" name="titleBarFrame"> <widget class="QFrame" name="titleBarFrame">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum"> <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@ -55,19 +34,7 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Sunken</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item> <item>
<widget class="QLabel" name="titleBarPixmap"> <widget class="QLabel" name="titleBarPixmap">
<property name="minimumSize"> <property name="minimumSize">
@ -86,7 +53,7 @@
<string/> <string/>
</property> </property>
<property name="pixmap"> <property name="pixmap">
<pixmap resource="../images.qrc">:/images/user/friends24.png</pixmap> <pixmap resource="../../../../../trunk/retroshare-gui/src/gui/images.qrc">:/images/user/friends24.png</pixmap>
</property> </property>
<property name="scaledContents"> <property name="scaledContents">
<bool>true</bool> <bool>true</bool>
@ -126,7 +93,7 @@
<enum>Qt::NoFocus</enum> <enum>Qt::NoFocus</enum>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../../../../../trunk/retroshare-gui/src/gui/images.qrc">
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset> <normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
</property> </property>
<property name="checkable"> <property name="checkable">
@ -140,7 +107,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item>
<widget class="QSplitter" name="splitter"> <widget class="QSplitter" name="splitter">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -156,16 +123,7 @@
<enum>QFrame::Sunken</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin"> <property name="margin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number> <number>2</number>
</property> </property>
<item> <item>
@ -192,7 +150,7 @@
<string>New ID</string> <string>New ID</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../../../../../trunk/retroshare-gui/src/gui/images.qrc">
<normaloff>:/images/identity/identity_create_32.png</normaloff>:/images/identity/identity_create_32.png</iconset> <normaloff>:/images/identity/identity_create_32.png</normaloff>:/images/identity/identity_create_32.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@ -251,11 +209,6 @@
<string>Identity ID</string> <string>Identity ID</string>
</property> </property>
</column> </column>
<column>
<property name="text">
<string>Last Activity</string>
</property>
</column>
<column> <column>
<property name="text"> <property name="text">
<string>Owned by</string> <string>Owned by</string>
@ -266,7 +219,7 @@
<string>Reputation</string> <string>Reputation</string>
</property> </property>
<property name="textAlignment"> <property name="textAlignment">
<set>AlignLeading|AlignVCenter</set> <set>AlignLeft|AlignVCenter</set>
</property> </property>
</column> </column>
</widget> </widget>
@ -277,81 +230,14 @@
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Circles</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QPushButton" name="pushButton_extCircle">
<property name="text">
<string>Create Circle</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_editCircle">
<property name="text">
<string>Edit Circle</string>
</property>
</widget>
</item>
<<<<<<< HEAD
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QTreeWidget" name="treeWidget_membership">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>IDs</string>
</property>
</column>
<item>
<property name="text">
<string>Public Circles</string>
</property>
</item>
<item>
<property name="text">
<string>Personal Circles</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="tab_2">
<attribute name="title"> <attribute name="title">
<string>Person</string> <string>Person</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_7"> <layout class="QVBoxLayout" name="verticalLayout">
<item row="0" column="0"> <item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QFrame" name="headerFrame"> <widget class="QFrame" name="headerFrame">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
@ -395,45 +281,10 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="3" rowspan="2">
<widget class="QToolButton" name="messageButton">
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="toolTip">
<string>Send message</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/mail-message-new.png</normaloff>:/images/mail-message-new.png</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item>
<widget class="QGroupBox" name="detailsGroupBox"> <widget class="QGroupBox" name="detailsGroupBox">
<property name="title"> <property name="title">
<string>Identity info</string> <string>Identity info</string>
@ -444,376 +295,6 @@
<property name="margin"> <property name="margin">
<number>6</number> <number>6</number>
</property> </property>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Identity name :</string>
</property>
</widget>
</item>
<item row="7" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Identity ID :</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="PgpId_LB">
<property name="text">
<string>Owner node ID :</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_Nickname">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_KeyId">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_GpgId">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="PgpName_LB">
<property name="text">
<string>Owner node name :</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEdit_GpgName">
<property name="enabled">
<bool>true</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_Type"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Last used:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="lineEdit_LastUsed"/>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="avatarLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text">
<string extracomment="Click here to change your avatar">Your Avatar</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QGroupBox" name="reputationGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Reputation</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Overall</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="line_RatingOverall">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Implicit</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="line_RatingImplicit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Opinion</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="line_RatingOwn">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Peers</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="line_RatingPeers">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QToolButton" name="toolButton_Reputation">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Edit reputation</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/edit_24.png</normaloff>:/images/edit_24.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextBesideIcon</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="tweakGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Tweak Opinion</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="repMod_Accept">
<property name="text">
<string>Accept (+100)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="repMod_Positive">
<property name="text">
<string>Positive (+10)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="repMod_Negative">
<property name="text">
<string>Negative (-10)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="repMod_Ban">
<property name="text">
<string>Ban (-100)</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="repMod_Custom">
<property name="text">
<string>Custom</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="repMod_spinBox">
<property name="minimum">
<number>-100</number>
</property>
<property name="maximum">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="repModButton">
<property name="text">
<string>Modify</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
<zorder>detailsGroupBox</zorder>
<zorder>headerFrame</zorder>
</widget>
=======
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="detailsGroupBox">
<property name="title">
<string>Identity info</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<property name="spacing"> <property name="spacing">
<number>6</number> <number>6</number>
</property> </property>
@ -985,16 +466,7 @@
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin"> <property name="margin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number> <number>6</number>
</property> </property>
<item row="2" column="1"> <item row="2" column="1">
@ -1055,7 +527,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
<property name="icon"> <property name="icon">
<iconset> <iconset>
<normaloff>../icons/yellow_biohazard64.png</normaloff>../icons/yellow_biohazard64.png</iconset> <normaloff>../../../../../trunk/retroshare-gui/src/gui/icons/yellow_biohazard64.png</normaloff>../../../../../trunk/retroshare-gui/src/gui/icons/yellow_biohazard64.png</iconset>
</property> </property>
</item> </item>
<item> <item>
@ -1115,14 +587,84 @@ p, li { white-space: pre-wrap; }
</spacer> </spacer>
</item> </item>
</layout> </layout>
>>>>>>> upstream/master </item>
</layout>
</widget>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Circles</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QPushButton" name="pushButton_extCircle">
<property name="text">
<string>Create Circle</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_editCircle">
<property name="text">
<string>Edit Circle</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QTreeWidget" name="treeWidget_membership">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Name</string>
</property>
</column>
<column>
<property name="text">
<string>IDs</string>
</property>
</column>
<item>
<property name="text">
<string>Public Circles</string>
</property>
</item>
<item>
<property name="text">
<string>Personal Circles</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</widget> </widget>
</widget> </widget>
</item> </item>
</layout> </layout>
<action name="editIdentity"> <action name="editIdentity">
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../../../../../trunk/retroshare-gui/src/gui/images.qrc">
<normaloff>:/images/edit_16.png</normaloff>:/images/edit_16.png</iconset> <normaloff>:/images/edit_16.png</normaloff>:/images/edit_16.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -1134,7 +676,7 @@ p, li { white-space: pre-wrap; }
</action> </action>
<action name="removeIdentity"> <action name="removeIdentity">
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../../../../../trunk/retroshare-gui/src/gui/images.qrc">
<normaloff>:/images/delete.png</normaloff>:/images/delete.png</iconset> <normaloff>:/images/delete.png</normaloff>:/images/delete.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -1143,7 +685,7 @@ p, li { white-space: pre-wrap; }
</action> </action>
<action name="chatIdentity"> <action name="chatIdentity">
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset resource="../../../../../trunk/retroshare-gui/src/gui/images.qrc">
<normaloff>:/images/toaster/chat.png</normaloff>:/images/toaster/chat.png</iconset> <normaloff>:/images/toaster/chat.png</normaloff>:/images/toaster/chat.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -1178,16 +720,9 @@ p, li { white-space: pre-wrap; }
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>idTreeWidget</tabstop> <tabstop>idTreeWidget</tabstop>
<<<<<<< HEAD
=======
<tabstop>lineEdit_Nickname</tabstop>
<tabstop>lineEdit_KeyId</tabstop>
<tabstop>lineEdit_GpgId</tabstop>
<tabstop>lineEdit_GpgName</tabstop>
>>>>>>> upstream/master
</tabstops> </tabstops>
<resources> <resources>
<include location="../images.qrc"/> <include location="../../../../../trunk/retroshare-gui/src/gui/images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View file

@ -35,6 +35,7 @@
#include "retroshare/rsgxscircles.h" #include "retroshare/rsgxscircles.h"
#include "retroshare/rsgxsflags.h" #include "retroshare/rsgxsflags.h"
#include "retroshare/rsmsgs.h" #include "retroshare/rsmsgs.h"
#include "retroshare/rsids.h"
#include <iostream> #include <iostream>
#include <QMenu> #include <QMenu>
@ -563,7 +564,9 @@ void PeopleDialog::chatIdentity()
uint32_t error_code ; uint32_t error_code ;
if(!rsMsgs->initiateDistantChatConnexion(RsGxsId(gxs_id), from_gxs_id, error_code)) DistantChatPeerId dpid ;
if(!rsMsgs->initiateDistantChatConnexion(RsGxsId(gxs_id), from_gxs_id, dpid,error_code))
QMessageBox::information(NULL, tr("Distant chat cannot work"), QString("%1 %2: %3").arg(tr("Distant chat refused with this person.")).arg(tr("Error code")).arg(error_code)) ; QMessageBox::information(NULL, tr("Distant chat cannot work"), QString("%1 %2: %3").arg(tr("Distant chat refused with this person.")).arg(tr("Error code")).arg(error_code)) ;
} }