activity notification in Ostatus_profile

This commit is contained in:
Evan Prodromou 2010-02-21 10:53:11 -05:00
parent ff2efd314f
commit 4e90bd34e9

View File

@ -305,9 +305,9 @@ class Ostatus_profile extends Memcached_DataObject
* Send an Activity Streams notification to the remote Salmon endpoint, * Send an Activity Streams notification to the remote Salmon endpoint,
* if so configured. * if so configured.
* *
* @param Profile $actor * @param Profile $actor Actor who did the activity
* @param $verb eg Activity::SUBSCRIBE or Activity::JOIN * @param string $verb Activity::SUBSCRIBE or Activity::JOIN
* @param string $object object of the action; if null, the remote entity itself is assumed * @param Object $object object of the action; must define asActivityNoun($tag)
*/ */
public function notify($actor, $verb, $object=null) public function notify($actor, $verb, $object=null)
{ {
@ -322,11 +322,12 @@ class Ostatus_profile extends Memcached_DataObject
$object = $this; $object = $this;
} }
if ($this->salmonuri) { if ($this->salmonuri) {
$text = 'update'; // @fixme
$id = 'tag:' . common_config('site', 'server') . $text = 'update';
':' . $verb . $id = TagURI::mint('%s:%s:%s',
':' . $actor->id . $verb,
':' . time(); // @fixme $actor->getURI(),
common_date_iso8601(date()));
// @fixme consolidate all these NS settings somewhere // @fixme consolidate all these NS settings somewhere
$attributes = array('xmlns' => Activity::ATOM, $attributes = array('xmlns' => Activity::ATOM,
@ -356,6 +357,20 @@ class Ostatus_profile extends Memcached_DataObject
} }
} }
public function notifyActivity($activity)
{
if ($this->salmonuri) {
$xml = $activity->asString();
$salmon = new Salmon(); // ?
$salmon->post($this->salmonuri, $xml);
}
return;
}
function getBestName() function getBestName()
{ {
if ($this->isGroup()) { if ($this->isGroup()) {