mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 16:35:13 +00:00
35 lines
866 B
PHP
35 lines
866 B
PHP
<?php
|
|
|
|
namespace Code\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 Code\Web\Controller;
|
|
|
|
class Connac extends Controller
|
|
{
|
|
|
|
public function init()
|
|
{
|
|
|
|
$ret = [];
|
|
|
|
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')",
|
|
intval(local_channel())
|
|
);
|
|
if ($r) {
|
|
foreach ($r as $rv) {
|
|
$ret[] = $rv['xchan_addr'];
|
|
}
|
|
}
|
|
json_return_and_die($ret);
|
|
}
|
|
|
|
}
|