accept own locations

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2034 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-01-14 00:38:36 +00:00
parent 79ead807a2
commit a51df4ba6b
2 changed files with 25 additions and 6 deletions

View File

@ -1998,6 +1998,13 @@ void p3ConnectMgr::peerConnectRequest(std::string id, struct sockaddr_in radd
bool p3ConnectMgr::addFriend(std::string id, std::string gpg_id, uint32_t netMode, uint32_t visState, time_t lastContact)
{
if (id == AuthSSL::getAuthSSL()->OwnId()) {
#ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::addFriend() cannot add own id as a friend." << std::endl;
#endif
/* (1) already exists */
return false;
}
/* so four possibilities
* (1) already exists as friend -> do nothing.
* (2) is in others list -> move over.
@ -2028,7 +2035,7 @@ bool p3ConnectMgr::addFriend(std::string id, std::string gpg_id, uint32_t netMod
}
//Authentication is now tested at connection time, we don't store the ssl cert anymore
if (!AuthGPG::getAuthGPG()->isGPGAccepted(gpg_id))
if (!AuthGPG::getAuthGPG()->isGPGAccepted(gpg_id) && gpg_id != AuthGPG::getAuthGPG()->getGPGOwnId())
{
#ifdef CONN_DEBUG
std::cerr << "p3ConnectMgr::addFriend() gpg is not accepted" << std::endl;

View File

@ -279,6 +279,13 @@ void PeersDialog::insertPeers()
rsPeers->getGPGAcceptedList(gpgFriends);
//add own gpg id, if we have more than on location (ssl client)
std::list<std::string> ownSslContacts;
rsPeers->getSSLChildListOfGPGId(rsPeers->getGPGOwnId(), ownSslContacts);
if (ownSslContacts.size() > 0) {
gpgFriends.push_back(rsPeers->getGPGOwnId());
}
/* get a link to the table */
QTreeWidget *peertreeWidget = ui.peertreeWidget;
@ -294,7 +301,7 @@ void PeersDialog::insertPeers()
int index = 0;
while (index < peertreeWidget->topLevelItemCount()) {
std::string gpg_id = (peertreeWidget->topLevelItem(index))->text(3).toStdString();
if (!rsPeers->isGPGAccepted(gpg_id)) {
if (!rsPeers->isGPGAccepted(gpg_id) && gpg_id != rsPeers->getGPGOwnId()) {
peertreeWidget->takeTopLevelItem(index);
} else {
index++;
@ -305,9 +312,9 @@ void PeersDialog::insertPeers()
//add the gpg friends
for(it = gpgFriends.begin(); it != gpgFriends.end(); it++) {
std::cerr << "" << *it << std::endl;
if (*it == rsPeers->getGPGOwnId()) {
continue;
}
// if (*it == rsPeers->getGPGOwnId()) {
// continue;
// }
/* make a widget per friend */
QTreeWidgetItem *gpg_item;
@ -320,7 +327,8 @@ void PeersDialog::insertPeers()
}
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(*it, detail) || !detail.accept_connection) {
if ((!rsPeers->getPeerDetails(*it, detail) || !detail.accept_connection)
&& detail.gpg_id != rsPeers->getGPGOwnId()) {
//don't accept anymore connection, remove from the view
peertreeWidget->takeTopLevelItem(peertreeWidget->indexOfTopLevelItem(gpg_item));
continue;
@ -352,6 +360,10 @@ void PeersDialog::insertPeers()
std::list<std::string> sslContacts;
rsPeers->getSSLChildListOfGPGId(detail.gpg_id, sslContacts);
for(std::list<std::string>::iterator sslIt = sslContacts.begin(); sslIt != sslContacts.end(); sslIt++) {
// if (*it == rsPeers->getGPGOwnId()) {
// continue;
// }
QTreeWidgetItem *sslItem;