fixed up using invite flags to populate certificate comments

This commit is contained in:
csoler 2022-02-13 22:38:32 +01:00
parent 2428ebf6c3
commit b9a4cdcd50
6 changed files with 24 additions and 19 deletions

@ -1 +1 @@
Subproject commit d26821b891d7b3e72da475896814a82716574e56
Subproject commit 61dbe774d60070a7ce371f925f230a878996cdd5

View File

@ -238,8 +238,7 @@ void HomePage::getOwnCert(QString& invite,QString& description) const
else
invite = QString::fromStdString(rsPeers->GetRetroshareInvite(detail.id,invite_flags));
bool include_extra_locators = mIncludeIPHistoryact->isChecked();
description = ConfCertDialog::getCertificateDescription(detail,false,!mUseOldFormatact->isChecked(),include_extra_locators);
description = ConfCertDialog::getCertificateDescription(detail,false,!mUseOldFormatact->isChecked(),invite_flags);
}
void HomePage::updateOwnCert()

View File

@ -283,7 +283,7 @@ void ConfCertDialog::loadInvitePage()
ui.stabWidget->setTabText(PageCertificate, tr("Retroshare Certificate"));
}
QString infotext = getCertificateDescription(detail,ui._shouldAddSignatures_CB->isChecked(),ui._shortFormat_CB->isChecked(), ui._includeIPHistory_CB->isChecked() );
QString infotext = getCertificateDescription(detail,ui._shouldAddSignatures_CB->isChecked(),ui._shortFormat_CB->isChecked(), flags );
ui.userCertificateText->setToolTip(infotext) ;
@ -297,7 +297,7 @@ void ConfCertDialog::loadInvitePage()
ui.userCertificateText->setText(QString::fromUtf8(invite.c_str()));
}
QString ConfCertDialog::getCertificateDescription(const RsPeerDetails& detail,bool signatures_included,bool use_short_format,bool include_additional_locators)
QString ConfCertDialog::getCertificateDescription(const RsPeerDetails& detail, bool signatures_included, bool use_short_format,RetroshareInviteFlags invite_flags)
{
//infotext += tr("<p>Use this certificate to make new friends. Send it by email, or give it hand to hand.</p>") ;
QString infotext;
@ -330,19 +330,23 @@ QString ConfCertDialog::getCertificateDescription(const RsPeerDetails& detail,bo
if(detail.isHiddenNode)
infotext += tr("<li> <b>onion address</b> and <b>port</b>") +" (" + detail.hiddenNodeAddress.c_str() + ":" + QString::number(detail.hiddenNodePort)+ ")</li>";
else if(!include_additional_locators)
else if(!!(invite_flags & RetroshareInviteFlags::FULL_IP_HISTORY))
for(auto it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it)
{
infotext += "<li>" ;
infotext += tr("<b>IP address</b> and <b>port</b>: ") + QString::fromStdString(*it) ;
infotext += "</li>" ;
}
else
{
if(!detail.localAddr.empty()) infotext += tr("<li><b>IP address</b> and <b>port</b>: ") + detail.localAddr.c_str() + ":" + QString::number(detail.localPort)+ "</li>";
if(!detail.extAddr.empty()) infotext += tr("<li><b>IP address</b> and <b>port</b>: ") + detail.extAddr.c_str() + ":" + QString::number(detail.extPort)+ "</li>";
}
else for(auto it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it)
{
infotext += "<li>" ;
infotext += tr("<b>IP address</b> and <b>port</b>: ") + QString::fromStdString(*it) ;
infotext += "</li>" ;
}
if(!!(invite_flags & RetroshareInviteFlags::CURRENT_LOCAL_IP) && !detail.localAddr.empty())
infotext += tr("<li><b>IP address</b> and <b>port</b>: ") + detail.localAddr.c_str() + ":" + QString::number(detail.localPort)+ "</li>";
if(!detail.dyndns.empty())
if(!!(invite_flags & RetroshareInviteFlags::CURRENT_EXTERNAL_IP) && !detail.extAddr.empty())
infotext += tr("<li><b>IP address</b> and <b>port</b>: ") + detail.extAddr.c_str() + ":" + QString::number(detail.extPort)+ "</li>";
}
if(!!(invite_flags & RetroshareInviteFlags::DNS) && !detail.dyndns.empty())
{
infotext += "<li>" ;
infotext += tr("<b>DNS:</b> : ") + QString::fromStdString(detail.dyndns);

View File

@ -59,7 +59,7 @@ public:
/* window will destroy itself! */
}
static void loadAll();
static QString getCertificateDescription(const RsPeerDetails& det, bool signatures_included, bool use_short_format, bool extra_locators_included);
static QString getCertificateDescription(const RsPeerDetails& det, bool signatures_included, bool use_short_format,RetroshareInviteFlags invite_flags);
signals:
void configChanged();

View File

@ -891,7 +891,9 @@ void ConnectFriendWizard::cleanFriendCert()
whileBlocking(ui->friendCertEdit)->setPlainText(QString::fromUtf8(cleanCert.c_str()));
whileBlocking(ui->friendCertEdit)->setTextCursor(textCursor);
certDetail = ConfCertDialog::getCertificateDescription(details,false,mIsShortInvite,!details.ipAddressList.empty());
// use dummy flags so that the content of the description is driven by what's in the "details" variable.
RetroshareInviteFlags dummy_flags = RetroshareInviteFlags::ALL;
certDetail = ConfCertDialog::getCertificateDescription(details,false,mIsShortInvite,dummy_flags);
}
if (mIsShortInvite)

View File

@ -165,7 +165,7 @@ CryptoPage::load()
RsPeerDetails detail;
rsPeers->getPeerDetails(rsPeers->getOwnId(),detail);
ui.certplainTextEdit->setToolTip(ConfCertDialog::getCertificateDescription(detail, ui._includeSignatures_CB->isChecked(), ui._shortFormat_CB->isChecked(), ui._includeAllIPs_CB->isChecked() ));
ui.certplainTextEdit->setToolTip(ConfCertDialog::getCertificateDescription(detail, ui._includeSignatures_CB->isChecked(), ui._shortFormat_CB->isChecked(), flags));
}
void