Merge pull request #2595 from csoler/v0.6-BugFixing_17

fixed certificate pasting bug
This commit is contained in:
csoler 2022-03-09 21:34:59 +01:00 committed by GitHub
commit bb2aee2b3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 13 deletions

View File

@ -205,16 +205,8 @@ HomePage::~HomePage()
delete ui; delete ui;
} }
void HomePage::getOwnCert(QString& invite,QString& description) const RetroshareInviteFlags HomePage::currentInviteFlags() const
{ {
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
{
std::cerr << "(EE) Cannot retrieve information about own certificate. That is a real problem!!" << std::endl;
return ;
}
RetroshareInviteFlags invite_flags = RetroshareInviteFlags::NOTHING; RetroshareInviteFlags invite_flags = RetroshareInviteFlags::NOTHING;
if(mIncludeLocIPact->isChecked()) if(mIncludeLocIPact->isChecked())
@ -229,6 +221,21 @@ void HomePage::getOwnCert(QString& invite,QString& description) const
if(mIncludeIPHistoryact->isChecked()) if(mIncludeIPHistoryact->isChecked())
invite_flags |= RetroshareInviteFlags::FULL_IP_HISTORY; invite_flags |= RetroshareInviteFlags::FULL_IP_HISTORY;
return invite_flags;
}
void HomePage::getOwnCert(QString& invite,QString& description) const
{
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(rsPeers->getOwnId(), detail))
{
std::cerr << "(EE) Cannot retrieve information about own certificate. That is a real problem!!" << std::endl;
return ;
}
auto invite_flags = currentInviteFlags();
invite_flags |= RetroshareInviteFlags::SLICE_TO_80_CHARS;
if(!mUseOldFormatact->isChecked()) if(!mUseOldFormatact->isChecked())
{ {
std::string short_invite; std::string short_invite;

View File

@ -49,6 +49,7 @@ public:
// Returns the certificate along with its description using current options. // Returns the certificate along with its description using current options.
void getOwnCert(QString& invite,QString& description) const; void getOwnCert(QString& invite,QString& description) const;
RetroshareInviteFlags currentInviteFlags() const ;
private slots: private slots:
#ifdef DEAD_CODE #ifdef DEAD_CODE

View File

@ -570,9 +570,13 @@ RetroShareLink RetroShareLink::createCertificate(const RsPeerId& ssl_id)
if(rsPeers->getOwnId() == ssl_id) // in this case, use application-wide parameters set in HomePage if(rsPeers->getOwnId() == ssl_id) // in this case, use application-wide parameters set in HomePage
{ {
QString invite,description; QString description;
static_cast<HomePage*>(MainWindow::getPage(MainWindow::Home))->getOwnCert(invite,description); auto invite_flags = static_cast<HomePage*>(MainWindow::getPage(MainWindow::Home))->currentInviteFlags();
link._radix = invite;
invite_flags &= ~RetroshareInviteFlags::SLICE_TO_80_CHARS;
invite_flags |= RetroshareInviteFlags::RADIX_FORMAT;
link._radix = QString::fromUtf8(rsPeers->GetRetroshareInvite(ssl_id,invite_flags).c_str());
} }
else else
link._radix = QString::fromUtf8(rsPeers->GetRetroshareInvite(ssl_id).c_str()); link._radix = QString::fromUtf8(rsPeers->GetRetroshareInvite(ssl_id).c_str());