From: Diogo Cordeiro Date: Mon, 22 Apr 2019 06:27:50 +0000 (+0100) Subject: OStatus and XMPP plugins now inform Nodeinfo plugins about their activity X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e186ad57d0;p=quix0rs-gnu-social.git OStatus and XMPP plugins now inform Nodeinfo plugins about their activity --- diff --git a/plugins/Nodeinfo/actions/nodeinfo_2_0.php b/plugins/Nodeinfo/actions/nodeinfo_2_0.php index 3a53b608e6..bdd83963e6 100644 --- a/plugins/Nodeinfo/actions/nodeinfo_2_0.php +++ b/plugins/Nodeinfo/actions/nodeinfo_2_0.php @@ -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; } diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index 4a903022bf..10d8e4350d 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -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', diff --git a/plugins/Xmpp/XmppPlugin.php b/plugins/Xmpp/XmppPlugin.php index 1fd7affddb..87bda488e9 100644 --- a/plugins/Xmpp/XmppPlugin.php +++ b/plugins/Xmpp/XmppPlugin.php @@ -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',