* printing option should now work if set to False

* ignore read errors


git-svn-id: svn://netflint.net/xmpphp@13 ef36c318-a008-4979-b6e8-6b496270793b
This commit is contained in:
fritzy 2008-04-02 20:19:55 +00:00
parent 7548c9f136
commit 8478473813
2 changed files with 6 additions and 6 deletions

View File

@ -79,13 +79,13 @@ class XMLStream {
$this->disconnected = False; $this->disconnected = False;
$this->sent_disconnect = False; $this->sent_disconnect = False;
if($persistent) { if($persistent) {
$conflag = STREAM_CLIENT_PERSISTENT; $conflag = STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT;
} else { } else {
$conflag = STREAM_CLIENT_CONNECT; $conflag = STREAM_CLIENT_CONNECT;
} }
$this->log->log("Connecting to tcp://{$this->host}:{$this->port}"); $this->log->log("Connecting to tcp://{$this->host}:{$this->port}");
$this->socket = stream_socket_client("tcp://{$this->host}:{$this->port}", $flags=$conflag); $this->socket = stream_socket_client("tcp://{$this->host}:{$this->port}", $flags=$conflag);
stream_set_blocking($this-socket, 1); stream_set_blocking($this->socket, 1);
if($sendinit) $this->send($this->stream_start); if($sendinit) $this->send($this->stream_start);
} }
@ -101,7 +101,7 @@ class XMLStream {
$except = NULL; $except = NULL;
$updated = stream_select($read, $write, $except, 1); $updated = stream_select($read, $write, $except, 1);
if ($updated > 0) { if ($updated > 0) {
$buff = fread($this->socket, 1024); $buff = @fread($this->socket, 1024);
if(!$buff) { if(!$buff) {
if($this->reconnect) { if($this->reconnect) {
$this->doReconnect(); $this->doReconnect();
@ -125,7 +125,7 @@ class XMLStream {
$except = NULL; $except = NULL;
$updated = stream_select($read, $write, $except, 1); $updated = stream_select($read, $write, $except, 1);
if ($updated > 0) { if ($updated > 0) {
$buff = fread($this->socket, 1024); $buff = @fread($this->socket, 1024);
if(!$buff) { if(!$buff) {
if($this->reconnect) { if($this->reconnect) {
$this->doReconnect(); $this->doReconnect();
@ -152,7 +152,7 @@ class XMLStream {
$except = NULL; $except = NULL;
$updated = stream_select($read, $write, $except, 1); $updated = stream_select($read, $write, $except, 1);
if ($updated > 0) { if ($updated > 0) {
$buff = fread($this->socket, 1024); $buff = @fread($this->socket, 1024);
if(!$buff) { if(!$buff) {
if($this->reconnect) { if($this->reconnect) {
$this->doReconnect(); $this->doReconnect();

View File

@ -30,7 +30,7 @@ class XMPP extends XMLStream {
var $fulljid; var $fulljid;
function XMPP($host, $port, $user, $password, $resource, $server=Null, $printlog=False, $loglevel=Null) { function XMPP($host, $port, $user, $password, $resource, $server=Null, $printlog=False, $loglevel=Null) {
$this->XMLStream($host, $port, $loglevel, $loglevel); $this->XMLStream($host, $port, $printlog, $loglevel);
$this->user = $user; $this->user = $user;
$this->password = $password; $this->password = $password;
$this->resource = $resource; $this->resource = $resource;