* applied Evan's XMLStream select() patches

* made roster presence tracking optional


git-svn-id: svn://netflint.net/xmpphp@69 ef36c318-a008-4979-b6e8-6b496270793b
This commit is contained in:
fritzy
2008-11-26 10:49:47 +00:00
parent 1a3c6cf010
commit 6cd2e281c7
2 changed files with 155 additions and 70 deletions

View File

@@ -88,6 +88,11 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
*/
protected $use_encryption = true;
/**
* @var boolean
*/
public $track_presence = true;
/**
* @var object
*/
@@ -115,6 +120,7 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
$this->basejid = $this->user . '@' . $this->host;
$this->roster = new Roster();
$this->track_presence = true;
$this->stream_start = '<stream:stream to="' . $server . '" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0">';
$this->stream_end = '</stream:stream>';
@@ -230,7 +236,9 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
$payload['from'] = $xml->attrs['from'];
$payload['status'] = (isset($xml->sub('status')->data)) ? $xml->sub('status')->data : '';
$payload['priority'] = (isset($xml->sub('priority')->data)) ? intval($xml->sub('priority')->data) : 0;
$this->roster->setPresence($payload['from'], $payload['priority'], $payload['show'], $payload['status']);
if($this->track_presence) {
$this->roster->setPresence($payload['from'], $payload['priority'], $payload['show'], $payload['status']);
}
$this->log->log("Presence: {$payload['from']} [{$payload['show']}] {$payload['status']}", XMPPHP_Log::LEVEL_DEBUG);
if(array_key_exists('type', $xml->attrs) and $xml->attrs['type'] == 'subscribe') {
if($this->auto_subscribe) {