diff --git a/libretroshare/src/rsserver/p3peers.cc b/libretroshare/src/rsserver/p3peers.cc index 6b7592629..4cedc4fcf 100644 --- a/libretroshare/src/rsserver/p3peers.cc +++ b/libretroshare/src/rsserver/p3peers.cc @@ -130,11 +130,12 @@ bool p3Peers::hasExportMinimal() } /* Updates ... */ -bool p3Peers::FriendsChanged() +bool p3Peers::FriendsChanged(bool add) { #ifdef P3PEERS_DEBUG std::cerr << "p3Peers::FriendsChanged()" << std::endl; #endif + RsServer::notify()->notifyListChange(NOTIFY_LIST_FRIENDS, add? NOTIFY_TYPE_ADD : NOTIFY_TYPE_DEL); /* TODO */ return false; @@ -289,16 +290,16 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d) /* get from gpg (first), to fill in the sign and trust details */ /* don't return now, we've got fill in the ssl and connection info */ - if(!getGPGDetails(ps.gpg_id, d)) - { - if(!ps.skip_pgp_signature_validation) - return false; + if(!getGPGDetails(ps.gpg_id, d)) + { + if(!ps.skip_pgp_signature_validation) + return false; - d.gpg_id = ps.gpg_id ; - d.skip_pgp_signature_validation = true; - } - else - d.skip_pgp_signature_validation = false; + d.gpg_id = ps.gpg_id ; + d.skip_pgp_signature_validation = true; + } + else + d.skip_pgp_signature_validation = false; d.isOnlyGPGdetail = false; @@ -766,7 +767,9 @@ bool p3Peers::addFriend(const RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePe return true; } - /* otherwise - we install as ssl_id..... + FriendsChanged(true); + + /* otherwise - we install as ssl_id..... * If we are adding an SSL certificate. we flag lastcontact as now. * This will cause the SSL certificate to be retained for 30 days... and give the person a chance to connect! * */ @@ -776,7 +779,13 @@ bool p3Peers::addFriend(const RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePe bool p3Peers::addSslOnlyFriend( const RsPeerId& sslId, const RsPgpId& pgp_id,const RsPeerDetails& details ) { - return mPeerMgr->addSslOnlyFriend(sslId, pgp_id,details); + if( mPeerMgr->addSslOnlyFriend(sslId, pgp_id,details)) + { + FriendsChanged(true); + return true; + } + else + return false; } bool p3Peers::removeKeysFromPGPKeyring(const std::set& pgp_ids,std::string& backup_file,uint32_t& error_code) @@ -1534,7 +1543,10 @@ bool p3Peers::loadCertificateFromString( // now get all friends who declare this key ID to be the one needed to check connections, and clear their "skip_pgp_signature_validation" flag if(res) + { mPeerMgr->notifyPgpKeyReceived(gpgid); + FriendsChanged(true); + } return res; } diff --git a/libretroshare/src/rsserver/p3peers.h b/libretroshare/src/rsserver/p3peers.h index ad6f2d056..e44e7d23a 100644 --- a/libretroshare/src/rsserver/p3peers.h +++ b/libretroshare/src/rsserver/p3peers.h @@ -48,7 +48,7 @@ public: virtual ~p3Peers() {} /* Updates ... */ - virtual bool FriendsChanged(); + virtual bool FriendsChanged(bool add); virtual bool OthersChanged(); /* Peer Details (Net & Auth) */ diff --git a/retroshare-gui/src/gui/common/FriendListModel.cpp b/retroshare-gui/src/gui/common/FriendListModel.cpp index de7ed2ab3..d0a20306a 100644 --- a/retroshare-gui/src/gui/common/FriendListModel.cpp +++ b/retroshare-gui/src/gui/common/FriendListModel.cpp @@ -37,6 +37,7 @@ #include "retroshare/rsmsgs.h" #define DEBUG_MODEL +//#define DEBUG_MODEL_INDEX #define IS_MESSAGE_UNREAD(flags) (flags & (RS_MSG_NEW | RS_MSG_UNREAD_BY_USER)) @@ -292,7 +293,7 @@ QModelIndex RsFriendListModel::index(int row, int column, const QModelIndex& par EntryIndex parent_index ; convertInternalIdToIndex(parent.internalId(),parent_index); -#ifdef DEBUG_MODEL +#ifdef DEBUG_MODEL_INDEX RsDbg() << "Index row=" << row << " col=" << column << " parent=" << parent << std::endl; #endif @@ -300,7 +301,7 @@ QModelIndex RsFriendListModel::index(int row, int column, const QModelIndex& par EntryIndex new_index = parent_index.child(row,mTopLevel); convertIndexToInternalId(new_index,ref); -#ifdef DEBUG_MODEL +#ifdef DEBUG_MODEL_INDEX RsDbg() << " returning " << createIndex(row,column,ref) << std::endl; #endif @@ -588,7 +589,7 @@ QVariant RsFriendListModel::onlineRole(const EntryIndex& e, int col) const QVariant RsFriendListModel::fontRole(const EntryIndex& e, int col) const { -#ifdef DEBUG_MODEL +#ifdef DEBUG_MODEL_INDEX std::cerr << " font role " << e.type << ", (" << (int)e.group_index << ","<< (int)e.profile_index << ","<< (int)e.node_index << ") col="<< col<<": " << std::endl; #endif @@ -613,7 +614,7 @@ public: QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const { -#ifdef DEBUG_MODEL +#ifdef DEBUG_MODEL_INDEX std::cerr << " Display role " << e.type << ", (" << (int)e.group_index << ","<< (int)e.profile_index << ","<< (int)e.node_index << ") col="<< col<<": "; AutoEndel x; #endif @@ -640,7 +641,7 @@ QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const switch(col) { case COLUMN_THREAD_NAME: -#ifdef DEBUG_MODEL +#ifdef DEBUG_MODEL_INDEX std::cerr << group->group_info.name.c_str() ; #endif @@ -663,7 +664,7 @@ QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const if(!profile) return QVariant(); -#ifdef DEBUG_MODEL +#ifdef DEBUG_MODEL_INDEX std::cerr << profile->profile_info.name.c_str() ; #endif switch(col) @@ -683,7 +684,7 @@ QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const if(!node) return QVariant(); -#ifdef DEBUG_MODEL +#ifdef DEBUG_MODEL_INDEX std::cerr << node->node_info.location.c_str() ; #endif switch(col)