function on_presence_stanza($client, $stanza) { global $client; $type = $stanza->type ? $stanza->type : "available"; $show = $stanza->show ? $stanza->show : "???"; _info($stanza->from . " is now " . $type . " ({$show})"); if ($type == "available") { // fetch vcard $client->get_vcard($stanza->from); } } function on_disconnect($client) { _info("got on_disconnect cb"); } // // bootstrap all account instances // foreach ($accounts as $account) { $client = new JAXL(array('jid' => $account[0], 'pass' => $account[1], 'log_level' => JAXL_DEBUG)); $client->add_cb('on_auth_success', 'on_auth_success'); $client->add_cb('on_auth_failure', 'on_auth_failure'); $client->add_cb('on_chat_message', 'on_chat_message'); $client->add_cb('on_presence_stanza', 'on_presence_stanza'); $client->add_cb('on_disconnect', 'on_disconnect'); $client->connect($client->get_socket_path()); $client->start_stream(); } // start core loop JAXLLoop::run(); echo "done\n";