From 9da8a8abc36ca7cc5284ba3bae278912802a444d Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 1 Jan 2016 21:37:27 -0500 Subject: [PATCH] fixed compilation of RsNxsTransaction encryption code --- libretroshare/src/gxs/gxssecurity.cc | 50 +- libretroshare/src/gxs/gxssecurity.h | 4 +- libretroshare/src/gxs/rsgxsnetservice.cc | 27 +- libretroshare/src/gxs/rsgxsnetservice.h | 3 +- libretroshare/src/rsserver/rsinit.cc | 14 +- libretroshare/src/serialiser/rsnxsitems.cc | 12 + libretroshare/src/services/p3gxscircles.cc | 2 +- retroshare-gui/src/gui/Identity/IdDialog.cpp | 22 +- retroshare-gui/src/gui/Identity/IdDialog.ui | 1211 +++++------------ .../src/gui/People/PeopleDialog.cpp | 7 +- 10 files changed, 454 insertions(+), 898 deletions(-) diff --git a/libretroshare/src/gxs/gxssecurity.cc b/libretroshare/src/gxs/gxssecurity.cc index 859f9eb32..681e2459c 100644 --- a/libretroshare/src/gxs/gxssecurity.cc +++ b/libretroshare/src/gxs/gxssecurity.cc @@ -405,7 +405,7 @@ bool GxsSecurity::validateNxsMsg(const RsNxsMsg& msg, const RsTlvKeySignature& s return false; } -bool GxsSecurity::initEncryption(GxsSecurity::MultiEncryptionContext& encryption_context, const std::list& keys) +bool GxsSecurity::initEncryption(GxsSecurity::MultiEncryptionContext& encryption_context, const std::vector& keys) { // 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.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); @@ -455,7 +455,7 @@ bool GxsSecurity::initEncryption(GxsSecurity::MultiEncryptionContext& encryption } 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() ; 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); + const EVP_CIPHER *cipher = EVP_CIPHER_CTX_cipher(&encryption_context.ctx) ; int cipher_block_size = EVP_CIPHER_block_size(cipher); int max_outlen = inlen + cipher_block_size ; @@ -523,10 +524,15 @@ bool GxsSecurity::encrypt(uint8_t *& out, uint32_t &outlen, const uint8_t *in, u #ifdef DISTRIB_DEBUG std::cerr << "GxsSecurity::encrypt() " << std::endl; #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 *rsa_publish_pub = RSAPublicKey_dup(tmpkey) ; - RSA_free(tmpkey) ; + RSA *tmpkey = ::extractPublicKey(key) ; + RSA *rsa_publish_pub = RSAPublicKey_dup(tmpkey) ; + RSA_free(tmpkey) ; EVP_PKEY *public_key = NULL; @@ -543,7 +549,7 @@ bool GxsSecurity::encrypt(uint8_t *& out, uint32_t &outlen, const uint8_t *in, u { #ifdef DISTRIB_DEBUG std::cerr << "GxsSecurity(): Could not generate publish key " << grpId - << std::endl; + << std::endl; #endif return false; } @@ -568,13 +574,13 @@ bool GxsSecurity::encrypt(uint8_t *& out, uint32_t &outlen, const uint8_t *in, u if(!EVP_SealInit(&ctx, EVP_aes_128_cbc(), &ek, &eklen, iv, &public_key, 1)) return false; // now assign memory to out accounting for data, and cipher block size, key length, and key length val - out = (uint8_t*)malloc(inlen + cipher_block_size + size_net_ekl + eklen + EVP_MAX_IV_LENGTH); + out = (uint8_t*)malloc(inlen + cipher_block_size + size_net_ekl + eklen + EVP_MAX_IV_LENGTH); - if(out == NULL) - { - std::cerr << "gxssecurity::encrypt(): cnnot allocate memory of size " << inlen + cipher_block_size + size_net_ekl + eklen + EVP_MAX_IV_LENGTH << " to encrypt data." << std::endl; - return false ; - } + if(out == NULL) + { + std::cerr << "gxssecurity::encrypt(): cnnot allocate memory of size " << inlen + cipher_block_size + size_net_ekl + eklen + EVP_MAX_IV_LENGTH << " to encrypt data." << std::endl; + return false ; + } net_ekl = htonl(eklen); memcpy((unsigned char*)out + out_offset, &net_ekl, size_net_ekl); @@ -589,7 +595,7 @@ bool GxsSecurity::encrypt(uint8_t *& out, uint32_t &outlen, const uint8_t *in, u // now encrypt actual data if(!EVP_SealUpdate(&ctx, (unsigned char*) out + out_offset, &out_currOffset, (unsigned char*) in, inlen)) { - free(out) ; + free(out) ; out = NULL ; return false; } @@ -600,7 +606,7 @@ bool GxsSecurity::encrypt(uint8_t *& out, uint32_t &outlen, const uint8_t *in, u // add padding if(!EVP_SealFinal(&ctx, (unsigned char*) out + out_offset, &out_currOffset)) { - free(out) ; + free(out) ; out = NULL ; return false; } @@ -611,7 +617,7 @@ bool GxsSecurity::encrypt(uint8_t *& out, uint32_t &outlen, const uint8_t *in, u // make sure offset has not gone passed valid memory bounds if(out_offset > max_outlen) { - free(out) ; + free(out) ; out = NULL ; return false; } @@ -667,7 +673,7 @@ bool GxsSecurity::initDecryption(GxsSecurity::MultiEncryptionContext& encryption } 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() ; return false ; } @@ -696,7 +702,7 @@ bool GxsSecurity::decrypt(uint8_t *&out, uint32_t &outlen, const uint8_t *in, ui 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) ; out = NULL ; @@ -711,11 +717,17 @@ 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) { + // 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 std::cerr << "GxsSecurity::decrypt() " << std::endl; #endif - RSA *rsa_publish = extractPrivateKey(key) ; + RSA *rsa_publish = extractPrivateKey(key) ; EVP_PKEY *privateKey = NULL; //RSA* rsa_publish = EVP_PKEY_get1_RSA(privateKey); diff --git a/libretroshare/src/gxs/gxssecurity.h b/libretroshare/src/gxs/gxssecurity.h index 77beaa48d..b15639e28 100644 --- a/libretroshare/src/gxs/gxssecurity.h +++ b/libretroshare/src/gxs/gxssecurity.h @@ -84,6 +84,8 @@ class GxsSecurity unsigned char **ek ; // array of encrypted keys EVP_CIPHER_CTX ctx; // EVP encryption context unsigned char iv[EVP_MAX_IV_LENGTH]; // initialization vector of the cipher. + + friend class GxsSecurity ; }; /*! * 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 * parameter. */ - static bool initEncryption(MultiEncryptionContext& encryption_context, const std::list &keys) ; + static bool initEncryption(MultiEncryptionContext& encryption_context, const std::vector &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) ; /*! diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index e363e57d6..a32e44d69 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -283,11 +283,11 @@ const uint32_t RsGxsNetService::FRAGMENT_SIZE = 150000; RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds, RsNxsNetMgr *netMgr, RsNxsObserver *nxsObs, - const RsServiceInfo serviceInfo, - RsGixsReputation* reputations, RsGcxs* circles, - PgpAuxUtils *pgpUtils, bool grpAutoSync,bool msgAutoSync) + const RsServiceInfo serviceInfo, + RsGixsReputation* reputations, RsGcxs* circles, RsGixs *gixs, + PgpAuxUtils *pgpUtils, bool grpAutoSync,bool msgAutoSync) : 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"), mSyncTs(0), mLastKeyPublishTs(0),mLastCleanRejectedMessages(0), mSYNC_PERIOD(SYNC_PERIOD), mCircles(circles), mReputations(reputations), mPgpUtils(pgpUtils), @@ -3275,13 +3275,13 @@ bool RsGxsNetService::encryptTransaction(NxsTransaction *tr) } std::cerr << " Dest Ids: " << std::endl; - std::list recipient_keys ; + std::vector recipient_keys ; for(std::list::const_iterator it(recipients.begin());it!=recipients.end();++it) { 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; // we should probably request the key. @@ -3314,7 +3314,7 @@ bool RsGxsNetService::encryptTransaction(NxsTransaction *tr) unsigned char *encrypted_data = NULL ; 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; continue ; @@ -3382,6 +3382,8 @@ bool RsGxsNetService::decryptTransaction(NxsTransaction *tr) GxsSecurity::MultiEncryptionContext muctx ; RsGxsId private_key_id ; + RsTlvBinaryData ek ; + RsTlvSecurityKey private_key; bool found = false ; for(std::map::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 ; 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; break ; @@ -3400,7 +3409,7 @@ bool RsGxsNetService::decryptTransaction(NxsTransaction *tr) 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; return false ; @@ -3418,7 +3427,7 @@ bool RsGxsNetService::decryptTransaction(NxsTransaction *tr) unsigned char *tempmem; 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; continue ; diff --git a/libretroshare/src/gxs/rsgxsnetservice.h b/libretroshare/src/gxs/rsgxsnetservice.h index aecdfc9b9..fb3786049 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.h +++ b/libretroshare/src/gxs/rsgxsnetservice.h @@ -91,7 +91,7 @@ public: RsNxsNetMgr *netMgr, RsNxsObserver *nxsObs, // used to be = NULL. const RsServiceInfo serviceInfo, - RsGixsReputation* reputations = NULL, RsGcxs* circles = NULL, + RsGixsReputation* reputations = NULL, RsGcxs* circles = NULL, RsGixs *gixs=NULL, PgpAuxUtils *pgpUtils = NULL, bool grpAutoSync = true, bool msgAutoSync = true); @@ -501,6 +501,7 @@ private: int mUpdateCounter ; RsGcxs* mCircles; + RsGixs *mGixs; RsGixsReputation* mReputations; PgpAuxUtils *mPgpUtils; bool mGrpAutoSync; diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index e9f6f3161..7dbf0fd41 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -1331,7 +1331,7 @@ int RsServer::StartupRetroShare() RsGxsNetService* gxsid_ns = new RsGxsNetService( RS_SERVICE_GXS_TYPE_GXSID, gxsid_ds, nxsMgr, mGxsIdService, mGxsIdService->getServiceInfo(), - mGxsIdService, mGxsCircles, + mGxsIdService, mGxsCircles,mGxsIdService, pgpAuxUtils, false,false); // don't synchronise group automatic (need explicit group request) // don't sync messages at all. @@ -1343,7 +1343,7 @@ int RsServer::StartupRetroShare() RsGxsNetService* gxscircles_ns = new RsGxsNetService( RS_SERVICE_GXS_TYPE_GXSCIRCLE, gxscircles_ds, nxsMgr, mGxsCircles, mGxsCircles->getServiceInfo(), - mGxsIdService, mGxsCircles, + mGxsIdService, mGxsCircles,mGxsIdService, pgpAuxUtils); /**** Posted GXS service ****/ @@ -1360,7 +1360,7 @@ int RsServer::StartupRetroShare() RsGxsNetService* posted_ns = new RsGxsNetService( RS_SERVICE_GXS_TYPE_POSTED, posted_ds, nxsMgr, mPosted, mPosted->getServiceInfo(), - mGxsIdService, mGxsCircles, + mGxsIdService, mGxsCircles,mGxsIdService, pgpAuxUtils); mPosted->setNetworkExchangeService(posted_ns) ; @@ -1401,7 +1401,7 @@ int RsServer::StartupRetroShare() RsGxsNetService* gxsforums_ns = new RsGxsNetService( RS_SERVICE_GXS_TYPE_FORUMS, gxsforums_ds, nxsMgr, mGxsForums, mGxsForums->getServiceInfo(), - mGxsIdService, mGxsCircles, + mGxsIdService, mGxsCircles,mGxsIdService, pgpAuxUtils); mGxsForums->setNetworkExchangeService(gxsforums_ns) ; @@ -1417,7 +1417,7 @@ int RsServer::StartupRetroShare() RsGxsNetService* gxschannels_ns = new RsGxsNetService( RS_SERVICE_GXS_TYPE_CHANNELS, gxschannels_ds, nxsMgr, mGxsChannels, mGxsChannels->getServiceInfo(), - mGxsIdService, mGxsCircles, + mGxsIdService, mGxsCircles,mGxsIdService, pgpAuxUtils); mGxsChannels->setNetworkExchangeService(gxschannels_ns) ; @@ -1434,7 +1434,7 @@ int RsServer::StartupRetroShare() RsGxsNetService* photo_ns = new RsGxsNetService( RS_SERVICE_GXS_TYPE_PHOTO, photo_ds, nxsMgr, mPhoto, mPhoto->getServiceInfo(), - mGxsIdService, mGxsCircles, + mGxsIdService, mGxsCircles,mGxsIdService, pgpAuxUtils); #endif @@ -1450,7 +1450,7 @@ int RsServer::StartupRetroShare() RsGxsNetService* wire_ns = new RsGxsNetService( RS_SERVICE_GXS_TYPE_WIRE, wire_ds, nxsMgr, mWire, mWire->getServiceInfo(), - mGxsIdService, mGxsCircles, + mGxsIdService, mGxsCircles,mGxsIdService, pgpAuxUtils); #endif // now add to p3service diff --git a/libretroshare/src/serialiser/rsnxsitems.cc b/libretroshare/src/serialiser/rsnxsitems.cc index 0c4aab617..278833f2c 100644 --- a/libretroshare/src/serialiser/rsnxsitems.cc +++ b/libretroshare/src/serialiser/rsnxsitems.cc @@ -79,6 +79,18 @@ RsItem* RsNxsSerialiser::deserialise(void *data, uint32_t *size) } +uint32_t RsNxsSerialiser::size(RsItem *item) +{ + RsNxsItem *nxs_item = dynamic_cast(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) { diff --git a/libretroshare/src/services/p3gxscircles.cc b/libretroshare/src/services/p3gxscircles.cc index 905f1d248..35b3320bf 100644 --- a/libretroshare/src/services/p3gxscircles.cc +++ b/libretroshare/src/services/p3gxscircles.cc @@ -390,7 +390,7 @@ bool p3GxsCircles::recipients(const RsGxsCircleId& circleId, std::list& if(!getCircleDetails(circleId, details)) return false; - for(std::set::const_iterator it(details.mUnknownPeers.begin());it!=details.mUnknownPeers.end();+it) + for(std::set::const_iterator it(details.mUnknownPeers.begin());it!=details.mUnknownPeers.end();++it) gxs_ids.push_back(*it) ; return true; diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp index e7381487c..4d989bd69 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -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() { //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_KEYID, QString::fromStdString(data.mMeta.mGroupId.toStdString())); - time_t now = time(NULL) ; - item->setText(RSID_COL_LASTUSED, getHumanReadableDuration(now - data.mLastUsageTS)) ; + //time_t now = time(NULL) ; + //item->setText(RSID_COL_LASTUSED, getHumanReadableDuration(now - data.mLastUsageTS)) ; item->setData(RSID_COL_KEYID, Qt::UserRole,QVariant(item_flags)) ; diff --git a/retroshare-gui/src/gui/Identity/IdDialog.ui b/retroshare-gui/src/gui/Identity/IdDialog.ui index 553d05b3b..4b8c8847e 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.ui +++ b/retroshare-gui/src/gui/Identity/IdDialog.ui @@ -6,12 +6,8 @@ 0 0 - 826 -<<<<<<< HEAD - 579 -======= - 630 ->>>>>>> upstream/master + 1484 + 791 @@ -23,25 +19,8 @@ -<<<<<<< HEAD - - -======= - - 0 - - - 0 - - - 0 - - - 0 - ->>>>>>> upstream/master @@ -55,19 +34,7 @@ QFrame::Sunken - - - 2 - - - 2 - - - 2 - - - 2 - + @@ -86,7 +53,7 @@ - :/images/user/friends24.png + :/images/user/friends24.png true @@ -126,7 +93,7 @@ Qt::NoFocus - + :/icons/help_64.png:/icons/help_64.png @@ -140,7 +107,7 @@ - + Qt::Horizontal @@ -156,16 +123,7 @@ QFrame::Sunken - - 2 - - - 2 - - - 2 - - + 2 @@ -192,7 +150,7 @@ New ID - + :/images/identity/identity_create_32.png:/images/identity/identity_create_32.png @@ -251,11 +209,6 @@ Identity ID - - - Last Activity - - Owned by @@ -266,7 +219,7 @@ Reputation - AlignLeading|AlignVCenter + AlignLeft|AlignVCenter @@ -277,6 +230,366 @@ 0 + + + Person + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 12 + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + + + + + + true + + + + + + + People + + + + + + + + + + Identity info + + + + + + 6 + + + 6 + + + + + Identity ID : + + + + + + + Identity name : + + + + + + + Owner node ID : + + + + + + + true + + + true + + + + + + + true + + + true + + + + + + + true + + + true + + + + + + + Owner node name : + + + + + + + true + + + true + + + + + + + Type: + + + + + + + + + + Last used: + + + + + + + + + + + + + + + 0 + 0 + + + + + 128 + 128 + + + + + 128 + 128 + + + + QFrame::Box + + + QFrame::Sunken + + + Your Avatar + + + true + + + Qt::AlignCenter + + + + + + + Send Invite + + + + + + + Qt::Vertical + + + + 20 + 2 + + + + + + + + + + + + + + 0 + 0 + + + + Reputation + + + + + + 6 + + + + + <html><head/><body><p>Average opinion of neighbor nodes about this identity. Negative is bad,</p><p>positive is good. Zero is neutral.</p></body></html> + + + true + + + + + + + Your opinion: + + + + + + + Neighbor nodes: + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Your own opinion about an identity rules the visibility of that identity for yourself,</p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">and is shared among friends. A final score is calculated according to a formula that accounts your own opinion and your friends' opinions about someone:</p> +<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> S = own_opinion * a + friends_opinion * (1-a)</p> +<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The factor 'a' depends on the type of ID. </p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">- anonymous IDs: </p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">- PGP-signed IDs by unknown PGP keys: a=</p> +<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The overall score is used in chat lobbies, forums and channels to decide on the actions to take for each specific identity:</p> +<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">S &lt; -0.5: Posts are not stored, nor forwarded </p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">S &lt; 0.2: Posts are hidden, but still transmitted</p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">S &lt; 0.0: </p> +<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The overall rating is computed in such a way that it is not possible for a single person to deterministically change someone's status at neighbor nodes.</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> + + + 0 + + + + Negative + + + + ../../../../../trunk/retroshare-gui/src/gui/icons/yellow_biohazard64.png../../../../../trunk/retroshare-gui/src/gui/icons/yellow_biohazard64.png + + + + + Neutral + + + + + Positive + + + + + + + + <html><head/><body><p>Overall reputation score, accounting for yours and your friends'.</p><p>Negative is bad, positive is good. Zero is neutral. If the score is too low,</p><p>the identity is flagged as bad, and will be filtered out in forums, chat lobbies,</p><p>channels, etc.</p></body></html> + + + true + + + + + + + + 75 + true + + + + Overall: + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 40 + + + + + + + + Circles @@ -298,7 +611,6 @@ -<<<<<<< HEAD @@ -346,783 +658,13 @@ - - - Person - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 12 - - - - - - 64 - 64 - - - - - 64 - 64 - - - - - - - - - - true - - - - - - - People - - - - - - - - 48 - 48 - - - - - 48 - 48 - - - - Send message - - - - - - - :/images/mail-message-new.png:/images/mail-message-new.png - - - - 48 - 48 - - - - true - - - - - - - - - - Identity info - - - - - - 6 - - - - - Identity name : - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Identity ID : - - - - - - - Owner node ID : - - - - - - - true - - - true - - - - - - - true - - - true - - - - - - - true - - - true - - - - - - - Owner node name : - - - - - - - true - - - true - - - - - - - Type: - - - - - - - - - - Last used: - - - - - - - - - - - - - - - 0 - 0 - - - - - 128 - 128 - - - - - 128 - 128 - - - - QFrame::Box - - - QFrame::Sunken - - - Your Avatar - - - true - - - Qt::AlignCenter - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - - 0 - 0 - - - - Reputation - - - - - - - - - 75 - true - - - - Overall - - - - - - - true - - - - - - - Implicit - - - - - - - true - - - - - - - Opinion - - - - - - - true - - - - - - - Peers - - - - - - - true - - - - - - - - - Qt::NoFocus - - - Edit reputation - - - - :/images/edit_24.png:/images/edit_24.png - - - - 24 - 24 - - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - - - - - 0 - 0 - - - - Tweak Opinion - - - - - - Accept (+100) - - - - - - - Positive (+10) - - - - - - - Negative (-10) - - - - - - - Ban (-100) - - - - - - - - - Custom - - - - - - - -100 - - - 100 - - - - - - - - - Modify - - - - - - - - - - detailsGroupBox - headerFrame - -======= - - - - - - - Identity info - - - - - - 6 - - - 6 - - - 6 - - - 6 - - - 6 - - - - - Identity ID : - - - - - - - Identity name : - - - - - - - Owner node ID : - - - - - - - true - - - true - - - - - - - true - - - true - - - - - - - true - - - true - - - - - - - Owner node name : - - - - - - - true - - - true - - - - - - - Type: - - - - - - - - - - Last used: - - - - - - - - - - - - - - - 0 - 0 - - - - - 128 - 128 - - - - - 128 - 128 - - - - QFrame::Box - - - QFrame::Sunken - - - Your Avatar - - - true - - - Qt::AlignCenter - - - - - - - Send Invite - - - - - - - Qt::Vertical - - - - 20 - 2 - - - - - - - - - - - - - - 0 - 0 - - - - Reputation - - - - - - 6 - - - 6 - - - 6 - - - 6 - - - - - <html><head/><body><p>Average opinion of neighbor nodes about this identity. Negative is bad,</p><p>positive is good. Zero is neutral.</p></body></html> - - - true - - - - - - - Your opinion: - - - - - - - Neighbor nodes: - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Your own opinion about an identity rules the visibility of that identity for yourself,</p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">and is shared among friends. A final score is calculated according to a formula that accounts your own opinion and your friends' opinions about someone:</p> -<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> S = own_opinion * a + friends_opinion * (1-a)</p> -<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The factor 'a' depends on the type of ID. </p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">- anonymous IDs: </p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">- PGP-signed IDs by unknown PGP keys: a=</p> -<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The overall score is used in chat lobbies, forums and channels to decide on the actions to take for each specific identity:</p> -<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">S &lt; -0.5: Posts are not stored, nor forwarded </p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">S &lt; 0.2: Posts are hidden, but still transmitted</p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">S &lt; 0.0: </p> -<p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The overall rating is computed in such a way that it is not possible for a single person to deterministically change someone's status at neighbor nodes.</p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> - - - 0 - - - - Negative - - - - ../icons/yellow_biohazard64.png../icons/yellow_biohazard64.png - - - - - Neutral - - - - - Positive - - - - - - - - <html><head/><body><p>Overall reputation score, accounting for yours and your friends'.</p><p>Negative is bad, positive is good. Zero is neutral. If the score is too low,</p><p>the identity is flagged as bad, and will be filtered out in forums, chat lobbies,</p><p>channels, etc.</p></body></html> - - - true - - - - - - - - 75 - true - - - - Overall: - - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - - ->>>>>>> upstream/master - + :/images/edit_16.png:/images/edit_16.png @@ -1134,7 +676,7 @@ p, li { white-space: pre-wrap; } - + :/images/delete.png:/images/delete.png @@ -1143,7 +685,7 @@ p, li { white-space: pre-wrap; } - + :/images/toaster/chat.png:/images/toaster/chat.png @@ -1178,16 +720,9 @@ p, li { white-space: pre-wrap; } idTreeWidget -<<<<<<< HEAD -======= - lineEdit_Nickname - lineEdit_KeyId - lineEdit_GpgId - lineEdit_GpgName ->>>>>>> upstream/master - + diff --git a/retroshare-gui/src/gui/People/PeopleDialog.cpp b/retroshare-gui/src/gui/People/PeopleDialog.cpp index 11d295322..85fbc8b6a 100644 --- a/retroshare-gui/src/gui/People/PeopleDialog.cpp +++ b/retroshare-gui/src/gui/People/PeopleDialog.cpp @@ -35,6 +35,7 @@ #include "retroshare/rsgxscircles.h" #include "retroshare/rsgxsflags.h" #include "retroshare/rsmsgs.h" +#include "retroshare/rsids.h" #include #include @@ -563,8 +564,10 @@ void PeopleDialog::chatIdentity() uint32_t error_code ; - if(!rsMsgs->initiateDistantChatConnexion(RsGxsId(gxs_id), from_gxs_id, 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)) ; + 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)) ; } }