mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-21 12:54:26 -04:00
Merge pull request #2211 from csoler/v0.6-BugFixing_5
Various bug fixes
This commit is contained in:
commit
d92132d025
17 changed files with 201 additions and 126 deletions
|
@ -187,7 +187,7 @@ RsGenExchange::RsGenExchange(
|
||||||
GxsMsgReq msgsToDel;
|
GxsMsgReq msgsToDel;
|
||||||
|
|
||||||
RsGxsSinglePassIntegrityCheck::check(mServType,mGixs,mDataStore,
|
RsGxsSinglePassIntegrityCheck::check(mServType,mGixs,mDataStore,
|
||||||
this, mSerialiser,
|
this, *mSerialiser,
|
||||||
grpsToDel,msgsToDel);
|
grpsToDel,msgsToDel);
|
||||||
|
|
||||||
for(auto& grpId: grpsToDel)
|
for(auto& grpId: grpsToDel)
|
||||||
|
@ -2309,7 +2309,16 @@ void RsGenExchange::publishMsgs()
|
||||||
uint32_t token = mit->first;
|
uint32_t token = mit->first;
|
||||||
|
|
||||||
uint32_t size = mSerialiser->size(msgItem);
|
uint32_t size = mSerialiser->size(msgItem);
|
||||||
char* mData = new char[size];
|
|
||||||
|
if(size > RsSerialiser::MAX_SERIAL_SIZE)
|
||||||
|
{
|
||||||
|
std::cerr << "Trying to publish a GXS message larger than the accepted maximal size of " << RsSerialiser::MAX_SERIAL_SIZE << " bytes. This is a bug." << std::endl;
|
||||||
|
mDataAccess->updatePublicRequestStatus(token, RsTokenService::FAILED);
|
||||||
|
delete msgItem;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
RsTemporaryMemory mData(size);
|
||||||
|
|
||||||
// for fatal sign creation
|
// for fatal sign creation
|
||||||
bool createOk = false;
|
bool createOk = false;
|
||||||
|
@ -2386,9 +2395,7 @@ void RsGenExchange::publishMsgs()
|
||||||
|
|
||||||
// check message not over single msg storage limit
|
// check message not over single msg storage limit
|
||||||
if(createOk)
|
if(createOk)
|
||||||
{
|
|
||||||
validSize = mDataStore->validSize(msg);
|
validSize = mDataStore->validSize(msg);
|
||||||
}
|
|
||||||
|
|
||||||
if(createOk && validSize)
|
if(createOk && validSize)
|
||||||
{
|
{
|
||||||
|
@ -2404,11 +2411,14 @@ void RsGenExchange::publishMsgs()
|
||||||
// now serialise meta data
|
// now serialise meta data
|
||||||
size = msg->metaData->serial_size();
|
size = msg->metaData->serial_size();
|
||||||
|
|
||||||
char* metaDataBuff = new char[size];
|
{
|
||||||
|
RsTemporaryMemory metaDataBuff(size);
|
||||||
|
|
||||||
bool s = msg->metaData->serialise(metaDataBuff, &size);
|
bool s = msg->metaData->serialise(metaDataBuff, &size);
|
||||||
s &= msg->meta.setBinData(metaDataBuff, size);
|
s &= msg->meta.setBinData(metaDataBuff, size);
|
||||||
if (!s)
|
if (!s)
|
||||||
std::cerr << "(WW) Can't serialise or set bin data" << std::endl;
|
std::cerr << "(WW) Can't serialise or set bin data" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
msg->metaData->mMsgStatus = GXS_SERV::GXS_MSG_STATUS_UNPROCESSED;
|
msg->metaData->mMsgStatus = GXS_SERV::GXS_MSG_STATUS_UNPROCESSED;
|
||||||
msgId = msg->msgId;
|
msgId = msg->msgId;
|
||||||
|
@ -2416,6 +2426,7 @@ void RsGenExchange::publishMsgs()
|
||||||
msg->metaData->recvTS = time(NULL);
|
msg->metaData->recvTS = time(NULL);
|
||||||
|
|
||||||
// FIXTESTS global variable rsPeers not available in unittests!
|
// FIXTESTS global variable rsPeers not available in unittests!
|
||||||
|
|
||||||
if(rsPeers)
|
if(rsPeers)
|
||||||
mRoutingClues[msg->metaData->mAuthorId].insert(rsPeers->getOwnId()) ;
|
mRoutingClues[msg->metaData->mAuthorId].insert(rsPeers->getOwnId()) ;
|
||||||
|
|
||||||
|
@ -2425,21 +2436,27 @@ void RsGenExchange::publishMsgs()
|
||||||
mPublishedMsgs[token] = *msg->metaData;
|
mPublishedMsgs[token] = *msg->metaData;
|
||||||
|
|
||||||
RsGxsMsgItem *msg_item = dynamic_cast<RsGxsMsgItem*>(mSerialiser->deserialise(msg->msg.bin_data,&msg->msg.bin_len)) ;
|
RsGxsMsgItem *msg_item = dynamic_cast<RsGxsMsgItem*>(mSerialiser->deserialise(msg->msg.bin_data,&msg->msg.bin_len)) ;
|
||||||
|
|
||||||
|
if(!msg_item)
|
||||||
|
{
|
||||||
|
delete msg;
|
||||||
|
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenService::FAILED);
|
||||||
|
|
||||||
|
std::cerr << "RsGenExchange::publishMsgs() failed to publish msg, probably because of data size limits. bin_len=" << msg->msg.bin_len << std::endl;
|
||||||
|
continue; // next mit
|
||||||
|
}
|
||||||
msg_item->meta = *msg->metaData;
|
msg_item->meta = *msg->metaData;
|
||||||
|
|
||||||
mDataAccess->addMsgData(msg); // msg is deleted by addMsgData()
|
mDataAccess->addMsgData(msg); // msg is deleted by addMsgData()
|
||||||
|
|
||||||
msgChangeMap[grpId].push_back(msg_item);
|
msgChangeMap[grpId].push_back(msg_item);
|
||||||
|
|
||||||
delete[] metaDataBuff;
|
|
||||||
|
|
||||||
if(mNetService != NULL)
|
if(mNetService != NULL)
|
||||||
mNetService->stampMsgServerUpdateTS(grpId) ;
|
mNetService->stampMsgServerUpdateTS(grpId) ;
|
||||||
|
|
||||||
// add to published to allow acknowledgement
|
// add to published to allow acknowledgement
|
||||||
mMsgNotify.insert(std::make_pair(mit->first, std::make_pair(grpId, msgId)));
|
mMsgNotify.insert(std::make_pair(mit->first, std::make_pair(grpId, msgId)));
|
||||||
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenService::COMPLETE);
|
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenService::COMPLETE);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2447,8 +2464,7 @@ void RsGenExchange::publishMsgs()
|
||||||
delete msg;
|
delete msg;
|
||||||
|
|
||||||
if(!tryLater)
|
if(!tryLater)
|
||||||
mDataAccess->updatePublicRequestStatus(mit->first,
|
mDataAccess->updatePublicRequestStatus(mit->first, RsTokenService::FAILED);
|
||||||
RsTokenService::FAILED);
|
|
||||||
|
|
||||||
std::cerr << "RsGenExchange::publishMsgs() failed to publish msg " << std::endl;
|
std::cerr << "RsGenExchange::publishMsgs() failed to publish msg " << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -2458,8 +2474,6 @@ void RsGenExchange::publishMsgs()
|
||||||
std::cerr << "RsGenExchange::publishMsgs() failed to serialise msg " << std::endl;
|
std::cerr << "RsGenExchange::publishMsgs() failed to serialise msg " << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] mData;
|
|
||||||
|
|
||||||
if(!tryLater)
|
if(!tryLater)
|
||||||
delete msgItem;
|
delete msgItem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,14 +199,8 @@ bool RsGxsCleanUp::clean(RsGxsGroupId& next_group_to_check,std::vector<RsGxsGrou
|
||||||
RsGxsIntegrityCheck::RsGxsIntegrityCheck(
|
RsGxsIntegrityCheck::RsGxsIntegrityCheck(
|
||||||
RsGeneralDataService* const dataService, RsGenExchange* genex,
|
RsGeneralDataService* const dataService, RsGenExchange* genex,
|
||||||
RsSerialType&
|
RsSerialType&
|
||||||
#ifdef RS_DEEP_CHANNEL_INDEX
|
|
||||||
serializer
|
|
||||||
#endif
|
|
||||||
, RsGixs* gixs )
|
, RsGixs* gixs )
|
||||||
: mDs(dataService), mGenExchangeClient(genex),
|
: mDs(dataService), mGenExchangeClient(genex),
|
||||||
#ifdef RS_DEEP_CHANNEL_INDEX
|
|
||||||
mSerializer(serializer),
|
|
||||||
#endif
|
|
||||||
mDone(false), mIntegrityMutex("integrity"), mGixs(gixs) {}
|
mDone(false), mIntegrityMutex("integrity"), mGixs(gixs) {}
|
||||||
|
|
||||||
void RsGxsIntegrityCheck::run()
|
void RsGxsIntegrityCheck::run()
|
||||||
|
|
|
@ -171,8 +171,8 @@ public:
|
||||||
* @param chunkSize
|
* @param chunkSize
|
||||||
* @param sleepPeriod
|
* @param sleepPeriod
|
||||||
*/
|
*/
|
||||||
RsGxsIntegrityCheck( RsGeneralDataService* const dataService,
|
RsGxsIntegrityCheck(RsGeneralDataService* const dataService,
|
||||||
RsGenExchange *genex, RsSerialType& gxsSerialiser,
|
RsGenExchange *genex, RsSerialType&,
|
||||||
RsGixs *gixs);
|
RsGixs *gixs);
|
||||||
|
|
||||||
static bool check(uint16_t service_type, RsGixs *mgixs, RsGeneralDataService *mds);
|
static bool check(uint16_t service_type, RsGixs *mgixs, RsGeneralDataService *mds);
|
||||||
|
|
|
@ -889,7 +889,7 @@ public:
|
||||||
bool& is_short_format, uint32_t& error_code ) = 0;
|
bool& is_short_format, uint32_t& error_code ) = 0;
|
||||||
virtual std::string saveCertificateToString(const RsPeerId &id) = 0;
|
virtual std::string saveCertificateToString(const RsPeerId &id) = 0;
|
||||||
|
|
||||||
virtual bool signGPGCertificate(const RsPgpId &gpg_id) = 0;
|
virtual bool signGPGCertificate(const RsPgpId &gpg_id,const std::string& gpg_passphrase) = 0;
|
||||||
virtual bool trustGPGCertificate(const RsPgpId &gpg_id, uint32_t trustlvl) = 0;
|
virtual bool trustGPGCertificate(const RsPgpId &gpg_id, uint32_t trustlvl) = 0;
|
||||||
|
|
||||||
/* Group Stuff */
|
/* Group Stuff */
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "pqi/authssl.h"
|
#include "pqi/authssl.h"
|
||||||
#include "pqi/authgpg.h"
|
#include "pqi/authgpg.h"
|
||||||
#include "retroshare/rsinit.h"
|
#include "retroshare/rsinit.h"
|
||||||
|
#include "retroshare/rsnotify.h"
|
||||||
#include "retroshare/rsfiles.h"
|
#include "retroshare/rsfiles.h"
|
||||||
#include "util/rsurl.h"
|
#include "util/rsurl.h"
|
||||||
#include "util/radix64.h"
|
#include "util/radix64.h"
|
||||||
|
@ -1680,19 +1681,23 @@ std::string p3Peers::saveCertificateToString(const RsPeerId &id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Peers::signGPGCertificate(const RsPgpId &id)
|
bool p3Peers::signGPGCertificate(const RsPgpId &id, const std::string &gpg_passphrase)
|
||||||
{
|
{
|
||||||
#ifdef P3PEERS_DEBUG
|
#ifdef P3PEERS_DEBUG
|
||||||
std::cerr << "p3Peers::SignCertificate() " << id;
|
std::cerr << "p3Peers::SignCertificate() " << id;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
rsNotify->cachePgpPassphrase(gpg_passphrase);
|
||||||
|
rsNotify->setDisableAskPassword(true);
|
||||||
|
|
||||||
|
bool res = AuthGPG::getAuthGPG()->SignCertificateLevel0(id);
|
||||||
|
|
||||||
AuthGPG::getAuthGPG()->AllowConnection(id, true);
|
rsNotify->clearPgpPassphrase();
|
||||||
return AuthGPG::getAuthGPG()->SignCertificateLevel0(id);
|
rsNotify->setDisableAskPassword(false);
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool p3Peers::trustGPGCertificate(const RsPgpId &id, uint32_t trustlvl)
|
bool p3Peers::trustGPGCertificate(const RsPgpId &id, uint32_t trustlvl)
|
||||||
{
|
{
|
||||||
#ifdef P3PEERS_DEBUG
|
#ifdef P3PEERS_DEBUG
|
||||||
|
|
|
@ -165,7 +165,7 @@ public:
|
||||||
virtual bool cleanCertificate(const std::string &certstr, std::string &cleanCert, bool &is_short_format, uint32_t& error_code) override;
|
virtual bool cleanCertificate(const std::string &certstr, std::string &cleanCert, bool &is_short_format, uint32_t& error_code) override;
|
||||||
virtual std::string saveCertificateToString(const RsPeerId &id) override;
|
virtual std::string saveCertificateToString(const RsPeerId &id) override;
|
||||||
|
|
||||||
virtual bool signGPGCertificate(const RsPgpId &id) override;
|
virtual bool signGPGCertificate(const RsPgpId &id,const std::string& gpg_passphrase) override;
|
||||||
virtual bool trustGPGCertificate(const RsPgpId &id, uint32_t trustlvl) override;
|
virtual bool trustGPGCertificate(const RsPgpId &id, uint32_t trustlvl) override;
|
||||||
|
|
||||||
/* Group Stuff */
|
/* Group Stuff */
|
||||||
|
|
|
@ -1927,20 +1927,26 @@ RsInit::LoadCertificateStatus RsLoginHelper::attemptLogin(const RsPeerId& accoun
|
||||||
{
|
{
|
||||||
if(isLoggedIn()) return RsInit::ERR_ALREADY_RUNNING;
|
if(isLoggedIn()) return RsInit::ERR_ALREADY_RUNNING;
|
||||||
|
|
||||||
|
{
|
||||||
|
if(!RsAccounts::SelectAccount(account))
|
||||||
|
return RsInit::ERR_UNKNOWN;
|
||||||
|
|
||||||
if(!password.empty())
|
if(!password.empty())
|
||||||
{
|
{
|
||||||
if(!rsNotify->cachePgpPassphrase(password)) return RsInit::ERR_UNKNOWN;
|
rsNotify->cachePgpPassphrase(password);
|
||||||
if(!rsNotify->setDisableAskPassword(true)) return RsInit::ERR_UNKNOWN;
|
rsNotify->setDisableAskPassword(true);
|
||||||
}
|
}
|
||||||
if(!RsAccounts::SelectAccount(account)) return RsInit::ERR_UNKNOWN;
|
|
||||||
std::string _ignore_lockFilePath;
|
std::string _ignore_lockFilePath;
|
||||||
RsInit::LoadCertificateStatus ret = RsInit::LockAndLoadCertificates(false, _ignore_lockFilePath);
|
RsInit::LoadCertificateStatus ret = RsInit::LockAndLoadCertificates(false, _ignore_lockFilePath);
|
||||||
|
|
||||||
if(!rsNotify->setDisableAskPassword(false)) return RsInit::ERR_UNKNOWN;
|
rsNotify->setDisableAskPassword(false) ;
|
||||||
if(!rsNotify->clearPgpPassphrase()) return RsInit::ERR_UNKNOWN;
|
rsNotify->clearPgpPassphrase() ;
|
||||||
if(ret != RsInit::OK) return ret;
|
|
||||||
if(RsControl::instance()->StartupRetroShare() == 1) return RsInit::OK;
|
if(ret == RsInit::OK && RsControl::instance()->StartupRetroShare() == 1)
|
||||||
return RsInit::ERR_UNKNOWN;
|
return RsInit::OK;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static*/ bool RsLoginHelper::collectEntropy(uint32_t bytes)
|
/*static*/ bool RsLoginHelper::collectEntropy(uint32_t bytes)
|
||||||
|
|
|
@ -636,9 +636,6 @@ void GenCertDialog::genPerson()
|
||||||
|
|
||||||
setCursor(Qt::ArrowCursor) ;
|
setCursor(Qt::ArrowCursor) ;
|
||||||
}
|
}
|
||||||
// now cache the PGP password so that it's not asked again for immediately signing the key
|
|
||||||
rsNotify->cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ;
|
|
||||||
|
|
||||||
//generate a random ssl password
|
//generate a random ssl password
|
||||||
std::string sslPasswd = RSRandom::random_alphaNumericString(RsInit::getSslPwdLen()) ;
|
std::string sslPasswd = RSRandom::random_alphaNumericString(RsInit::getSslPwdLen()) ;
|
||||||
|
|
||||||
|
@ -650,6 +647,10 @@ void GenCertDialog::genPerson()
|
||||||
std::string err;
|
std::string err;
|
||||||
this->hide();//To show dialog asking password PGP Key.
|
this->hide();//To show dialog asking password PGP Key.
|
||||||
std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl;
|
std::cout << "RsAccounts::GenerateSSLCertificate" << std::endl;
|
||||||
|
|
||||||
|
// now cache the PGP password so that it's not asked again for immediately signing the key
|
||||||
|
rsNotify->cachePgpPassphrase(ui.password_input->text().toUtf8().constData()) ;
|
||||||
|
|
||||||
bool okGen = RsAccounts::createNewAccount(PGPId, "", genLoc, "", isHiddenLoc, isAutoTor, sslPasswd, sslId, err);
|
bool okGen = RsAccounts::createNewAccount(PGPId, "", genLoc, "", isHiddenLoc, isAutoTor, sslPasswd, sslId, err);
|
||||||
|
|
||||||
if (okGen)
|
if (okGen)
|
||||||
|
@ -658,16 +659,23 @@ void GenCertDialog::genPerson()
|
||||||
RsInit::LoadPassword(sslPasswd);
|
RsInit::LoadPassword(sslPasswd);
|
||||||
if (Rshare::loadCertificate(sslId, false)) {
|
if (Rshare::loadCertificate(sslId, false)) {
|
||||||
|
|
||||||
|
// Now clear the cached passphrase
|
||||||
|
rsNotify->clearPgpPassphrase();
|
||||||
|
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Now clear the cached passphrase
|
||||||
|
rsNotify->clearPgpPassphrase();
|
||||||
|
|
||||||
/* Message Dialog */
|
/* Message Dialog */
|
||||||
QMessageBox::warning(this,
|
QMessageBox::warning(this,
|
||||||
tr("Profile generation failure"),
|
tr("Profile generation failure"),
|
||||||
tr("Failed to generate your new certificate, maybe PGP password is wrong!"),
|
tr("Failed to generate your new certificate, maybe PGP password is wrong!"),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
|
|
||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -549,6 +549,8 @@ void IdEditDialog::createId()
|
||||||
std::string gpg_name = rsPeers->getGPGName(rsPeers->getGPGOwnId());
|
std::string gpg_name = rsPeers->getGPGName(rsPeers->getGPGOwnId());
|
||||||
bool cancelled;
|
bool cancelled;
|
||||||
|
|
||||||
|
rsNotify->clearPgpPassphrase(); // just in case
|
||||||
|
|
||||||
if(!NotifyQt::getInstance()->askForPassword(tr("Profile password needed.").toStdString(),
|
if(!NotifyQt::getInstance()->askForPassword(tr("Profile password needed.").toStdString(),
|
||||||
gpg_name + " (" + rsPeers->getOwnId().toStdString() + ")",
|
gpg_name + " (" + rsPeers->getOwnId().toStdString() + ")",
|
||||||
false,
|
false,
|
||||||
|
|
|
@ -126,6 +126,7 @@ void StartDialog::loadPerson()
|
||||||
bool res = Rshare::loadCertificate(accountId, ui.autologin_checkbox->isChecked()) ;
|
bool res = Rshare::loadCertificate(accountId, ui.autologin_checkbox->isChecked()) ;
|
||||||
|
|
||||||
rsNotify->setDisableAskPassword(false);
|
rsNotify->setDisableAskPassword(false);
|
||||||
|
rsNotify->clearPgpPassphrase();
|
||||||
|
|
||||||
if(res)
|
if(res)
|
||||||
accept();
|
accept();
|
||||||
|
|
|
@ -740,6 +740,38 @@ void ConnectFriendWizard::accept()
|
||||||
{
|
{
|
||||||
std::cerr << "ConclusionPage::validatePage() accepting GPG key for connection." << std::endl;
|
std::cerr << "ConclusionPage::validatePage() accepting GPG key for connection." << std::endl;
|
||||||
|
|
||||||
|
if(sign)
|
||||||
|
{
|
||||||
|
std::cerr << "ConclusionPage::validatePage() signing GPG key." << std::endl;
|
||||||
|
bool prev_is_bad = false;
|
||||||
|
|
||||||
|
for(int i=0;i<3;++i)
|
||||||
|
{
|
||||||
|
std::string pgp_name = rsPeers->getGPGName(rsPeers->getGPGOwnId());
|
||||||
|
bool cancelled;
|
||||||
|
std::string pgp_password;
|
||||||
|
|
||||||
|
if(!NotifyQt::getInstance()->askForPassword(tr("Profile password needed.").toStdString(), pgp_name + " (" + rsPeers->getOwnId().toStdString() + ")", prev_is_bad, pgp_password,cancelled))
|
||||||
|
{
|
||||||
|
QMessageBox::critical(NULL,tr("Identity creation failed"),tr("Cannot create an identity linked to your profile without your profile password."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rsPeers->signGPGCertificate(peerDetails.gpg_id,pgp_password))
|
||||||
|
{
|
||||||
|
prev_is_bad = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
prev_is_bad = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(prev_is_bad)
|
||||||
|
{
|
||||||
|
QMessageBox::warning(nullptr,tr("Signature failed"),tr("Signature failed. Uncheck the key signature box if you want to make friends without signing the friends' certificate"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(peerDetails.skip_pgp_signature_validation)
|
if(peerDetails.skip_pgp_signature_validation)
|
||||||
rsPeers->addSslOnlyFriend(peerDetails.id, peerDetails.gpg_id,peerDetails);
|
rsPeers->addSslOnlyFriend(peerDetails.id, peerDetails.gpg_id,peerDetails);
|
||||||
else
|
else
|
||||||
|
@ -757,12 +789,7 @@ void ConnectFriendWizard::accept()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sign)
|
|
||||||
{
|
|
||||||
std::cerr << "ConclusionPage::validatePage() signing GPG key." << std::endl;
|
|
||||||
rsPeers->signGPGCertificate(peerDetails.gpg_id); //bye default sign set accept_connection to true;
|
|
||||||
rsPeers->setServicePermissionFlags(peerDetails.gpg_id,serviceFlags()) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!groupId.isEmpty())
|
if (!groupId.isEmpty())
|
||||||
rsPeers->assignPeerToGroup(RsNodeGroupId(groupId.toStdString()), peerDetails.gpg_id, true);
|
rsPeers->assignPeerToGroup(RsNodeGroupId(groupId.toStdString()), peerDetails.gpg_id, true);
|
||||||
|
|
|
@ -87,8 +87,6 @@ PGPKeyDialog::PGPKeyDialog(const RsPeerId& id, const RsPgpId &pgp_id, QWidget *p
|
||||||
connect(ui.make_friend_button, SIGNAL(clicked()), this, SLOT(makeFriend()));
|
connect(ui.make_friend_button, SIGNAL(clicked()), this, SLOT(makeFriend()));
|
||||||
connect(ui.denyFriendButton, SIGNAL(clicked()), this, SLOT(denyFriend()));
|
connect(ui.denyFriendButton, SIGNAL(clicked()), this, SLOT(denyFriend()));
|
||||||
connect(ui.signKeyButton, SIGNAL(clicked()), this, SLOT(signGPGKey()));
|
connect(ui.signKeyButton, SIGNAL(clicked()), this, SLOT(signGPGKey()));
|
||||||
//connect(ui.trusthelpButton, SIGNAL(clicked()), this, SLOT(showHelpDialog()));
|
|
||||||
//connect(ui._shouldAddSignatures_CB, SIGNAL(toggled(bool)), this, SLOT(loadInvitePage()));
|
|
||||||
connect(ui._shouldAddSignatures_CB_2, SIGNAL(toggled(bool)), this, SLOT(loadKeyPage()));
|
connect(ui._shouldAddSignatures_CB_2, SIGNAL(toggled(bool)), this, SLOT(loadKeyPage()));
|
||||||
|
|
||||||
//ui.avatar->setFrameType(AvatarWidget::NORMAL_FRAME);
|
//ui.avatar->setFrameType(AvatarWidget::NORMAL_FRAME);
|
||||||
|
@ -182,7 +180,6 @@ void PGPKeyDialog::load()
|
||||||
if (detail.gpg_id == rsPeers->getGPGOwnId())
|
if (detail.gpg_id == rsPeers->getGPGOwnId())
|
||||||
{
|
{
|
||||||
ui.make_friend_button->hide();
|
ui.make_friend_button->hide();
|
||||||
ui.signGPGKeyCheckBox->hide();
|
|
||||||
ui.signKeyButton->hide();
|
ui.signKeyButton->hide();
|
||||||
ui.denyFriendButton->hide();
|
ui.denyFriendButton->hide();
|
||||||
|
|
||||||
|
@ -199,30 +196,17 @@ void PGPKeyDialog::load()
|
||||||
ui.trustlevel_CB->show();
|
ui.trustlevel_CB->show();
|
||||||
ui.is_signing_me->show();
|
ui.is_signing_me->show();
|
||||||
ui.signersLabel->setText(tr("This key is signed by :")+" ");
|
ui.signersLabel->setText(tr("This key is signed by :")+" ");
|
||||||
|
ui.signKeyButton->setEnabled(!detail.ownsign);
|
||||||
|
|
||||||
if (detail.accept_connection)
|
if (detail.accept_connection)
|
||||||
{
|
{
|
||||||
ui.make_friend_button->hide();
|
ui.make_friend_button->hide();
|
||||||
ui.denyFriendButton->show();
|
ui.denyFriendButton->show();
|
||||||
ui.signGPGKeyCheckBox->hide();
|
|
||||||
//connection already accepted, propose to sign gpg key
|
|
||||||
if (!detail.ownsign) {
|
|
||||||
ui.signKeyButton->show();
|
|
||||||
} else {
|
|
||||||
ui.signKeyButton->hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui.make_friend_button->show();
|
ui.make_friend_button->show();
|
||||||
ui.denyFriendButton->hide();
|
ui.denyFriendButton->hide();
|
||||||
ui.signKeyButton->hide();
|
|
||||||
if (!detail.ownsign) {
|
|
||||||
ui.signGPGKeyCheckBox->show();
|
|
||||||
ui.signGPGKeyCheckBox->setChecked(false);
|
|
||||||
} else {
|
|
||||||
ui.signGPGKeyCheckBox->hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//web of trust
|
//web of trust
|
||||||
|
@ -358,12 +342,7 @@ void PGPKeyDialog::applyDialog()
|
||||||
|
|
||||||
void PGPKeyDialog::makeFriend()
|
void PGPKeyDialog::makeFriend()
|
||||||
{
|
{
|
||||||
if (ui.signGPGKeyCheckBox->isChecked()) {
|
|
||||||
rsPeers->signGPGCertificate(pgpId);
|
|
||||||
}
|
|
||||||
|
|
||||||
rsPeers->addFriend(peerId, pgpId);
|
rsPeers->addFriend(peerId, pgpId);
|
||||||
// setServiceFlags() ;
|
|
||||||
loadAll();
|
loadAll();
|
||||||
|
|
||||||
emit configChanged();
|
emit configChanged();
|
||||||
|
@ -379,12 +358,21 @@ void PGPKeyDialog::denyFriend()
|
||||||
|
|
||||||
void PGPKeyDialog::signGPGKey()
|
void PGPKeyDialog::signGPGKey()
|
||||||
{
|
{
|
||||||
if (!rsPeers->signGPGCertificate(pgpId)) {
|
std::string gpg_name = rsPeers->getGPGName(rsPeers->getGPGOwnId());
|
||||||
QMessageBox::warning ( NULL,
|
bool cancelled;
|
||||||
tr("Signature Failure"),
|
std::string gpg_password;
|
||||||
tr("Maybe password is wrong"),
|
|
||||||
QMessageBox::Ok);
|
if(!NotifyQt::getInstance()->askForPassword(tr("Profile password needed.").toStdString(), gpg_name + " (" + rsPeers->getOwnId().toStdString() + ")", false, gpg_password,cancelled))
|
||||||
|
{
|
||||||
|
QMessageBox::critical(NULL,tr("Identity creation failed"),tr("Cannot create an identity linked to your profile without your profile password."));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rsNotify->clearPgpPassphrase(); // just in case
|
||||||
|
|
||||||
|
if(!rsPeers->signGPGCertificate(pgpId,gpg_password))
|
||||||
|
QMessageBox::warning ( NULL, tr("Signature Failure"), tr("Check the password!"), QMessageBox::Ok);
|
||||||
|
|
||||||
loadAll();
|
loadAll();
|
||||||
|
|
||||||
emit configChanged();
|
emit configChanged();
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>600</width>
|
<width>600</width>
|
||||||
<height>401</height>
|
<height>452</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -205,16 +205,6 @@ p, li { white-space: pre-wrap; }
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="signGPGKeyCheckBox">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string><html><head/><body><p><span style=" font-size:10pt;">Signing a friend's key is a way to express your trust into this friend, to your other friends. It helps them to decide whether to allow connections from that key based on your own trust. Signing a key is absolutely optional and cannot be undone, so do it wisely.</span></p></body></html></string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Sign PGP key</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
|
@ -98,6 +98,7 @@ public:
|
||||||
// Helper functions
|
// Helper functions
|
||||||
|
|
||||||
void clear() ;
|
void clear() ;
|
||||||
|
bool getFileData(const QModelIndex& i, ChannelPostFileInfo &fmpe) const;
|
||||||
|
|
||||||
// AbstractItemModel functions.
|
// AbstractItemModel functions.
|
||||||
|
|
||||||
|
@ -156,7 +157,6 @@ private:
|
||||||
quintptr getParentRow(quintptr ref,int& row) const;
|
quintptr getParentRow(quintptr ref,int& row) const;
|
||||||
quintptr getChildRef(quintptr ref, int index) const;
|
quintptr getChildRef(quintptr ref, int index) const;
|
||||||
int getChildrenCount(quintptr ref) const;
|
int getChildrenCount(quintptr ref) const;
|
||||||
bool getFileData(const QModelIndex& i, ChannelPostFileInfo &fmpe) const;
|
|
||||||
|
|
||||||
static bool convertTabEntryToRefPointer(uint32_t entry, quintptr& ref);
|
static bool convertTabEntryToRefPointer(uint32_t entry, quintptr& ref);
|
||||||
static bool convertRefPointerToTabEntry(quintptr ref,uint32_t& entry);
|
static bool convertRefPointerToTabEntry(quintptr ref,uint32_t& entry);
|
||||||
|
|
|
@ -406,6 +406,9 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
|
||||||
connect(ui->channelPostFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnPostFiles(int,Qt::SortOrder)));
|
connect(ui->channelPostFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnPostFiles(int,Qt::SortOrder)));
|
||||||
connect(ui->channelFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnFiles(int,Qt::SortOrder)));
|
connect(ui->channelFiles_TV->header(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), this, SLOT(sortColumnFiles(int,Qt::SortOrder)));
|
||||||
|
|
||||||
|
connect(ui->channelPostFiles_TV,SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showChannelFilesContextMenu(QPoint)));
|
||||||
|
connect(ui->channelFiles_TV,SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showChannelFilesContextMenu(QPoint)));
|
||||||
|
|
||||||
ui->channelFiles_TV->setModel(mChannelFilesModel = new RsGxsChannelPostFilesModel());
|
ui->channelFiles_TV->setModel(mChannelFilesModel = new RsGxsChannelPostFilesModel());
|
||||||
ui->channelFiles_TV->setItemDelegate(mFilesDelegate = new ChannelPostFilesDelegate(this));
|
ui->channelFiles_TV->setItemDelegate(mFilesDelegate = new ChannelPostFilesDelegate(this));
|
||||||
ui->channelFiles_TV->setPlaceholderText(tr("No files in the channel, or no channel selected"));
|
ui->channelFiles_TV->setPlaceholderText(tr("No files in the channel, or no channel selected"));
|
||||||
|
@ -1243,6 +1246,35 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
|
||||||
showPostDetails();
|
showPostDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxsChannelPostsWidgetWithModel::showChannelFilesContextMenu(QPoint p)
|
||||||
|
{
|
||||||
|
QMenu contextMnu(this) ;
|
||||||
|
|
||||||
|
QAction *action = contextMnu.addAction(QIcon(), tr("Copy Retroshare link"), this, SLOT(copyChannelFilesLink()));
|
||||||
|
action->setData(QVariant::fromValue(sender()));
|
||||||
|
contextMnu.exec(QCursor::pos());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxsChannelPostsWidgetWithModel::copyChannelFilesLink()
|
||||||
|
{
|
||||||
|
// Block the popup if no results available
|
||||||
|
QAction *action = dynamic_cast<QAction*>(sender());
|
||||||
|
RSTreeView *tree = dynamic_cast<RSTreeView*>(action->data().value<QWidget*>());
|
||||||
|
|
||||||
|
QModelIndexList sel = tree->selectionModel()->selection().indexes();
|
||||||
|
|
||||||
|
if(sel.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
ChannelPostFileInfo file;
|
||||||
|
|
||||||
|
if(!static_cast<RsGxsChannelPostFilesModel*>(tree->model())->getFileData(sel.front(),file))
|
||||||
|
return;
|
||||||
|
|
||||||
|
RetroShareLink link = RetroShareLink::createFile(QString::fromUtf8(file.mName.c_str()), file.mSize, QString::fromStdString(file.mHash.toStdString()));
|
||||||
|
RSLinkClipboard::copyLinks(QList<RetroShareLink>{ link });
|
||||||
|
}
|
||||||
|
|
||||||
void GxsChannelPostsWidgetWithModel::setSubscribeButtonText(const RsGxsGroupId& group_id,uint32_t flags, uint32_t mPop)
|
void GxsChannelPostsWidgetWithModel::setSubscribeButtonText(const RsGxsGroupId& group_id,uint32_t flags, uint32_t mPop)
|
||||||
{
|
{
|
||||||
if(IS_GROUP_SUBSCRIBED(flags))
|
if(IS_GROUP_SUBSCRIBED(flags))
|
||||||
|
|
|
@ -163,6 +163,8 @@ public slots:
|
||||||
void sortColumnFiles(int col,Qt::SortOrder so);
|
void sortColumnFiles(int col,Qt::SortOrder so);
|
||||||
void sortColumnPostFiles(int col,Qt::SortOrder so);
|
void sortColumnPostFiles(int col,Qt::SortOrder so);
|
||||||
void updateCommentsCount(int n);
|
void updateCommentsCount(int n);
|
||||||
|
void showChannelFilesContextMenu(QPoint p);
|
||||||
|
void copyChannelFilesLink();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void processSettings(bool load);
|
void processSettings(bool load);
|
||||||
|
|
|
@ -181,7 +181,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="channel_TW">
|
<widget class="QTabWidget" name="channel_TW">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab_3">
|
<widget class="QWidget" name="tab_3">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
@ -552,6 +552,9 @@ p, li { white-space: pre-wrap; }
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="RSTreeView" name="channelPostFiles_TV">
|
<widget class="RSTreeView" name="channelPostFiles_TV">
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
<property name="editTriggers">
|
<property name="editTriggers">
|
||||||
<set>QAbstractItemView::CurrentChanged|QAbstractItemView::SelectedClicked</set>
|
<set>QAbstractItemView::CurrentChanged|QAbstractItemView::SelectedClicked</set>
|
||||||
</property>
|
</property>
|
||||||
|
@ -602,6 +605,9 @@ p, li { white-space: pre-wrap; }
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="RSTreeView" name="channelFiles_TV">
|
<widget class="RSTreeView" name="channelFiles_TV">
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
<property name="editTriggers">
|
<property name="editTriggers">
|
||||||
<set>QAbstractItemView::CurrentChanged|QAbstractItemView::SelectedClicked</set>
|
<set>QAbstractItemView::CurrentChanged|QAbstractItemView::SelectedClicked</set>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue