added a tab to display the certificate of friends, in peer details

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3439 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-09-03 19:23:24 +00:00
parent 1d957f3674
commit 180f833df3
5 changed files with 58 additions and 21 deletions

View File

@ -179,6 +179,7 @@ virtual bool getAllowServerIPDetermination() = 0 ;
virtual bool getAllowTunnelConnection() = 0 ; virtual bool getAllowTunnelConnection() = 0 ;
/* Auth Stuff */ /* Auth Stuff */
virtual std::string GetRetroshareInvite(const std::string& ssl_id) = 0;
virtual std::string GetRetroshareInvite() = 0; virtual std::string GetRetroshareInvite() = 0;
virtual bool loadCertificateFromFile(std::string fname, std::string &ssl_id, std::string &gpg_id) = 0; virtual bool loadCertificateFromFile(std::string fname, std::string &ssl_id, std::string &gpg_id) = 0;

View File

@ -805,30 +805,42 @@ p3Peers::setVisState(std::string id, uint32_t extVisState)
/* Auth Stuff */ /* Auth Stuff */
std::string std::string
p3Peers::GetRetroshareInvite() p3Peers::GetRetroshareInvite()
{
return GetRetroshareInvite(getOwnId());
}
std::string
p3Peers::GetRetroshareInvite(const std::string& ssl_id)
{ {
#ifdef P3PEERS_DEBUG #ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::GetRetroshareInvite()" << std::endl; std::cerr << "p3Peers::GetRetroshareInvite()" << std::endl;
#endif #endif
std::string invite = AuthGPG::getAuthGPG()->SaveCertificateToString(AuthGPG::getAuthGPG()->getGPGOwnId());
//add the sslid, location, ip local and external address after the signature //add the sslid, location, ip local and external address after the signature
RsPeerDetails ownDetail; RsPeerDetails Detail;
if (getPeerDetails(rsPeers->getOwnId(), ownDetail)) { std::string invite ;
invite += CERT_SSL_ID + ownDetail.id + ";";
invite += CERT_LOCATION + ownDetail.location + ";\n"; if (getPeerDetails(ssl_id, Detail))
invite += CERT_LOCAL_IP + ownDetail.localAddr + ":"; {
std::ostringstream out; invite = AuthGPG::getAuthGPG()->SaveCertificateToString(Detail.gpg_id);
out << ownDetail.localPort;
invite += out.str() + ";"; if(!Detail.isOnlyGPGdetail)
invite += CERT_EXT_IP + ownDetail.extAddr + ":"; {
std::ostringstream out2; invite += CERT_SSL_ID + Detail.id + ";";
out2 << ownDetail.extPort; invite += CERT_LOCATION + Detail.location + ";\n";
invite += out2.str() + ";"; invite += CERT_LOCAL_IP + Detail.localAddr + ":";
if (!ownDetail.dyndns.empty()) { std::ostringstream out;
invite += "\n" + CERT_DYNDNS + ownDetail.dyndns + ";"; out << Detail.localPort;
} invite += out.str() + ";";
} invite += CERT_EXT_IP + Detail.extAddr + ":";
std::ostringstream out2;
out2 << Detail.extPort;
invite += out2.str() + ";";
if (!Detail.dyndns.empty()) {
invite += "\n" + CERT_DYNDNS + Detail.dyndns + ";";
}
}
}
#ifdef P3PEERS_DEBUG #ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::GetRetroshareInvite() returns : \n" << invite << std::endl; std::cerr << "p3Peers::GetRetroshareInvite() returns : \n" << invite << std::endl;

View File

@ -87,6 +87,9 @@ virtual bool getAllowServerIPDetermination() ;
virtual bool getAllowTunnelConnection() ; virtual bool getAllowTunnelConnection() ;
/* Auth Stuff */ /* Auth Stuff */
// Get the invitation (GPG cert + local/ext address + SSL id for the given peer)
virtual std::string GetRetroshareInvite(const std::string& ssl_id);
// same but for own id
virtual std::string GetRetroshareInvite(); virtual std::string GetRetroshareInvite();
virtual bool loadCertificateFromFile(std::string fname, std::string &id, std::string &gpg_id); virtual bool loadCertificateFromFile(std::string fname, std::string &id, std::string &gpg_id);

View File

@ -305,6 +305,17 @@ void ConfCertDialog::loadDialog()
ui.signers_listWidget->addItem(QString::fromStdString(signerDetail.name) + " (" + QString::fromStdString(signerDetail.id) +")"); ui.signers_listWidget->addItem(QString::fromStdString(signerDetail.name) + " (" + QString::fromStdString(signerDetail.id) +")");
} }
} }
std::string invite = rsPeers->GetRetroshareInvite(detail.id) ; // this needs to be a SSL id
ui.userCertificateText->setReadOnly(true);
ui.userCertificateText->setMinimumHeight(200);
ui.userCertificateText->setMinimumWidth(530);
QFont font("Courier New",10,50,false);
font.setStyleHint(QFont::TypeWriter,QFont::PreferMatch);
font.setStyle(QFont::StyleNormal);
ui.userCertificateText->setFont(font);
ui.userCertificateText->setText(QString::fromStdString(invite));
} }

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>489</width> <width>516</width>
<height>505</height> <height>606</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -21,7 +21,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTabWidget" name="stabWidget"> <widget class="QTabWidget" name="stabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>2</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="icon"> <attribute name="icon">
@ -580,6 +580,16 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Certificate</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTextEdit" name="userCertificateText"/>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">