summaryrefslogtreecommitdiff
path: root/plugins/OStatus/classes
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-02-19 12:08:07 -0800
committerBrion Vibber <brion@pobox.com>2010-02-19 12:08:07 -0800
commita1a3ab1c58cf8636c4e9ac6b9d44bdc18946a547 (patch)
tree83c225246b2c9628e2a66d9c453f2fd8bb11cd73 /plugins/OStatus/classes
parent114eb310ca4f53e09c98f2337850829a9036c133 (diff)
OStatus: hooked up follow/unfollow events on Salmon endpoint to create/destroy remote subscriber relationships
Diffstat (limited to 'plugins/OStatus/classes')
-rw-r--r--plugins/OStatus/classes/Ostatus_profile.php22
1 files changed, 17 insertions, 5 deletions
diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php
index 319b76a66..97d8eec10 100644
--- a/plugins/OStatus/classes/Ostatus_profile.php
+++ b/plugins/OStatus/classes/Ostatus_profile.php
@@ -310,8 +310,15 @@ class Ostatus_profile extends Memcached_DataObject
* @param $verb eg Activity::SUBSCRIBE or Activity::JOIN
* @param $object object of the action; if null, the remote entity itself is assumed
*/
- public function notify(Profile $actor, $verb, $object=null)
+ public function notify($actor, $verb, $object=null)
{
+ if (!($actor instanceof Profile)) {
+ $type = gettype($actor);
+ if ($type == 'object') {
+ $type = get_class($actor);
+ }
+ throw new ServerException("Invalid actor passed to " . __METHOD__ . ": " . $type);
+ }
if ($object == null) {
$object = $this;
}
@@ -340,7 +347,7 @@ class Ostatus_profile extends Memcached_DataObject
$feed->addEntry($entry);
$xml = $feed->getString();
- common_log(LOG_INFO, "Posting to Salmon endpoint $salmon: $xml");
+ common_log(LOG_INFO, "Posting to Salmon endpoint $this->salmonuri: $xml");
$salmon = new Salmon(); // ?
$salmon->post($this->salmonuri, $xml);
@@ -531,9 +538,14 @@ class Ostatus_profile extends Memcached_DataObject
$temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar');
copy($url, $temp_filename);
+ if ($this->isGroup()) {
+ $id = $this->group_id;
+ } else {
+ $id = $this->profile_id;
+ }
// @fixme should we be using different ids?
- $imagefile = new ImageFile($this->id, $temp_filename);
- $filename = Avatar::filename($this->id,
+ $imagefile = new ImageFile($id, $temp_filename);
+ $filename = Avatar::filename($id,
image_type_to_extension($imagefile->type),
null,
common_timestamp());
@@ -646,7 +658,7 @@ class Ostatus_profile extends Memcached_DataObject
$actor = $activity->actor;
$homeuri = self::getActorProfileURI($activity);
$nickname = self::getAuthorNick($activity);
- $avatar = self::getAvatar($actor, $feed);
+ $avatar = self::getAvatar($actor, $activity->feed);
if (!$homeuri) {
common_log(LOG_DEBUG, __METHOD__ . " empty actor profile URI: " . var_export($activity, true));