mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-23 14:39:34 -05:00
GxsChannels optimizable API
This commit is contained in:
parent
bdf9bd5c56
commit
7113eb7bfc
@ -197,17 +197,28 @@ public:
|
||||
std::vector<RsGxsChannelGroup>& channelsInfo ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get content of specified channels. Blocking API
|
||||
* @brief Get channel contents
|
||||
* @jsonapi{development}
|
||||
* @param[in] chanIds id of the channels of which the content is requested
|
||||
* @param[out] posts storage for the posts
|
||||
* @param[in] channelId id of the channel of which the content is requested
|
||||
* @param[in] contentsIds ids of requested contents
|
||||
* @param[out] posts storage for posts
|
||||
* @param[out] comments storage for the comments
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool getChannelsContent(
|
||||
const std::list<RsGxsGroupId>& chanIds,
|
||||
std::vector<RsGxsChannelPost>& posts,
|
||||
std::vector<RsGxsComment>& comments ) = 0;
|
||||
virtual bool getChannelContent( const RsGxsGroupId& channelId,
|
||||
const std::set<RsGxsMessageId>& contentsIds,
|
||||
std::vector<RsGxsChannelPost>& posts,
|
||||
std::vector<RsGxsComment>& comments ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get channel content summaries
|
||||
* @jsonapi{development}
|
||||
* @param[in] channelId id of the channel of which the content is requested
|
||||
* @param[out] summaries storage for summaries
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool getContentSummaries( const RsGxsGroupId& channelId,
|
||||
std::vector<RsMsgMetaData>& summaries ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Toggle post read status. Blocking API.
|
||||
|
@ -1016,16 +1016,42 @@ bool p3GxsChannels::getChannelsInfo(
|
||||
return getGroupData(token, channelsInfo);
|
||||
}
|
||||
|
||||
bool p3GxsChannels::getChannelsContent(
|
||||
const std::list<RsGxsGroupId>& chanIds,
|
||||
std::vector<RsGxsChannelPost>& posts,
|
||||
std::vector<RsGxsComment>& comments )
|
||||
bool p3GxsChannels::getContentSummaries(
|
||||
const RsGxsGroupId& channelId, std::vector<RsMsgMetaData>& summaries )
|
||||
{
|
||||
uint32_t token;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_META;
|
||||
|
||||
std::list<RsGxsGroupId> channelIds;
|
||||
channelIds.push_back(channelId);
|
||||
|
||||
if( !requestMsgInfo(token, opts, channelIds) ||
|
||||
waitToken(token, std::chrono::seconds(5)) != RsTokenService::COMPLETE )
|
||||
return false;
|
||||
|
||||
GxsMsgMetaMap metaMap;
|
||||
bool res = RsGenExchange::getMsgMeta(token, metaMap);
|
||||
summaries = metaMap[channelId];
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool p3GxsChannels::getChannelContent( const RsGxsGroupId& channelId,
|
||||
const std::set<RsGxsMessageId>& contentsIds,
|
||||
std::vector<RsGxsChannelPost>& posts,
|
||||
std::vector<RsGxsComment>& comments )
|
||||
{
|
||||
uint32_t token;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
if( !requestMsgInfo(token, opts, chanIds)
|
||||
|| waitToken(token) != RsTokenService::COMPLETE ) return false;
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
msgIds[channelId] = contentsIds;
|
||||
|
||||
if( !requestMsgInfo(token, opts, msgIds) ||
|
||||
waitToken(token) != RsTokenService::COMPLETE ) return false;
|
||||
|
||||
return getPostData(token, posts, comments);
|
||||
}
|
||||
|
||||
|
@ -186,10 +186,14 @@ virtual bool ExtraFileRemove(const RsFileHash &hash);
|
||||
std::vector<RsGxsChannelGroup>& channelsInfo );
|
||||
|
||||
/// Implementation of @see RsGxsChannels::getChannelContent
|
||||
virtual bool getChannelsContent(
|
||||
const std::list<RsGxsGroupId>& chanIds,
|
||||
std::vector<RsGxsChannelPost>& posts,
|
||||
std::vector<RsGxsComment>& comments );
|
||||
virtual bool getChannelContent( const RsGxsGroupId& channelId,
|
||||
const std::set<RsGxsMessageId>& contentsIds,
|
||||
std::vector<RsGxsChannelPost>& posts,
|
||||
std::vector<RsGxsComment>& comments );
|
||||
|
||||
/// Implementation of @see RsGxsChannels::getContentSummaries
|
||||
virtual bool getContentSummaries( const RsGxsGroupId& channelId,
|
||||
std::vector<RsMsgMetaData>& summaries );
|
||||
|
||||
/// Implementation of @see RsGxsChannels::createChannel
|
||||
virtual bool createChannel(RsGxsChannelGroup& channel);
|
||||
|
Loading…
Reference in New Issue
Block a user