mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-22 06:05:08 -05:00
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:
parent
79ead807a2
commit
a51df4ba6b
@ -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)
|
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
|
/* so four possibilities
|
||||||
* (1) already exists as friend -> do nothing.
|
* (1) already exists as friend -> do nothing.
|
||||||
* (2) is in others list -> move over.
|
* (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
|
//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
|
#ifdef CONN_DEBUG
|
||||||
std::cerr << "p3ConnectMgr::addFriend() gpg is not accepted" << std::endl;
|
std::cerr << "p3ConnectMgr::addFriend() gpg is not accepted" << std::endl;
|
||||||
|
@ -279,6 +279,13 @@ void PeersDialog::insertPeers()
|
|||||||
|
|
||||||
rsPeers->getGPGAcceptedList(gpgFriends);
|
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 */
|
/* get a link to the table */
|
||||||
QTreeWidget *peertreeWidget = ui.peertreeWidget;
|
QTreeWidget *peertreeWidget = ui.peertreeWidget;
|
||||||
|
|
||||||
@ -294,7 +301,7 @@ void PeersDialog::insertPeers()
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
while (index < peertreeWidget->topLevelItemCount()) {
|
while (index < peertreeWidget->topLevelItemCount()) {
|
||||||
std::string gpg_id = (peertreeWidget->topLevelItem(index))->text(3).toStdString();
|
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);
|
peertreeWidget->takeTopLevelItem(index);
|
||||||
} else {
|
} else {
|
||||||
index++;
|
index++;
|
||||||
@ -305,9 +312,9 @@ void PeersDialog::insertPeers()
|
|||||||
//add the gpg friends
|
//add the gpg friends
|
||||||
for(it = gpgFriends.begin(); it != gpgFriends.end(); it++) {
|
for(it = gpgFriends.begin(); it != gpgFriends.end(); it++) {
|
||||||
std::cerr << "" << *it << std::endl;
|
std::cerr << "" << *it << std::endl;
|
||||||
if (*it == rsPeers->getGPGOwnId()) {
|
// if (*it == rsPeers->getGPGOwnId()) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/* make a widget per friend */
|
/* make a widget per friend */
|
||||||
QTreeWidgetItem *gpg_item;
|
QTreeWidgetItem *gpg_item;
|
||||||
@ -320,7 +327,8 @@ void PeersDialog::insertPeers()
|
|||||||
}
|
}
|
||||||
|
|
||||||
RsPeerDetails detail;
|
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
|
//don't accept anymore connection, remove from the view
|
||||||
peertreeWidget->takeTopLevelItem(peertreeWidget->indexOfTopLevelItem(gpg_item));
|
peertreeWidget->takeTopLevelItem(peertreeWidget->indexOfTopLevelItem(gpg_item));
|
||||||
continue;
|
continue;
|
||||||
@ -352,6 +360,10 @@ void PeersDialog::insertPeers()
|
|||||||
std::list<std::string> sslContacts;
|
std::list<std::string> sslContacts;
|
||||||
rsPeers->getSSLChildListOfGPGId(detail.gpg_id, sslContacts);
|
rsPeers->getSSLChildListOfGPGId(detail.gpg_id, sslContacts);
|
||||||
for(std::list<std::string>::iterator sslIt = sslContacts.begin(); sslIt != sslContacts.end(); sslIt++) {
|
for(std::list<std::string>::iterator sslIt = sslContacts.begin(); sslIt != sslContacts.end(); sslIt++) {
|
||||||
|
// if (*it == rsPeers->getGPGOwnId()) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
QTreeWidgetItem *sslItem;
|
QTreeWidgetItem *sslItem;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user