added missing notifications when adding friends

This commit is contained in:
csoler 2019-09-22 20:42:49 +02:00
parent cdeee0198e
commit 282d2d324d
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
3 changed files with 33 additions and 20 deletions

View File

@ -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<RsPgpId>& 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;
}

View File

@ -48,7 +48,7 @@ public:
virtual ~p3Peers() {}
/* Updates ... */
virtual bool FriendsChanged();
virtual bool FriendsChanged(bool add);
virtual bool OthersChanged();
/* Peer Details (Net & Auth) */

View File

@ -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<sizeof(uintptr_t)>(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<sizeof(uintptr_t)>(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)