Ostatus_profile.php

Summary
Ostatus_profile.php
Ostatus_profileOStatus specific profile stores
Ostatus_profileSuperclass containing the OStatus profile as it is stored in the back-end database, as well as the related interfaces.
schemaDefReturn table definition for Schema setup and DB_DataObject usage.
getUriReturns the URI of this profile.
getFeedSubReturns the feedsubs that follow the feed URI of this profile.
fromProfileReturns the OStatus_profile associated with profile $profile.
localProfileFetch the locally stored profile for this feed.
localGroupFetch the postActiv-side profile for this feed.
localPeopletagFetch the postActiv-side peopletag for this feed
asActivityObjectReturns an ActivityObject describing this remote user or group profile.
asActivityNounReturns an XML string fragment with profile information as an Activity Streams noun object with the given element type.
isGroupReturns true/false if this is a remote group
isPersonReturns true/false if this is a person, as opposed to a group.
isPeopletagReturns true/false if this is a remote peopletag (list).
unsubscribeCheck if this remote profile has any active local subscriptions, and if not drop the WebSub subscription feed.
garbageCollectCheck if this remote profile has any active local subscriptions, and if not drop the WebSub subscription feed.
subscriberCountCheck if this remote profile has any active local subscriptions, so the WebSub subscription layer can decide if it can drop the feed.
notifySend an Activity Streams notification to the remote Salmon endpoint, if so configured.
notifyActivitySend a Salmon notification ping immediately, and confirm that we got an acceptable response from the remote site.
notifyDeferredQueue a Salmon notification for later.
notifyPrepXMLReturns the preamble XML for a notify OStatus activity.
getBestNameReturns the best name for a group, peopletag, or profile, as appropriate.
processFeedRead and post notices for updates from the feed.
processAtomFeedMeta function that constructs an array of items for processEntries harvested from an ATOM feed.
processRssFeedMeta function that constructs an array of items for processEntries harvested from an RSS feed.
processEntriesMeta function the parses an array of feed entries through processEntry iteratively.
processEntryProcess a posted entry from this feed source.
processActivityGiven an Entry to process, create the appropriate ActivityObject for it.
processPostProcess an incoming post activity from this remote feed.
filterAttentionFilters a list of recipient ID URIs to just those for local delivery.
ensureProfileURLLook up and if necessary create an Ostatus_profile for the remote entity with the given profile page URL.
getFromProfileURLLook up the Ostatus_profile, if present, for a remote entity with the given profile page URL.
getFromProfileReturns the OStatus profile for a given local $profile
ensureFeedURLLook up and if necessary create an Ostatus_profile for remote entity with the given update feed.
ensureAtomFeedLook up and, if necessary, create an Ostatus_profile for the remote profile with the given Atom feed - actually loaded from the feed.
ensureRssChannelLook up and, if necessary, create an Ostatus_profile for the remote profile with the given RSS feed - actually loaded from the feed.
updateAvatarDownload and update given avatar image
getActivityObjectAvatarPull avatar URL from ActivityObject or profile hints
getAvatarGet an appropriate avatar image source URL, if available.
ensureActorProfileFetch, or build if necessary, an Ostatus_profile for the actor in a given Activity Streams activity.
ensureActivityObjectProfileFetch, or build if necessary, an Ostatus_profile for the profile in a given Activity Streams object (can be subject, actor, or object).
getActorProfileRetrieves the profile for the actor in an ActivityObject.
getActivityObjectProfileRetrieves the URI from an ActivityObject and uses it to map out the appropriate OStatus_profile for the object.
getActivityObjectProfileURIGet the identifier URI for the remote entity described by this ActivityObject.
createActivityObjectProfileCreate local ostatus_profile and profile/user_group entries for the provided remote user or group.
updateFromActivityObjectSave any updated profile information to our local copy.
updateProfileUpdate a local OStatus_profile.
updateGroupUpdate a local OStatus_profile for a group.
updatePeopletagUpdate a local OStatus_profile for a peopletag.
getActivityObjectHomepage
getActivityObjectLocationIf the ActivityObject specifies a geolocation, then return it.
getActivityObjectBioReturns the bio for the poster of an ActivityObject if one is specified, or null otherwise.
getActivityObjectNicknameReturns the nickname for the poster of an ActivityObject if one is specified, or null otherwise.
nicknameFromURIRetrieves the nickname for a profile given a URI
ensureWebFingerLook up, and if necessary create, an Ostatus_profile for the remote entity with the given webfinger address.
saveHTMLFileStore the full-length scrubbed HTML of a remote notice to an attachment file on our server.
ensureProfileURIMake sure we get a profile for a given URI.
checkAuthorshipFigure out who authored an ActivityObject $activity and return their Profile.
updateUriKeysA fix for older StatusNet sites upgrading to postActiv to update the keys in the database for given profile_uri and dedupe.

Ostatus_profile

OStatus specific profile stores

postActiv

the micro-blogging software

Copyright

Copyright © 2016-2017, Maiyannah Bishop

Derived from code copyright various sources

  • GNU Social © 2013-2016, Free Software Foundation, Inc
  • StatusNet © 2008-2012, StatusNet, Inc

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program.  If not, see http://www.gnu.org/licenses/.

https://www.gnu.org/licenses/agpl.html

About

OStatus specific profile stores.

I’m not entirely clear on why we need a store specific for OStatus since it is the native protocol and ActivityPub builds on it, so this could be a candidate for merging into the normal profile - mb

PHP version

Tested with PHP 7

File Authors

Web

Ostatus_profile

Superclass containing the OStatus profile as it is stored in the back-end database, as well as the related interfaces.

Properties

  • __table = ‘ostatus_profile’
  • uri
  • profile_id
  • group_id
  • peopletag_id
  • feeduri
  • salmonuri
  • avatar - remote URL of the last avatar we saved
  • created
  • modified
Summary
schemaDefReturn table definition for Schema setup and DB_DataObject usage.
getUriReturns the URI of this profile.
getFeedSubReturns the feedsubs that follow the feed URI of this profile.
fromProfileReturns the OStatus_profile associated with profile $profile.
localProfileFetch the locally stored profile for this feed.
localGroupFetch the postActiv-side profile for this feed.
localPeopletagFetch the postActiv-side peopletag for this feed
asActivityObjectReturns an ActivityObject describing this remote user or group profile.
asActivityNounReturns an XML string fragment with profile information as an Activity Streams noun object with the given element type.
isGroupReturns true/false if this is a remote group
isPersonReturns true/false if this is a person, as opposed to a group.
isPeopletagReturns true/false if this is a remote peopletag (list).
unsubscribeCheck if this remote profile has any active local subscriptions, and if not drop the WebSub subscription feed.
garbageCollectCheck if this remote profile has any active local subscriptions, and if not drop the WebSub subscription feed.
subscriberCountCheck if this remote profile has any active local subscriptions, so the WebSub subscription layer can decide if it can drop the feed.
notifySend an Activity Streams notification to the remote Salmon endpoint, if so configured.
notifyActivitySend a Salmon notification ping immediately, and confirm that we got an acceptable response from the remote site.
notifyDeferredQueue a Salmon notification for later.
notifyPrepXMLReturns the preamble XML for a notify OStatus activity.
getBestNameReturns the best name for a group, peopletag, or profile, as appropriate.
processFeedRead and post notices for updates from the feed.
processAtomFeedMeta function that constructs an array of items for processEntries harvested from an ATOM feed.
processRssFeedMeta function that constructs an array of items for processEntries harvested from an RSS feed.
processEntriesMeta function the parses an array of feed entries through processEntry iteratively.
processEntryProcess a posted entry from this feed source.
processActivityGiven an Entry to process, create the appropriate ActivityObject for it.
processPostProcess an incoming post activity from this remote feed.
filterAttentionFilters a list of recipient ID URIs to just those for local delivery.
ensureProfileURLLook up and if necessary create an Ostatus_profile for the remote entity with the given profile page URL.
getFromProfileURLLook up the Ostatus_profile, if present, for a remote entity with the given profile page URL.
getFromProfileReturns the OStatus profile for a given local $profile
ensureFeedURLLook up and if necessary create an Ostatus_profile for remote entity with the given update feed.
ensureAtomFeedLook up and, if necessary, create an Ostatus_profile for the remote profile with the given Atom feed - actually loaded from the feed.
ensureRssChannelLook up and, if necessary, create an Ostatus_profile for the remote profile with the given RSS feed - actually loaded from the feed.
updateAvatarDownload and update given avatar image
getActivityObjectAvatarPull avatar URL from ActivityObject or profile hints
getAvatarGet an appropriate avatar image source URL, if available.
ensureActorProfileFetch, or build if necessary, an Ostatus_profile for the actor in a given Activity Streams activity.
ensureActivityObjectProfileFetch, or build if necessary, an Ostatus_profile for the profile in a given Activity Streams object (can be subject, actor, or object).
getActorProfileRetrieves the profile for the actor in an ActivityObject.
getActivityObjectProfileRetrieves the URI from an ActivityObject and uses it to map out the appropriate OStatus_profile for the object.
getActivityObjectProfileURIGet the identifier URI for the remote entity described by this ActivityObject.
createActivityObjectProfileCreate local ostatus_profile and profile/user_group entries for the provided remote user or group.
updateFromActivityObjectSave any updated profile information to our local copy.
updateProfileUpdate a local OStatus_profile.
updateGroupUpdate a local OStatus_profile for a group.
updatePeopletagUpdate a local OStatus_profile for a peopletag.
getActivityObjectHomepage
getActivityObjectLocationIf the ActivityObject specifies a geolocation, then return it.
getActivityObjectBioReturns the bio for the poster of an ActivityObject if one is specified, or null otherwise.
getActivityObjectNicknameReturns the nickname for the poster of an ActivityObject if one is specified, or null otherwise.
nicknameFromURIRetrieves the nickname for a profile given a URI
ensureWebFingerLook up, and if necessary create, an Ostatus_profile for the remote entity with the given webfinger address.
saveHTMLFileStore the full-length scrubbed HTML of a remote notice to an attachment file on our server.
ensureProfileURIMake sure we get a profile for a given URI.
checkAuthorshipFigure out who authored an ActivityObject $activity and return their Profile.
updateUriKeysA fix for older StatusNet sites upgrading to postActiv to update the keys in the database for given profile_uri and dedupe.

schemaDef

static function schemaDef()

Return table definition for Schema setup and DB_DataObject usage.

Returns

  • array array of column definitions

getUri

public function getUri()

Returns the URI of this profile.

getFeedSub

public function getFeedSub()

Returns the feedsubs that follow the feed URI of this profile.

fromProfile

static function fromProfile(Profile $profile)

Returns the OStatus_profile associated with profile $profile.

localProfile

public function localProfile()

Fetch the locally stored profile for this feed.

Returns

  • retrived Profile

Error States

  • throws NoProfileException if it was not found

localGroup

public function localGroup()

Fetch the postActiv-side profile for this feed.

Returns

  • Profile

localPeopletag

public function localPeopletag()

Fetch the postActiv-side peopletag for this feed

Returns

  • Profile

asActivityObject

function asActivityObject()

Returns an ActivityObject describing this remote user or group profile.  Can then be used to generate Atom chunks.

Returns

  • ActivityObject

asActivityNoun

function asActivityNoun($element)

Returns an XML string fragment with profile information as an Activity Streams noun object with the given element type.

Assumes that ‘activity’ namespace has been previously defined.

FIXME

  • Replace with wrappers on asActivityObject when it’s got everything.

Parameters

  • string $element one of ‘actor’, ‘subject’, ‘object’, ‘target’

Returns

  • string

isGroup

function isGroup()

Returns true/false if this is a remote group

isPerson

public function isPerson()

Returns true/false if this is a person, as opposed to a group.

isPeopletag

function isPeopletag()

Returns true/false if this is a remote peopletag (list).

unsubscribe

public function unsubscribe()

Check if this remote profile has any active local subscriptions, and if not drop the WebSub subscription feed.

Returns

  • boolean true if subscription is removed, false if there are still subscribers to the feed

Error States

  • throws Exception of various kinds on failure.

garbageCollect

public function garbageCollect()

Check if this remote profile has any active local subscriptions, and if not drop the WebSub subscription feed.

Returns

  • boolean true if subscription is removed, false if there are still subscribers to the feed

Error States

  • throws Exception of various kinds on failure.

subscriberCount

public function subscriberCount()

Check if this remote profile has any active local subscriptions, so the WebSub subscription layer can decide if it can drop the feed.

This gets called via the FeedSubSubscriberCount event when running FeedSub::garbageCollect().

Returns

  • int

Error States

  • throws NoProfileException if there is no local profile for the object

notify

public function notify(Profile $actor,  
 $verb,  
 $object = null,
 $target = null)

Send an Activity Streams notification to the remote Salmon endpoint, if so configured.

Parameters

  • Profile $actor Actor who did the activity
  • string $verb Activity::SUBSCRIBE or Activity::JOIN
  • Object $object object of the action; must define asActivityNoun($tag)

notifyActivity

public function notifyActivity( $entry,
Profile $actor)

Send a Salmon notification ping immediately, and confirm that we got an acceptable response from the remote site.

Parameters

  • mixed $entry XML string, Notice, or Activity
  • Profile $actor

Returns

  • boolean success

notifyDeferred

public function notifyDeferred($entry,
$actor)

Queue a Salmon notification for later.  If queues are disabled we’ll send immediately but won’t get the return value.

Parameters

  • mixed $entry XML string, Notice, or Activity

Returns

  • boolean success

notifyPrepXML

Returns the preamble XML for a notify OStatus activity.

getBestName

function getBestName()

Returns the best name for a group, peopletag, or profile, as appropriate.

processFeed

public function processFeed(DOMDocument $doc,
 $source)

Read and post notices for updates from the feed.  Currently assumes that all items in the feed are new, coming from a WebSub hub.

Parameters

  • DOMDocument $doc
  • string $source identifier (“push”)

processAtomFeed

public function processAtomFeed(DOMElement $feed,
 $source)

Meta function that constructs an array of items for processEntries harvested from an ATOM feed.

processRssFeed

public function processRssFeed(DOMElement $rss,
 $source)

Meta function that constructs an array of items for processEntries harvested from an RSS feed.

processEntries

public function processEntries(DOMNodeList $entries,
DOMElement $feed,
 $source)

Meta function the parses an array of feed entries through processEntry iteratively.

processEntry

public function processEntry(DOMElement $entry,
DOMElement $feed,
 $source)

Process a posted entry from this feed source.

Oarameters

  • DOMElement $entry
  • DOMElement $feed for context
  • string $source identifier (“push” or “salmon”)

Returns

  • Notice - Notice representing the new (or existing) activity

processActivity

public function processActivity(Activity $activity,
 $source)

Given an Entry to process, create the appropriate ActivityObject for it.  Or, more specifically, trigger the events in postActiv that will process the activity.

TODO

  • Make this throw an exception

processPost

public function processPost($activity,
$method)

Process an incoming post activity from this remote feed.

Parameters

  • Activity $activity
  • string $method ‘push’ or ‘salmon’

Returns

  • mixed saved Notice or false

filterAttention

static public function filterAttention(Profile $sender,
array $attention)

Filters a list of recipient ID URIs to just those for local delivery.

Parameters

  • Profile local profile of sender
  • array in/out &$attention_uris set of URIs, will be pruned on output

Returns

  • array of group IDs

ensureProfileURL

public static function ensureProfileURL( $profile_url,  
array $hints = array())

Look up and if necessary create an Ostatus_profile for the remote entity with the given profile page URL.  This should never return null -- you will either get an object or an exception will be thrown.

Parameters

  • string $profile_url

Returns

  • Ostatus_profile

Error States

  • throws Exception on various error conditions
  • throws OStatusShadowException if this reference would obscure a local user/group

getFromProfileURL

static function getFromProfileURL($profile_url)

Look up the Ostatus_profile, if present, for a remote entity with the given profile page URL.  Will return null for both unknown and invalid remote profiles.

Returns

  • mixed Ostatus_profile or null

Error States

  • throws OStatusShadowException for local profiles

getFromProfile

static function getFromProfile(Profile $profile)

Returns the OStatus profile for a given local $profile

ensureFeedURL

public static function ensureFeedURL( $feed_url,  
array $hints = array())

Look up and if necessary create an Ostatus_profile for remote entity with the given update feed.  This should never return null -- you will either get an object or an exception will be thrown.

Returns

  • Ostatus_profile

Error States

  • throws Exception

ensureAtomFeed

public static function ensureAtomFeed(DOMElement $feedEl,
array $hints)

Look up and, if necessary, create an Ostatus_profile for the remote profile with the given Atom feed - actually loaded from the feed.  This should never return null -- you will either get an object or an exception will be thrown.

Parameters

  • DOMElement $feedEl root element of a loaded Atom feed
  • array $hints additional discovery information passed from higher levels

Returns

  • Ostatus_profile

Error States

  • throws Exception

FIXME

  • Should this be marked public?

ensureRssChannel

public static function ensureRssChannel(DOMElement $feedEl,
array $hints)

Look up and, if necessary, create an Ostatus_profile for the remote profile with the given RSS feed - actually loaded from the feed.  This should never return null -- you will either get an object or an exception will be thrown.

Parameters

  • DOMElement $feedEl root element of a loaded RSS feed
  • array $hints additional discovery information passed from higher levels

Returns

  • Ostatus_profile

Error States

  • throws Exception

FIXME

  • Should this be marked public?
  • Posterous code needs to be removed
  • We should check whether this feed has elements with different <author> or <dc:creator> elements, and...  I dunno.  Do something about that.

updateAvatar

public function updateAvatar($url,  
$force = false)

Download and update given avatar image

Parameters

  • string $url

Returns

  • Avatar The Avatar we have on disk.  (seldom used)

Error States

  • throws Exception in various failure cases

FIXME

  • Hardcoded chmod is lame, but seems to be necessary to keep from accidentally saving images from command-line (queues) that can’t be read from web server, which causes hard-to-notice problems later on: http://status.net/open-source/issues/2663

getActivityObjectAvatar

public static function getActivityObjectAvatar(ActivityObject $object,  
array $hints = array())

Pull avatar URL from ActivityObject or profile hints

Parameters

  • ActivityObject $object
  • array $hints

Returns

  • mixed URL string or false

getAvatar

protected static function getAvatar(ActivityObject $actor,
DOMElement $feed)

Get an appropriate avatar image source URL, if available.

Parameters

  • ActivityObject $actor
  • DOMElement $feed

Returns

  • string

ensureActorProfile

public static function ensureActorProfile(Activity $activity,  
array $hints = array())

Fetch, or build if necessary, an Ostatus_profile for the actor in a given Activity Streams activity.  This should never return null -- you will either get an object or an exception will be thrown.

Parameters

  • Activity $activity
  • string $feeduri if we already know the canonical feed URI!
  • string $salmonuri if we already know the salmon return channel URI

Returns

  • Ostatus_profile

ensureActivityObjectProfile

public static function ensureActivityObjectProfile(ActivityObject $object,  
array $hints = array())

Fetch, or build if necessary, an Ostatus_profile for the profile in a given Activity Streams object (can be subject, actor, or object).  This should never return null -- you will either get an object or an exception will be thrown.

Parameters

  • ActivityObject $object
  • array $hints additional discovery information passed from higher levels

Returns

  • Ostatus_profile

getActorProfile

public static function getActorProfile(Activity $activity)

Retrieves the profile for the actor in an ActivityObject.

Parameters

  • Activity $activity

Returns

  • mixed matching Ostatus_profile or false if none known

Error States

  • throws ServerException if feed info invalid

getActivityObjectProfile

protected static function getActivityObjectProfile(ActivityObject $object)

Retrieves the URI from an ActivityObject and uses it to map out the appropriate OStatus_profile for the object.

Parameters

  • ActivityObject $activity

Returns

  • mixed matching Ostatus_profile or false if none known

Error States

  • throws ServerException if feed info invalid

getActivityObjectProfileURI

protected static function getActivityObjectProfileURI(ActivityObject $object)

Get the identifier URI for the remote entity described by this ActivityObject.  This URI is not guaranteed to be a resolvable HTTP/HTTPS URL.

Parameters

  • ActivityObject $object

Returns

  • string

Error States

  • throws ServerException if feed info invalid

createActivityObjectProfile

protected static function createActivityObjectProfile(ActivityObject $object,  
array $hints = array())

Create local ostatus_profile and profile/user_group entries for the provided remote user or group.  This should never return null -- you will either get an object or an exception will be thrown.

Parameters

  • ActivityObject $object
  • array $hints

Returns

  • Ostatus_profile

updateFromActivityObject

public function updateFromActivityObject(ActivityObject $object,  
array $hints = array())

Save any updated profile information to our local copy.

Parameters

  • ActivityObject $object
  • array $hints

updateProfile

public static function updateProfile(Profile $profile,  
ActivityObject $object,  
array $hints = array())

Update a local OStatus_profile.

Parameters

  • profile $profile
  • ActivityObject $object
  • array $hints

updateGroup

protected static function updateGroup(User_group $group,  
ActivityObject $object,  
array $hints = array())

Update a local OStatus_profile for a group.

Parameters

  • profile $profile
  • ActivityObject $object
  • array $hints

updatePeopletag

protected static function updatePeopletag( $tag,  
ActivityObject $object,  
array $hints = array())

Update a local OStatus_profile for a peopletag.

Parameters

  • profile $profile
  • ActivityObject $object
  • array $hints

getActivityObjectHomepage

protected static function getActivityObjectHomepage(ActivityObject $object,  
array $hints = array())
Pretty much what it says on the tinretrieves the stated homepage for an ActivityObject.

Parameters

  • ActivityObject $object
  • array $hints

getActivityObjectLocation

protected static function getActivityObjectLocation(ActivityObject $object,  
array $hints = array())

If the ActivityObject specifies a geolocation, then return it.  Will return null otherwise.

Parameters

  • ActivityObject $object
  • array $hints

getActivityObjectBio

protected static function getActivityObjectBio(ActivityObject $object,  
array $hints = array())

Returns the bio for the poster of an ActivityObject if one is specified, or null otherwise.

Parameters

  • ActivityObject $object
  • array $hints

getActivityObjectNickname

public static function getActivityObjectNickname(ActivityObject $object,  
array $hints = array())

Returns the nickname for the poster of an ActivityObject if one is specified, or null otherwise.

Parameters

  • ActivityObject $object
  • array $hints

nicknameFromURI

protected static function nicknameFromURI($uri)

Retrieves the nickname for a profile given a URI

ensureWebFinger

Look up, and if necessary create, an Ostatus_profile for the remote entity with the given webfinger address.  This should never return null -- you will either get an object or an exception will be thrown.

Returns

  • string $addr webfinger address

Returns

  • Ostatus_profile

Error States

  • throws Exception on error conditions
  • throws OStatusShadowException if this reference would obscure a local user/group

saveHTMLFile

function saveHTMLFile($title,
$rendered)

Store the full-length scrubbed HTML of a remote notice to an attachment file on our server.  We’ll link to this at the end of the cropped version.

Parameters

  • string $title plaintext for HTML page’s title
  • string $rendered HTML fragment for HTML page’s body

Returns

  • File

ensureProfileURI

static function ensureProfileURI($uri)

Make sure we get a profile for a given URI.

checkAuthorship

public function checkAuthorship(Activity $activity)

Figure out who authored an ActivityObject $activity and return their Profile.

updateUriKeys

public function updateUriKeys( $profile_uri,  
array $hints = array())

A fix for older StatusNet sites upgrading to postActiv to update the keys in the database for given profile_uri and dedupe.

static function schemaDef()
Return table definition for Schema setup and DB_DataObject usage.
public function getUri()
Returns the URI of this profile.
public function getFeedSub()
Returns the feedsubs that follow the feed URI of this profile.
static function fromProfile(Profile $profile)
Returns the OStatus_profile associated with profile $profile.
public function localProfile()
Fetch the locally stored profile for this feed.
public function localGroup()
Fetch the postActiv-side profile for this feed.
public function localPeopletag()
Fetch the postActiv-side peopletag for this feed
function asActivityObject()
Returns an ActivityObject describing this remote user or group profile.
function asActivityNoun($element)
Returns an XML string fragment with profile information as an Activity Streams noun object with the given element type.
function isGroup()
Returns true/false if this is a remote group
public function isPerson()
Returns true/false if this is a person, as opposed to a group.
function isPeopletag()
Returns true/false if this is a remote peopletag (list).
public function unsubscribe()
Check if this remote profile has any active local subscriptions, and if not drop the WebSub subscription feed.
public function garbageCollect()
Check if this remote profile has any active local subscriptions, and if not drop the WebSub subscription feed.
public function subscriberCount()
Check if this remote profile has any active local subscriptions, so the WebSub subscription layer can decide if it can drop the feed.
public function notify(Profile $actor,  
 $verb,  
 $object = null,
 $target = null)
Send an Activity Streams notification to the remote Salmon endpoint, if so configured.
public function notifyActivity( $entry,
Profile $actor)
Send a Salmon notification ping immediately, and confirm that we got an acceptable response from the remote site.
public function notifyDeferred($entry,
$actor)
Queue a Salmon notification for later.
function getBestName()
Returns the best name for a group, peopletag, or profile, as appropriate.
public function processFeed(DOMDocument $doc,
 $source)
Read and post notices for updates from the feed.
public function processAtomFeed(DOMElement $feed,
 $source)
Meta function that constructs an array of items for processEntries harvested from an ATOM feed.
public function processRssFeed(DOMElement $rss,
 $source)
Meta function that constructs an array of items for processEntries harvested from an RSS feed.
public function processEntries(DOMNodeList $entries,
DOMElement $feed,
 $source)
Meta function the parses an array of feed entries through processEntry iteratively.
public function processEntry(DOMElement $entry,
DOMElement $feed,
 $source)
Process a posted entry from this feed source.
public function processActivity(Activity $activity,
 $source)
Given an Entry to process, create the appropriate ActivityObject for it.
public function processPost($activity,
$method)
Process an incoming post activity from this remote feed.
static public function filterAttention(Profile $sender,
array $attention)
Filters a list of recipient ID URIs to just those for local delivery.
public static function ensureProfileURL( $profile_url,  
array $hints = array())
Look up and if necessary create an Ostatus_profile for the remote entity with the given profile page URL.
static function getFromProfileURL($profile_url)
Look up the Ostatus_profile, if present, for a remote entity with the given profile page URL.
static function getFromProfile(Profile $profile)
Returns the OStatus profile for a given local $profile
public static function ensureFeedURL( $feed_url,  
array $hints = array())
Look up and if necessary create an Ostatus_profile for remote entity with the given update feed.
public static function ensureAtomFeed(DOMElement $feedEl,
array $hints)
Look up and, if necessary, create an Ostatus_profile for the remote profile with the given Atom feed - actually loaded from the feed.
public static function ensureRssChannel(DOMElement $feedEl,
array $hints)
Look up and, if necessary, create an Ostatus_profile for the remote profile with the given RSS feed - actually loaded from the feed.
public function updateAvatar($url,  
$force = false)
Download and update given avatar image
public static function getActivityObjectAvatar(ActivityObject $object,  
array $hints = array())
Pull avatar URL from ActivityObject or profile hints
protected static function getAvatar(ActivityObject $actor,
DOMElement $feed)
Get an appropriate avatar image source URL, if available.
public static function ensureActorProfile(Activity $activity,  
array $hints = array())
Fetch, or build if necessary, an Ostatus_profile for the actor in a given Activity Streams activity.
public static function ensureActivityObjectProfile(ActivityObject $object,  
array $hints = array())
Fetch, or build if necessary, an Ostatus_profile for the profile in a given Activity Streams object (can be subject, actor, or object).
public static function getActorProfile(Activity $activity)
Retrieves the profile for the actor in an ActivityObject.
protected static function getActivityObjectProfile(ActivityObject $object)
Retrieves the URI from an ActivityObject and uses it to map out the appropriate OStatus_profile for the object.
protected static function getActivityObjectProfileURI(ActivityObject $object)
Get the identifier URI for the remote entity described by this ActivityObject.
protected static function createActivityObjectProfile(ActivityObject $object,  
array $hints = array())
Create local ostatus_profile and profile/user_group entries for the provided remote user or group.
public function updateFromActivityObject(ActivityObject $object,  
array $hints = array())
Save any updated profile information to our local copy.
public static function updateProfile(Profile $profile,  
ActivityObject $object,  
array $hints = array())
Update a local OStatus_profile.
protected static function updateGroup(User_group $group,  
ActivityObject $object,  
array $hints = array())
Update a local OStatus_profile for a group.
protected static function updatePeopletag( $tag,  
ActivityObject $object,  
array $hints = array())
Update a local OStatus_profile for a peopletag.
protected static function getActivityObjectHomepage(ActivityObject $object,  
array $hints = array())
protected static function getActivityObjectLocation(ActivityObject $object,  
array $hints = array())
If the ActivityObject specifies a geolocation, then return it.
protected static function getActivityObjectBio(ActivityObject $object,  
array $hints = array())
Returns the bio for the poster of an ActivityObject if one is specified, or null otherwise.
public static function getActivityObjectNickname(ActivityObject $object,  
array $hints = array())
Returns the nickname for the poster of an ActivityObject if one is specified, or null otherwise.
protected static function nicknameFromURI($uri)
Retrieves the nickname for a profile given a URI
function saveHTMLFile($title,
$rendered)
Store the full-length scrubbed HTML of a remote notice to an attachment file on our server.
static function ensureProfileURI($uri)
Make sure we get a profile for a given URI.
public function checkAuthorship(Activity $activity)
Figure out who authored an ActivityObject $activity and return their Profile.
public function updateUriKeys( $profile_uri,  
array $hints = array())
A fix for older StatusNet sites upgrading to postActiv to update the keys in the database for given profile_uri and dedupe.