mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-06 16:15:23 -04:00
first pass for converting GxsMessageFrameWidget to blocking API
This commit is contained in:
parent
c18dfb39c3
commit
55c810f848
12 changed files with 420 additions and 221 deletions
|
@ -68,12 +68,10 @@ struct RsGxsChannelGroup : RsSerializable, RsGxsGenericGroupData
|
|||
~RsGxsChannelGroup() override;
|
||||
};
|
||||
|
||||
struct RsGxsChannelPost : RsSerializable
|
||||
struct RsGxsChannelPost : RsSerializable, RsGxsGenericMsgData
|
||||
{
|
||||
RsGxsChannelPost() : mCount(0), mSize(0) {}
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
|
||||
std::set<RsGxsMessageId> mOlderVersions;
|
||||
std::string mMsg; // UTF8 encoded.
|
||||
|
||||
|
|
|
@ -43,11 +43,12 @@
|
|||
enum class TokenRequestType: uint8_t
|
||||
{
|
||||
GROUP_INFO = 0x01,
|
||||
MSG_INFO = 0x02,
|
||||
MSG_RELATED_INFO = 0x03,
|
||||
GROUP_STATISTICS = 0x04,
|
||||
SERVICE_STATISTICS = 0x05,
|
||||
NO_KILL_TYPE = 0x06,
|
||||
POSTS = 0x02,
|
||||
ALL_POSTS = 0x03,
|
||||
MSG_RELATED_INFO = 0x04,
|
||||
GROUP_STATISTICS = 0x05,
|
||||
SERVICE_STATISTICS = 0x06,
|
||||
NO_KILL_TYPE = 0x07,
|
||||
};
|
||||
|
||||
class RsGxsIfaceHelper
|
||||
|
@ -278,13 +279,12 @@ public:
|
|||
}
|
||||
|
||||
/// @see RsTokenService::requestMsgInfo
|
||||
bool requestMsgInfo( uint32_t& token,
|
||||
const RsTokReqOptions& opts, const GxsMsgReq& msgIds )
|
||||
bool requestMsgInfo( uint32_t& token, const RsTokReqOptions& opts, const GxsMsgReq& msgIds )
|
||||
{
|
||||
if(mTokenService.requestMsgInfo(token, 0, opts, msgIds))
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx);
|
||||
mActiveTokens[token]=TokenRequestType::MSG_INFO;
|
||||
mActiveTokens[token]= msgIds.empty()?(TokenRequestType::ALL_POSTS):(TokenRequestType::POSTS);
|
||||
locked_dumpTokens();
|
||||
return true;
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ public:
|
|||
if(mTokenService.requestMsgInfo(token, 0, opts, grpIds))
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx);
|
||||
mActiveTokens[token]=TokenRequestType::MSG_INFO;
|
||||
mActiveTokens[token]=TokenRequestType::ALL_POSTS;
|
||||
locked_dumpTokens();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -184,6 +184,14 @@ struct RsMsgMetaData : RsSerializable
|
|||
}
|
||||
};
|
||||
|
||||
struct RsGxsGenericMsgData
|
||||
{
|
||||
virtual ~RsGxsGenericMsgData() = default; // making the type polymorphic
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
};
|
||||
|
||||
|
||||
class GxsGroupStatistic
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -46,14 +46,13 @@ struct RsPostedGroup: RsGxsGenericGroupData
|
|||
RsGxsImage mGroupImage;
|
||||
};
|
||||
|
||||
struct RsPostedPost
|
||||
struct RsPostedPost: public RsGxsGenericMsgData
|
||||
{
|
||||
RsPostedPost(): mHaveVoted(false), mUpVotes(0), mDownVotes(0), mComments(0),
|
||||
mHotScore(0), mTopScore(0), mNewScore(0) {}
|
||||
|
||||
bool calculateScores(rstime_t ref_time);
|
||||
|
||||
RsMsgMetaData mMeta;
|
||||
std::string mLink;
|
||||
std::string mNotes;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue