made ConnectFriendWizard to accept retroshare links

This commit is contained in:
csoler 2023-10-29 20:47:00 +01:00
parent 315fb77d63
commit 55651e73d9

View File

@ -34,6 +34,7 @@
#endif
#include "gui/common/FilesDefs.h"
#include "gui/RetroShareLink.h"
#include "gui/settings/rsharesettings.h"
#include "util/misc.h"
#include "ConnectFriendWizard.h"
@ -449,8 +450,9 @@ void ConnectFriendWizard::initializePage(int id)
}
sockaddr_storage addr ;
#ifdef DEBUG_FRIENDWIZARD
std::cerr << "Cert IP = " << peerDetails.extAddr << std::endl;
#endif
if(sockaddr_storage_ipv4_aton(addr,peerDetails.extAddr.c_str()) && sockaddr_storage_isValidNet(addr))
{
@ -870,7 +872,18 @@ void ConnectFriendWizard::cleanFriendCert()
bool certValid = false;
QString errorMsg ;
QString certDetail;
std::string cert = ui->friendCertEdit->toPlainText().toUtf8().constData();
std::string cert ;
RetroShareLink rslink(ui->friendCertEdit->toPlainText());
if(rslink.valid() && rslink.type() == RetroShareLink::TYPE_CERTIFICATE)
cert = rslink.radix().toStdString();
else
cert = ui->friendCertEdit->toPlainText().toUtf8().constData();
#ifdef DEBUG_FRIENDWIZARD
std::cerr << "Friend cert:\"" << cert << "\"" << std::endl;
#endif
if (cert.empty()) {
ui->friendCertCleanLabel->setToolTip("");