added missing IPs to certificate links

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4924 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-02-11 14:49:04 +00:00
parent 340a313fea
commit 98086e125b
2 changed files with 20 additions and 4 deletions

View File

@ -82,6 +82,8 @@
#define CERTIFICATE_GPG_CHECKSUM "gpgchecksum"
#define CERTIFICATE_LOCATION "location"
#define CERTIFICATE_NAME "name"
#define CERTIFICATE_EXT_IPPORT "extipp"
#define CERTIFICATE_LOC_IPPORT "locipp"
RetroShareLink::RetroShareLink(const QUrl& url)
{
@ -225,6 +227,8 @@ void RetroShareLink::fromUrl(const QUrl& url)
_GPGBase64String = url.queryItemValue(CERTIFICATE_GPG_BASE64);
_GPGid = url.queryItemValue(CERTIFICATE_GPG_ID);
_GPGBase64CheckSum = url.queryItemValue(CERTIFICATE_GPG_CHECKSUM);
_ext_ip_port = url.queryItemValue(CERTIFICATE_EXT_IPPORT);
_loc_ip_port = url.queryItemValue(CERTIFICATE_LOC_IPPORT);
std::cerr << "Got a certificate link!!" << std::endl;
check() ;
return;
@ -309,16 +313,16 @@ bool RetroShareLink::createCertificate(const std::string& ssl_id)
_location = QString::fromStdString(detail.location) ;
_name = QString::fromStdString(detail.name) ;
//_external_ipp = QString::fromStdString(invite).section("--EXT--",1,1) ;
_ext_ip_port = QString::fromStdString(invite).section("--EXT--",1,1) ;
QString lst = QString::fromStdString(invite).section("--EXT--",0,0) ;
//_local_ipp = lst.section("--LOCAL--",1,1) ;
_loc_ip_port = lst.section("--LOCAL--",1,1) ;
std::cerr << "Found gpg base 64 string = " << _GPGBase64String.toStdString() << std::endl;
std::cerr << "Found gpg base 64 checksum = " << _GPGBase64CheckSum.toStdString() << std::endl;
std::cerr << "Found SSLId = " << _SSLid.toStdString() << std::endl;
std::cerr << "Found GPGId = " << _GPGid.toStdString() << std::endl;
//std::cerr << "Found External IP+Port = " << _external_ipp.toStdString() << std::endl;
//std::cerr << "Found External IP+Port = " << _local_ipp.toStdString() << std::endl;
std::cerr << "Found Local IP+Port = " << _loc_ip_port.toStdString() << std::endl;
std::cerr << "Found External IP+Port = " << _ext_ip_port.toStdString() << std::endl;
std::cerr << "Found Location = " << _location.toStdString() << std::endl;
return true;
@ -606,6 +610,8 @@ QString RetroShareLink::toString() const
url.addQueryItem(CERTIFICATE_GPG_CHECKSUM, _GPGBase64CheckSum);
url.addQueryItem(CERTIFICATE_LOCATION, encodeItem(_location));
url.addQueryItem(CERTIFICATE_NAME, encodeItem(_name));
url.addQueryItem(CERTIFICATE_LOC_IPPORT, encodeItem(_loc_ip_port));
url.addQueryItem(CERTIFICATE_EXT_IPPORT, encodeItem(_ext_ip_port));
return url.toString();
}
@ -884,6 +890,12 @@ static void processList(QStringList &list, const QString &textSingular, const QS
RS_Certificate += "-----END PGP PUBLIC KEY BLOCK-----\n" ;
RS_Certificate += "--SSLID--" + link.SSLId() + ";--LOCATION--" + link.location() + ";\n" ;
if(!link.externalIPAndPort().isNull())
RS_Certificate += "--EXT--" + link.externalIPAndPort() + ";" ;
if(!link.localIPAndPort().isNull())
RS_Certificate += "--LOCAL--" + link.localIPAndPort() + ";" ;
RS_Certificate += "\n" ;
std::cerr << "Usign this certificate:" << std::endl;
std::cerr << RS_Certificate.toStdString() << std::endl;

View File

@ -74,6 +74,8 @@ class RetroShareLink
const QString& GPGBase64CheckSum() const { return _GPGBase64CheckSum ; }
const QString& SSLId() const { return _SSLid ; }
const QString& GPGId() const { return _GPGid ; }
const QString& localIPAndPort() const { return _loc_ip_port ; }
const QString& externalIPAndPort() const { return _ext_ip_port ; }
const QString& location() const { return _location ; }
QString title() const;
@ -121,6 +123,8 @@ class RetroShareLink
QString _GPGBase64String ; // GPG Cert
QString _GPGBase64CheckSum ; // GPG Cert
QString _location ; // location
QString _ext_ip_port ;
QString _loc_ip_port ;
};
/// This class handles the copy/paste of links. Every member is static to ensure unicity.