mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-05 15:45:04 -04:00
added handling of channel, forum and posted events in GUI
This commit is contained in:
parent
eef5a5a8ef
commit
4fe6e46410
6 changed files with 174 additions and 74 deletions
|
@ -61,7 +61,7 @@ enum class RsEventType : uint32_t
|
|||
/// @see pqissl
|
||||
PEER_CONNECTION = 4,
|
||||
|
||||
/// @see RsGxsChanges
|
||||
/// @see RsGxsChanges // this one should probably be removed because it's not used anywhere
|
||||
GXS_CHANGES = 5,
|
||||
|
||||
/// Emitted when a peer state changes, @see RsPeers
|
||||
|
@ -73,6 +73,15 @@ enum class RsEventType : uint32_t
|
|||
/// @see RsGxsCircleEvent
|
||||
GXS_CIRCLES = 8,
|
||||
|
||||
/// @see RsGxsChannelEvent
|
||||
GXS_CHANNELS = 9,
|
||||
|
||||
/// @see RsGxsForumEvent
|
||||
GXS_FORUMS = 10,
|
||||
|
||||
/// @see RsGxsPostedEvent
|
||||
GXS_POSTED = 11,
|
||||
|
||||
MAX /// Used to detect invalid event type passed
|
||||
};
|
||||
|
||||
|
|
|
@ -102,6 +102,34 @@ struct RsGxsChannelPost : RsSerializable
|
|||
~RsGxsChannelPost() override;
|
||||
};
|
||||
|
||||
struct RsGxsChannelEvent: RsEvent
|
||||
{
|
||||
RsGxsChannelEvent()
|
||||
: RsEvent(RsEventType::GXS_CHANNELS), mChannelEventCode(UNKNOWN) {}
|
||||
|
||||
enum ChannelEventCode: uint8_t {
|
||||
UNKNOWN = 0x00,
|
||||
NEW_CHANNEL = 0x01, // emitted when new channel is received
|
||||
UPDATED_CHANNEL = 0x02, // emitted when existing channel is updated
|
||||
NEW_MESSAGE = 0x03, // new message reeived in a particular channel (group and msg id)
|
||||
UPDATED_MESSAGE = 0x04, // existing message has been updated in a particular channel (group and msg id)
|
||||
RECEIVED_PUBLISH_KEY = 0x05, // publish key for this channel has been received.
|
||||
};
|
||||
|
||||
ChannelEventCode mChannelEventCode;
|
||||
RsGxsGroupId mChannelGroupId;
|
||||
RsGxsMessageId mChannelMsgId;
|
||||
|
||||
///* @see RsEvent @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) override
|
||||
{
|
||||
RsEvent::serial_process(j, ctx);
|
||||
|
||||
RS_SERIAL_PROCESS(mChannelEventCode);
|
||||
RS_SERIAL_PROCESS(mChannelGroupId);
|
||||
RS_SERIAL_PROCESS(mChannelMsgId);
|
||||
}
|
||||
};
|
||||
|
||||
class RsGxsChannels: public RsGxsIfaceHelper, public RsGxsCommentService
|
||||
{
|
||||
|
|
|
@ -104,6 +104,33 @@ struct RsGxsForumMsg : RsSerializable
|
|||
~RsGxsForumMsg() override;
|
||||
};
|
||||
|
||||
struct RsGxsForumEvent: RsEvent
|
||||
{
|
||||
RsGxsForumEvent()
|
||||
: RsEvent(RsEventType::GXS_FORUMS), mForumEventCode(UNKNOWN) {}
|
||||
|
||||
enum ForumEventCode: uint8_t {
|
||||
UNKNOWN = 0x00,
|
||||
NEW_FORUM = 0x01, // emitted when new forum is received
|
||||
UPDATED_FORUM = 0x02, // emitted when existing forum is updated
|
||||
NEW_MESSAGE = 0x03, // new message reeived in a particular forum (group and msg id)
|
||||
UPDATED_MESSAGE = 0x04, // existing message has been updated in a particular forum (group and msg id)
|
||||
};
|
||||
|
||||
ForumEventCode mForumEventCode;
|
||||
RsGxsGroupId mForumGroupId;
|
||||
RsGxsMessageId mForumMsgId;
|
||||
|
||||
///* @see RsEvent @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) override
|
||||
{
|
||||
RsEvent::serial_process(j, ctx);
|
||||
|
||||
RS_SERIAL_PROCESS(mForumEventCode);
|
||||
RS_SERIAL_PROCESS(mForumGroupId);
|
||||
RS_SERIAL_PROCESS(mForumMsgId);
|
||||
}
|
||||
};
|
||||
|
||||
class RsGxsForums: public RsGxsIfaceHelper
|
||||
{
|
||||
|
|
|
@ -68,6 +68,32 @@ class RsPostedGroup
|
|||
std::ostream &operator<<(std::ostream &out, const RsPostedGroup &group);
|
||||
std::ostream &operator<<(std::ostream &out, const RsPostedPost &post);
|
||||
|
||||
struct RsGxsPostedEvent: RsEvent
|
||||
{
|
||||
RsGxsPostedEvent()
|
||||
: RsEvent(RsEventType::GXS_POSTED), mPostedEventCode(UNKNOWN) {}
|
||||
|
||||
enum PostedEventCode: uint8_t {
|
||||
UNKNOWN = 0x00,
|
||||
NEW_POSTED_GROUP = 0x01,
|
||||
NEW_MESSAGE = 0x02
|
||||
};
|
||||
|
||||
PostedEventCode mPostedEventCode;
|
||||
RsPeerId mAuthorId;
|
||||
RsGxsGroupId mPostedGroupId;
|
||||
RsGxsMessageId mPostedMsgId;
|
||||
|
||||
///* @see RsEvent @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) override
|
||||
{
|
||||
RsEvent::serial_process(j, ctx);
|
||||
RS_SERIAL_PROCESS(mPostedEventCode);
|
||||
RS_SERIAL_PROCESS(mAuthorId);
|
||||
RS_SERIAL_PROCESS(mPostedGroupId);
|
||||
RS_SERIAL_PROCESS(mPostedMsgId);
|
||||
}
|
||||
};
|
||||
|
||||
class RsPosted : public RsGxsIfaceHelper, public RsGxsCommentService
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue