예제 #1
0
 /**
  * Handle a posted object from PuSH
  *
  * @param Activity        $activity activity to handle
  * @param Ostatus_profile $oprofile Profile for the feed
  *
  * @return boolean hook value
  */
 function onStartHandleFeedEntryWithProfile($activity, $oprofile, &$notice)
 {
     if ($this->isMyActivity($activity)) {
         $actor = $oprofile->checkAuthorship($activity);
         if (empty($actor)) {
             // TRANS: Client exception thrown when no author for an activity was found.
             throw new ClientException(_('Cannot get author for activity.'));
         }
         $object = $activity->objects[0];
         $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);
         return false;
     }
     return true;
 }
예제 #2
0
 /**
  * Handle a posted bookmark from PuSH
  *
  * @param Activity        $activity activity to handle
  * @param Ostatus_profile $oprofile Profile for the feed
  *
  * @return boolean hook value
  */
 function onStartHandleFeedEntryWithProfile($activity, $oprofile)
 {
     common_log(LOG_INFO, "BookmarkPlugin called for new feed entry.");
     if (self::_isPostBookmark($activity)) {
         common_log(LOG_INFO, "Importing activity {$activity->id} as a bookmark.");
         $author = $oprofile->checkAuthorship($activity);
         if (empty($author)) {
             throw new ClientException(_('Can\'t get author for activity.'));
         }
         self::_postRemoteBookmark($author, $activity);
         return false;
     }
     return true;
 }