X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FOStatus%2Fclasses%2FOstatus_profile.php;h=c4d857f22cdb57a4baac1825519d7b48ac246fd9;hb=dc424ab63a91bf4c29198452d54543b8737b65ac;hp=898c63e83e438fe08970a1bf8e8dc6e14fb9bbef;hpb=e365e709c5bab7d593ee1cde26c8bcfdddcc6780;p=quix0rs-gnu-social.git
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index 898c63e83e..c4d857f22c 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -17,11 +17,14 @@
* along with this program. If not, see .
*/
+if (!defined('STATUSNET')) {
+ exit(1);
+}
+
/**
* @package OStatusPlugin
* @maintainer Brion Vibber
*/
-
class Ostatus_profile extends Memcached_DataObject
{
public $__table = 'ostatus_profile';
@@ -51,7 +54,6 @@ class Ostatus_profile extends Memcached_DataObject
*
* @return array array of column definitions
*/
-
function table()
{
return array('uri' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL,
@@ -92,7 +94,6 @@ class Ostatus_profile extends Memcached_DataObject
*
* @return array key definitions
*/
-
function keys()
{
return array_keys($this->keyTypes());
@@ -106,7 +107,6 @@ class Ostatus_profile extends Memcached_DataObject
*
* @return array key definitions
*/
-
function keyTypes()
{
return array('uri' => 'K', 'profile_id' => 'U', 'group_id' => 'U', 'feeduri' => 'U');
@@ -188,9 +188,11 @@ class Ostatus_profile extends Memcached_DataObject
} else if ($this->group_id && !$this->profile_id) {
return true;
} else if ($this->group_id && $this->profile_id) {
- throw new ServerException("Invalid ostatus_profile state: both group and profile IDs set for $this->uri");
+ // TRANS: Server exception. %s is a URI.
+ throw new ServerException(sprintf(_m('Invalid ostatus_profile state: both group and profile IDs set for %s.'),$this->uri));
} else {
- throw new ServerException("Invalid ostatus_profile state: both group and profile IDs empty for $this->uri");
+ // TRANS: Server exception. %s is a URI.
+ throw new ServerException(sprintf(_m('Invalid ostatus_profile state: both group and profile IDs empty for %s.'),$this->uri));
}
}
@@ -278,7 +280,9 @@ class Ostatus_profile extends Memcached_DataObject
if ($type == 'object') {
$type = get_class($actor);
}
- throw new ServerException("Invalid actor passed to " . __METHOD__ . ": " . $type);
+ // TRANS: Server exception.
+ // TRANS: %1$s is the method name the exception occured in, %2$s is the actor type.
+ throw new ServerException(sprintf(_m('Invalid actor passed to %1$s: %2$s.'),__METHOD__,$type));
}
if ($object == null) {
$object = $this;
@@ -327,6 +331,7 @@ class Ostatus_profile extends Memcached_DataObject
* an acceptable response from the remote site.
*
* @param mixed $entry XML string, Notice, or Activity
+ * @param Profile $actor
* @return boolean success
*/
public function notifyActivity($entry, $actor)
@@ -370,7 +375,8 @@ class Ostatus_profile extends Memcached_DataObject
} else if ($entry instanceof Notice) {
return $preamble . $entry->asAtomEntry(true, true);
} else {
- throw new ServerException("Invalid type passed to Ostatus_profile::notify; must be XML string or Activity entry");
+ // TRANS: Server exception.
+ throw new ServerException(_m('Invalid type passed to Ostatus_profile::notify. It must be XML string or Activity entry.'));
}
}
@@ -400,7 +406,8 @@ class Ostatus_profile extends Memcached_DataObject
} else if ($feed->localName == 'rss') { // @fixme check namespace
$this->processRssFeed($feed, $source);
} else {
- throw new Exception("Unknown feed format.");
+ // TRANS: Exception.
+ throw new Exception(_m('Unknown feed format.'));
}
}
@@ -423,7 +430,8 @@ class Ostatus_profile extends Memcached_DataObject
$channels = $rss->getElementsByTagName('channel');
if ($channels->length == 0) {
- throw new Exception("RSS feed without a channel.");
+ // TRANS: Exception.
+ throw new Exception(_m('RSS feed without a channel.'));
} else if ($channels->length > 1) {
common_log(LOG_WARNING, __METHOD__ . ": more than one channel in an RSS feed");
}
@@ -450,7 +458,8 @@ class Ostatus_profile extends Memcached_DataObject
{
$activity = new Activity($entry, $feed);
- if (Event::handle('StartHandleFeedEntry', array($activity))) {
+ if (Event::handle('StartHandleFeedEntryWithProfile', array($activity, $this)) &&
+ Event::handle('StartHandleFeedEntry', array($activity))) {
// @todo process all activity objects
switch ($activity->objects[0]->type) {
@@ -467,10 +476,12 @@ class Ostatus_profile extends Memcached_DataObject
}
break;
default:
- throw new ClientException("Can't handle that kind of post.");
+ // TRANS: Client exception.
+ throw new ClientException(_m('Can\'t handle that kind of post.'));
}
Event::handle('EndHandleFeedEntry', array($activity));
+ Event::handle('EndHandleFeedEntryWithProfile', array($activity, $this));
}
}
@@ -483,36 +494,10 @@ class Ostatus_profile extends Memcached_DataObject
*/
public function processPost($activity, $method)
{
- if ($this->isGroup()) {
- // A group feed will contain posts from multiple authors.
- // @fixme validate these profiles in some way!
- $oprofile = self::ensureActorProfile($activity);
- if ($oprofile->isGroup()) {
- // Groups can't post notices in StatusNet.
- common_log(LOG_WARNING, "OStatus: skipping post with group listed as author: $oprofile->uri in feed from $this->uri");
- return false;
- }
- } else {
- $actor = $activity->actor;
-
- if (empty($actor)) {
- // OK here! assume the default
- } else if ($actor->id == $this->uri || $actor->link == $this->uri) {
- $this->updateFromActivityObject($actor);
- } else if ($actor->id) {
- // We have an ActivityStreams actor with an explicit ID that doesn't match the feed owner.
- // This isn't what we expect from mainline OStatus person feeds!
- // Group feeds go down another path, with different validation...
- // Most likely this is a plain ol' blog feed of some kind which
- // doesn't match our expectations. We'll take the entry, but ignore
- // the info.
- common_log(LOG_WARNING, "Got an actor '{$actor->title}' ({$actor->id}) on single-user feed for {$this->uri}");
- } else {
- // Plain without ActivityStreams actor info.
- // We'll just ignore this info for now and save the update under the feed's identity.
- }
+ $oprofile = $this->checkAuthorship($activity);
- $oprofile = $this;
+ if (empty($oprofile)) {
+ return false;
}
// It's not always an ActivityObject::NOTE, but... let's just say it is.
@@ -549,13 +534,14 @@ class Ostatus_profile extends Memcached_DataObject
$sourceContent = $note->title;
} else {
// @fixme fetch from $sourceUrl?
- throw new ClientException("No content for notice {$sourceUri}");
+ // TRANS: Client exception. %s is a source URI.
+ throw new ClientException(sprintf(_m('No content for notice %s.'),$sourceUri));
}
// Get (safe!) HTML and text versions of the content
$rendered = $this->purify($sourceContent);
- $content = html_entity_decode(strip_tags($rendered));
+ $content = html_entity_decode(strip_tags($rendered), ENT_QUOTES, 'UTF-8');
$shortened = common_shorten_links($content);
@@ -566,7 +552,7 @@ class Ostatus_profile extends Memcached_DataObject
if (Notice::contentTooLong($shortened)) {
$attachment = $this->saveHTMLFile($note->title, $rendered);
- $summary = html_entity_decode(strip_tags($note->summary));
+ $summary = html_entity_decode(strip_tags($note->summary), ENT_QUOTES, 'UTF-8');
if (empty($summary)) {
$summary = $content;
}
@@ -580,12 +566,17 @@ class Ostatus_profile extends Memcached_DataObject
// We mark up the attachment link specially for the HTML output
// so we can fold-out the full version inline.
+
+ // @fixme I18N this tooltip will be saved with the site's default language
+ // TRANS: Shown when a notice is longer than supported and/or when attachments are present. At runtime
+ // TRANS: this will usually be replaced with localised text from StatusNet core messages.
+ $showMoreText = _m('Show more');
$attachUrl = common_local_url('attachment',
array('attachment' => $attachment->id));
$rendered = common_render_text($shortSummary) .
'' .
+ ' title="'. htmlspecialchars($showMoreText) . '">' .
'…' .
'';
}
@@ -699,23 +690,7 @@ class Ostatus_profile extends Memcached_DataObject
continue;
}
- // Is the recipient a remote group?
- $oprofile = Ostatus_profile::ensureProfileURI($recipient);
-
- if ($oprofile) {
- if ($oprofile->isGroup()) {
- // Deliver to local members of this remote group.
- // @fixme sender verification?
- $groups[] = $oprofile->group_id;
- } else {
- // may be canonicalized or something
- $replies[] = $oprofile->uri;
- }
- continue;
- }
-
// Is the recipient a local group?
- // @fixme uri on user_group isn't reliable yet
// $group = User_group::staticGet('uri', $recipient);
$id = OStatusPlugin::localGroupFromUrl($recipient);
if ($id) {
@@ -734,7 +709,22 @@ class Ostatus_profile extends Memcached_DataObject
}
}
- common_log(LOG_DEBUG, "Skipping reply to unrecognized profile $recipient");
+ // Is the recipient a remote user or group?
+ try {
+ $oprofile = Ostatus_profile::ensureProfileURI($recipient);
+ if ($oprofile->isGroup()) {
+ // Deliver to local members of this remote group.
+ // @fixme sender verification?
+ $groups[] = $oprofile->group_id;
+ } else {
+ // may be canonicalized or something
+ $replies[] = $oprofile->uri;
+ }
+ continue;
+ } catch (Exception $e) {
+ // Neither a recognizable local nor remote user!
+ common_log(LOG_DEBUG, "Skipping reply to unrecognized profile $recipient: " . $e->getMessage());
+ }
}
$attention_uris = $replies;
@@ -772,7 +762,8 @@ class Ostatus_profile extends Memcached_DataObject
$response = $client->get($profile_url);
if (!$response->isOk()) {
- throw new Exception("Could not reach profile page: " . $profile_url);
+ // TRANS: Exception. %s is a profile URL.
+ throw new Exception(sprintf(_m('Could not reach profile page %s.'),$profile_url));
}
// Check if we have a non-canonical URL
@@ -829,7 +820,8 @@ class Ostatus_profile extends Memcached_DataObject
return self::ensureFeedURL($feedurl, $hints);
}
- throw new Exception("Could not find a feed URL for profile page " . $finalUrl);
+ // TRANS: Exception. %s is a URL.
+ throw new Exception(sprintf(_m('Could not find a feed URL for profile page %s.'),$finalUrl));
}
/**
@@ -861,6 +853,7 @@ class Ostatus_profile extends Memcached_DataObject
$user = User::staticGet('id', $profile->id);
if (!empty($user)) {
+ // @todo i18n FIXME: use sprintf and add i18n (?)
throw new OStatusShadowException($profile, "'$profile_url' is the profile for local user '{$user->nickname}'.");
}
@@ -919,54 +912,19 @@ class Ostatus_profile extends Memcached_DataObject
* @return Ostatus_profile
* @throws Exception
*/
+
public static function ensureAtomFeed($feedEl, $hints)
{
- // Try to get a profile from the feed activity:subject
-
- $subject = ActivityUtils::child($feedEl, Activity::SUBJECT, Activity::SPEC);
-
- if (!empty($subject)) {
- $subjObject = new ActivityObject($subject);
- return self::ensureActivityObjectProfile($subjObject, $hints);
- }
-
- // Otherwise, try the feed author
-
- $author = ActivityUtils::child($feedEl, Activity::AUTHOR, Activity::ATOM);
-
- if (!empty($author)) {
- $authorObject = new ActivityObject($author);
- return self::ensureActivityObjectProfile($authorObject, $hints);
- }
-
- // Sheesh. Not a very nice feed! Let's try fingerpoken in the
- // entries.
-
- $entries = $feedEl->getElementsByTagNameNS(Activity::ATOM, 'entry');
-
- if (!empty($entries) && $entries->length > 0) {
-
- $entry = $entries->item(0);
-
- $actor = ActivityUtils::child($entry, Activity::ACTOR, Activity::SPEC);
-
- if (!empty($actor)) {
- $actorObject = new ActivityObject($actor);
- return self::ensureActivityObjectProfile($actorObject, $hints);
+ $author = ActivityUtils::getFeedAuthor($feedEl);
- }
-
- $author = ActivityUtils::child($entry, Activity::AUTHOR, Activity::ATOM);
-
- if (!empty($author)) {
- $authorObject = new ActivityObject($author);
- return self::ensureActivityObjectProfile($authorObject, $hints);
- }
+ if (empty($author)) {
+ // XXX: make some educated guesses here
+ // TRANS: Feed sub exception.
+ throw new FeedSubException(_m('Can\'t find enough profile '.
+ 'information to make a feed.'));
}
- // XXX: make some educated guesses here
-
- throw new FeedSubException("Can't find enough profile information to make a feed.");
+ return self::ensureActivityObjectProfile($author, $hints);
}
/**
@@ -1025,7 +983,8 @@ class Ostatus_profile extends Memcached_DataObject
return;
}
if (!common_valid_http_url($url)) {
- throw new ServerException(sprintf(_m("Invalid avatar URL %s"), $url));
+ // TRANS: Server exception. %s is a URL.
+ throw new ServerException(sprintf(_m("Invalid avatar URL %s."), $url));
}
if ($this->isGroup()) {
@@ -1035,29 +994,44 @@ class Ostatus_profile extends Memcached_DataObject
}
if (!$self) {
throw new ServerException(sprintf(
- _m("Tried to update avatar for unsaved remote profile %s"),
+ // TRANS: Server exception. %s is a URI.
+ _m("Tried to update avatar for unsaved remote profile %s."),
$this->uri));
}
// @fixme this should be better encapsulated
// ripped from oauthstore.php (for old OMB client)
$temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar');
- if (!copy($url, $temp_filename)) {
- throw new ServerException(sprintf(_m("Unable to fetch avatar from %s"), $url));
+ try {
+ if (!copy($url, $temp_filename)) {
+ // TRANS: Server exception. %s is a URL.
+ throw new ServerException(sprintf(_m("Unable to fetch avatar from %s."), $url));
+ }
+
+ if ($this->isGroup()) {
+ $id = $this->group_id;
+ } else {
+ $id = $this->profile_id;
+ }
+ // @fixme should we be using different ids?
+ $imagefile = new ImageFile($id, $temp_filename);
+ $filename = Avatar::filename($id,
+ image_type_to_extension($imagefile->type),
+ null,
+ common_timestamp());
+ rename($temp_filename, Avatar::path($filename));
+ } catch (Exception $e) {
+ unlink($temp_filename);
+ throw $e;
}
+ // @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
+ chmod(Avatar::path($filename), 0644);
- if ($this->isGroup()) {
- $id = $this->group_id;
- } else {
- $id = $this->profile_id;
- }
- // @fixme should we be using different ids?
- $imagefile = new ImageFile($id, $temp_filename);
- $filename = Avatar::filename($id,
- image_type_to_extension($imagefile->type),
- null,
- common_timestamp());
- rename($temp_filename, Avatar::path($filename));
$self->setOriginal($filename);
$orig = clone($this);
@@ -1073,7 +1047,7 @@ class Ostatus_profile extends Memcached_DataObject
* @return mixed URL string or false
*/
- protected static function getActivityObjectAvatar($object, $hints=array())
+ public static function getActivityObjectAvatar($object, $hints=array())
{
if ($object->avatarLinks) {
$best = false;
@@ -1138,7 +1112,8 @@ class Ostatus_profile extends Memcached_DataObject
return $url;
}
}
- return common_path('plugins/OStatus/images/96px-Feed-icon.svg.png');
+
+ return Plugin::staticPath('OStatus', 'images/96px-Feed-icon.svg.png');
}
/**
@@ -1226,7 +1201,7 @@ class Ostatus_profile extends Memcached_DataObject
if ($object->link && common_valid_http_url($object->link)) {
return $object->link;
}
- throw new ServerException("No author ID URI found");
+ throw new ServerException("No author ID URI found.");
}
/**
@@ -1256,11 +1231,13 @@ class Ostatus_profile extends Memcached_DataObject
$user = User::staticGet('uri', $homeuri);
if ($user) {
- throw new Exception("Local user can't be referenced as remote.");
+ // TRANS: Exception.
+ throw new Exception(_m('Local user can\'t be referenced as remote.'));
}
if (OStatusPlugin::localGroupFromUrl($homeuri)) {
- throw new Exception("Local group can't be referenced as remote.");
+ // TRANS: Exception.
+ throw new Exception(_m('Local group can\'t be referenced as remote.'));
}
if (array_key_exists('feedurl', $hints)) {
@@ -1311,7 +1288,8 @@ class Ostatus_profile extends Memcached_DataObject
$oprofile->profile_id = $profile->insert();
if (!$oprofile->profile_id) {
- throw new ServerException("Can't save local profile");
+ // TRANS: Server exception.
+ throw new ServerException(_m('Can\'t save local profile.'));
}
} else {
$group = new User_group();
@@ -1321,14 +1299,16 @@ class Ostatus_profile extends Memcached_DataObject
$oprofile->group_id = $group->insert();
if (!$oprofile->group_id) {
- throw new ServerException("Can't save local profile");
+ // TRANS: Server exception.
+ throw new ServerException(_m('Can\'t save local profile.'));
}
}
$ok = $oprofile->insert();
if (!$ok) {
- throw new ServerException("Can't save OStatus profile");
+ // TRANS: Server exception.
+ throw new ServerException(_m('Can\'t save OStatus profile.'));
}
$avatar = self::getActivityObjectAvatar($object, $hints);
@@ -1370,11 +1350,21 @@ class Ostatus_profile extends Memcached_DataObject
}
}
- protected static function updateProfile($profile, $object, $hints=array())
+ public static function updateProfile($profile, $object, $hints=array())
{
$orig = clone($profile);
- $profile->nickname = self::getActivityObjectNickname($object, $hints);
+ // Existing nickname is better than nothing.
+
+ if (!array_key_exists('nickname', $hints)) {
+ $hints['nickname'] = $profile->nickname;
+ }
+
+ $nickname = self::getActivityObjectNickname($object, $hints);
+
+ if (!empty($nickname)) {
+ $profile->nickname = $nickname;
+ }
if (!empty($object->title)) {
$profile->fullname = $object->title;
@@ -1390,9 +1380,23 @@ class Ostatus_profile extends Memcached_DataObject
$profile->profileurl = $object->id;
}
- $profile->bio = self::getActivityObjectBio($object, $hints);
- $profile->location = self::getActivityObjectLocation($object, $hints);
- $profile->homepage = self::getActivityObjectHomepage($object, $hints);
+ $bio = self::getActivityObjectBio($object, $hints);
+
+ if (!empty($bio)) {
+ $profile->bio = $bio;
+ }
+
+ $location = self::getActivityObjectLocation($object, $hints);
+
+ if (!empty($location)) {
+ $profile->location = $location;
+ }
+
+ $homepage = self::getActivityObjectHomepage($object, $hints);
+
+ if (!empty($homepage)) {
+ $profile->homepage = $homepage;
+ }
if (!empty($object->geopoint)) {
$location = ActivityContext::locationFromPoint($object->geopoint);
@@ -1498,7 +1502,7 @@ class Ostatus_profile extends Memcached_DataObject
return $bio;
}
- protected static function getActivityObjectNickname($object, $hints=array())
+ public static function getActivityObjectNickname($object, $hints=array())
{
if ($object->poco) {
if (!empty($object->poco->preferredUsername)) {
@@ -1515,8 +1519,11 @@ class Ostatus_profile extends Memcached_DataObject
}
// Try the profile url (like foo.example.com or example.com/user/foo)
-
- $profileUrl = ($object->link) ? $object->link : $hints['profileurl'];
+ if (!empty($object->link)) {
+ $profileUrl = $object->link;
+ } else if (!empty($hints['profileurl'])) {
+ $profileUrl = $hints['profileurl'];
+ }
if (!empty($profileUrl)) {
$nickname = self::nicknameFromURI($profileUrl);
@@ -1547,9 +1554,11 @@ class Ostatus_profile extends Memcached_DataObject
protected static function nicknameFromURI($uri)
{
- preg_match('/(\w+):/', $uri, $matches);
-
- $protocol = $matches[1];
+ if (preg_match('/(\w+):/', $uri, $matches)) {
+ $protocol = $matches[1];
+ } else {
+ return null;
+ }
switch ($protocol) {
case 'acct':
@@ -1586,7 +1595,8 @@ class Ostatus_profile extends Memcached_DataObject
if ($uri !== false) {
if (is_null($uri)) {
// Negative cache entry
- throw new Exception('Not a valid webfinger address.');
+ // TRANS: Exception.
+ throw new Exception(_m('Not a valid webfinger address.'));
}
$oprofile = Ostatus_profile::staticGet('uri', $uri);
if (!empty($oprofile)) {
@@ -1613,7 +1623,8 @@ class Ostatus_profile extends Memcached_DataObject
// Save negative cache entry so we don't waste time looking it up again.
// @fixme distinguish temporary failures?
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), null);
- throw new Exception('Not a valid webfinger address.');
+ // TRANS: Exception.
+ throw new Exception(_m('Not a valid webfinger address.'));
}
$hints = array('webfinger' => $addr);
@@ -1694,7 +1705,8 @@ class Ostatus_profile extends Memcached_DataObject
if (!$profile_id) {
common_log_db_error($profile, 'INSERT', __FILE__);
- throw new Exception("Couldn't save profile for '$addr'");
+ // TRANS: Exception. %s is a webfinger address.
+ throw new Exception(sprintf(_m('Couldn\'t save profile for "%s".'),$addr));
}
$oprofile = new Ostatus_profile();
@@ -1712,14 +1724,16 @@ class Ostatus_profile extends Memcached_DataObject
if (!$result) {
common_log_db_error($oprofile, 'INSERT', __FILE__);
- throw new Exception("Couldn't save ostatus_profile for '$addr'");
+ // TRANS: Exception. %s is a webfinger address.
+ throw new Exception(sprintf(_m('Couldn\'t save ostatus_profile for "%s".'),$addr));
}
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), $oprofile->uri);
return $oprofile;
}
- throw new Exception("Couldn't find a valid profile for '$addr'");
+ // TRANS: Exception. %s is a webfinger address.
+ throw new Exception(sprintf(_m('Couldn\'t find a valid profile for "%s".'),$addr));
}
/**
@@ -1761,7 +1775,8 @@ class Ostatus_profile extends Memcached_DataObject
if ($file_id === false) {
common_log_db_error($file, "INSERT", __FILE__);
- throw new ServerException(_('Could not store HTML content of long post as file.'));
+ // TRANS: Server exception.
+ throw new ServerException(_m('Could not store HTML content of long post as file.'));
}
return $file;
@@ -1789,12 +1804,55 @@ class Ostatus_profile extends Memcached_DataObject
case 'mailto':
$rest = $match[2];
$oprofile = Ostatus_profile::ensureWebfinger($rest);
+ break;
default:
- common_log("Unrecognized URI protocol for profile: $protocol ($uri)");
+ throw new ServerException("Unrecognized URI protocol for profile: $protocol ($uri)");
break;
}
+ } else {
+ throw new ServerException("No URI protocol for profile: ($uri)");
}
}
+
+ return $oprofile;
+ }
+
+ function checkAuthorship($activity)
+ {
+ if ($this->isGroup()) {
+ // A group feed will contain posts from multiple authors.
+ // @fixme validate these profiles in some way!
+ $oprofile = self::ensureActorProfile($activity);
+ if ($oprofile->isGroup()) {
+ // Groups can't post notices in StatusNet.
+ common_log(LOG_WARNING,
+ "OStatus: skipping post with group listed as author: ".
+ "$oprofile->uri in feed from $this->uri");
+ return false;
+ }
+ } else {
+ $actor = $activity->actor;
+
+ if (empty($actor)) {
+ // OK here! assume the default
+ } else if ($actor->id == $this->uri || $actor->link == $this->uri) {
+ $this->updateFromActivityObject($actor);
+ } else if ($actor->id) {
+ // We have an ActivityStreams actor with an explicit ID that doesn't match the feed owner.
+ // This isn't what we expect from mainline OStatus person feeds!
+ // Group feeds go down another path, with different validation...
+ // Most likely this is a plain ol' blog feed of some kind which
+ // doesn't match our expectations. We'll take the entry, but ignore
+ // the info.
+ common_log(LOG_WARNING, "Got an actor '{$actor->title}' ({$actor->id}) on single-user feed for {$this->uri}");
+ } else {
+ // Plain without ActivityStreams actor info.
+ // We'll just ignore this info for now and save the update under the feed's identity.
+ }
+
+ $oprofile = $this;
+ }
+
return $oprofile;
}
}
@@ -1818,4 +1876,3 @@ class OStatusShadowException extends Exception
parent::__construct($message);
}
}
-