summaryrefslogtreecommitdiff
path: root/plugins/OStatus/OStatusPlugin.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-08-13 14:33:41 -0700
committerEvan Prodromou <evan@status.net>2010-08-13 14:33:41 -0700
commit718317542940a8976f2c6f2a9ea09a04f2f00ca6 (patch)
tree2bae1e1b0ce628101453b83c7e4ddcce59b43c62 /plugins/OStatus/OStatusPlugin.php
parent9f0715a9935966f3ec483bccc476d5baf3324b3c (diff)
parent029aa0c61c9942c0688fd3dc9aa2893311543db1 (diff)
Merge branch 'master' into 1.0.x
Diffstat (limited to 'plugins/OStatus/OStatusPlugin.php')
-rw-r--r--plugins/OStatus/OStatusPlugin.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php
index 70971c5b3..6fef20d6f 100644
--- a/plugins/OStatus/OStatusPlugin.php
+++ b/plugins/OStatus/OStatusPlugin.php
@@ -28,6 +28,15 @@ set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/ext
class FeedSubException extends Exception
{
+ function __construct($msg=null)
+ {
+ $type = get_class($this);
+ if ($msg) {
+ parent::__construct("$type: $msg");
+ } else {
+ parent::__construct($type);
+ }
+ }
}
class OStatusPlugin extends Plugin
@@ -480,6 +489,24 @@ class OStatusPlugin extends Plugin
}
/**
+ * Tell the FeedSub infrastructure whether we have any active OStatus
+ * usage for the feed; if not it'll be able to garbage-collect the
+ * feed subscription.
+ *
+ * @param FeedSub $feedsub
+ * @param integer $count in/out
+ * @return mixed hook return code
+ */
+ function onFeedSubSubscriberCount($feedsub, &$count)
+ {
+ $oprofile = Ostatus_profile::staticGet('feeduri', $feedsub->uri);
+ if ($oprofile) {
+ $count += $oprofile->subscriberCount();
+ }
+ return true;
+ }
+
+ /**
* When about to subscribe to a remote user, start a server-to-server
* PuSH subscription if needed. If we can't establish that, abort.
*