* added support for SASL-ANONYMOUS
* changed BOSH session serialization git-svn-id: svn://netflint.net/xmpphp@59 ef36c318-a008-4979-b6e8-6b496270793b
This commit is contained in:
parent
756afc45a4
commit
454b0e0b7e
@ -169,18 +169,18 @@ class XMPPHP_BOSH extends XMPPHP_XMPP {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function loadSession() {
|
public function loadSession() {
|
||||||
if(isset($_SESSION['XMPPHP_BOSH']) and is_array($_SESSION['XMPPHP_BOSH'])) {
|
if(isset($_SESSION['XMPPHP_BOSH_RID'])) $this->rid = $_SESSION['XMPPHP_BOSH_RID'];
|
||||||
foreach($_SESSION['XMPPHP_BOSH'] as $key => $value) {
|
if(isset($_SESSION['XMPPHP_BOSH_SID'])) $this->sid = $_SESSION['XMPPHP_BOSH_SID'];
|
||||||
#print "Loading $key as $value<br/>";
|
if(isset($_SESSION['XMPPHP_BOSH_authed'])) $this->authed = $_SESSION['XMPPHP_BOSH_authed'];
|
||||||
$this->$key = $value;
|
if(isset($_SESSION['XMPPHP_BOSH_jid'])) $this->jid = $_SESSION['XMPPHP_BOSH_jid'];
|
||||||
}
|
if(isset($_SESSION['XMPPHP_BOSH_fulljid'])) $this->fulljid = $_SESSION['XMPPHP_BOSH_fulljid'];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function saveSession() {
|
public function saveSession() {
|
||||||
$_SESSION['XMPPHP_BOSH'] = Array();
|
$_SESSION['XMPPHP_BOSH_RID'] = (string) $this->rid;
|
||||||
$_SESSION['XMPPHP_BOSH']['rid'] = (string) $this->rid;
|
$_SESSION['XMPPHP_BOSH_SID'] = (string) $this->sid;
|
||||||
$_SESSION['XMPPHP_BOSH']['sid'] = (string) $this->sid;
|
$_SESSION['XMPPHP_BOSH_authed'] = (boolean) $this->authed;
|
||||||
$_SESSION['XMPPHP_BOSH']['authed'] = (boolean) $this->authed;
|
$_SESSION['XMPPHP_BOSH_jid'] = (string) $this->jid;
|
||||||
|
$_SESSION['XMPPHP_BOSH_fulljid'] = (string) $this->fulljid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,11 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
|
|||||||
$this->send("<iq xmlns=\"jabber:client\" type=\"set\" id=\"$id\"><bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\"><resource>{$this->resource}</resource></bind></iq>");
|
$this->send("<iq xmlns=\"jabber:client\" type=\"set\" id=\"$id\"><bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\"><resource>{$this->resource}</resource></bind></iq>");
|
||||||
} else {
|
} else {
|
||||||
$this->log->log("Attempting Auth...");
|
$this->log->log("Attempting Auth...");
|
||||||
|
if ($this->password) {
|
||||||
$this->send("<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>" . base64_encode("\x00" . $this->user . "\x00" . $this->password) . "</auth>");
|
$this->send("<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>" . base64_encode("\x00" . $this->user . "\x00" . $this->password) . "</auth>");
|
||||||
|
} else {
|
||||||
|
$this->send("<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='ANONYMOUS'/>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,6 +286,8 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream {
|
|||||||
if($xml->attrs['type'] == 'result') {
|
if($xml->attrs['type'] == 'result') {
|
||||||
$this->log->log("Bound to " . $xml->sub('bind')->sub('jid')->data);
|
$this->log->log("Bound to " . $xml->sub('bind')->sub('jid')->data);
|
||||||
$this->fulljid = $xml->sub('bind')->sub('jid')->data;
|
$this->fulljid = $xml->sub('bind')->sub('jid')->data;
|
||||||
|
$jidarray = explode('/',$this->fulljid);
|
||||||
|
$this->jid = $jidarray[0];
|
||||||
}
|
}
|
||||||
$id = $this->getId();
|
$id = $this->getId();
|
||||||
$this->addIdHandler($id, 'session_start_handler');
|
$this->addIdHandler($id, 'session_start_handler');
|
||||||
|
Loading…
Reference in New Issue
Block a user