* @fixme If something else aborts later, we could end up with a stray
* PuSH subscription. This is relatively harmless, though.
*
- * @param Profile $subscriber
- * @param Profile $other
+ * @param Profile $profile subscriber
+ * @param Profile $other subscribee
*
* @return hook return code
*
* @throws Exception
*/
- function onStartSubscribe($subscriber, $other)
+ function onStartSubscribe(Profile $profile, Profile $other)
{
- $user = User::getKV('id', $subscriber->id);
-
- if (empty($user)) {
+ if (!$profile->isLocal()) {
return true;
}
* Having established a remote subscription, send a notification to the
* remote OStatus profile's endpoint.
*
- * @param Profile $subscriber
- * @param Profile $other
+ * @param Profile $profile subscriber
+ * @param Profile $other subscribee
*
* @return hook return code
*
* @throws Exception
*/
- function onEndSubscribe($subscriber, $other)
+ function onEndSubscribe(Profile $profile, Profile $other)
{
- $user = User::getKV('id', $subscriber->id);
-
- if (empty($user)) {
+ if (!$profile->isLocal()) {
return true;
}
return true;
}
- $sub = Subscription::pkeyGet(array('subscriber' => $subscriber->id,
+ $sub = Subscription::pkeyGet(array('subscriber' => $profile->id,
'subscribed' => $other->id));
$act = $sub->asActivity();
- $oprofile->notifyActivity($act, $subscriber);
+ $oprofile->notifyActivity($act, $profile);
return true;
}
* @param Profile $other
* @return hook return value
*/
- function onEndUnsubscribe($profile, $other)
+ function onEndUnsubscribe(Profile $profile, Profile $other)
{
- $user = User::getKV('id', $profile->id);
-
- if (empty($user)) {
+ if (!$profile->isLocal()) {
return true;
}