summaryrefslogtreecommitdiff
path: root/plugins/OStatus/actions
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-02-12 00:22:16 +0000
committerBrion Vibber <brion@pobox.com>2010-02-12 00:22:16 +0000
commit8e6b52e8994ce9a3180554f999bdc89b414fc892 (patch)
tree233dbc8374737133c05e61d24fbbacce74b0b5e1 /plugins/OStatus/actions
parente08657d56cc10d2cf45e9e5701856d8a0dc7351e (diff)
OStatus: renamed feedinfo table to ostatus_profile -- will cover remote ostatus people and groups whether a subscription's active or not (maintains identity over unsub/resub, and between subscribers and subscribees)
Diffstat (limited to 'plugins/OStatus/actions')
-rw-r--r--plugins/OStatus/actions/feedsubsettings.php20
-rw-r--r--plugins/OStatus/actions/ostatussub.php16
-rw-r--r--plugins/OStatus/actions/pushcallback.php22
3 files changed, 29 insertions, 29 deletions
diff --git a/plugins/OStatus/actions/feedsubsettings.php b/plugins/OStatus/actions/feedsubsettings.php
index 6f592bf5b..af8bf4d25 100644
--- a/plugins/OStatus/actions/feedsubsettings.php
+++ b/plugins/OStatus/actions/feedsubsettings.php
@@ -182,9 +182,9 @@ class FeedSubSettingsAction extends ConnectSettingsAction
}
$this->munger = $discover->feedMunger();
- $this->feedinfo = $this->munger->feedInfo();
+ $this->profile = $this->munger->ostatusProfile();
- if ($this->feedinfo->huburi == '' && !common_config('feedsub', 'nohub')) {
+ if ($this->profile->huburi == '' && !common_config('feedsub', 'nohub')) {
$this->showForm(_m('Feed is not PuSH-enabled; cannot subscribe.'));
return false;
}
@@ -196,13 +196,13 @@ class FeedSubSettingsAction extends ConnectSettingsAction
{
if ($this->validateFeed()) {
$this->preview = true;
- $this->feedinfo = Feedinfo::ensureProfile($this->munger);
+ $this->profile = Ostatus_profile::ensureProfile($this->munger);
// If not already in use, subscribe to updates via the hub
- if ($this->feedinfo->sub_start) {
- common_log(LOG_INFO, __METHOD__ . ": double the fun! new sub for {$this->feedinfo->feeduri} last subbed {$this->feedinfo->sub_start}");
+ if ($this->profile->sub_start) {
+ common_log(LOG_INFO, __METHOD__ . ": double the fun! new sub for {$this->profile->feeduri} last subbed {$this->profile->sub_start}");
} else {
- $ok = $this->feedinfo->subscribe();
+ $ok = $this->profile->subscribe();
common_log(LOG_INFO, __METHOD__ . ": sub was $ok");
if (!$ok) {
$this->showForm(_m('Feed subscription failed! Bad response from hub.'));
@@ -212,15 +212,15 @@ class FeedSubSettingsAction extends ConnectSettingsAction
// And subscribe the current user to the local profile
$user = common_current_user();
- $profile = $this->feedinfo->getProfile();
+ $profile = $this->profile->getLocalProfile();
if (!$profile) {
throw new ServerException("Feed profile was not saved properly.");
}
- if ($this->feedinfo->isGroup()) {
+ if ($this->profile->isGroup()) {
if ($user->isMember($profile)) {
$this->showForm(_m('Already a member!'));
- } elseif (Group_member::join($this->feedinfo->group_id, $user->id)) {
+ } elseif (Group_member::join($this->profile->group_id, $user->id)) {
$this->showForm(_m('Joined remote group!'));
} else {
$this->showForm(_m('Remote group join failed!'));
@@ -247,7 +247,7 @@ class FeedSubSettingsAction extends ConnectSettingsAction
function previewFeed()
{
- $feedinfo = $this->munger->feedinfo();
+ $profile = $this->munger->ostatusProfile();
$notice = $this->munger->notice(0, true); // preview
if ($notice) {
diff --git a/plugins/OStatus/actions/ostatussub.php b/plugins/OStatus/actions/ostatussub.php
index ffc4ae8df..9774286fd 100644
--- a/plugins/OStatus/actions/ostatussub.php
+++ b/plugins/OStatus/actions/ostatussub.php
@@ -164,9 +164,9 @@ class OStatusSubAction extends Action
}
$this->munger = $discover->feedMunger();
- $this->feedinfo = $this->munger->feedInfo();
+ $this->profile = $this->munger->ostatusProfile();
- if ($this->feedinfo->huburi == '') {
+ if ($this->profile->huburi == '') {
$this->showForm(_m('Feed is not PuSH-enabled; cannot subscribe.'));
return false;
}
@@ -178,13 +178,13 @@ class OStatusSubAction extends Action
{
if ($this->validateFeed()) {
$this->preview = true;
- $this->feedinfo = Feedinfo::ensureProfile($this->munger);
+ $this->profile = Ostatus_profile::ensureProfile($this->munger);
// If not already in use, subscribe to updates via the hub
- if ($this->feedinfo->sub_start) {
- common_log(LOG_INFO, __METHOD__ . ": double the fun! new sub for {$this->feedinfo->feeduri} last subbed {$this->feedinfo->sub_start}");
+ if ($this->profile->sub_start) {
+ common_log(LOG_INFO, __METHOD__ . ": double the fun! new sub for {$this->profile->feeduri} last subbed {$this->profile->sub_start}");
} else {
- $ok = $this->feedinfo->subscribe();
+ $ok = $this->profile->subscribe();
common_log(LOG_INFO, __METHOD__ . ": sub was $ok");
if (!$ok) {
$this->showForm(_m('Feed subscription failed! Bad response from hub.'));
@@ -194,7 +194,7 @@ class OStatusSubAction extends Action
// And subscribe the current user to the local profile
$user = common_current_user();
- $profile = $this->feedinfo->getProfile();
+ $profile = $this->profile->getProfile();
if ($user->isSubscribed($profile)) {
$this->showForm(_m('Already subscribed!'));
@@ -209,7 +209,7 @@ class OStatusSubAction extends Action
function previewFeed()
{
- $feedinfo = $this->munger->feedinfo();
+ $profile = $this->munger->ostatusProfile();
$notice = $this->munger->notice(0, true); // preview
if ($notice) {
diff --git a/plugins/OStatus/actions/pushcallback.php b/plugins/OStatus/actions/pushcallback.php
index 471d079ab..a446593ff 100644
--- a/plugins/OStatus/actions/pushcallback.php
+++ b/plugins/OStatus/actions/pushcallback.php
@@ -48,9 +48,9 @@ class PushCallbackAction extends Action
throw new ServerException('Empty or invalid feed id', 400);
}
- $feedinfo = Feedinfo::staticGet('id', $feedid);
- if (!$feedinfo) {
- throw new ServerException('Unknown feed id ' . $feedid, 400);
+ $profile = Ostatus_profile::staticGet('id', $feedid);
+ if (!$profile) {
+ throw new ServerException('Unknown OStatus/PuSH feed id ' . $feedid, 400);
}
$hmac = '';
@@ -59,7 +59,7 @@ class PushCallbackAction extends Action
}
$post = file_get_contents('php://input');
- $feedinfo->postUpdates($post, $hmac);
+ $profile->postUpdates($post, $hmac);
}
/**
@@ -78,8 +78,8 @@ class PushCallbackAction extends Action
throw new ServerException("Bogus hub callback: bad mode", 404);
}
- $feedinfo = Feedinfo::staticGet('feeduri', $topic);
- if (!$feedinfo) {
+ $profile = Ostatus_profile::staticGet('feeduri', $topic);
+ if (!$profile) {
common_log(LOG_WARNING, __METHOD__ . ": bogus hub callback for unknown feed $topic");
throw new ServerException("Bogus hub callback: unknown feed", 404);
}
@@ -93,16 +93,16 @@ class PushCallbackAction extends Action
// OK!
if ($mode == 'subscribe') {
common_log(LOG_INFO, __METHOD__ . ': sub confirmed');
- $feedinfo->sub_start = common_sql_date(time());
+ $profile->sub_start = common_sql_date(time());
if ($lease_seconds > 0) {
- $feedinfo->sub_end = common_sql_date(time() + $lease_seconds);
+ $profile->sub_end = common_sql_date(time() + $lease_seconds);
} else {
- $feedinfo->sub_end = null;
+ $profile->sub_end = null;
}
- $feedinfo->update();
+ $profile->update();
} else {
common_log(LOG_INFO, __METHOD__ . ": unsub confirmed; deleting sub record for $topic");
- $feedinfo->delete();
+ $profile->delete();
}
print $challenge;