removing of own gpg key as friend when not necessary

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2080 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2010-01-19 13:09:11 +00:00
parent 98820697d4
commit b617dcd1f7
3 changed files with 17 additions and 3 deletions

View File

@ -2073,6 +2073,9 @@ std::list<RsItem*> AuthGPG::saveList(bool& cleanup)
RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ; RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ;
std::map<std::string, bool>::iterator mapIt; std::map<std::string, bool>::iterator mapIt;
for (mapIt = mAcceptToConnectMap.begin(); mapIt != mAcceptToConnectMap.end(); mapIt++) { for (mapIt = mAcceptToConnectMap.begin(); mapIt != mAcceptToConnectMap.end(); mapIt++) {
if (mapIt->first == getGPGOwnId()) {
continue;
}
RsTlvKeyValue kv; RsTlvKeyValue kv;
kv.key = mapIt->first; kv.key = mapIt->first;
std::cerr << "AuthGPG::saveList() called (mapIt->second) : " << (mapIt->second) << std::endl ; std::cerr << "AuthGPG::saveList() called (mapIt->second) : " << (mapIt->second) << std::endl ;
@ -2104,6 +2107,9 @@ bool AuthGPG::loadList(std::list<RsItem*> load)
std::list<RsTlvKeyValue>::iterator kit; std::list<RsTlvKeyValue>::iterator kit;
for(kit = vitem->tlvkvs.pairs.begin(); kit != vitem->tlvkvs.pairs.end(); kit++) { for(kit = vitem->tlvkvs.pairs.begin(); kit != vitem->tlvkvs.pairs.end(); kit++) {
if (kit->key == getGPGOwnId()) {
continue;
}
mAcceptToConnectMap[kit->key] = (kit->value == "TRUE"); mAcceptToConnectMap[kit->key] = (kit->value == "TRUE");
//set the gpg key //set the gpg key
certmap::iterator it; certmap::iterator it;

View File

@ -637,7 +637,7 @@ bool p3Peers::isDummyFriend(std::string ssl_id) {
bool p3Peers::removeFriend(std::string ssl_or_gpgid) bool p3Peers::removeFriend(std::string ssl_or_gpgid)
{ {
#ifdef P3PEERS_DEBUG #ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::removeFriend() " << id << std::endl; std::cerr << "p3Peers::removeFriend() " << ssl_or_gpgid << std::endl;
#endif #endif
if (ssl_or_gpgid == AuthGPG::getAuthGPG()->getGPGOwnId()) { if (ssl_or_gpgid == AuthGPG::getAuthGPG()->getGPGOwnId()) {
#ifdef P3PEERS_DEBUG #ifdef P3PEERS_DEBUG

View File

@ -334,8 +334,16 @@ void PeersDialog::insertPeers()
//remove items that are not fiends anymore //remove items that are not fiends anymore
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_widget_id = (peertreeWidget->topLevelItem(index))->text(3).toStdString();
if (!rsPeers->isGPGAccepted(gpg_id) && gpg_id != rsPeers->getGPGOwnId()) { std::list<std::string>::iterator gpgfriendIt;
bool found = false;
for (gpgfriendIt = gpgFriends.begin(); gpgfriendIt != gpgFriends.end(); gpgfriendIt++) {
if (gpg_widget_id == *gpgfriendIt) {
found = true;
break;
}
}
if (!found) {
peertreeWidget->takeTopLevelItem(index); peertreeWidget->takeTopLevelItem(index);
} else { } else {
index++; index++;