streams/Zotlabs/Module/Connac.php

36 lines
872 B
PHP
Raw Normal View History

<?php
2021-12-03 03:01:39 +00:00
namespace Zotlabs\Module;
// Connection autocompleter for util/nsh
// We could probably add this case to the general purpose autocompleter (mod_acl) but
// that module has gotten far too overloaded.
// Returns as json a simply array containing the webfinger addresses of all your Nomad connections
use Zotlabs\Web\Controller;
2021-12-02 23:02:31 +00:00
class Connac extends Controller
{
public function init()
{
2021-12-02 23:02:31 +00:00
$ret = [];
2021-12-02 23:02:31 +00:00
if (!local_channel()) {
json_return_and_die($ret);
}
$r = q("select xchan_addr from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and xchan_network in ('nomad','zot6')",
2021-12-02 23:02:31 +00:00
intval(local_channel())
);
if ($r) {
foreach ($r as $rv) {
$ret[] = $rv['xchan_addr'];
}
}
json_return_and_die($ret);
}
}