mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-06 05:38:51 -04:00
added missing event for FriendList when friends added now that notifyQt is not used anymore
This commit is contained in:
parent
8e61b0ce4f
commit
339948a15c
3 changed files with 18 additions and 10 deletions
|
@ -121,15 +121,21 @@ p3Peers::p3Peers(p3LinkMgr *lm, p3PeerMgr *pm, p3NetMgr *nm)
|
||||||
:mLinkMgr(lm), mPeerMgr(pm), mNetMgr(nm) {}
|
:mLinkMgr(lm), mPeerMgr(pm), mNetMgr(nm) {}
|
||||||
|
|
||||||
/* Updates ... */
|
/* Updates ... */
|
||||||
bool p3Peers::FriendsChanged(bool add)
|
bool p3Peers::FriendsChanged(const RsPeerId& pid,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);
|
if(rsEvents)
|
||||||
|
{
|
||||||
|
auto ev = std::make_shared<RsPeerStateChangedEvent>();
|
||||||
|
ev->mSslId = pid;
|
||||||
|
rsEvents->postEvent(ev);
|
||||||
|
}
|
||||||
|
RsServer::notify()->notifyListChange(NOTIFY_LIST_FRIENDS, add? NOTIFY_TYPE_ADD : NOTIFY_TYPE_DEL); // this is meant to disappear
|
||||||
|
|
||||||
/* TODO */
|
/* TODO */
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Peers::OthersChanged()
|
bool p3Peers::OthersChanged()
|
||||||
|
@ -769,7 +775,7 @@ bool p3Peers::addFriend(const RsPeerId &ssl_id, const RsPgpId &gpg_id,ServicePe
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
FriendsChanged(true);
|
FriendsChanged(ssl_id,true);
|
||||||
|
|
||||||
/* otherwise - we install as ssl_id.....
|
/* 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.
|
||||||
|
@ -783,7 +789,7 @@ bool p3Peers::addSslOnlyFriend( const RsPeerId& sslId, const RsPgpId& pgp_id,con
|
||||||
{
|
{
|
||||||
if( mPeerMgr->addSslOnlyFriend(sslId, pgp_id,details))
|
if( mPeerMgr->addSslOnlyFriend(sslId, pgp_id,details))
|
||||||
{
|
{
|
||||||
FriendsChanged(true);
|
FriendsChanged(sslId,true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -802,8 +808,9 @@ bool p3Peers::removeFriendLocation(const RsPeerId &sslId)
|
||||||
#endif
|
#endif
|
||||||
//will remove if it's a ssl id
|
//will remove if it's a ssl id
|
||||||
mPeerMgr->removeFriend(sslId, false);
|
mPeerMgr->removeFriend(sslId, false);
|
||||||
return true;
|
|
||||||
|
|
||||||
|
FriendsChanged(sslId,false);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Peers::removeFriend(const RsPgpId& gpgId)
|
bool p3Peers::removeFriend(const RsPgpId& gpgId)
|
||||||
|
@ -1641,7 +1648,7 @@ bool p3Peers::loadCertificateFromString(
|
||||||
if(res)
|
if(res)
|
||||||
{
|
{
|
||||||
mPeerMgr->notifyPgpKeyReceived(gpgid);
|
mPeerMgr->notifyPgpKeyReceived(gpgid);
|
||||||
FriendsChanged(true);
|
FriendsChanged(ssl_id,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
virtual ~p3Peers() {}
|
virtual ~p3Peers() {}
|
||||||
|
|
||||||
/* Updates ... */
|
/* Updates ... */
|
||||||
virtual bool FriendsChanged(bool add);
|
virtual bool FriendsChanged(const RsPeerId &pid, bool add);
|
||||||
virtual bool OthersChanged();
|
virtual bool OthersChanged();
|
||||||
|
|
||||||
/* Peer Details (Net & Auth) */
|
/* Peer Details (Net & Auth) */
|
||||||
|
|
|
@ -179,6 +179,7 @@ NewFriendList::NewFriendList(QWidget */*parent*/) : /* RsAutoUpdatePage(5000,par
|
||||||
mEventHandlerId_peer=0; // forces initialization
|
mEventHandlerId_peer=0; // forces initialization
|
||||||
mEventHandlerId_gssp=0; // forces initialization
|
mEventHandlerId_gssp=0; // forces initialization
|
||||||
|
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId_peer, RsEventType::PEER_STATE_CHANGED );
|
||||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId_peer, RsEventType::PEER_CONNECTION );
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId_peer, RsEventType::PEER_CONNECTION );
|
||||||
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId_gssp, RsEventType::GOSSIP_DISCOVERY );
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> e) { handleEvent(e); }, mEventHandlerId_gssp, RsEventType::GOSSIP_DISCOVERY );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue