class jabber

Jabber class from Flyspray project

Constants

private STREAM_CLOSE_HANDSHAKE

Properties

$connection
$session
$timeout
$server
$connect_server
$port
$username
$password
$use_ssl
$verify_peer
$verify_peer_name
$allow_self_signed
$resource
$enable_logging
$log_array
$features

Methods

__construct(string $server, int $port, string $username, string $password, bool $use_ssl = false, bool $verify_peer = true, bool $verify_peer_name = true, bool $allow_self_signed = false)

Constructor

static 
can_use_ssl()

Able to use the SSL functionality?

static 
can_use_tls()

Able to use TLS?

set_resource(string $name)

Sets the resource which is used. No validation is done here, only escaping.

connect()

Connect

disconnect()

Disconnect

connected()

Connected?

bool
login()

Initiates login (using data from contructor, after calling connect())

bool
send(string $xml)

Send data to the Jabber server

bool
open_socket(string $server, int $port, bool $use_ssl, bool $verify_peer, bool $verify_peer_name, bool $allow_self_signed)

OpenSocket

get_log()

Return log

add_to_log($string)

Add information to log

mixed
listen($timeout = 10, $wait = false)

Listens to the connection until it gets data or the timeout is reached.

bool
register()

Initiates account registration (based on data used for contructor)

bool
send_presence($message = '', $type = '', $unavailable = false)

Sets account presence. No additional info required (default is "online" status)

bool
response(array $xml)

This handles all the different XML elements

send_message($to, $text, $subject = '', $type = 'normal')

No description

string
encrypt_password(array $data)

Encrypts a password as in RFC 2831

array
parse_data(string $data)

parse_data like a="b",c="d",... or like a="a, b", c, d="e", f=g,.

string
implode_data(array $data)

opposite of jabber::parse_data()

xmlize($data, $skip_white = 1, $encoding = 'UTF-8')

xmlize()

_xml_depth($vals, $i)

_xml_depth()

Details

at line 69
__construct(string $server, int $port, string $username, string $password, bool $use_ssl = false, bool $verify_peer = true, bool $verify_peer_name = true, bool $allow_self_signed = false)

Constructor

Parameters

string $server

Jabber server

int $port

Jabber server port

string $username

Jabber username or JID

string $password

Jabber password

bool $use_ssl

Use ssl

bool $verify_peer

Verify SSL certificate

bool $verify_peer_name

Verify Jabber peer name

bool $allow_self_signed

Allow self signed certificates

at line 107
static can_use_ssl()

Able to use the SSL functionality?

at line 115
static can_use_tls()

Able to use TLS?

at line 142
set_resource(string $name)

Sets the resource which is used. No validation is done here, only escaping.

Parameters

string $name

at line 150
connect()

Connect

at line 179
disconnect()

Disconnect

at line 208
connected()

Connected?

at line 219
bool login()

Initiates login (using data from contructor, after calling connect())

Return Value

bool

at line 236
bool send(string $xml)

Send data to the Jabber server

Parameters

string $xml

Return Value

bool

at line 261
bool open_socket(string $server, int $port, bool $use_ssl, bool $verify_peer, bool $verify_peer_name, bool $allow_self_signed)

OpenSocket

Parameters

string $server

host to connect to

int $port

port number

bool $use_ssl

use ssl or not

bool $verify_peer

verify ssl certificate

bool $verify_peer_name

verify peer name

bool $allow_self_signed

allow self-signed ssl certificates

Return Value

bool

at line 304
get_log()

Return log

at line 317
add_to_log($string)

Add information to log

Parameters

$string

at line 331
mixed listen($timeout = 10, $wait = false)

Listens to the connection until it gets data or the timeout is reached.

Thus, it should only be called if data is expected to be received.

Parameters

$timeout
$wait

Return Value

mixed

either false for timeout or an array with the received data

at line 365
bool register()

Initiates account registration (based on data used for contructor)

Return Value

bool

at line 385
bool send_presence($message = '', $type = '', $unavailable = false)

Sets account presence. No additional info required (default is "online" status)

Parameters

$message

online, offline...

$type

dnd, away, chat, xa or nothing

$unavailable

set this to true if you want to become unavailable

Return Value

bool

at line 410
bool response(array $xml)

This handles all the different XML elements

Parameters

array $xml

Return Value

bool

at line 719
send_message($to, $text, $subject = '', $type = 'normal')

No description

Parameters

$to
$text
$subject
$type

at line 744
string encrypt_password(array $data)

Encrypts a password as in RFC 2831

Parameters

array $data

Needs data from the client-server connection

Return Value

string

at line 778
array parse_data(string $data)

parse_data like a="b",c="d",... or like a="a, b", c, d="e", f=g,.

..

Parameters

string $data

Return Value

array

a => b ...

at line 810
string implode_data(array $data)

opposite of jabber::parse_data()

Parameters

array $data

Return Value

string

at line 825
xmlize($data, $skip_white = 1, $encoding = 'UTF-8')

xmlize()

Parameters

$data
$skip_white
$encoding

at line 861
_xml_depth($vals, $i)

_xml_depth()

Parameters

$vals
$i