fixed registration of event handler

This commit is contained in:
csoler 2021-02-26 23:20:48 +01:00
parent 339948a15c
commit b16c30bc3f
3 changed files with 5 additions and 3 deletions

View File

@ -128,8 +128,7 @@ bool p3Peers::FriendsChanged(const RsPeerId& pid,bool add)
#endif #endif
if(rsEvents) if(rsEvents)
{ {
auto ev = std::make_shared<RsPeerStateChangedEvent>(); auto ev = std::make_shared<RsPeerStateChangedEvent>(pid);
ev->mSslId = pid;
rsEvents->postEvent(ev); rsEvents->postEvent(ev);
} }
RsServer::notify()->notifyListChange(NOTIFY_LIST_FRIENDS, add? NOTIFY_TYPE_ADD : NOTIFY_TYPE_DEL); // this is meant to disappear RsServer::notify()->notifyListChange(NOTIFY_LIST_FRIENDS, add? NOTIFY_TYPE_ADD : NOTIFY_TYPE_DEL); // this is meant to disappear

View File

@ -178,8 +178,9 @@ 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
mEventHandlerId_pssc=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_pssc, 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 );
@ -267,6 +268,7 @@ NewFriendList::~NewFriendList()
{ {
rsEvents->unregisterEventsHandler(mEventHandlerId_peer); rsEvents->unregisterEventsHandler(mEventHandlerId_peer);
rsEvents->unregisterEventsHandler(mEventHandlerId_gssp); rsEvents->unregisterEventsHandler(mEventHandlerId_gssp);
rsEvents->unregisterEventsHandler(mEventHandlerId_pssc);
delete mModel; delete mModel;
delete mProxyModel; delete mProxyModel;

View File

@ -123,6 +123,7 @@ private:
bool mShowState; bool mShowState;
RsEventsHandlerId_t mEventHandlerId_peer; RsEventsHandlerId_t mEventHandlerId_peer;
RsEventsHandlerId_t mEventHandlerId_gssp; RsEventsHandlerId_t mEventHandlerId_gssp;
RsEventsHandlerId_t mEventHandlerId_pssc;
std::set<RsNodeGroupId> openGroups; std::set<RsNodeGroupId> openGroups;
std::set<RsPgpId> openPeers; std::set<RsPgpId> openPeers;