mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
added NEW_COMMENT and NEW_VOTE to rsEvents types in Posted and Channels
This commit is contained in:
parent
dc90d6f6dc
commit
3cac0c030d
4 changed files with 25 additions and 4 deletions
|
@ -116,6 +116,8 @@ enum class RsChannelEventCode: uint8_t
|
|||
RECEIVED_DISTANT_SEARCH_RESULT = 0x08, // result for the given group id available for the given turtle request id
|
||||
STATISTICS_CHANGED = 0x09, // stats (nb of supplier friends, how many msgs they have etc) has changed
|
||||
SYNC_PARAMETERS_UPDATED = 0x0a, // sync and storage times have changed
|
||||
NEW_COMMENT = 0x0b, // new comment arrived/published. mChannelThreadId gives the ID of the commented message
|
||||
NEW_VOTE = 0x0c, // new vote arrived/published. mChannelThreadId gives the ID of the votes message comment
|
||||
};
|
||||
|
||||
struct RsGxsChannelEvent: RsEvent
|
||||
|
@ -125,6 +127,7 @@ struct RsGxsChannelEvent: RsEvent
|
|||
RsChannelEventCode mChannelEventCode;
|
||||
RsGxsGroupId mChannelGroupId;
|
||||
RsGxsMessageId mChannelMsgId;
|
||||
RsGxsMessageId mChannelThreadId;
|
||||
|
||||
///* @see RsEvent @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) override
|
||||
|
|
|
@ -117,6 +117,8 @@ enum class RsPostedEventCode: uint8_t
|
|||
STATISTICS_CHANGED = 0x07,
|
||||
MESSAGE_VOTES_UPDATED = 0x08,
|
||||
SYNC_PARAMETERS_UPDATED = 0x09,
|
||||
NEW_COMMENT = 0x0a,
|
||||
NEW_VOTE = 0x0b,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -259,7 +259,15 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||
|
||||
ev->mChannelMsgId = msgChange->mMsgId;
|
||||
ev->mChannelGroupId = msgChange->mGroupId;
|
||||
ev->mChannelEventCode = RsChannelEventCode::NEW_MESSAGE;
|
||||
|
||||
if(nullptr != dynamic_cast<RsGxsCommentItem*>(msgChange->mNewMsgItem))
|
||||
ev->mChannelEventCode = RsChannelEventCode::NEW_COMMENT;
|
||||
else
|
||||
if(nullptr != dynamic_cast<RsGxsVoteItem*>(msgChange->mNewMsgItem))
|
||||
ev->mChannelEventCode = RsChannelEventCode::NEW_VOTE;
|
||||
else
|
||||
ev->mChannelEventCode = RsChannelEventCode::NEW_MESSAGE;
|
||||
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,10 +107,18 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||
case RsGxsNotify::TYPE_PUBLISHED:
|
||||
{
|
||||
auto ev = std::make_shared<RsGxsPostedEvent>();
|
||||
ev->mPostedMsgId = msgChange->mMsgId;
|
||||
ev->mPostedMsgId = msgChange->mMsgId;
|
||||
ev->mPostedThreadId = msgChange->mNewMsgItem->meta.mThreadId;
|
||||
ev->mPostedGroupId = msgChange->mGroupId;
|
||||
ev->mPostedEventCode = RsPostedEventCode::NEW_MESSAGE;
|
||||
ev->mPostedGroupId = msgChange->mGroupId;
|
||||
|
||||
if(nullptr != dynamic_cast<RsGxsCommentItem*>(msgChange->mNewMsgItem))
|
||||
ev->mPostedEventCode = RsPostedEventCode::NEW_COMMENT;
|
||||
else
|
||||
if(nullptr != dynamic_cast<RsGxsVoteItem*>(msgChange->mNewMsgItem))
|
||||
ev->mPostedEventCode = RsPostedEventCode::NEW_VOTE;
|
||||
else
|
||||
ev->mPostedEventCode = RsPostedEventCode::NEW_MESSAGE;
|
||||
|
||||
rsEvents->postEvent(ev);
|
||||
#ifdef POSTBASE_DEBUG
|
||||
std::cerr << "p3PostBase::notifyChanges() Found Message Change Notification: NEW/PUBLISHED ID=" << msgChange->mMsgId << " in group " << msgChange->mGroupId << ", thread ID = " << msgChange->mNewMsgItem->meta.mThreadId << std::endl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue