From 97829de0ba023c663a6f81ae148f6d4866365278 Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 9 Mar 2022 21:32:26 +0100 Subject: [PATCH] fixed certificate pasting bug --- retroshare-gui/src/gui/HomePage.cpp | 27 ++++++++++++++--------- retroshare-gui/src/gui/HomePage.h | 1 + retroshare-gui/src/gui/RetroShareLink.cpp | 10 ++++++--- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/retroshare-gui/src/gui/HomePage.cpp b/retroshare-gui/src/gui/HomePage.cpp index b14b68eb9..dec4e9fec 100644 --- a/retroshare-gui/src/gui/HomePage.cpp +++ b/retroshare-gui/src/gui/HomePage.cpp @@ -205,17 +205,9 @@ HomePage::~HomePage() 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()) invite_flags |= RetroshareInviteFlags::CURRENT_LOCAL_IP; @@ -229,6 +221,21 @@ void HomePage::getOwnCert(QString& invite,QString& description) const if(mIncludeIPHistoryact->isChecked()) 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()) { std::string short_invite; diff --git a/retroshare-gui/src/gui/HomePage.h b/retroshare-gui/src/gui/HomePage.h index a20f07863..aa77ed1a3 100644 --- a/retroshare-gui/src/gui/HomePage.h +++ b/retroshare-gui/src/gui/HomePage.h @@ -49,6 +49,7 @@ public: // Returns the certificate along with its description using current options. void getOwnCert(QString& invite,QString& description) const; + RetroshareInviteFlags currentInviteFlags() const ; private slots: #ifdef DEAD_CODE diff --git a/retroshare-gui/src/gui/RetroShareLink.cpp b/retroshare-gui/src/gui/RetroShareLink.cpp index 524f3c757..6e377f70e 100644 --- a/retroshare-gui/src/gui/RetroShareLink.cpp +++ b/retroshare-gui/src/gui/RetroShareLink.cpp @@ -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 { - QString invite,description; - static_cast(MainWindow::getPage(MainWindow::Home))->getOwnCert(invite,description); - link._radix = invite; + QString description; + auto invite_flags = static_cast(MainWindow::getPage(MainWindow::Home))->currentInviteFlags(); + + 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 link._radix = QString::fromUtf8(rsPeers->GetRetroshareInvite(ssl_id).c_str());