mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
added code to notify GxsBroadcast system with new distant search results
This commit is contained in:
parent
5b9666855d
commit
6ccc7654d6
15 changed files with 63 additions and 6 deletions
|
@ -1110,6 +1110,8 @@ void RsGenExchange::receiveChanges(std::vector<RsGxsNotify*>& changes)
|
|||
RsGxsNotify* n = *vit;
|
||||
RsGxsGroupChange* gc;
|
||||
RsGxsMsgChange* mc;
|
||||
RsGxsDistantSearchResultChange *gt;
|
||||
|
||||
if((mc = dynamic_cast<RsGxsMsgChange*>(n)) != NULL)
|
||||
{
|
||||
if (mc->metaChange())
|
||||
|
@ -1132,6 +1134,10 @@ void RsGenExchange::receiveChanges(std::vector<RsGxsNotify*>& changes)
|
|||
out.mGrps.splice(out.mGrps.end(), gc->mGrpIdList);
|
||||
}
|
||||
}
|
||||
else if((gt = dynamic_cast<RsGxsDistantSearchResultChange*>(n)) != NULL)
|
||||
{
|
||||
out.mDistantSearchReqs.push_back(gt->mRequestId);
|
||||
}
|
||||
else
|
||||
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);
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
||||
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) ;
|
||||
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)
|
||||
{
|
||||
RS_STACK_MUTEX(mNxsMutex) ;
|
||||
RsGxsGrpMetaTemporaryMap grpMetaMap;
|
||||
mDataStore->retrieveGxsGrpMetaData(grpMetaMap);
|
||||
{
|
||||
RS_STACK_MUTEX(mNxsMutex) ;
|
||||
mDataStore->retrieveGxsGrpMetaData(grpMetaMap);
|
||||
}
|
||||
|
||||
RsGroupNetworkStats stats ;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
* Called when new distant search result arrive.
|
||||
* \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;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgsMeta;
|
||||
std::list<RsGxsGroupId> mGrps;
|
||||
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){}
|
||||
|
||||
NotifyType getType() { return TYPE_RECEIVED_DISTANT_SEARCH_RESULTS ; }
|
||||
private:
|
||||
|
||||
TurtleRequestId mRequestId ;
|
||||
RsGxsGroupId mGroupId;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue