diff options
author | Brion Vibber <brion@pobox.com> | 2010-02-18 18:20:48 +0000 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-02-18 18:20:48 +0000 |
commit | 22ff358ba8d1fd0396136e1de570d788dd0727b6 (patch) | |
tree | e53d46a094dea1c653ad7e2cb6576ac8ec17c86e /plugins/OStatus/actions/pushhub.php | |
parent | c2ba7645359242590c8ac60b66f012110ae889ef (diff) |
OStatus sub/unsub updates:
- fix for PuSH unsub verification
- send Salmon notification on unsub
Diffstat (limited to 'plugins/OStatus/actions/pushhub.php')
-rw-r--r-- | plugins/OStatus/actions/pushhub.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/OStatus/actions/pushhub.php b/plugins/OStatus/actions/pushhub.php index 13ec09d52..19599d815 100644 --- a/plugins/OStatus/actions/pushhub.php +++ b/plugins/OStatus/actions/pushhub.php @@ -83,6 +83,7 @@ class PushHubAction extends Action { $feed = $this->argUrl('hub.topic'); $callback = $this->argUrl('hub.callback'); + $token = $this->arg('hub.verify_token', null); common_log(LOG_DEBUG, __METHOD__ . ": checking sub'd to $feed $callback"); if ($this->getSub($feed, $callback)) { @@ -96,7 +97,6 @@ class PushHubAction extends Action $sub = new HubSub(); $sub->topic = $feed; $sub->callback = $callback; - $sub->verify_token = $this->arg('hub.verify_token', null); $sub->secret = $this->arg('hub.secret', null); if (strlen($sub->secret) > 200) { throw new ClientException("hub.secret must be no longer than 200 chars", 400); @@ -115,7 +115,7 @@ class PushHubAction extends Action // @fixme check errors ;) - $data = array('sub' => $sub, 'mode' => 'subscribe'); + $data = array('sub' => $sub, 'mode' => 'subscribe', 'token' => $token); $qm = QueueManager::get(); $qm->enqueue($data, 'hubverify'); @@ -130,6 +130,8 @@ class PushHubAction extends Action * 202 Accepted - request saved and awaiting verification * 204 No Content - already subscribed * 400 Bad Request - invalid params or rejected feed + * + * @fixme background this */ function unsubscribe() { @@ -138,7 +140,8 @@ class PushHubAction extends Action $sub = $this->getSub($feed, $callback); if ($sub) { - if ($sub->verify('unsubscribe')) { + $token = $this->arg('hub.verify_token', null); + if ($sub->verify('unsubscribe', $token)) { $sub->delete(); common_log(LOG_INFO, "PuSH unsubscribed $feed for $callback"); } else { |