implement the trust settings in the gui

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2012 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-01-13 21:14:49 +00:00
parent dabe44356a
commit 1ae1c9a98b
10 changed files with 362 additions and 146 deletions

View file

@ -259,11 +259,6 @@ bool p3Peers::isOnline(std::string id)
return false;
}
bool p3Peers::isTrustingMe(std::string id) const
{
return AuthSSL::getAuthSSL()->isTrustingMe(id) ;
}
bool p3Peers::isFriend(std::string id)
{
#ifdef P3PEERS_DEBUG
@ -300,9 +295,17 @@ bool p3Peers::getPeerDetails(std::string id, RsPeerDetails &d)
std::cerr << "p3Peers::getPeerDetails() " << id;
std::cerr << std::endl;
#endif
//first, check if it's a gpg or a ssl id.
if (AuthSSL::getAuthSSL()->getGPGId(id) == "") {
//assume is not SSL, because every ssl_id has got a pgp_id
d.isOnlyGPGdetail = true;
return this->getPGPDetails(id, d);
}
/* get from gpg (first), to fill in the sign and trust details */
/* don't retrun now, we've got fill in the ssl and connection info */
this->getPGPDetails(AuthSSL::getAuthSSL()->getGPGId(id), d);
d.isOnlyGPGdetail = false;
//get the ssl details
sslcert authDetail;
@ -533,8 +536,6 @@ bool p3Peers::getPGPFriendList(std::list<std::string> &ids)
return true;
}
bool p3Peers::getPGPAllList(std::list<std::string> &ids)
{
#ifdef P3PEERS_DEBUG
@ -547,6 +548,42 @@ bool p3Peers::getPGPAllList(std::list<std::string> &ids)
return true;
}
bool p3Peers::getPGPValidList(std::list<std::string> &ids)
{
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::getPGPOthersList()";
std::cerr << std::endl;
#endif
/* get from mAuthMgr */
AuthGPG::getAuthGPG()->getPGPValidList(ids);
return true;
}
bool p3Peers::getPGPSignedList(std::list<std::string> &ids)
{
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::getPGPOthersList()";
std::cerr << std::endl;
#endif
/* get from mAuthMgr */
AuthGPG::getAuthGPG()->getPGPSignedList(ids);
return true;
}
bool p3Peers::getPGPAcceptedList(std::list<std::string> &ids)
{
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::getPGPOthersList()";
std::cerr << std::endl;
#endif
/* get from mAuthMgr */
AuthGPG::getAuthGPG()->getPGPSignedList(ids);
return true;
}
bool p3Peers::getPGPDetails(std::string id, RsPeerDetails &d)
{
#ifdef P3PEERS_DEBUG
@ -903,18 +940,22 @@ bool p3Peers::SignGPGCertificate(std::string id)
return AuthGPG::getAuthGPG()->SignCertificateLevel0(id);
}
bool p3Peers::TrustCertificate(std::string id, bool trust)
bool p3Peers::TrustGPGCertificate(std::string id, uint32_t trustlvl)
{
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::TrustCertificate() " << id;
std::cerr << std::endl;
#endif
return AuthSSL::getAuthSSL()->TrustCertificate(id, trust);
//check if we've got a ssl or gpg id
if (AuthSSL::getAuthSSL()->getGPGId(id) == "") {
//if no result then it must be a gpg id
return AuthGPG::getAuthGPG()->TrustCertificate(id, trustlvl);
} else {
return AuthGPG::getAuthGPG()->TrustCertificate(AuthSSL::getAuthSSL()->getGPGId(id), trustlvl);
}
}
int ensureExtension(std::string &name, std::string def_ext)
{
/* if it has an extension, don't change */

View file

@ -56,18 +56,19 @@ virtual bool getPeerDetails(std::string id, RsPeerDetails &d);
/* Using PGP Ids */
virtual std::string getPGPOwnId();
virtual std::string getPGPId(std::string ssl_id);
virtual bool getPGPFriendList(std::list<std::string> &ids);
virtual bool getPGPAcceptedList(std::list<std::string> &ids);
virtual bool getPGPSignedList(std::list<std::string> &ids);
virtual bool getPGPValidList(std::list<std::string> &ids);
virtual bool getPGPAllList(std::list<std::string> &ids);
virtual bool getPGPDetails(std::string id, RsPeerDetails &d);
virtual bool getPGPFriendList(std::list<std::string> &ids);
/* Add/Remove Friends */
virtual bool addFriend(std::string id);
virtual bool removeFriend(std::string id);
/* get/set third party info about who trusts me */
virtual bool isTrustingMe(std::string id) const ;
/* Network Stuff */
virtual bool connectAttempt(std::string id);
virtual bool setLocalAddress(std::string id, std::string addr, uint16_t port);
@ -90,7 +91,7 @@ virtual bool SaveCertificateToFile(std::string id, std::string fname);
virtual std::string SaveCertificateToString(std::string id);
virtual bool SignGPGCertificate(std::string id);
virtual bool TrustCertificate(std::string id, bool trust);
virtual bool TrustGPGCertificate(std::string id, uint32_t trustlvl);
private: