mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-14 08:59:50 -05:00
added code to notify GxsBroadcast system with new distant search results
This commit is contained in:
parent
5b9666855d
commit
6ccc7654d6
@ -1110,6 +1110,8 @@ void RsGenExchange::receiveChanges(std::vector<RsGxsNotify*>& changes)
|
|||||||
RsGxsNotify* n = *vit;
|
RsGxsNotify* n = *vit;
|
||||||
RsGxsGroupChange* gc;
|
RsGxsGroupChange* gc;
|
||||||
RsGxsMsgChange* mc;
|
RsGxsMsgChange* mc;
|
||||||
|
RsGxsDistantSearchResultChange *gt;
|
||||||
|
|
||||||
if((mc = dynamic_cast<RsGxsMsgChange*>(n)) != NULL)
|
if((mc = dynamic_cast<RsGxsMsgChange*>(n)) != NULL)
|
||||||
{
|
{
|
||||||
if (mc->metaChange())
|
if (mc->metaChange())
|
||||||
@ -1132,6 +1134,10 @@ void RsGenExchange::receiveChanges(std::vector<RsGxsNotify*>& changes)
|
|||||||
out.mGrps.splice(out.mGrps.end(), gc->mGrpIdList);
|
out.mGrps.splice(out.mGrps.end(), gc->mGrpIdList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if((gt = dynamic_cast<RsGxsDistantSearchResultChange*>(n)) != NULL)
|
||||||
|
{
|
||||||
|
out.mDistantSearchReqs.push_back(gt->mRequestId);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
std::cerr << "(EE) Unknown changes type!!" << std::endl;
|
std::cerr << "(EE) Unknown changes type!!" << std::endl;
|
||||||
|
|
||||||
@ -1641,6 +1647,8 @@ void RsGenExchange::receiveDistantSearchResults(TurtleRequestId id,const RsGxsGr
|
|||||||
|
|
||||||
RsGxsDistantSearchResultChange* gc = new RsGxsDistantSearchResultChange(id,grpId);
|
RsGxsDistantSearchResultChange* gc = new RsGxsDistantSearchResultChange(id,grpId);
|
||||||
mNotifications.push_back(gc);
|
mNotifications.push_back(gc);
|
||||||
|
|
||||||
|
std::cerr << "RsGenExchange::receiveDistantSearchResults(): received result for request " << std::hex << id << std::dec << std::endl;
|
||||||
}
|
}
|
||||||
void RsGenExchange::notifyReceivePublishKey(const RsGxsGroupId &grpId)
|
void RsGenExchange::notifyReceivePublishKey(const RsGxsGroupId &grpId)
|
||||||
{
|
{
|
||||||
|
@ -5136,7 +5136,8 @@ void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req, const std:
|
|||||||
// only keep groups that are not locally known, and groups that are not already in the mDistantSearchResults structure
|
// only keep groups that are not locally known, and groups that are not already in the mDistantSearchResults structure
|
||||||
|
|
||||||
for(auto it(group_infos.begin());it!=group_infos.end();++it)
|
for(auto it(group_infos.begin());it!=group_infos.end();++it)
|
||||||
if(grpMeta[(*it).group_id] == NULL)
|
#warning Uncomment when done with testing!
|
||||||
|
// if(grpMeta[(*it).group_id] == NULL)
|
||||||
{
|
{
|
||||||
filtered_results.push_back(*it) ;
|
filtered_results.push_back(*it) ;
|
||||||
search_results_map[(*it).group_id] = *it;
|
search_results_map[(*it).group_id] = *it;
|
||||||
@ -5146,9 +5147,11 @@ void RsGxsNetService::receiveTurtleSearchResults(TurtleRequestId req, const std:
|
|||||||
|
|
||||||
bool RsGxsNetService::search(const std::string& substring,std::list<RsGxsGroupSummary>& group_infos)
|
bool RsGxsNetService::search(const std::string& substring,std::list<RsGxsGroupSummary>& group_infos)
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mNxsMutex) ;
|
|
||||||
RsGxsGrpMetaTemporaryMap grpMetaMap;
|
RsGxsGrpMetaTemporaryMap grpMetaMap;
|
||||||
mDataStore->retrieveGxsGrpMetaData(grpMetaMap);
|
{
|
||||||
|
RS_STACK_MUTEX(mNxsMutex) ;
|
||||||
|
mDataStore->retrieveGxsGrpMetaData(grpMetaMap);
|
||||||
|
}
|
||||||
|
|
||||||
RsGroupNetworkStats stats ;
|
RsGroupNetworkStats stats ;
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
* Called when new distant search result arrive.
|
* Called when new distant search result arrive.
|
||||||
* \param grpId
|
* \param grpId
|
||||||
*/
|
*/
|
||||||
virtual void receiveDistantSearchResults(TurtleRequestId& /*id*/,const RsGxsGroupId& /*grpId*/)
|
virtual void receiveDistantSearchResults(TurtleRequestId /*id*/,const RsGxsGroupId& /*grpId*/)
|
||||||
{
|
{
|
||||||
std::cerr << __PRETTY_FUNCTION__ << ": not overloaded but still called. Nothing will happen." << std::endl;
|
std::cerr << __PRETTY_FUNCTION__ << ": not overloaded but still called. Nothing will happen." << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ public:
|
|||||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgsMeta;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgsMeta;
|
||||||
std::list<RsGxsGroupId> mGrps;
|
std::list<RsGxsGroupId> mGrps;
|
||||||
std::list<RsGxsGroupId> mGrpsMeta;
|
std::list<RsGxsGroupId> mGrpsMeta;
|
||||||
|
std::list<TurtleRequestId> mDistantSearchReqs;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
RsGxsDistantSearchResultChange(TurtleRequestId id,const RsGxsGroupId& group_id) : mRequestId(id),mGroupId(group_id){}
|
RsGxsDistantSearchResultChange(TurtleRequestId id,const RsGxsGroupId& group_id) : mRequestId(id),mGroupId(group_id){}
|
||||||
|
|
||||||
NotifyType getType() { return TYPE_RECEIVED_DISTANT_SEARCH_RESULTS ; }
|
NotifyType getType() { return TYPE_RECEIVED_DISTANT_SEARCH_RESULTS ; }
|
||||||
private:
|
|
||||||
TurtleRequestId mRequestId ;
|
TurtleRequestId mRequestId ;
|
||||||
RsGxsGroupId mGroupId;
|
RsGxsGroupId mGroupId;
|
||||||
};
|
};
|
||||||
|
@ -245,6 +245,16 @@ void GxsGroupFrameDialog::updateDisplay(bool complete)
|
|||||||
updateMessageSummaryList(msgIt->first);
|
updateMessageSummaryList(msgIt->first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateSearchResults() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxsGroupFrameDialog::updateSearchResults()
|
||||||
|
{
|
||||||
|
const std::set<TurtleRequestId>& reqs = getSearchResults();
|
||||||
|
|
||||||
|
for(auto it(reqs.begin());it!=reqs.end();++it)
|
||||||
|
std::cerr << "updating search ID " << std::hex << *it << std::dec << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsGroupFrameDialog::todo()
|
void GxsGroupFrameDialog::todo()
|
||||||
|
@ -152,6 +152,7 @@ private:
|
|||||||
void initUi();
|
void initUi();
|
||||||
|
|
||||||
void updateMessageSummaryList(RsGxsGroupId groupId);
|
void updateMessageSummaryList(RsGxsGroupId groupId);
|
||||||
|
void updateSearchResults();
|
||||||
|
|
||||||
void openGroupInNewTab(const RsGxsGroupId &groupId);
|
void openGroupInNewTab(const RsGxsGroupId &groupId);
|
||||||
void groupSubscribe(bool subscribe);
|
void groupSubscribe(bool subscribe);
|
||||||
|
@ -16,12 +16,19 @@ RsGxsUpdateBroadcastBase::RsGxsUpdateBroadcastBase(RsGxsIfaceHelper *ifaceImpl,
|
|||||||
connect(mUpdateBroadcast, SIGNAL(changed()), this, SLOT(updateBroadcastChanged()));
|
connect(mUpdateBroadcast, SIGNAL(changed()), this, SLOT(updateBroadcastChanged()));
|
||||||
connect(mUpdateBroadcast, SIGNAL(grpsChanged(std::list<RsGxsGroupId>, std::list<RsGxsGroupId>)), this, SLOT(updateBroadcastGrpsChanged(std::list<RsGxsGroupId>,std::list<RsGxsGroupId>)));
|
connect(mUpdateBroadcast, SIGNAL(grpsChanged(std::list<RsGxsGroupId>, std::list<RsGxsGroupId>)), this, SLOT(updateBroadcastGrpsChanged(std::list<RsGxsGroupId>,std::list<RsGxsGroupId>)));
|
||||||
connect(mUpdateBroadcast, SIGNAL(msgsChanged(std::map<RsGxsGroupId,std::set<RsGxsMessageId> >, std::map<RsGxsGroupId,std::set<RsGxsMessageId> >)), this, SLOT(updateBroadcastMsgsChanged(std::map<RsGxsGroupId,std::set<RsGxsMessageId> >,std::map<RsGxsGroupId,std::set<RsGxsMessageId> >)));
|
connect(mUpdateBroadcast, SIGNAL(msgsChanged(std::map<RsGxsGroupId,std::set<RsGxsMessageId> >, std::map<RsGxsGroupId,std::set<RsGxsMessageId> >)), this, SLOT(updateBroadcastMsgsChanged(std::map<RsGxsGroupId,std::set<RsGxsMessageId> >,std::map<RsGxsGroupId,std::set<RsGxsMessageId> >)));
|
||||||
|
connect(mUpdateBroadcast, SIGNAL(distantSearchResultsChanged(const std::list<TurtleRequestId>&)), this, SLOT(updateBroadcastDistantSearchResultsChanged(const std::list<TurtleRequestId>&)));
|
||||||
}
|
}
|
||||||
|
|
||||||
RsGxsUpdateBroadcastBase::~RsGxsUpdateBroadcastBase()
|
RsGxsUpdateBroadcastBase::~RsGxsUpdateBroadcastBase()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RsGxsUpdateBroadcastBase::updateBroadcastDistantSearchResultsChanged(const std::list<TurtleRequestId>& ids)
|
||||||
|
{
|
||||||
|
for(auto it(ids.begin());it!=ids.end();++it)
|
||||||
|
mTurtleResults.insert(*it);
|
||||||
|
}
|
||||||
|
|
||||||
void RsGxsUpdateBroadcastBase::fillComplete()
|
void RsGxsUpdateBroadcastBase::fillComplete()
|
||||||
{
|
{
|
||||||
mFillComplete = true;
|
mFillComplete = true;
|
||||||
@ -37,6 +44,9 @@ void RsGxsUpdateBroadcastBase::securedUpdateDisplay()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is *bad* because if the connection is done asynchronously the client will call mGrpIds, mGrpIdsMeta, etc without the guarranty that the
|
||||||
|
// the structed havnt' been cleared in the mean time.
|
||||||
|
|
||||||
emit fillDisplay(mFillComplete);
|
emit fillDisplay(mFillComplete);
|
||||||
mFillComplete = false;
|
mFillComplete = false;
|
||||||
|
|
||||||
@ -75,7 +85,7 @@ void RsGxsUpdateBroadcastBase::updateBroadcastChanged()
|
|||||||
// The question to whether we should re=load when mGrpIds is not empty is still open. It's not harmful anyway.
|
// The question to whether we should re=load when mGrpIds is not empty is still open. It's not harmful anyway.
|
||||||
// This should probably be decided by the service itself.
|
// This should probably be decided by the service itself.
|
||||||
|
|
||||||
if (!mGrpIds.empty() || !mGrpIdsMeta.empty() /*|| !mMsgIds.empty()*/ || !mMsgIdsMeta.empty())
|
if (!mGrpIds.empty() || !mGrpIdsMeta.empty() /*|| !mMsgIds.empty()*/ || !mMsgIdsMeta.empty() || !mTurtleResults.empty())
|
||||||
mFillComplete = true ;
|
mFillComplete = true ;
|
||||||
|
|
||||||
securedUpdateDisplay();
|
securedUpdateDisplay();
|
||||||
|
@ -7,6 +7,8 @@ class QShowEvent;
|
|||||||
class RsGxsIfaceHelper;
|
class RsGxsIfaceHelper;
|
||||||
class RsGxsUpdateBroadcast;
|
class RsGxsUpdateBroadcast;
|
||||||
|
|
||||||
|
typedef uint32_t TurtleRequestId ;
|
||||||
|
|
||||||
class RsGxsUpdateBroadcastBase : public QObject
|
class RsGxsUpdateBroadcastBase : public QObject
|
||||||
{
|
{
|
||||||
friend class RsGxsUpdateBroadcastPage;
|
friend class RsGxsUpdateBroadcastPage;
|
||||||
@ -25,6 +27,7 @@ public:
|
|||||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds() { return mMsgIds; }
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds() { return mMsgIds; }
|
||||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta() { return mMsgIdsMeta; }
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta() { return mMsgIdsMeta; }
|
||||||
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||||
|
const std::set<TurtleRequestId>& getSearchResults() { return mTurtleResults ; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void fillComplete();
|
void fillComplete();
|
||||||
@ -39,6 +42,7 @@ private slots:
|
|||||||
void updateBroadcastChanged();
|
void updateBroadcastChanged();
|
||||||
void updateBroadcastGrpsChanged(const std::list<RsGxsGroupId>& grpIds, const std::list<RsGxsGroupId> &grpIdsMeta);
|
void updateBroadcastGrpsChanged(const std::list<RsGxsGroupId>& grpIds, const std::list<RsGxsGroupId> &grpIdsMeta);
|
||||||
void updateBroadcastMsgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIdsMeta);
|
void updateBroadcastMsgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIdsMeta);
|
||||||
|
void updateBroadcastDistantSearchResultsChanged(const std::list<TurtleRequestId>& ids);
|
||||||
void securedUpdateDisplay();
|
void securedUpdateDisplay();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -49,4 +53,5 @@ private:
|
|||||||
std::set<RsGxsGroupId> mGrpIdsMeta;
|
std::set<RsGxsGroupId> mGrpIdsMeta;
|
||||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgIds;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgIds;
|
||||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgIdsMeta;
|
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgIdsMeta;
|
||||||
|
std::set<TurtleRequestId> mTurtleResults;
|
||||||
};
|
};
|
||||||
|
@ -22,6 +22,11 @@ void RsGxsUpdateBroadcastPage::setUpdateWhenInvisible(bool update)
|
|||||||
mBase->setUpdateWhenInvisible(update);
|
mBase->setUpdateWhenInvisible(update);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::set<TurtleRequestId>& RsGxsUpdateBroadcastPage::getSearchResults()
|
||||||
|
{
|
||||||
|
return mBase->getSearchResults();
|
||||||
|
}
|
||||||
|
|
||||||
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastPage::getGrpIdsMeta()
|
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastPage::getGrpIdsMeta()
|
||||||
{
|
{
|
||||||
return mBase->getGrpIdsMeta();
|
return mBase->getGrpIdsMeta();
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
class RsGxsIfaceHelper;
|
class RsGxsIfaceHelper;
|
||||||
class RsGxsUpdateBroadcastBase;
|
class RsGxsUpdateBroadcastBase;
|
||||||
|
typedef uint32_t TurtleRequestId ;
|
||||||
|
|
||||||
class RsGxsUpdateBroadcastPage : public MainPage
|
class RsGxsUpdateBroadcastPage : public MainPage
|
||||||
{
|
{
|
||||||
@ -30,6 +31,7 @@ public:
|
|||||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds();
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds();
|
||||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta();
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta();
|
||||||
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||||
|
const std::set<TurtleRequestId>& getSearchResults();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent *event);
|
virtual void showEvent(QShowEvent *event);
|
||||||
|
@ -29,6 +29,10 @@ const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIds()
|
|||||||
return mBase->getGrpIds();
|
return mBase->getGrpIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::set<TurtleRequestId>& RsGxsUpdateBroadcastWidget::getSearchResults()
|
||||||
|
{
|
||||||
|
return mBase->getSearchResults();
|
||||||
|
}
|
||||||
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIdsMeta()
|
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIdsMeta()
|
||||||
{
|
{
|
||||||
return mBase->getGrpIdsMeta();
|
return mBase->getGrpIdsMeta();
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
class RsGxsIfaceHelper;
|
class RsGxsIfaceHelper;
|
||||||
class RsGxsUpdateBroadcastBase;
|
class RsGxsUpdateBroadcastBase;
|
||||||
|
typedef uint32_t TurtleRequestId;
|
||||||
|
|
||||||
class RsGxsUpdateBroadcastWidget : public QWidget
|
class RsGxsUpdateBroadcastWidget : public QWidget
|
||||||
{
|
{
|
||||||
@ -30,6 +31,7 @@ public:
|
|||||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds();
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds();
|
||||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta();
|
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta();
|
||||||
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||||
|
const std::set<TurtleRequestId>& getSearchResults() ;
|
||||||
|
|
||||||
RsGxsIfaceHelper *interfaceHelper() { return mInterfaceHelper; }
|
RsGxsIfaceHelper *interfaceHelper() { return mInterfaceHelper; }
|
||||||
|
|
||||||
|
@ -79,5 +79,8 @@ void RsGxsUpdateBroadcast::onChangesReceived(const RsGxsChanges& changes)
|
|||||||
emit grpsChanged(changes.mGrps, changes.mGrpsMeta);
|
emit grpsChanged(changes.mGrps, changes.mGrpsMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!changes.mDistantSearchReqs.empty())
|
||||||
|
emit distantSearchResultsChanged(changes.mDistantSearchReqs) ;
|
||||||
|
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
class RsGxsIfaceHelper;
|
class RsGxsIfaceHelper;
|
||||||
class RsGxsChanges;
|
class RsGxsChanges;
|
||||||
|
|
||||||
|
typedef uint32_t TurtleRequestId ;
|
||||||
|
|
||||||
class RsGxsUpdateBroadcast : public QObject
|
class RsGxsUpdateBroadcast : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -21,6 +23,7 @@ signals:
|
|||||||
void changed();
|
void changed();
|
||||||
void msgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIdsMeta);
|
void msgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIdsMeta);
|
||||||
void grpsChanged(const std::list<RsGxsGroupId>& grpIds, const std::list<RsGxsGroupId>& grpIdsMeta);
|
void grpsChanged(const std::list<RsGxsGroupId>& grpIds, const std::list<RsGxsGroupId>& grpIdsMeta);
|
||||||
|
void distantSearchResultsChanged(const std::list<TurtleRequestId>& reqs);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onChangesReceived(const RsGxsChanges& changes);
|
void onChangesReceived(const RsGxsChanges& changes);
|
||||||
|
Loading…
Reference in New Issue
Block a user