moved GxsChanges to rsEvents

This commit is contained in:
csoler 2019-12-09 22:19:03 +01:00
parent e402630095
commit 27793627e3
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
8 changed files with 14 additions and 21 deletions

View File

@ -1118,38 +1118,25 @@ void RsGenExchange::receiveChanges(std::vector<RsGxsNotify*>& changes)
if((mc = dynamic_cast<RsGxsMsgChange*>(n)) != nullptr)
{
if (mc->metaChange())
{
addMessageChanged(out.mMsgsMeta, mc->msgChangeMap);
}
else
{
addMessageChanged(out.mMsgs, mc->msgChangeMap);
}
}
else if((gc = dynamic_cast<RsGxsGroupChange*>(n)) != nullptr)
{
if(gc->metaChange())
{
out.mGrpsMeta.splice(out.mGrpsMeta.end(), gc->mGrpIdList);
}
else
{
out.mGrps.splice(out.mGrps.end(), gc->mGrpIdList);
}
}
else if(( gt =
dynamic_cast<RsGxsDistantSearchResultChange*>(n) ) != nullptr)
{
else if(( gt = dynamic_cast<RsGxsDistantSearchResultChange*>(n) ) != nullptr)
out.mDistantSearchReqs.push_back(gt->mRequestId);
}
else
RsErr() << __PRETTY_FUNCTION__ << " Unknown changes type!"
<< std::endl;
RsErr() << __PRETTY_FUNCTION__ << " Unknown changes type!" << std::endl;
delete n;
}
changes.clear() ;
RsServer::notify()->notifyGxsChange(out);
if(rsEvents) rsEvents->postEvent(std::move(evt));
}

View File

@ -233,7 +233,6 @@ void p3Notify::notifyOwnAvatarChanged ()
void p3Notify::notifyOwnStatusMessageChanged() { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyOwnStatusMessageChanged() ; }
void p3Notify::notifyDiskFull (uint32_t location , uint32_t size_limit_in_MB ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyDiskFull (location,size_limit_in_MB) ; }
void p3Notify::notifyPeerStatusChanged (const std::string& peer_id , uint32_t status ) { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyPeerStatusChanged (peer_id,status) ; }
void p3Notify::notifyGxsChange (const RsGxsChanges& changes) {FOR_ALL_NOTIFY_CLIENTS (*it)->notifyGxsChange(changes) ;}
void p3Notify::notifyPeerStatusChangedSummary () { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyPeerStatusChangedSummary() ; }
void p3Notify::notifyDiscInfoChanged () { FOR_ALL_NOTIFY_CLIENTS (*it)->notifyDiscInfoChanged () ; }

View File

@ -109,7 +109,6 @@ class p3Notify: public RsNotify
void notifyOwnStatusMessageChanged () ;
void notifyDiskFull (uint32_t /* location */, uint32_t /* size limit in MB */) ;
void notifyPeerStatusChanged (const std::string& /* peer_id */, uint32_t /* status */) ;
void notifyGxsChange (const RsGxsChanges& /* changes */);
void notifyConnectionWithoutCert ();
void notifyPeerStatusChangedSummary () ;

View File

@ -229,7 +229,6 @@ public:
virtual void notifyOwnStatusMessageChanged () {}
virtual void notifyDiskFull (uint32_t /* location */, uint32_t /* size limit in MB */) {}
virtual void notifyPeerStatusChanged (const std::string& /* peer_id */, uint32_t /* status */) {}
virtual void notifyGxsChange (const RsGxsChanges& /* changes */) {}
/* one or more peers has changed the states */
virtual void notifyPeerStatusChangedSummary () {}

View File

@ -422,6 +422,7 @@ void NotifyQt::notifyPeerStatusChangedSummary()
emit peerStatusChangedSummary();
}
#ifdef TO_REMOVE
void NotifyQt::notifyGxsChange(const RsGxsChanges& changes)
{
{
@ -436,6 +437,7 @@ void NotifyQt::notifyGxsChange(const RsGxsChanges& changes)
emit gxsChange(changes);
}
#endif
void NotifyQt::notifyOwnStatusMessageChanged()
{

View File

@ -82,8 +82,6 @@ class NotifyQt: public QObject, public NotifyClient
/* one or more peers has changed the states */
virtual void notifyPeerStatusChangedSummary();
virtual void notifyGxsChange(const RsGxsChanges& change);
virtual void notifyHistoryChanged(uint32_t msgId, int type);
virtual void notifyDiscInfoChanged() ;

View File

@ -37,7 +37,14 @@ QMap<RsGxsIfaceHelper*, RsGxsUpdateBroadcast*> updateBroadcastMap;
RsGxsUpdateBroadcast::RsGxsUpdateBroadcast(RsGxsIfaceHelper *ifaceImpl) :
QObject(NULL), mIfaceImpl(ifaceImpl)
{
connect(NotifyQt::getInstance(), SIGNAL(gxsChange(RsGxsChanges)), this, SLOT(onChangesReceived(RsGxsChanges)));
mEventHandlerId = 0; // forces initialization in registerEventsHandler()
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
{
if(event->mType == RsEventType::GXS_CHANGES)
onChangesReceived(*dynamic_cast<const RsGxsChanges*>(event.get()));
}, mEventHandlerId );
}
void RsGxsUpdateBroadcast::cleanup()

View File

@ -24,6 +24,7 @@
#include <QObject>
#include <retroshare/rsgxsifacetypes.h>
#include <retroshare/rsevents.h>
struct RsGxsIfaceHelper;
struct RsGxsChanges;
@ -53,6 +54,7 @@ private:
private:
RsGxsIfaceHelper* mIfaceImpl;
RsEventsHandlerId_t mEventHandlerId ;
};
#endif // RSGXSUPDATEBROADCAST_H