mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-01 12:24:36 -04:00
changed code to create msg data map using MsgMeta instead of full Msg and added the handles to request MsgMeta data in forums
This commit is contained in:
parent
8f9c9295b2
commit
a114856b77
5 changed files with 81 additions and 42 deletions
|
@ -139,10 +139,11 @@ public:
|
|||
const std::list<RsGxsGroupId>& forumIds,
|
||||
std::vector<RsGxsForumGroup>& forumsInfo ) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get content of specified forums. Blocking API
|
||||
* @jsonapi{development}
|
||||
* @param[in] forumIds id of the channels of which the content is requested
|
||||
* @param[in] forumIds id of the forum of which the content is requested
|
||||
* @param[out] messages storage for the forum messages
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
|
@ -150,6 +151,16 @@ public:
|
|||
const std::list<RsGxsGroupId>& forumIds,
|
||||
std::vector<RsGxsForumMsg>& messages ) = 0;
|
||||
|
||||
/**
|
||||
* @brief Get message metadatas for some messages of a specific forum. Blocking API
|
||||
* @jsonapi{development}
|
||||
* @param[in] forumIds id of the forum of which the content is requested
|
||||
* @param[out] msg_metas storage for the forum messages meta data
|
||||
* @return false if something failed, true otherwhise
|
||||
*/
|
||||
virtual bool getForumMsgMetaData( const RsGxsGroupId& forumId,
|
||||
std::vector<RsMsgMetaData>& msg_metas) =0;
|
||||
|
||||
/**
|
||||
* @brief Get specific list of messages from a single forums. Blocking API
|
||||
* @jsonapi{development}
|
||||
|
|
|
@ -297,6 +297,11 @@ bool p3GxsForums::getGroupData(const uint32_t &token, std::vector<RsGxsForumGrou
|
|||
return ok;
|
||||
}
|
||||
|
||||
bool p3GxsForums::getMsgMetaData(const uint32_t &token, GxsMsgMetaMap& msg_metas)
|
||||
{
|
||||
return RsGenExchange::getMsgMeta(token, msg_metas);
|
||||
}
|
||||
|
||||
/* Okay - chris is not going to be happy with this...
|
||||
* but I can't be bothered with crazy data structures
|
||||
* at the moment - fix it up later
|
||||
|
@ -433,8 +438,7 @@ bool p3GxsForums::editForum(RsGxsForumGroup& forum)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool p3GxsForums::getForumsSummaries(
|
||||
std::list<RsGroupMetaData>& forums )
|
||||
bool p3GxsForums::getForumsSummaries( std::list<RsGroupMetaData>& forums )
|
||||
{
|
||||
uint32_t token;
|
||||
RsTokReqOptions opts;
|
||||
|
@ -482,6 +486,26 @@ bool p3GxsForums::getForumsContent(
|
|||
return getMsgData(token, messages);
|
||||
}
|
||||
|
||||
|
||||
bool p3GxsForums::getForumMsgMetaData(const RsGxsGroupId& forumId, std::vector<RsMsgMetaData>& msg_metas)
|
||||
{
|
||||
uint32_t token;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_META;
|
||||
|
||||
GxsMsgMetaMap meta_map;
|
||||
std::list<RsGxsGroupId> forumIds;
|
||||
forumIds.push_back(forumId);
|
||||
|
||||
if( !requestMsgInfo(token, opts, forumIds) || waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE ) return false;
|
||||
|
||||
bool res = getMsgMetaData(token, meta_map);
|
||||
|
||||
msg_metas = meta_map[forumId];
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool p3GxsForums::markRead(const RsGxsGrpMsgIdPair& msgId, bool read)
|
||||
{
|
||||
uint32_t token;
|
||||
|
|
|
@ -77,6 +77,9 @@ public:
|
|||
const std::list<RsGxsGroupId>& forumIds,
|
||||
std::vector<RsGxsForumMsg>& messages );
|
||||
|
||||
/// @see RsGxsForums::getForumMsgMetaData
|
||||
virtual bool getForumMsgMetaData(const RsGxsGroupId& forumId, std::vector<RsMsgMetaData>& msg_metas) ;
|
||||
|
||||
/// @see RsGxsForums::getForumsContent
|
||||
virtual bool getForumsContent( const RsGxsGroupId& forumId, std::set<RsGxsMessageId>& msgs_to_request,std::vector<RsGxsForumMsg>& msgs) ;
|
||||
|
||||
|
@ -85,6 +88,7 @@ public:
|
|||
|
||||
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsForumGroup> &groups);
|
||||
virtual bool getMsgData(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs);
|
||||
virtual bool getMsgMetaData(const uint32_t &token, GxsMsgMetaMap& msg_metas);
|
||||
virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read);
|
||||
virtual bool createGroup(uint32_t &token, RsGxsForumGroup &group);
|
||||
virtual bool createMsg(uint32_t &token, RsGxsForumMsg &msg);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue