summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-02-20 15:56:36 -0800
committerBrion Vibber <brion@pobox.com>2010-02-20 15:56:36 -0800
commit9c2fe8492f7dae183e0369f8d43f124fd80e4433 (patch)
tree86ff0bb2805b5256ff9f1e3e604a67f35ad22e71 /plugins
parentea9d6f21ecaff6e26ebe30775d1ddcd6d68d0a11 (diff)
OStatus: send favorite/unfavorite notifications to remote authors
Diffstat (limited to 'plugins')
-rw-r--r--plugins/OStatus/OStatusPlugin.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php
index e78e658a6..4cbf78e63 100644
--- a/plugins/OStatus/OStatusPlugin.php
+++ b/plugins/OStatus/OStatusPlugin.php
@@ -357,4 +357,39 @@ class OStatusPlugin extends Plugin
return true;
}
+
+ /**
+ * 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)
+ {
+ if ($profile instanceof User) {
+ // @fixme upstream function should clarify its parameters
+ $profile = $profile->getProfile();
+ }
+ $oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
+ if ($oprofile) {
+ $oprofile->notify($profile, ActivityVerb::FAVORITE, $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)
+ {
+ $oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
+ if ($oprofile) {
+ $oprofile->notify($profile, ActivityVerb::UNFAVORITE, $notice);
+ }
+ }
+
}