}
bool AbstractItem::CanReceive(std::string id) const {
- if (impl_->receiver_group_list_.size() == 0 || id.empty())
+ if (impl_->receiver_group_list_.size() != 0 && !id.empty()) {
+ list<string>::iterator iter =
+ std::find(impl_->receiver_group_list_.begin(),
+ impl_->receiver_group_list_.end(), id);
+
+ if (iter != impl_->receiver_group_list_.end())
+ return false;
+ }
+
+ if (impl_->hide_viewer_list_.size() == 0)
return true;
+
+ string app_id = util::GetAppId();
list<string>::iterator iter =
- std::find(impl_->receiver_group_list_.begin(),
- impl_->receiver_group_list_.end(), id);
- return !(iter == impl_->receiver_group_list_.end());
+ std::find(impl_->hide_viewer_list_.begin(),
+ impl_->hide_viewer_list_.end(), app_id);
+
+ if (iter != impl_->hide_viewer_list_.end())
+ return false;
+
+ return true;
}
void AbstractItem::SetPolicy(AbstractItem::Policy policy) {
list<shared_ptr<item::AbstractItem>> item_list = OnRequestEvent(info);
list<Bundle> serialized_list;
for (auto& i : item_list) {
- serialized_list.push_back(i->Serialize());
+ if (i->CanReceive(impl_->receiver_group_))
+ serialized_list.push_back(i->Serialize());
}
return serialized_list;
}