X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=plugins%2FOStatus%2Fclasses%2FOstatus_profile.php;fp=plugins%2FOStatus%2Fclasses%2FOstatus_profile.php;h=07432d78fa1c4d65a3134973bcc948ec7a84e38c;hb=3326b7b850f538f0e3c2c7969c5e566e2a374ffb;hp=a8269bdf0728594687656769ec2ef4e12e719446;hpb=ef005987a1ed1ed0774ae7ae88772e3ca4654cbd;p=quix0rs-gnu-social.git diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index a8269bdf07..07432d78fa 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -371,9 +371,10 @@ class Ostatus_profile extends Managed_DataObject * send immediately but won't get the return value. * * @param mixed $entry XML string, Notice, or Activity + * @param Profile $actor Acting profile * @return boolean success */ - public function notifyDeferred($entry, $actor) + public function notifyDeferred($entry, Profile $actor) { if ($this->salmonuri) { try { @@ -526,7 +527,7 @@ class Ostatus_profile extends Managed_DataObject * @param string $method 'push' or 'salmon' * @return mixed saved Notice or false */ - public function processPost($activity, $method) + public function processPost(Activity $activity, $method) { $actor = ActivityUtils::checkAuthorship($activity, $this->localProfile()); @@ -550,7 +551,7 @@ class Ostatus_profile extends Managed_DataObject */ static public function filterAttention(Profile $sender, array $attention) { - common_log(LOG_DEBUG, "Original reply recipients: " . implode(', ', array_keys($attention))); + common_debug("Original reply recipients: " . implode(', ', array_keys($attention))); $groups = array(); $replies = array(); foreach ($attention as $recipient=>$type) { @@ -572,11 +573,11 @@ class Ostatus_profile extends Managed_DataObject if ($sender->isMember($group)) { $groups[] = $group->id; } else { - common_log(LOG_DEBUG, sprintf('Skipping reply to local group %s as sender %d is not a member', $group->getNickname(), $sender->id)); + common_debug(sprintf('Skipping reply to local group %s as sender %d is not a member', $group->getNickname(), $sender->id)); } continue; } else { - common_log(LOG_DEBUG, "Skipping reply to bogus group $recipient"); + common_debug("Skipping reply to bogus group $recipient"); } } @@ -594,12 +595,12 @@ class Ostatus_profile extends Managed_DataObject continue; } catch (Exception $e) { // Neither a recognizable local nor remote user! - common_log(LOG_DEBUG, "Skipping reply to unrecognized profile $recipient: " . $e->getMessage()); + common_debug("Skipping reply to unrecognized profile $recipient: " . $e->getMessage()); } } - common_log(LOG_DEBUG, "Local reply recipients: " . implode(', ', $replies)); - common_log(LOG_DEBUG, "Local group recipients: " . implode(', ', $groups)); + common_debug("Local reply recipients: " . implode(', ', $replies)); + common_debug("Local group recipients: " . implode(', ', $groups)); return array($groups, $replies); } @@ -890,7 +891,7 @@ class Ostatus_profile extends Managed_DataObject // @todo FIXME: This should be better encapsulated // ripped from oauthstore.php (for old OMB client) - $temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar'); + $temp_filename = tempnam(common_get_temp_dir(), 'listener_avatar'); try { $imgData = HTTPClient::quickGet($url); // Make sure it's at least an image file. ImageFile can do the rest. @@ -1115,7 +1116,7 @@ class Ostatus_profile extends Managed_DataObject $discover = false; if (!$homeuri) { - common_log(LOG_DEBUG, __METHOD__ . " empty actor profile URI: " . var_export($activity, true)); + common_debug(__METHOD__ . " empty actor profile URI: " . var_export($activity, true)); // TRANS: Exception. throw new Exception(_m('No profile URI.')); } @@ -1357,7 +1358,7 @@ class Ostatus_profile extends Managed_DataObject // @todo tags from categories if ($profile->id) { - common_log(LOG_DEBUG, "Updating OStatus profile $profile->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true)); + common_debug("Updating OStatus profile $profile->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true)); $profile->update($orig); } } @@ -1381,12 +1382,12 @@ class Ostatus_profile extends Managed_DataObject $group->homepage = self::getActivityObjectHomepage($object, $hints); if ($group->id) { // If no id, we haven't called insert() yet, so don't run update() - common_log(LOG_DEBUG, "Updating OStatus group $group->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true)); + common_debug("Updating OStatus group $group->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true)); $group->update($orig); } } - protected static function updatePeopletag($tag, ActivityObject $object, array $hints=array()) { + protected static function updatePeopletag(Peopletag $tag, ActivityObject $object, array $hints=array()) { $orig = clone($tag); $tag->tag = $object->title; @@ -1402,7 +1403,7 @@ class Ostatus_profile extends Managed_DataObject $tag->tagger = $tagger->profile_id; if ($tag->id) { - common_log(LOG_DEBUG, "Updating OStatus peopletag $tag->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true)); + common_debug("Updating OStatus peopletag $tag->id from remote info $object->id: " . var_export($object, true) . var_export($hints, true)); $tag->update($orig); } } @@ -1804,7 +1805,7 @@ class Ostatus_profile extends Managed_DataObject } else { $actor = $activity->actor; - if (empty($actor)) { + if (!$actor instanceof Profile) { // OK here! assume the default } else if ($actor->id == $this->getUri() || $actor->link == $this->getUri()) { $this->updateFromActivityObject($actor);