]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
OStatus and XMPP plugins now inform Nodeinfo plugins about their activity
authorDiogo Cordeiro <diogo@fc.up.pt>
Mon, 22 Apr 2019 06:27:50 +0000 (07:27 +0100)
committerDiogo Cordeiro <diogo@fc.up.pt>
Mon, 22 Apr 2019 06:28:45 +0000 (07:28 +0100)
plugins/Nodeinfo/actions/nodeinfo_2_0.php
plugins/OStatus/OStatusPlugin.php
plugins/Xmpp/XmppPlugin.php

index 3a53b608e6272f58fd5e0fffb997048bcda97bcc..bdd83963e6fa324ad76c64c3855780ee4a40fe15 100644 (file)
@@ -136,23 +136,9 @@ class Nodeinfo_2_0Action extends ApiAction
 
     public function getProtocols()
     {
-        $oStatusEnabled = array_key_exists('ostatus', $this->plugins);
-        $xmppEnabled = (array_key_exists('xmpp', $this->plugins) && common_config('xmpp', 'enabled')) ? true : false;
-        $protocols = array();
-
-        if (Event::handle('StartNodeInfoProtocols', array(&$protocols))) {
-            // Until the OStatus and XMPP plugins handle this themselves,
-            // try to figure out if they're enabled ourselves.
+        $protocols = [];
 
-            if ($oStatusEnabled) {
-                $protocols[] = 'ostatus';
-            }
-
-            if ($xmppEnabled) {
-                $protocols[] = 'xmpp';
-            }
-        }
-        Event::handle('EndNodeInfoProtocols', array(&$protocols));
+        Event::handle('NodeInfoProtocols', array(&$protocols));
 
         return $protocols;
     }
index 4a903022bf94faddb3ad19df14a16ea963d4318c..10d8e4350dabb0bf0dc4e07a3e029a61c976c24e 100644 (file)
@@ -1335,6 +1335,18 @@ class OStatusPlugin extends Plugin
         return true;
     }
 
+    /**
+     * Plugin Nodeinfo information
+     *
+     * @param array $protocols
+     * @return bool hook true
+     */
+    public function onNodeInfoProtocols(array &$protocols)
+    {
+        $protocols[] = "ostatus";
+        return true;
+    }
+
     function onPluginVersion(array &$versions)
     {
         $versions[] = array('name' => 'OStatus',
index 1fd7affddbd59b725f0e118dd4cb9ef99f3c4118..87bda488e9c83fd592e8f37386d18928b8be8435 100644 (file)
@@ -426,6 +426,18 @@ class XmppPlugin extends ImPlugin
         return true;
     }
 
+    /**
+     * Plugin Nodeinfo information
+     *
+     * @param array $protocols
+     * @return bool hook true
+     */
+    public function onNodeInfoProtocols(array &$protocols)
+    {
+        $protocols[] = "xmpp";
+        return true;
+    }
+
     function onPluginVersion(array &$versions)
     {
         $versions[] = array('name' => 'XMPP',