* added payload option to messages

git-svn-id: svn://netflint.net/xmpphp@47 ef36c318-a008-4979-b6e8-6b496270793b
This commit is contained in:
fritzy
2008-07-11 23:25:36 +00:00
parent d2b45506b5
commit 895021132c
3 changed files with 27 additions and 54 deletions

View File

@@ -290,6 +290,26 @@ class XMPPHP_XMLStream {
public function isDisconnected() {
return $this->connected;
}
private function __process() {
$read = array($this->socket);
$write = null;
$except = null;
$updated = stream_select($read, $write, $except, 1);
if ($updated > 0) {
$buff = @fread($this->socket, 1024);
if(!$buff) {
if($this->reconnect) {
$this->doReconnect();
} else {
fclose($this->socket);
return false;
}
}
$this->log->log("RECV: $buff", XMPPHP_Log::LEVEL_VERBOSE);
xml_parse($this->parser, $buff, false);
}
}
/**
* Process
@@ -299,23 +319,7 @@ class XMPPHP_XMLStream {
public function process() {
$updated = '';
while(!$this->disconnect) {
$read = array($this->socket);
$write = null;
$except = null;
$updated = stream_select($read, $write, $except, 1);
if ($updated > 0) {
$buff = @fread($this->socket, 1024);
if(!$buff) {
if($this->reconnect) {
$this->doReconnect();
} else {
fclose($this->socket);
return false;
}
}
$this->log->log("RECV: $buff", XMPPHP_Log::LEVEL_VERBOSE);
xml_parse($this->parser, $buff, false);
}
$this->__process();
}
}
@@ -329,23 +333,7 @@ class XMPPHP_XMLStream {
$start = time();
$updated = '';
while(!$this->disconnected and ($timeout == -1 or time() - $start < $timeout)) {
$read = array($this->socket);
$write = null;
$except = null;
$updated = stream_select($read, $write, $except, 1);
if ($updated > 0) {
$buff = @fread($this->socket, 1024);
if(!$buff) {
if($this->reconnect) {
$this->doReconnect();
} else {
fclose($this->socket);
return false;
}
}
$this->log->log("RECV: $buff", XMPPHP_Log::LEVEL_VERBOSE);
xml_parse($this->parser, $buff, false);
}
$this->__process();
}
}
@@ -365,23 +353,7 @@ class XMPPHP_XMLStream {
reset($this->until);
$updated = '';
while(!$this->disconnected and $this->until[$event_key] and (time() - $start < $timeout or $timeout == -1)) {
$read = array($this->socket);
$write = null;
$except = null;
$updated = stream_select($read, $write, $except, 1);
if ($updated > 0) {
$buff = @fread($this->socket, 1024);
if(!$buff) {
if($this->reconnect) {
$this->doReconnect();
} else {
fclose($this->socket);
return false;
}
}
$this->log->log("RECV: $buff", XMPPHP_Log::LEVEL_VERBOSE);
xml_parse($this->parser, $buff, false);
}
$this->__process();
}
if(array_key_exists($event_key, $this->until_payload)) {
$payload = $this->until_payload[$event_key];