]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/RSSCloud/RSSCloudPlugin.php
added readme
[quix0rs-gnu-social.git] / plugins / RSSCloud / RSSCloudPlugin.php
index db2cdd74d780d4085311138532954a852c2c6a1a..661c32141faedf7a3f23c4edf86036543b3365df 100644 (file)
@@ -31,6 +31,8 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
+define('RSSCLOUDPLUGIN_VERSION', '0.1');
+
 /**
  * Plugin class for adding RSSCloud capabilities to StatusNet
  *
@@ -70,7 +72,7 @@ class RSSCloudPlugin extends Plugin
 
         // set defaults
 
-        $local_server = parse_url(common_path('/main/rsscloud/request_notify'));
+        $local_server = parse_url(common_path('main/rsscloud/request_notify'));
 
         if (empty($this->domain)) {
             $this->domain = $local_server['host'];
@@ -81,7 +83,7 @@ class RSSCloudPlugin extends Plugin
         }
 
         if (empty($this->path)) {
-            $this->path = '/main/rsscloud/request_notify';
+            $this->path = $local_server['path'];
         }
 
         if (empty($this->funct)) {
@@ -98,12 +100,12 @@ class RSSCloudPlugin extends Plugin
      *
      * Hook for RouterInitialized event.
      *
-     * @param Mapper &$m URL parser and mapper
+     * @param Mapper $m URL parser and mapper
      *
      * @return boolean hook return
      */
 
-    function onRouterInitialized(&$m)
+    function onRouterInitialized($m)
     {
         $m->connect('/main/rsscloud/request_notify',
                     array('action' => 'RSSCloudRequestNotify'));
@@ -136,6 +138,9 @@ class RSSCloudPlugin extends Plugin
         case 'RSSCloudNotifier':
             include_once INSTALLDIR . '/plugins/RSSCloud/RSSCloudNotifier.php';
             return false;
+        case 'RSSCloudQueueHandler':
+            include_once INSTALLDIR . '/plugins/RSSCloud/RSSCloudQueueHandler.php';
+            return false;
         case 'RSSCloudRequestNotifyAction':
         case 'LoggingAggregatorAction':
             include_once INSTALLDIR . '/plugins/RSSCloud/' .
@@ -191,32 +196,6 @@ class RSSCloudPlugin extends Plugin
         return true;
     }
 
-    /**
-     * broadcast the message when not using queuehandler
-     *
-     * @param Notice &$notice the notice
-     * @param array  $queue   destination queue
-     *
-     * @return boolean hook return
-     */
-
-    function onUnqueueHandleNotice(&$notice, $queue)
-    {
-        if (($queue == 'rsscloud') && ($this->_isLocal($notice))) {
-
-            common_debug('broadcasting rssCloud bound notice ' . $notice->id);
-
-            $profile = $notice->getProfile();
-
-            $notifier = new RSSCloudNotifier();
-            $notifier->notify($profile);
-
-            return false;
-        }
-
-        return true;
-    }
-
     /**
      * Determine whether the notice was locally created
      *
@@ -259,19 +238,29 @@ class RSSCloudPlugin extends Plugin
     }
 
     /**
-     * Add RSSCloudQueueHandler to the list of valid daemons to
-     * start
+     * Register RSSCloud notice queue handler
      *
-     * @param array $daemons the list of daemons to run
+     * @param QueueManager $manager
      *
      * @return boolean hook return
-     *
      */
+    function onEndInitializeQueueManager($manager)
+    {
+        $manager->connect('rsscloud', 'RSSCloudQueueHandler');
+        return true;
+    }
 
-    function onGetValidDaemons($daemons)
+    function onPluginVersion(&$versions)
     {
-        array_push($daemons, INSTALLDIR .
-                   '/plugins/RSSCloud/RSSCloudQueueHandler.php');
+        $versions[] = array('name' => 'RSSCloud',
+                            'version' => RSSCLOUDPLUGIN_VERSION,
+                            'author' => 'Zach Copley',
+                            'homepage' => 'http://status.net/wiki/Plugin:RSSCloud',
+                            'rawdescription' =>
+                            _m('The RSSCloud plugin enables your StatusNet instance to publish ' .
+                               'real-time updates for profile RSS feeds using the ' .
+                               '<a href="http://rsscloud.org/">RSSCloud protocol</a>".'));
+
         return true;
     }