*/
function onNoticeDeleteRelated($notice)
{
- if ($this->isMyNotice($notice)) {
- $this->deleteRelated($notice);
+ if (!$this->isMyNotice($notice)) {
+ return true;
}
- return true;
+ $this->deleteRelated($notice);
}
/**
*/
function onStartActivityObjectFromNotice($notice, &$object)
{
- if ($this->isMyNotice($notice)) {
- $object = $this->activityObjectFromNotice($notice);
- return false;
+ if (!$this->isMyNotice($notice)) {
+ return true;
}
- return true;
+ $object = $this->activityObjectFromNotice($notice);
+ return false;
}
/**
*/
function onStartHandleFeedEntryWithProfile($activity, $oprofile, &$notice)
{
- if ($this->isMyActivity($activity)) {
+ if (!$this->isMyActivity($activity)) {
+ return true;
+ }
- $actor = $oprofile->checkAuthorship($activity);
+ $actor = $oprofile->checkAuthorship($activity);
- if (!$actor instanceof Ostatus_profile) {
- // TRANS: Client exception thrown when no author for an activity was found.
- throw new ClientException(_('Cannot get author for activity.'));
- }
+ if (!$actor instanceof Ostatus_profile) {
+ // TRANS: Client exception thrown when no author for an activity was found.
+ throw new ClientException(_('Cannot get author for activity.'));
+ }
- $object = $activity->objects[0];
+ $object = $activity->objects[0];
- $options = array('uri' => $object->id,
- 'url' => $object->link,
- 'is_local' => Notice::REMOTE,
- 'source' => 'ostatus');
+ $options = array('uri' => $object->id,
+ 'url' => $object->link,
+ 'is_local' => Notice::REMOTE,
+ 'source' => 'ostatus');
- // $actor is an ostatus_profile
- $notice = $this->saveNoticeFromActivity($activity, $actor->localProfile(), $options);
+ // $actor is an ostatus_profile
+ $notice = $this->saveNoticeFromActivity($activity, $actor->localProfile(), $options);
- return false;
- }
-
- return true;
+ return false;
}
/**
function onStartHandleSalmonTarget($activity, $target)
{
- if ($this->isMyActivity($activity)) {
- $this->log(LOG_INFO, "Checking {$activity->id} as a valid Salmon slap.");
-
- if ($target instanceof User_group) {
- $uri = $target->getUri();
- if (!array_key_exists($uri, $activity->context->attention)) {
- // @todo FIXME: please document (i18n).
- // TRANS: Client exception thrown when ...
- throw new ClientException(_('Object not posted to this group.'));
- }
- } else if ($target instanceof User) {
- $uri = $target->uri;
- $original = null;
- if (!empty($activity->context->replyToID)) {
- $original = Notice::getKV('uri',
- $activity->context->replyToID);
- }
- if (!array_key_exists($uri, $activity->context->attention) &&
- (empty($original) ||
- $original->profile_id != $target->id)) {
- // @todo FIXME: Please document (i18n).
- // TRANS: Client exception when ...
- throw new ClientException(_('Object not posted to this user.'));
- }
- } else {
- // TRANS: Server exception thrown when a micro app plugin uses a target that cannot be handled.
- throw new ServerException(_('Do not know how to handle this kind of target.'));
- }
+ if (!$this->isMyActivity($activity)) {
+ return true;
+ }
+
+ $this->log(LOG_INFO, "Checking {$activity->id} as a valid Salmon slap.");
- $actor = Ostatus_profile::ensureActivityObjectProfile($activity->actor);
+ if ($target instanceof User_group) {
+ $uri = $target->getUri();
+ if (!array_key_exists($uri, $activity->context->attention)) {
+ // @todo FIXME: please document (i18n).
+ // TRANS: Client exception thrown when ...
+ throw new ClientException(_('Object not posted to this group.'));
+ }
+ } else if ($target instanceof User) {
+ $uri = $target->uri;
+ $original = null;
+ if (!empty($activity->context->replyToID)) {
+ $original = Notice::getKV('uri', $activity->context->replyToID);
+ }
+ if (!array_key_exists($uri, $activity->context->attention) &&
+ (empty($original) ||
+ $original->profile_id != $target->id)) {
+ // @todo FIXME: Please document (i18n).
+ // TRANS: Client exception when ...
+ throw new ClientException(_('Object not posted to this user.'));
+ }
+ } else {
+ // TRANS: Server exception thrown when a micro app plugin uses a target that cannot be handled.
+ throw new ServerException(_('Do not know how to handle this kind of target.'));
+ }
- $object = $activity->objects[0];
+ $actor = Ostatus_profile::ensureActivityObjectProfile($activity->actor);
- $options = array('uri' => $object->id,
- 'url' => $object->link,
- 'is_local' => Notice::REMOTE,
- 'source' => 'ostatus');
+ $object = $activity->objects[0];
- // $actor is an ostatus_profile
- $this->saveNoticeFromActivity($activity, $actor->localProfile(), $options);
+ $options = array('uri' => $object->id,
+ 'url' => $object->link,
+ 'is_local' => Notice::REMOTE,
+ 'source' => 'ostatus');
- return false;
- }
+ // $actor is an ostatus_profile
+ $this->saveNoticeFromActivity($activity, $actor->localProfile(), $options);
- return true;
+ return false;
}
/**
*/
function onStartAtomPubNewActivity(&$activity, $user, &$notice)
{
- if ($this->isMyActivity($activity)) {
+ if (!$this->isMyActivity($activity)) {
+ return true;
+ }
- $options = array('source' => 'atompub');
+ $options = array('source' => 'atompub');
- // $user->getProfile() is a Profile
- $notice = $this->saveNoticeFromActivity($activity,
- $user->getProfile(),
- $options);
+ // $user->getProfile() is a Profile
+ $notice = $this->saveNoticeFromActivity($activity,
+ $user->getProfile(),
+ $options);
- return false;
- }
-
- return true;
+ return false;
}
/**
*/
function onStartImportActivity($user, $author, $activity, $trusted, &$done)
{
- if ($this->isMyActivity($activity)) {
-
- $obj = $activity->objects[0];
+ if (!$this->isMyActivity($activity)) {
+ return true;
+ }
- $options = array('uri' => $object->id,
- 'url' => $object->link,
- 'source' => 'restore');
+ $obj = $activity->objects[0];
- // $user->getProfile() is a Profile
- $saved = $this->saveNoticeFromActivity($activity,
- $user->getProfile(),
- $options);
+ $options = array('uri' => $object->id,
+ 'url' => $object->link,
+ 'source' => 'restore');
- if (!empty($saved)) {
- $done = true;
- }
+ // $user->getProfile() is a Profile
+ $saved = $this->saveNoticeFromActivity($activity,
+ $user->getProfile(),
+ $options);
- return false;
+ if (!empty($saved)) {
+ $done = true;
}
- return true;
+ return false;
}
/**