added proper notifications when a group is deleted

This commit is contained in:
csoler 2020-11-25 23:35:20 +01:00
parent f21b57b643
commit bce514115d
15 changed files with 60 additions and 8 deletions

View file

@ -195,7 +195,7 @@ bool RsGxsCleanUp::clean(RsGxsGroupId& next_group_to_check)
}
}
//mDs->removeGroups(grps_to_delete);
mDs->removeGroups(grps_to_delete);
return full_round;
}

View file

@ -118,6 +118,7 @@ enum class RsChannelEventCode: uint8_t
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
DELETED_CHANNEL = 0x0d, // channel was deleted by auto-cleaning system
};
struct RsGxsChannelEvent: RsEvent

View file

@ -235,6 +235,11 @@ enum class RsGxsCircleEventCode: uint8_t
*
* no additional information. Simply means that the info previously from the cache has changed. */
CACHE_DATA_UPDATED = 0x06,
/**
* The circle has been deleted by auto-cleaning.
* */
CIRCLE_DELETED = 0x07,
};
struct RsGxsCircleEvent: RsEvent

View file

@ -117,6 +117,7 @@ enum class RsForumEventCode: uint8_t
MODERATOR_LIST_CHANGED = 0x08, /// forum moderation list has changed.
SYNC_PARAMETERS_UPDATED = 0x0a, /// sync and storage times have changed
PINNED_POSTS_CHANGED = 0x0b, /// some posts where pinned or un-pinned
DELETED_FORUM = 0x0c, /// forum was deleted by cleaning
};
struct RsGxsForumEvent: RsEvent

View file

@ -119,6 +119,7 @@ enum class RsPostedEventCode: uint8_t
SYNC_PARAMETERS_UPDATED = 0x09,
NEW_COMMENT = 0x0a,
NEW_VOTE = 0x0b,
BOARD_DELETED = 0x0c,
};

View file

@ -376,7 +376,16 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
}
break;
case RsGxsNotify::TYPE_RECEIVED_PUBLISHKEY:
case RsGxsNotify::TYPE_GROUP_DELETED:
{
auto ev = std::make_shared<RsGxsChannelEvent>();
ev->mChannelGroupId = grpChange->mGroupId;
ev->mChannelEventCode = RsChannelEventCode::DELETED_CHANNEL;
rsEvents->postEvent(ev);
}
break;
case RsGxsNotify::TYPE_RECEIVED_PUBLISHKEY:
{
/* group received */
auto ev = std::make_shared<RsGxsChannelEvent>();

View file

@ -698,7 +698,7 @@ void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
ev->mCircleId = RsGxsCircleId(*git);
ev->mGxsId = gxs_id;
rsEvents->sendEvent(ev);
rsEvents->postEvent(ev);
}
}
else if(c->getType()==RsGxsNotify::TYPE_UPDATED)
@ -728,7 +728,7 @@ void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
ev->mCircleId = circle_id;
ev->mGxsId = gxs_id;
rsEvents->sendEvent(ev);
rsEvents->postEvent(ev);
}
for(auto& gxs_id: old_circle_grp_item->gxsIdSet.ids)
@ -740,10 +740,19 @@ void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
ev->mCircleId = circle_id;
ev->mGxsId = gxs_id;
rsEvents->sendEvent(ev);
rsEvents->postEvent(ev);
}
}
else if(c->getType()==RsGxsNotify::TYPE_GROUP_DELETED)
{
auto ev = std::make_shared<RsGxsCircleEvent>();
ev->mCircleEventType = RsGxsCircleEventCode::CIRCLE_DELETED;
ev->mCircleId = RsGxsCircleId(groupChange->mGroupId);
rsEvents->postEvent(ev);
}
}
}

View file

@ -298,7 +298,16 @@ void p3GxsForums::notifyChanges(std::vector<RsGxsNotify *> &changes)
}
break;
case RsGxsNotify::TYPE_STATISTICS_CHANGED:
case RsGxsNotify::TYPE_GROUP_DELETED:
{
auto ev = std::make_shared<RsGxsForumEvent>();
ev->mForumGroupId = grpChange->mGroupId;
ev->mForumEventCode = RsForumEventCode::DELETED_FORUM;
rsEvents->postEvent(ev);
}
break;
case RsGxsNotify::TYPE_STATISTICS_CHANGED:
{
auto ev = std::make_shared<RsGxsForumEvent>();
ev->mForumGroupId = grpChange->mGroupId;

View file

@ -132,6 +132,7 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
}
break;
case RsGxsNotify::TYPE_PROCESSED:
{
auto ev = std::make_shared<RsGxsPostedEvent>();
@ -184,6 +185,16 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
}
break;
case RsGxsNotify::TYPE_GROUP_DELETED:
{
auto ev = std::make_shared<RsGxsPostedEvent>();
ev->mPostedGroupId = msgChange->mGroupId;
ev->mPostedEventCode = RsPostedEventCode::BOARD_DELETED;
rsEvents->postEvent(ev);
}
break;
case RsGxsNotify::TYPE_STATISTICS_CHANGED:
{
auto ev = std::make_shared<RsGxsPostedEvent>();