get_vcard() public method

public get_vcard ( $jid = null, $cb = null )
コード例 #1
0
require_once 'jaxl.php';
$client = new JAXL(array('jid' => $argv[1], 'pass' => $argv[2], 'auth_type' => @$argv[3] ? $argv[3] : 'PLAIN', 'log_level' => JAXL_INFO));
//
// required XEP's
//
$client->require_xep(array('0199'));
//
// add necessary event callbacks here
//
$client->add_cb('on_auth_success', function () {
    global $client;
    _info("got on_auth_success cb, jid " . $client->full_jid->to_string());
    // fetch roster list
    $client->get_roster();
    // fetch vcard
    $client->get_vcard();
    // set status
    $client->set_status("available!", "dnd", 10);
});
// by default JAXL instance catches incoming roster list results and updates
// roster list is parsed/cached and an event 'on_roster_update' is emitted
$client->add_cb('on_roster_update', function () {
    //global $client;
    //print_r($client->roster);
});
$client->add_cb('on_auth_failure', function ($reason) {
    global $client;
    _info("got on_auth_failure cb with reason {$reason}");
    $client->send_end_stream();
});
$client->add_cb('on_chat_message', function ($stanza) {
コード例 #2
0
ファイル: ligrevSim.php プロジェクト: sylae/loungesim
l("Getting identity...");
if ($argc >= 2) {
    $source = $argv[1];
    $nick = $argv[2];
} else {
    l("No identity!", L_AAAA);
    die;
}
$config['sim_prefix'] .= $nick;
l("[JAXL] Loading JAXL and connecting...");
$client = new \JAXL($config['jaxl']);
$client->require_xep(array('0045', '0203', '0199'));
$client->add_cb('on_auth_success', function () {
    global $client, $config, $rooms;
    l("[JAXL] Connected with jid " . $client->full_jid->to_string());
    $client->get_vcard();
    $client->get_roster();
    $client->set_status("", "chat", 10);
    $ctrl = new \XMPPJid($config['LCN_control'] . '/' . $config['sim_prefix']);
    l("[JAXL] Joining room " . $ctrl->to_string());
    $client->xeps['0045']->join_room($ctrl);
    l("[JAXL] Joined room " . $ctrl->to_string());
    $rooms = new \XMPPJid($config['sim'] . '/' . $config['sim_prefix']);
    l("[JAXL] Joining room " . $rooms->to_string());
    $client->xeps['0045']->join_room($rooms);
    l("[JAXL] Joined room " . $rooms->to_string());
});
$client->add_cb('on_auth_failure', function ($reason) {
    global $client;
    $client->send_end_stream();
    l("[JAXL] Auth failure: " . $reason, L_WARN);