* added SSL and fixed XMPP_Old

git-svn-id: svn://netflint.net/xmpphp@51 ef36c318-a008-4979-b6e8-6b496270793b
This commit is contained in:
fritzy
2008-07-25 21:39:09 +00:00
parent 1b39cfe6de
commit f7bb8d8f76
3 changed files with 25 additions and 8 deletions

View File

@@ -149,6 +149,10 @@ class XMPPHP_XMLStream {
* @var float
*/
protected $last_send = 0;
/**
* @var boolean
*/
protected $use_ssl = false;
/**
* Constructor
@@ -197,6 +201,15 @@ class XMPPHP_XMLStream {
return $this->lastid;
}
/**
* Set SSL
*
* @return integer
*/
public function useSSL($use=true) {
$this->use_ssl = $use;
}
/**
* Add ID Handler
*
@@ -247,9 +260,11 @@ class XMPPHP_XMLStream {
} else {
$conflag = STREAM_CLIENT_CONNECT;
}
$this->log->log("Connecting to tcp://{$this->host}:{$this->port}");
$conntype = 'tcp';
if($this->use_ssl) $conntype = 'ssl';
$this->log->log("Connecting to $conntype://{$this->host}:{$this->port}");
try {
$this->socket = @stream_socket_client("tcp://{$this->host}:{$this->port}", $errno, $errstr, $timeout, $conflag);
$this->socket = @stream_socket_client("$conntype://{$this->host}:{$this->port}", $errno, $errstr, $timeout, $conflag);
} catch (Exception $e) {
throw new XMPPHP_Exception($e->getMessage());
}