// Salmon endpoint
$m->connect('main/salmon/user/:id',
- array('action' => 'salmon'),
+ array('action' => 'usersalmon'),
array('id' => '[0-9]+'));
$m->connect('main/salmon/group/:id',
- array('action' => 'salmongroup'),
+ array('action' => 'groupsalmon'),
array('id' => '[0-9]+'));
return true;
}
{
if ($user instanceof Profile) {
$profile = $user;
- } else if ($user instanceof Profile) {
+ } else if ($user instanceof User) {
$profile = $user->getProfile();
}
$oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
$oprofile = Ostatus_profile::staticGet('feeduri', $feedsub->uri);
if ($oprofile) {
$oprofile->processFeed($feed);
+ } else {
+ common_log(LOG_DEBUG, "No ostatus profile for incoming feed $feedsub->uri");
+ }
+ }
+
+ function onEndSubscribe($subscriber, $other)
+ {
+ $user = User::staticGet('id', $subscriber->id);
+
+ if (empty($user)) {
+ return true;
+ }
+
+ $oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
+
+ if (empty($oprofile)) {
+ return true;
+ }
+
+ // We have a local user subscribing to a remote profile; make the
+ // magic happen!
+
+ $oprofile->notify($subscriber, ActivityVerb::FOLLOW, $oprofile);
+
+ 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 $profile, Notice $notice)
+ {
+ $user = User::staticGet('id', $profile->id);
+
+ if (empty($user)) {
+ return true;
+ }
+
+ $oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
+
+ if ($oprofile) {
+ $oprofile->notify($profile, ActivityVerb::FAVORITE, $notice);
+ }
+
+ return true;
+ }
+
+ /**
+ * 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)
+ {
+ $user = User::staticGet('id', $profile->id);
+
+ if (empty($user)) {
+ return true;
}
+
+ $oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
+
+ if ($oprofile) {
+ $oprofile->notify($profile, ActivityVerb::UNFAVORITE, $notice);
+ }
+
+ return true;
}
}