summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-02-21 10:53:11 -0500
committerEvan Prodromou <evan@status.net>2010-02-21 10:53:11 -0500
commit4e90bd34e9aff1abd97a92b62fc7c48bf1ee5a9c (patch)
tree430001e306008023da56d387655fccb3d4caea89
parentff2efd314f15bf5e4b42fe02d56217a996a7c692 (diff)
activity notification in Ostatus_profile
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php31
1 files changed, 23 insertions, 8 deletions
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index d9cb7a6e1..55f347a02 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -305,9 +305,9 @@ class Ostatus_profile extends Memcached_DataObject
* Send an Activity Streams notification to the remote Salmon endpoint,
* if so configured.
*
- * @param Profile $actor
- * @param $verb eg Activity::SUBSCRIBE or Activity::JOIN
- * @param string $object object of the action; if null, the remote entity itself is assumed
+ * @param Profile $actor Actor who did the activity
+ * @param string $verb Activity::SUBSCRIBE or Activity::JOIN
+ * @param Object $object object of the action; must define asActivityNoun($tag)
*/
public function notify($actor, $verb, $object=null)
{
@@ -322,11 +322,12 @@ class Ostatus_profile extends Memcached_DataObject
$object = $this;
}
if ($this->salmonuri) {
- $text = 'update'; // @fixme
- $id = 'tag:' . common_config('site', 'server') .
- ':' . $verb .
- ':' . $actor->id .
- ':' . time(); // @fixme
+
+ $text = 'update';
+ $id = TagURI::mint('%s:%s:%s',
+ $verb,
+ $actor->getURI(),
+ common_date_iso8601(date()));
// @fixme consolidate all these NS settings somewhere
$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()
{
if ($this->isGroup()) {