2021-10-04 02:30:35 +00:00
|
|
|
<?php
|
2021-12-03 03:01:39 +00:00
|
|
|
|
2022-02-16 04:08:28 +00:00
|
|
|
namespace Code\Module;
|
2021-10-04 02:30:35 +00:00
|
|
|
|
2021-10-04 21:19:27 +00:00
|
|
|
// 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
|
2021-10-04 02:30:35 +00:00
|
|
|
|
2022-02-16 04:08:28 +00:00
|
|
|
use Code\Web\Controller;
|
2021-10-04 02:30:35 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
class Connac extends Controller
|
|
|
|
{
|
|
|
|
|
|
|
|
public function init()
|
|
|
|
{
|
2021-10-04 02:30:35 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
$ret = [];
|
2021-10-04 02:30:35 +00:00
|
|
|
|
2021-12-02 23:02:31 +00:00
|
|
|
if (!local_channel()) {
|
|
|
|
json_return_and_die($ret);
|
|
|
|
}
|
2021-10-04 02:30:35 +00:00
|
|
|
|
2021-12-06 21:19:19 +00:00
|
|
|
$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);
|
|
|
|
}
|
2021-10-04 02:30:35 +00:00
|
|
|
|
|
|
|
}
|