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 ... */ /* Updates ... */
bool p3Peers::FriendsChanged() bool p3Peers::FriendsChanged(bool add)
{ {
#ifdef P3PEERS_DEBUG #ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::FriendsChanged()" << std::endl; std::cerr << "p3Peers::FriendsChanged()" << std::endl;
#endif #endif
RsServer::notify()->notifyListChange(NOTIFY_LIST_FRIENDS, add? NOTIFY_TYPE_ADD : NOTIFY_TYPE_DEL);
/* TODO */ /* TODO */
return false; 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 */ /* 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 */ /* don't return now, we've got fill in the ssl and connection info */
if(!getGPGDetails(ps.gpg_id, d)) if(!getGPGDetails(ps.gpg_id, d))
{ {
if(!ps.skip_pgp_signature_validation) if(!ps.skip_pgp_signature_validation)
return false; return false;
d.gpg_id = ps.gpg_id ; d.gpg_id = ps.gpg_id ;
d.skip_pgp_signature_validation = true; d.skip_pgp_signature_validation = true;
} }
else else
d.skip_pgp_signature_validation = false; d.skip_pgp_signature_validation = false;
d.isOnlyGPGdetail = false; d.isOnlyGPGdetail = false;
@ -766,7 +767,9 @@ bool p3Peers::addFriend(const RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePe
return true; 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. * 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! * 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 ) 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) 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 // 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) if(res)
{
mPeerMgr->notifyPgpKeyReceived(gpgid); mPeerMgr->notifyPgpKeyReceived(gpgid);
FriendsChanged(true);
}
return res; return res;
} }

View file

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

View file

@ -37,6 +37,7 @@
#include "retroshare/rsmsgs.h" #include "retroshare/rsmsgs.h"
#define DEBUG_MODEL #define DEBUG_MODEL
//#define DEBUG_MODEL_INDEX
#define IS_MESSAGE_UNREAD(flags) (flags & (RS_MSG_NEW | RS_MSG_UNREAD_BY_USER)) #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 ; EntryIndex parent_index ;
convertInternalIdToIndex<sizeof(uintptr_t)>(parent.internalId(),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; RsDbg() << "Index row=" << row << " col=" << column << " parent=" << parent << std::endl;
#endif #endif
@ -300,7 +301,7 @@ QModelIndex RsFriendListModel::index(int row, int column, const QModelIndex& par
EntryIndex new_index = parent_index.child(row,mTopLevel); EntryIndex new_index = parent_index.child(row,mTopLevel);
convertIndexToInternalId<sizeof(uintptr_t)>(new_index,ref); convertIndexToInternalId<sizeof(uintptr_t)>(new_index,ref);
#ifdef DEBUG_MODEL #ifdef DEBUG_MODEL_INDEX
RsDbg() << " returning " << createIndex(row,column,ref) << std::endl; RsDbg() << " returning " << createIndex(row,column,ref) << std::endl;
#endif #endif
@ -588,7 +589,7 @@ QVariant RsFriendListModel::onlineRole(const EntryIndex& e, int col) const
QVariant RsFriendListModel::fontRole(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; std::cerr << " font role " << e.type << ", (" << (int)e.group_index << ","<< (int)e.profile_index << ","<< (int)e.node_index << ") col="<< col<<": " << std::endl;
#endif #endif
@ -613,7 +614,7 @@ public:
QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const 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<<": "; std::cerr << " Display role " << e.type << ", (" << (int)e.group_index << ","<< (int)e.profile_index << ","<< (int)e.node_index << ") col="<< col<<": ";
AutoEndel x; AutoEndel x;
#endif #endif
@ -640,7 +641,7 @@ QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const
switch(col) switch(col)
{ {
case COLUMN_THREAD_NAME: case COLUMN_THREAD_NAME:
#ifdef DEBUG_MODEL #ifdef DEBUG_MODEL_INDEX
std::cerr << group->group_info.name.c_str() ; std::cerr << group->group_info.name.c_str() ;
#endif #endif
@ -663,7 +664,7 @@ QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const
if(!profile) if(!profile)
return QVariant(); return QVariant();
#ifdef DEBUG_MODEL #ifdef DEBUG_MODEL_INDEX
std::cerr << profile->profile_info.name.c_str() ; std::cerr << profile->profile_info.name.c_str() ;
#endif #endif
switch(col) switch(col)
@ -683,7 +684,7 @@ QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const
if(!node) if(!node)
return QVariant(); return QVariant();
#ifdef DEBUG_MODEL #ifdef DEBUG_MODEL_INDEX
std::cerr << node->node_info.location.c_str() ; std::cerr << node->node_info.location.c_str() ;
#endif #endif
switch(col) switch(col)