mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-26 07:11:08 -04:00
fixed missing code in passing turtle group data result to client service
This commit is contained in:
parent
8ad454723a
commit
2067b106e4
4 changed files with 55 additions and 20 deletions
|
@ -5349,6 +5349,7 @@ bool RsGxsNetService::search(const Sha1CheckSum& hashed_group_id,unsigned char *
|
||||||
Sha1CheckSum hash(RsDirUtil::sha1sum(it->first.toByteArray(),it->first.SIZE_IN_BYTES));
|
Sha1CheckSum hash(RsDirUtil::sha1sum(it->first.toByteArray(),it->first.SIZE_IN_BYTES));
|
||||||
|
|
||||||
mGroupHashCache[hash] = grp ;
|
mGroupHashCache[hash] = grp ;
|
||||||
|
it->second = NULL ; // prevents deletion
|
||||||
|
|
||||||
if(hash == hashed_group_id)
|
if(hash == hashed_group_id)
|
||||||
grp_data = grp ;
|
grp_data = grp ;
|
||||||
|
|
|
@ -1064,7 +1064,7 @@ bool RsGxsNetTunnelService::receiveSearchRequest(unsigned char *search_request_d
|
||||||
{
|
{
|
||||||
RsGxsNetTunnelTurtleSearchGroupDataItem search_result_item ;
|
RsGxsNetTunnelTurtleSearchGroupDataItem search_result_item ;
|
||||||
|
|
||||||
search_result_item.service = substring_sr->service ;
|
search_result_item.service = substring_gr->service ;
|
||||||
search_result_item.encrypted_group_data = encrypted_group_data ;
|
search_result_item.encrypted_group_data = encrypted_group_data ;
|
||||||
search_result_item.encrypted_group_data_len = encrypted_group_data_len;
|
search_result_item.encrypted_group_data_len = encrypted_group_data_len;
|
||||||
|
|
||||||
|
@ -1091,26 +1091,52 @@ void RsGxsNetTunnelService::receiveSearchResult(TurtleSearchRequestId request_id
|
||||||
|
|
||||||
RsGxsNetTunnelTurtleSearchGroupSummaryItem *result_gs = dynamic_cast<RsGxsNetTunnelTurtleSearchGroupSummaryItem *>(item) ;
|
RsGxsNetTunnelTurtleSearchGroupSummaryItem *result_gs = dynamic_cast<RsGxsNetTunnelTurtleSearchGroupSummaryItem *>(item) ;
|
||||||
|
|
||||||
if(result_gs == NULL)
|
if(result_gs != NULL)
|
||||||
|
{
|
||||||
|
GXS_NET_TUNNEL_DEBUG() << " : result is of type group summary result for service " << result_gs->service << std::dec << ": " << std::endl;
|
||||||
|
|
||||||
|
for(auto it(result_gs->group_infos.begin());it!=result_gs->group_infos.end();++it)
|
||||||
|
std::cerr << " group " << (*it).group_id << ": " << (*it).group_name << ", " << (*it).number_of_messages << " messages, last is " << time(NULL)-(*it).last_message_ts << " secs ago." << std::endl;
|
||||||
|
|
||||||
|
auto it = mSearchableServices.find(result_gs->service) ;
|
||||||
|
|
||||||
|
if(it == mSearchableServices.end())
|
||||||
|
{
|
||||||
|
GXS_NET_TUNNEL_ERROR() << ": deserialized item is for service " << std::hex << result_gs->service << std::dec << " that is not in the searchable services list." << std::endl;
|
||||||
|
delete item;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
it->second->receiveTurtleSearchResults(request_id,result_gs->group_infos) ;
|
||||||
|
|
||||||
|
delete item;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
RsGxsNetTunnelTurtleSearchGroupDataItem *result_gd = dynamic_cast<RsGxsNetTunnelTurtleSearchGroupDataItem *>(item) ;
|
||||||
|
|
||||||
|
if(result_gd != NULL)
|
||||||
{
|
{
|
||||||
GXS_NET_TUNNEL_ERROR() << ": deserialized item is not a GroupSummary Item. Smething's wrong here." << std::endl;
|
GXS_NET_TUNNEL_DEBUG() << " : result is of type group data for service " << result_gd->service << std::dec << ": " << std::endl;
|
||||||
return ;
|
|
||||||
|
auto it = mSearchableServices.find(result_gd->service) ;
|
||||||
|
|
||||||
|
if(it == mSearchableServices.end())
|
||||||
|
{
|
||||||
|
GXS_NET_TUNNEL_ERROR() << ": deserialized item is for service " << std::hex << result_gd->service << std::dec << " that is not in the searchable services list." << std::endl;
|
||||||
|
delete item;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
|
it->second->receiveTurtleSearchResults(request_id,result_gd->encrypted_group_data,result_gd->encrypted_group_data_len) ;
|
||||||
|
|
||||||
|
result_gd->encrypted_group_data = NULL ; // prevents deletion
|
||||||
|
delete item;
|
||||||
|
|
||||||
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
GXS_NET_TUNNEL_DEBUG() << " : result is of type group summary result for service " << result_gs->service << std::dec << ": " << std::endl;
|
GXS_NET_TUNNEL_ERROR() << ": deserialized item is of unknown type. Dropping!" << std::endl;
|
||||||
|
|
||||||
for(auto it(result_gs->group_infos.begin());it!=result_gs->group_infos.end();++it)
|
|
||||||
std::cerr << " group " << (*it).group_id << ": " << (*it).group_name << ", " << (*it).number_of_messages << " messages, last is " << time(NULL)-(*it).last_message_ts << " secs ago." << std::endl;
|
|
||||||
|
|
||||||
auto it = mSearchableServices.find(result_gs->service) ;
|
|
||||||
|
|
||||||
if(it == mSearchableServices.end())
|
|
||||||
{
|
|
||||||
GXS_NET_TUNNEL_ERROR() << ": deserialized item is for service " << std::hex << result_gs->service << std::dec << " that is in the searchable services list." << std::endl;
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
it->second->receiveTurtleSearchResults(request_id,result_gs->group_infos) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,14 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void receiveTurtleSearchResults(TurtleRequestId req,const std::list<RsGxsGroupSummary>& group_infos)=0;
|
virtual void receiveTurtleSearchResults(TurtleRequestId req,const std::list<RsGxsGroupSummary>& group_infos)=0;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief receiveTurtleSearchResults
|
||||||
|
* Called by turtle (through RsGxsNetTunnel) when new data is received
|
||||||
|
* \param req Turtle search request ID associated with this result
|
||||||
|
* \param encrypted_group_data Group data
|
||||||
|
*/
|
||||||
|
virtual void receiveTurtleSearchResults(TurtleRequestId req,const unsigned char *encrypted_group_data,uint32_t encrypted_group_data_len)=0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief retrieveTurtleSearchResults
|
* \brief retrieveTurtleSearchResults
|
||||||
* To be used to retrieve the search results that have been notified (or not)
|
* To be used to retrieve the search results that have been notified (or not)
|
||||||
|
|
|
@ -95,7 +95,7 @@ protected:
|
||||||
virtual RetroShareLink::enumType getLinkType() = 0;
|
virtual RetroShareLink::enumType getLinkType() = 0;
|
||||||
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Nothing; }
|
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Nothing; }
|
||||||
virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata);
|
virtual void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata);
|
||||||
virtual void checkRequestGroup(const RsGxsGroupId& grpId) {}
|
virtual void checkRequestGroup(const RsGxsGroupId& /* grpId */) {} // overload this one in order to retrieve full group data when the group is browsed
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void todo();
|
void todo();
|
||||||
|
@ -149,7 +149,7 @@ private:
|
||||||
virtual void groupTreeCustomActions(RsGxsGroupId /*grpId*/, int /*subscribeFlags*/, QList<QAction*> &/*actions*/) {}
|
virtual void groupTreeCustomActions(RsGxsGroupId /*grpId*/, int /*subscribeFlags*/, QList<QAction*> &/*actions*/) {}
|
||||||
virtual RsGxsCommentService *getCommentService() { return NULL; }
|
virtual RsGxsCommentService *getCommentService() { return NULL; }
|
||||||
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &/*grpId*/, const RsGxsMessageId &/*msgId*/) { return NULL; }
|
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &/*grpId*/, const RsGxsMessageId &/*msgId*/) { return NULL; }
|
||||||
virtual bool getDistantSearchResults(TurtleRequestId id, std::map<RsGxsGroupId,RsGxsGroupSummary>& group_infos){ return false ;}
|
virtual bool getDistantSearchResults(TurtleRequestId /* id */, std::map<RsGxsGroupId,RsGxsGroupSummary>& /* group_infos */){ return false ;}
|
||||||
|
|
||||||
void initUi();
|
void initUi();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue