summaryrefslogtreecommitdiff
path: root/plugins/OStatus/OStatusPlugin.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-02-20 20:27:04 -0500
committerEvan Prodromou <evan@status.net>2010-02-20 20:27:04 -0500
commit5565216b42fc97d84c9602864b2095e557769717 (patch)
tree321515410535f2bc3826fdbfce39d8f888556ab4 /plugins/OStatus/OStatusPlugin.php
parent96c6019638f6407b38fbc5a45485a3797af47adb (diff)
parent145a19954f6f993714cb8b65aaf9d54996503664 (diff)
Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
Conflicts: plugins/OStatus/OStatusPlugin.php
Diffstat (limited to 'plugins/OStatus/OStatusPlugin.php')
-rw-r--r--plugins/OStatus/OStatusPlugin.php69
1 files changed, 24 insertions, 45 deletions
diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php
index 98e048c14..5081c4d98 100644
--- a/plugins/OStatus/OStatusPlugin.php
+++ b/plugins/OStatus/OStatusPlugin.php
@@ -358,59 +358,38 @@ class OStatusPlugin extends Plugin
return true;
}
- function onEndFavor($profile, $notice)
+ /**
+ * Notify remote users when their notices get favorited.
+ *
+ * @param Profile or User $profile of local user doing the faving
+ * @param Notice $notice being favored
+ * @return hook return value
+ */
+ function onEndFavorNotice($profile, Notice $notice)
{
- // is the favorer a local user?
-
- $user = User::staticGet('id', $profile->id);
-
- if (empty($user)) {
- return true;
+ if ($profile instanceof User) {
+ // @fixme upstream function should clarify its parameters
+ $profile = $profile->getProfile();
}
-
- // is the author an OStatus remote user?
-
$oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
-
- if (empty($oprofile)) {
- return true;
+ if ($oprofile) {
+ $oprofile->notify($profile, ActivityVerb::FAVORITE, $notice);
}
-
- // Local user faved an Ostatus profile's notice; notify them!
-
- $obj = ActivityObject::fromNotice($notice);
-
- $oprofile->notify($profile,
- ActivityVerb::FAVORITE,
- $obj->asString());
- return true;
}
- function onEndDisfavor($profile, $notice)
+ /**
+ * Notify remote users when their notices get de-favorited.
+ *
+ * @param Profile or User $profile of local user doing the de-faving
+ * @param Notice $notice being favored
+ * @return hook return value
+ */
+ function onEndDisfavorNotice(Profile $profile, Notice $notice)
{
- // is the favorer a local user?
-
- $user = User::staticGet('id', $profile->id);
-
- if (empty($user)) {
- return true;
- }
-
- // is the author an OStatus remote user?
-
$oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
-
- if (empty($oprofile)) {
- return true;
+ if ($oprofile) {
+ $oprofile->notify($profile, ActivityVerb::UNFAVORITE, $notice);
}
-
- // Local user faved an Ostatus profile's notice; notify them!
-
- $obj = ActivityObject::fromNotice($notice);
-
- $oprofile->notify($profile,
- ActivityVerb::UNFAVORITE,
- $obj->asString());
- return true;
}
+
}