OStatus and XMPP plugins now inform Nodeinfo plugins about their activity

This commit is contained in:
Diogo Cordeiro 2019-04-22 07:27:50 +01:00
parent e6667db0cd
commit e186ad57d0
3 changed files with 26 additions and 16 deletions

View 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();
$protocols = [];
if (Event::handle('StartNodeInfoProtocols', array(&$protocols))) {
// Until the OStatus and XMPP plugins handle this themselves,
// try to figure out if they're enabled ourselves.
if ($oStatusEnabled) {
$protocols[] = 'ostatus';
}
if ($xmppEnabled) {
$protocols[] = 'xmpp';
}
}
Event::handle('EndNodeInfoProtocols', array(&$protocols));
Event::handle('NodeInfoProtocols', array(&$protocols));
return $protocols;
}

View 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',

View 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',