mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-04 07:05:26 -04:00
Merge pull request #1970 from drbob/TheWire-rework-ui
TheWire rework UI, and update Data Messages.
This commit is contained in:
commit
035010af76
43 changed files with 5662 additions and 1621 deletions
|
@ -35,11 +35,38 @@
|
|||
class RsWire;
|
||||
extern RsWire *rsWire;
|
||||
|
||||
struct RsWireGroup: RsGxsGenericGroupData
|
||||
class RsWireGroup;
|
||||
typedef std::shared_ptr<RsWireGroup> RsWireGroupSPtr;
|
||||
typedef std::shared_ptr<const RsWireGroup> RsWireGroupConstSPtr;
|
||||
|
||||
class RsWireGroup: public RsGxsGenericGroupData
|
||||
{
|
||||
public:
|
||||
std::string mDescription;
|
||||
RsGxsImage mIcon;
|
||||
RsWireGroup();
|
||||
|
||||
std::string mTagline;
|
||||
std::string mLocation;
|
||||
|
||||
// Images max size should be enforced.
|
||||
RsGxsImage mHeadshot; // max size?
|
||||
RsGxsImage mMasthead; // max size?
|
||||
|
||||
// Unserialised stuff ---------------------
|
||||
|
||||
// These are this groups top-level msgs.
|
||||
uint32_t mGroupPulses;
|
||||
uint32_t mGroupRepublishes;
|
||||
uint32_t mGroupLikes;
|
||||
uint32_t mGroupReplies;
|
||||
// how do we handle these. TODO
|
||||
// uint32_t mGroupFollowing;
|
||||
// uint32_t mGroupFollowers;
|
||||
|
||||
// These are this groups REF / RESPONSE msgs from others.
|
||||
uint32_t mRefMentions; // TODO how to handle this?
|
||||
uint32_t mRefRepublishes;
|
||||
uint32_t mRefLikes;
|
||||
uint32_t mRefReplies;
|
||||
};
|
||||
|
||||
|
||||
|
@ -60,13 +87,7 @@ struct RsWireGroup: RsGxsGenericGroupData
|
|||
*
|
||||
***********************************************************************/
|
||||
|
||||
class RsWirePlace
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
* Pulse comes in three flavours.
|
||||
|
@ -82,24 +103,39 @@ class RsWirePlace
|
|||
* This info will be duplicated in two msgs - but allow data to spread easier.
|
||||
*
|
||||
* Reply Msg Pulse, will be Top-Level Msg on Publisher's Group.
|
||||
* - mPulseMode = WIRE_PULSE_TYPE_REPLY_MSG
|
||||
* - mPulseMode = WIRE_PULSE_TYPE_RESPONSE | WIRE_PULSE_TYPE_REPLY
|
||||
* - Ref fields refer to Parent (InReplyTo) Msg.
|
||||
*
|
||||
* Reply Reference, is Child Msg of Parent Msg, on Parent Publisher's Group.
|
||||
* - mPulseMode = WIRE_PULSE_TYPE_REPLY_REFERENCE
|
||||
* - mPulseMode = WIRE_PULSE_TYPE_REFERENCE | WIRE_PULSE_TYPE_REPLY
|
||||
* - Ref fields refer to Reply Msg.
|
||||
* - NB: This Msg requires Parent Msg for complete info, while other two are self-contained.
|
||||
*
|
||||
* Additionally need to sort out additional relationships.
|
||||
* - Mentions.
|
||||
* - Followers.
|
||||
* - Following.
|
||||
***********************************************************************/
|
||||
|
||||
#define WIRE_PULSE_TYPE_ORIGINAL_MSG (0x0001)
|
||||
#define WIRE_PULSE_TYPE_REPLY_MSG (0x0002)
|
||||
#define WIRE_PULSE_TYPE_REPLY_REFERENCE (0x0004)
|
||||
#define WIRE_PULSE_TYPE_ORIGINAL (0x0001)
|
||||
#define WIRE_PULSE_TYPE_RESPONSE (0x0002)
|
||||
#define WIRE_PULSE_TYPE_REFERENCE (0x0004)
|
||||
|
||||
#define WIRE_PULSE_RESPONSE_MASK (0x0f00)
|
||||
#define WIRE_PULSE_TYPE_REPLY (0x0100)
|
||||
#define WIRE_PULSE_TYPE_REPUBLISH (0x0200)
|
||||
#define WIRE_PULSE_TYPE_LIKE (0x0400)
|
||||
|
||||
#define WIRE_PULSE_SENTIMENT_NO_SENTIMENT (0x0000)
|
||||
#define WIRE_PULSE_SENTIMENT_POSITIVE (0x0001)
|
||||
#define WIRE_PULSE_SENTIMENT_NEUTRAL (0x0002)
|
||||
#define WIRE_PULSE_SENTIMENT_NEGATIVE (0x0003)
|
||||
|
||||
class RsWirePulse;
|
||||
|
||||
typedef std::shared_ptr<RsWirePulse> RsWirePulseSPtr;
|
||||
typedef std::shared_ptr<const RsWirePulse> RsWirePulseConstSPtr;
|
||||
|
||||
class RsWirePulse
|
||||
{
|
||||
public:
|
||||
|
@ -110,23 +146,50 @@ class RsWirePulse
|
|||
std::string mPulseText;
|
||||
|
||||
uint32_t mPulseType;
|
||||
uint32_t mReplySentiment; // only relevant if a reply.
|
||||
uint32_t mSentiment; // sentiment can be asserted at any point.
|
||||
|
||||
// These Ref to the related (parent or reply) if reply (MODE_REPLY_MSG set)
|
||||
// Mode REPLY_MSG only REPLY_REFERENCE
|
||||
RsGxsGroupId mRefGroupId; // PARENT_GrpId REPLY_GrpId
|
||||
std::string mRefGroupName; // PARENT_GrpName REPLY_GrpName
|
||||
RsGxsMessageId mRefOrigMsgId; // PARENT_OrigMsgId REPLY_OrigMsgId
|
||||
RsGxsId mRefAuthorId; // PARENT_AuthorId REPLY_AuthorId
|
||||
rstime_t mRefPublishTs; // PARENT_PublishTs REPLY_PublishTs
|
||||
std::string mRefPulseText; // PARENT_PulseText REPLY_PulseText
|
||||
// These Ref to the related (parent or reply) if reply (RESPONSE set)
|
||||
// Mode RESPONSE REFERENCE
|
||||
RsGxsGroupId mRefGroupId; // PARENT_GrpId REPLY_GrpId
|
||||
std::string mRefGroupName; // PARENT_GrpName REPLY_GrpName
|
||||
RsGxsMessageId mRefOrigMsgId; // PARENT_OrigMsgId REPLY_OrigMsgId
|
||||
RsGxsId mRefAuthorId; // PARENT_AuthorId REPLY_AuthorId
|
||||
rstime_t mRefPublishTs; // PARENT_PublishTs REPLY_PublishTs
|
||||
std::string mRefPulseText; // PARENT_PulseText REPLY_PulseText
|
||||
uint32_t mRefImageCount; // PARENT_#Images REPLY_#Images
|
||||
|
||||
// Open Question. Do we want these additional fields?
|
||||
// These can potentially be added at some point.
|
||||
// std::list<std::string> mMentions;
|
||||
// std::list<std::string> mHashTags;
|
||||
// std::list<std::string> mUrls;
|
||||
// RsWirePlace mPlace;
|
||||
// Additional Fields for version 2.
|
||||
// Images, need to enforce 20k limit?
|
||||
RsGxsImage mImage1;
|
||||
RsGxsImage mImage2;
|
||||
RsGxsImage mImage3;
|
||||
RsGxsImage mImage4;
|
||||
|
||||
// Below Here is not serialised.
|
||||
// They are additional fields linking pulses together or parsing elements of msg.
|
||||
|
||||
// functions.
|
||||
uint32_t ImageCount();
|
||||
|
||||
// can't have self referencial list, so need to use pointers.
|
||||
// using SharedPointers to automatically cleanup.
|
||||
|
||||
// Pointer to WireGroups
|
||||
// mRefGroupPtr is opportunistically filled in, but will often be empty.
|
||||
RsWireGroupSPtr mRefGroupPtr; // ORIG/RESP: N/A , REF: Reply Group
|
||||
RsWireGroupSPtr mGroupPtr; // ORIG/RESP: Own Group, REF: Parent Group
|
||||
|
||||
// These are the direct children of this message
|
||||
// split into likes, replies and retweets.
|
||||
std::list<RsWirePulseSPtr> mReplies;
|
||||
std::list<RsWirePulseSPtr> mLikes;
|
||||
std::list<RsWirePulseSPtr> mRepublishes;
|
||||
|
||||
// parsed from msg.
|
||||
// do we need references..?
|
||||
std::list<std::string> mHashTags;
|
||||
std::list<std::string> mMentions;
|
||||
std::list<std::string> mUrls;
|
||||
};
|
||||
|
||||
|
||||
|
@ -158,7 +221,29 @@ virtual bool createPulse(uint32_t &token, RsWirePulse &pulse) = 0;
|
|||
// Blocking Interfaces.
|
||||
virtual bool createGroup(RsWireGroup &group) = 0;
|
||||
virtual bool updateGroup(const RsWireGroup &group) = 0;
|
||||
virtual bool getGroups(const std::list<RsGxsGroupId> grpIds, std::vector<RsWireGroup> &groups) = 0;
|
||||
virtual bool getGroups(const std::list<RsGxsGroupId> grpIds,
|
||||
std::vector<RsWireGroup> &groups) = 0;
|
||||
|
||||
// New Blocking Interfaces.
|
||||
// Plan to migrate all GUI calls to these, and remove old interfaces above.
|
||||
// These are not single requests, but return data graphs for display.
|
||||
virtual bool createOriginalPulse(const RsGxsGroupId &grpId, RsWirePulseSPtr pPulse) = 0;
|
||||
virtual bool createReplyPulse(RsGxsGroupId grpId, RsGxsMessageId msgId,
|
||||
RsGxsGroupId replyWith, uint32_t reply_type,
|
||||
RsWirePulseSPtr pPulse) = 0;
|
||||
|
||||
|
||||
// Provide Individual Group Details for display.
|
||||
virtual bool getWireGroup(const RsGxsGroupId &groupId, RsWireGroupSPtr &grp) = 0;
|
||||
virtual bool getWirePulse(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, RsWirePulseSPtr &pPulse) = 0;
|
||||
|
||||
// Provide list of pulses associated with groups.
|
||||
virtual bool getPulsesForGroups(const std::list<RsGxsGroupId> &groupIds,
|
||||
std::list<RsWirePulseSPtr> &pulsePtrs) = 0;
|
||||
|
||||
// Provide pulse, and associated replies / like etc.
|
||||
virtual bool getPulseFocus(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId,
|
||||
int type, RsWirePulseSPtr &pPulse) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -43,39 +43,55 @@ RsItem *RsGxsWireSerialiser::create_item(uint16_t service,uint8_t item_subtype)
|
|||
|
||||
void RsGxsWireGroupItem::clear()
|
||||
{
|
||||
group.mDescription.clear();
|
||||
group.mIcon.clear();
|
||||
group.mTagline.clear();
|
||||
group.mLocation.clear();
|
||||
group.mHeadshot.clear();
|
||||
group.mMasthead.clear();
|
||||
}
|
||||
|
||||
void RsGxsWireGroupItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
{
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DESCR,group.mDescription,"group.mDescription") ;
|
||||
group.mIcon.serial_process(j, ctx);
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DESCR,group.mTagline,"group.mTagline") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_LOCATION,group.mLocation,"group.mLocation") ;
|
||||
group.mHeadshot.serial_process(j, ctx);
|
||||
group.mMasthead.serial_process(j, ctx);
|
||||
}
|
||||
|
||||
void RsGxsWirePulseItem::clear()
|
||||
{
|
||||
pulse.mPulseText.clear();
|
||||
pulse.mPulseType = 0;
|
||||
pulse.mReplySentiment = 0;
|
||||
pulse.mSentiment = 0;
|
||||
pulse.mRefGroupId.clear();
|
||||
pulse.mRefGroupName.clear();
|
||||
pulse.mRefOrigMsgId.clear();
|
||||
pulse.mRefAuthorId.clear();
|
||||
pulse.mRefPublishTs = 0;
|
||||
pulse.mRefPulseText.clear();
|
||||
pulse.mRefImageCount = 0;
|
||||
|
||||
pulse.mImage1.clear();
|
||||
pulse.mImage2.clear();
|
||||
pulse.mImage3.clear();
|
||||
pulse.mImage4.clear();
|
||||
}
|
||||
|
||||
void RsGxsWirePulseItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
{
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_MSG,pulse.mPulseText,"pulse.mPulseText") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_UINT32_PARAM,pulse.mPulseType,"pulse.mPulseType") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_UINT32_PARAM,pulse.mReplySentiment,"pulse.mReplySentiment") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_UINT32_PARAM,pulse.mSentiment,"pulse.mSentiment") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,pulse.mRefGroupId,"pulse.mRefGroupId") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_NAME,pulse.mRefGroupName,"pulse.mRefGroupName") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,pulse.mRefOrigMsgId,"pulse.mRefOrigMsgId") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,pulse.mRefAuthorId,"pulse.mRefAuthorId") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,pulse.mRefPublishTs,"pulse.mRefPublishTs") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_MSG,pulse.mRefPulseText,"pulse.mRefPulseText") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_UINT32_PARAM,pulse.mRefImageCount,"pulse.mRefImageCount") ;
|
||||
|
||||
pulse.mImage1.serial_process(j, ctx);
|
||||
pulse.mImage2.serial_process(j, ctx);
|
||||
pulse.mImage3.serial_process(j, ctx);
|
||||
pulse.mImage4.serial_process(j, ctx);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -61,7 +61,52 @@ public:
|
|||
virtual bool updateGroup(const RsWireGroup &group) override;
|
||||
virtual bool getGroups(const std::list<RsGxsGroupId> grpIds, std::vector<RsWireGroup> &groups) override;
|
||||
|
||||
// New Interfaces.
|
||||
// Blocking, request structures for display.
|
||||
virtual bool createOriginalPulse(const RsGxsGroupId &grpId, RsWirePulseSPtr pPulse) override;
|
||||
virtual bool createReplyPulse(RsGxsGroupId grpId, RsGxsMessageId msgId,
|
||||
RsGxsGroupId replyWith, uint32_t reply_type,
|
||||
RsWirePulseSPtr pPulse) override;
|
||||
|
||||
#if 0
|
||||
virtual bool createReplyPulse(uint32_t &token, RsWirePulse &pulse) override;
|
||||
virtual bool createRepublishPulse(uint32_t &token, RsWirePulse &pulse) override;
|
||||
virtual bool createLikePulse(uint32_t &token, RsWirePulse &pulse) override;
|
||||
#endif
|
||||
|
||||
virtual bool getWireGroup(const RsGxsGroupId &groupId, RsWireGroupSPtr &grp) override;
|
||||
virtual bool getWirePulse(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, RsWirePulseSPtr &pPulse) override;
|
||||
|
||||
virtual bool getPulsesForGroups(const std::list<RsGxsGroupId> &groupIds, std::list<RsWirePulseSPtr> &pulsePtrs) override;
|
||||
|
||||
virtual bool getPulseFocus(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, int type, RsWirePulseSPtr &pPulse) override;
|
||||
|
||||
private:
|
||||
// Internal Service Data.
|
||||
// They should eventually all be here.
|
||||
bool getRelatedPulseData(const uint32_t &token, std::vector<RsWirePulse> &pulses);
|
||||
bool getGroupPtrData(const uint32_t &token,
|
||||
std::map<RsGxsGroupId, RsWireGroupSPtr> &groups);
|
||||
bool getPulsePtrData(const uint32_t &token, std::list<RsWirePulseSPtr> &pulses);
|
||||
|
||||
// util functions fetching data.
|
||||
bool fetchPulse(RsGxsGroupId grpId, RsGxsMessageId msgId, RsWirePulseSPtr &pPulse);
|
||||
bool updatePulse(RsWirePulseSPtr pPulse, int levels);
|
||||
bool updatePulseChildren(RsWirePulseSPtr pParent, uint32_t token);
|
||||
|
||||
// update GroupPtrs
|
||||
bool extractGroupIds(RsWirePulseConstSPtr pPulse, std::set<RsGxsGroupId> &groupIds);
|
||||
|
||||
bool updateGroupPtrs(RsWirePulseSPtr pPulse,
|
||||
const std::map<RsGxsGroupId, RsWireGroupSPtr> &groups);
|
||||
|
||||
bool fetchGroupPtrs(const std::set<RsGxsGroupId> &groupIds,
|
||||
std::map<RsGxsGroupId, RsWireGroupSPtr> &groups);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual void generateDummyData();
|
||||
std::string genRandomId();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue