completely removed TokenQueue from GxsGroupDialog and GxsGroupFrameDialog

This commit is contained in:
csoler 2020-03-22 21:47:14 +01:00
parent 7ba83272cf
commit 6c1f09a53b
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
26 changed files with 423 additions and 217 deletions

View file

@ -1053,6 +1053,15 @@ bool p3GxsChannels::getChannelsInfo( const std::list<RsGxsGroupId>& chanIds, std
return getGroupData(token, channelsInfo) && !channelsInfo.empty();
}
bool p3GxsChannels::getChannelStatistics(const RsGxsGroupId& channelId,GxsGroupStatistic& stat)
{
uint32_t token;
if(!RsGxsIfaceHelper::requestGroupStatistic(token, channelId) || waitToken(token) != RsTokenService::COMPLETE)
return false;
return RsGenExchange::getGroupStatistic(token,stat);
}
bool p3GxsChannels::getContentSummaries(
const RsGxsGroupId& channelId, std::vector<RsMsgMetaData>& summaries )
{

View file

@ -196,6 +196,9 @@ virtual bool ExtraFileRemove(const RsFileHash &hash);
const RsGxsGroupId& channelId,
std::vector<RsMsgMetaData>& summaries ) override;
/// Implementation of @see RsGxsChannels::getChannelStatistics
bool getChannelStatistics(const RsGxsGroupId& channelId,GxsGroupStatistic& stat) override;
/// Implementation of @see RsGxsChannels::createChannelV2
bool createChannelV2(
const std::string& name, const std::string& description,

View file

@ -819,7 +819,16 @@ bool p3GxsForums::createGroup(uint32_t &token, RsGxsForumGroup &group)
return true;
}
bool p3GxsForums::updateGroup(uint32_t &token, RsGxsForumGroup &group)
bool p3GxsForums::getForumStatistics(const RsGxsGroupId& ForumId,GxsGroupStatistic& stat)
{
uint32_t token;
if(!RsGxsIfaceHelper::requestGroupStatistic(token, ForumId) || waitToken(token) != RsTokenService::COMPLETE)
return false;
return RsGenExchange::getGroupStatistic(token,stat);
}
bool p3GxsForums::updateGroup(uint32_t &token, const RsGxsForumGroup &group)
{
std::cerr << "p3GxsForums::updateGroup()" << std::endl;

View file

@ -94,6 +94,9 @@ public:
const std::list<RsGxsGroupId>& forumIds,
std::vector<RsGxsForumGroup>& forumsInfo );
/// Implementation of @see RsGxsForums::getForumStatistics
bool getForumStatistics(const RsGxsGroupId& ForumId,GxsGroupStatistic& stat) override;
/// @see RsGxsForums::getForumMsgMetaData
virtual bool getForumMsgMetaData(const RsGxsGroupId& forumId, std::vector<RsMsgMetaData>& msg_metas) ;
@ -125,13 +128,16 @@ public:
std::string& errMsg = RS_DEFAULT_STORAGE_PARAM(std::string)
) override;
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);
virtual bool updateGroup(uint32_t &token, RsGxsForumGroup &group);
/// implementation of rsGxsGorums
///
bool getGroupData(const uint32_t &token, std::vector<RsGxsForumGroup> &groups) override;
bool getMsgData(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs) override;
void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) override;
bool createGroup(uint32_t &token, RsGxsForumGroup &group) override;
bool createMsg(uint32_t &token, RsGxsForumMsg &msg) override;
bool updateGroup(uint32_t &token, const RsGxsForumGroup &group) override;
bool getMsgMetaData(const uint32_t &token, GxsMsgMetaMap& msg_metas) ;
private:

View file

@ -350,5 +350,62 @@ bool p3Posted::getBoardsSummaries(std::list<RsGroupMetaData>& boards )
return getGroupSummary(token, boards);
}
bool p3Posted::getBoardStatistics(const RsGxsGroupId& boardId,GxsGroupStatistic& stat)
{
uint32_t token;
if(!RsGxsIfaceHelper::requestGroupStatistic(token, boardId) || waitToken(token) != RsTokenService::COMPLETE)
return false;
return RsGenExchange::getGroupStatistic(token,stat);
}
bool p3Posted::createBoard(RsPostedGroup& board)
{
uint32_t token;
if(!createGroup(token, board))
{
std::cerr << __PRETTY_FUNCTION__ << "Error! Failed creating group." << std::endl;
return false;
}
if(waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE)
{
std::cerr << __PRETTY_FUNCTION__ << "Error! GXS operation failed." << std::endl;
return false;
}
if(!RsGenExchange::getPublishedGroupMeta(token, board.mMeta))
{
std::cerr << __PRETTY_FUNCTION__ << "Error! Failure getting updated " << " group data." << std::endl;
return false;
}
return true;
}
bool p3Posted::editBoard(RsPostedGroup& board)
{
uint32_t token;
if(!updateGroup(token, board))
{
std::cerr << __PRETTY_FUNCTION__ << " Error! Failed updating group." << std::endl;
return false;
}
if(waitToken(token) != RsTokenService::COMPLETE)
{
std::cerr << __PRETTY_FUNCTION__ << " Error! GXS operation failed." << std::endl;
return false;
}
if(!RsGenExchange::getPublishedGroupMeta(token, board.mMeta))
{
std::cerr << __PRETTY_FUNCTION__ << " Error! Failure getting updated " << " group data." << std::endl;
return false;
}
return true;
}
RsPosted::~RsPosted() = default;
RsGxsPostedEvent::~RsGxsPostedEvent() = default;

View file

@ -68,6 +68,12 @@ virtual void receiveHelperChanges(std::vector<RsGxsNotify*>& changes)
bool getBoardsSummaries(std::list<RsGroupMetaData>& groupInfo) override;
bool getBoardStatistics(const RsGxsGroupId& boardId,GxsGroupStatistic& stat) override;
bool editBoard(RsPostedGroup& board) override;
bool createBoard(RsPostedGroup& board) override;
virtual bool getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &groups);
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts, std::vector<RsGxsComment> &cmts);
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts) { std::vector<RsGxsComment> cmts; return getPostData( token, posts, cmts);}