mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-30 09:56:14 -05:00
Fix compilation with deep search and rm dead code
This commit is contained in:
parent
aca29e3ea7
commit
2d497d7303
@ -1045,119 +1045,38 @@ bool p3GxsChannels::getChannelsContent(
|
|||||||
bool p3GxsChannels::createChannel(RsGxsChannelGroup& channel)
|
bool p3GxsChannels::createChannel(RsGxsChannelGroup& channel)
|
||||||
{
|
{
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
time_t beginCreation = time(nullptr);
|
if( !createGroup(token, channel)
|
||||||
if( !createGroup(token, channel) || waitToken(token) != RsTokenService::COMPLETE )
|
|| waitToken(token) != RsTokenService::COMPLETE )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(RsGenExchange::getPublishedGroupMeta(token,channel.mMeta))
|
if(RsGenExchange::getPublishedGroupMeta(token, channel.mMeta))
|
||||||
{
|
{
|
||||||
#ifdef RS_DEEP_SEARCH
|
#ifdef RS_DEEP_SEARCH
|
||||||
if(found) DeepSearch::indexChannelGroup(channel);
|
DeepSearch::indexChannelGroup(channel);
|
||||||
#endif // RS_DEEP_SEARCH
|
#endif // RS_DEEP_SEARCH
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// time_t endCreation = time(nullptr);
|
return false;
|
||||||
//
|
|
||||||
//
|
|
||||||
// std::list<RsGroupMetaData> channels;
|
|
||||||
// if(!getChannelsSummaries(channels)) return false;
|
|
||||||
//
|
|
||||||
// /* This is ugly but after digging and doing many tries of doing it the right
|
|
||||||
// * way ending always into too big refactor chain reaction, I think this is
|
|
||||||
// * not that bad, moreover seems the last created group tend to end up near
|
|
||||||
// * the beginning of the list so it is fast founding it.
|
|
||||||
// * The shortcoming of this is that if groups with same data are created in
|
|
||||||
// * a burst (more then once in a second) is that the id of another similar
|
|
||||||
// * group can be returned, but this is a pointy case.
|
|
||||||
// * Order of conditions in the `if` matter for performances */
|
|
||||||
// bool found = false;
|
|
||||||
// for(const RsGroupMetaData& chan : channels)
|
|
||||||
// {
|
|
||||||
// if( IS_GROUP_ADMIN(chan.mSubscribeFlags)
|
|
||||||
// && IS_GROUP_SUBSCRIBED(chan.mSubscribeFlags)
|
|
||||||
// && chan.mPublishTs >= beginCreation
|
|
||||||
// && chan.mPublishTs <= endCreation
|
|
||||||
// && chan.mGroupFlags == channel.mMeta.mGroupFlags
|
|
||||||
// && chan.mSignFlags == channel.mMeta.mSignFlags
|
|
||||||
// && chan.mCircleType == channel.mMeta.mCircleType
|
|
||||||
// && chan.mAuthorId == channel.mMeta.mAuthorId
|
|
||||||
// && chan.mCircleId == channel.mMeta.mCircleId
|
|
||||||
// && chan.mServiceString == channel.mMeta.mServiceString
|
|
||||||
// && chan.mGroupName == channel.mMeta.mGroupName )
|
|
||||||
// {
|
|
||||||
// channel.mMeta = chan;
|
|
||||||
// found = true;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3GxsChannels::createPost(RsGxsChannelPost& post)
|
bool p3GxsChannels::createPost(RsGxsChannelPost& post)
|
||||||
{
|
{
|
||||||
uint32_t token;
|
uint32_t token;
|
||||||
time_t beginCreation = time(nullptr);
|
|
||||||
if( !createPost(token, post)
|
if( !createPost(token, post)
|
||||||
|| waitToken(token) != RsTokenService::COMPLETE ) return false;
|
|| waitToken(token) != RsTokenService::COMPLETE ) return false;
|
||||||
time_t endCreation = time(nullptr);
|
|
||||||
|
|
||||||
if(RsGenExchange::getPublishedMsgMeta(token,post.mMeta))
|
if(RsGenExchange::getPublishedMsgMeta(token,post.mMeta))
|
||||||
{
|
{
|
||||||
#ifdef RS_DEEP_SEARCH
|
#ifdef RS_DEEP_SEARCH
|
||||||
if(found) DeepSearch::indexChannelGroup(post);
|
DeepSearch::indexChannelPost(post);
|
||||||
#endif // RS_DEEP_SEARCH
|
#endif // RS_DEEP_SEARCH
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// std::list<RsGxsGroupId> chanIds; chanIds.push_back(post.mMeta.mGroupId);
|
return false;
|
||||||
// std::vector<RsGxsChannelPost> posts;
|
|
||||||
// std::vector<RsGxsComment> comments;
|
|
||||||
// if(!getChannelsContent(chanIds, posts, comments)) return false;
|
|
||||||
//
|
|
||||||
// /* This is ugly but after digging and doing many tries of doing it the right
|
|
||||||
// * way ending always into too big refactor chain reaction, I think this is
|
|
||||||
// * not that bad.
|
|
||||||
// * The shortcoming of this is that if posts with same data are created in
|
|
||||||
// * a burst (more then once in a second) is that the id of another similar
|
|
||||||
// * post could be returned, but this is a pointy case.
|
|
||||||
// * Order of conditions in the `if` matter for performances */
|
|
||||||
// bool found = false;
|
|
||||||
// for(const RsGxsChannelPost& itPost : posts)
|
|
||||||
// {
|
|
||||||
// std::cout << __PRETTY_FUNCTION__ << " " << beginCreation << " "
|
|
||||||
// << itPost.mMeta.mPublishTs << " " << endCreation << " "
|
|
||||||
// << itPost.mMeta.mMsgId << std::endl;
|
|
||||||
//
|
|
||||||
// if( itPost.mMeta.mPublishTs >= beginCreation
|
|
||||||
// && itPost.mMeta.mPublishTs <= endCreation
|
|
||||||
// && itPost.mMeta.mMsgFlags == post.mMeta.mMsgFlags
|
|
||||||
// && itPost.mMeta.mGroupId == post.mMeta.mGroupId
|
|
||||||
// && itPost.mMeta.mThreadId == post.mMeta.mThreadId
|
|
||||||
// && itPost.mMeta.mParentId == post.mMeta.mParentId
|
|
||||||
// && itPost.mMeta.mAuthorId == post.mMeta.mAuthorId
|
|
||||||
// && itPost.mMeta.mMsgName == post.mMeta.mMsgName
|
|
||||||
// && itPost.mFiles.size() == post.mFiles.size()
|
|
||||||
// && itPost.mMeta.mServiceString == post.mMeta.mServiceString
|
|
||||||
// && itPost.mOlderVersions == post.mOlderVersions
|
|
||||||
// && itPost.mMsg == post.mMsg )
|
|
||||||
// {
|
|
||||||
// post = itPost;
|
|
||||||
// found = true;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//#ifdef RS_DEEP_SEARCH
|
|
||||||
// if(found) DeepSearch::indexChannelPost(post);
|
|
||||||
//#endif // RS_DEEP_SEARCH
|
|
||||||
//
|
|
||||||
// return found;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user