Exemplo n.º 1
0
                roster_remove($jid->node);
                send_status($stanza->to, $stanza->from, 'unsubscribed');
                break;
            case 'unavailable':
                roster_resource_set($jid->node, $jid->resource);
                break;
            case NULL:
                $status = $stanza->show ? $stanza->show : 'available';
                $message = $stanza->status;
                roster_resource_set($jid->node, $jid->resource, $status, $message);
                break;
        }
    });
    // connect to the destination host/port
    if ($comp->connect($comp->get_socket_path())) {
        $comp->emit('on_connect');
        JAXLLoop::run(2, 0);
        $comp->emit('on_disconnect');
    }
    sleep(2);
    unset($comp);
}
function manager_read()
{
    global $astman;
    $response = $astman->wait_response(true);
    $reconnects = $astman->reconnects;
    $oldsocket = $astman->socket;
    while ($response === false && $reconnects > 0) {
        $astman->disconnect();
        if ($astman->connect($astman->server . ':' . $astman->port, $astman->username, $astman->secret, $astman->events) !== false) {