function showProfileInfo(Ostatus_profile $oprofile)
{
    if ($oprofile->isGroup()) {
        echo "group\n";
    } else {
        $profile = $oprofile->localProfile();
        try {
            foreach (array('nickname', 'fullname', 'bio', 'homepage', 'location') as $field) {
                print "  {$field}: {$profile->{$field}}\n";
            }
        } catch (NoProfileException $e) {
            print "local profile not found";
        }
    }
    echo "\n";
}
예제 #2
0
 /**
  * Let the OStatus subscription garbage collection know if we're
  * making use of a remote feed, so it doesn't get dropped out
  * from under us.
  *
  * @param Ostatus_profile $oprofile
  * @param int $count in/out
  * @return mixed hook return value
  */
 function onOstatus_profileSubscriberCount(Ostatus_profile $oprofile, &$count)
 {
     try {
         $profile = $oprofile->localProfile();
         $mirror = new SubMirror();
         $mirror->subscribed = $profile->id;
         if ($mirror->find()) {
             while ($mirror->fetch()) {
                 $count++;
             }
         }
     } catch (NoProfileException $e) {
         // We can't handle this kind of Ostatus_profile since it has no
         // local profile
     }
     return true;
 }
 function pingReply(Ostatus_profile $oprofile)
 {
     if ($this->user) {
         common_debug("OSTATUS [{$this->notice->getID()}]: pinging reply to {$oprofile->localProfile()->getNickname()} for local user '{$this->user->getID()}'");
         // For local posts, send a Salmon ping to the mentioned
         // remote user or group.
         // @fixme as an optimization we can skip this if the
         // remote profile is subscribed to the author.
         $oprofile->notifyDeferred($this->notice, $this->user);
     }
 }
예제 #4
0
 /**
  * Save a remote bookmark (from Salmon or PuSH)
  *
  * @param Ostatus_profile $author   Author of the bookmark
  * @param Activity        $activity Activity to save
  *
  * @return Notice resulting notice.
  */
 private static function _postRemoteBookmark(Ostatus_profile $author, Activity $activity)
 {
     $bookmark = $activity->objects[0];
     $options = array('uri' => $bookmark->id, 'url' => $bookmark->link, 'is_local' => Notice::REMOTE, 'source' => 'ostatus');
     return self::_postBookmark($author->localProfile(), $activity, $options);
 }