$xml = $entry->getString();
common_log(LOG_INFO, "Posting to Salmon endpoint $this->salmonuri: $xml");
- Salmon::post($this->salmonuri, $xml, $actor->getUser());
+ Salmon::post($this->salmonuri, $xml, $actor);
}
/**
public function notifyActivity($entry, Profile $actor)
{
if ($this->salmonuri) {
- return Salmon::post($this->salmonuri, $this->notifyPrepXml($entry), $actor->getUser());
+ return Salmon::post($this->salmonuri, $this->notifyPrepXml($entry), $actor, $this->localProfile());
}
common_debug(__CLASS__.' error: No salmonuri for Ostatus_profile uri: '.$this->uri);
if ($this->salmonuri) {
$data = array('salmonuri' => $this->salmonuri,
'entry' => $this->notifyPrepXml($entry),
- 'actor' => $actor->id);
+ 'actor' => $actor->getID(),
+ 'target' => $this->localProfile()->getID());
$qm = QueueManager::get();
return $qm->enqueue($data, 'salmon');
*
* @param string $endpoint_uri
* @param string $xml string representation of payload
- * @param User $user local user profile whose keys we sign with
+ * @param Profile $user profile whose keys we sign with (must be a local user)
* @return boolean success
*/
- public static function post($endpoint_uri, $xml, User $user, Profile $target=null)
+ public static function post($endpoint_uri, $xml, Profile $actor, Profile $target=null)
{
if (empty($endpoint_uri)) {
- common_debug('No endpoint URI for Salmon post to '.$user->getUri());
+ common_debug('No endpoint URI for Salmon post to '.$actor->getUri());
return false;
}
try {
- $magic_env = MagicEnvelope::signAsUser($xml, $user);
+ $magic_env = MagicEnvelope::signAsUser($xml, $actor->getUser());
} catch (Exception $e) {
common_log(LOG_ERR, "Salmon unable to sign: " . $e->getMessage());
return false;
assert(is_string($data['entry']));
$actor = Profile::getKV($data['actor']);
+ $target = array_key_exists('target', $data) ? Profile::getKV($data['target']) : null;
- Salmon::post($data['salmonuri'], $data['entry'], $actor->getUser());
+ Salmon::post($data['salmonuri'], $data['entry'], $actor, $target);
// @fixme detect failure and attempt to resend
return true;