diff --git a/XMPPHP/BOSH.php b/XMPPHP/BOSH.php index 653bbf6..d43a48e 100644 --- a/XMPPHP/BOSH.php +++ b/XMPPHP/BOSH.php @@ -169,18 +169,18 @@ class XMPPHP_BOSH extends XMPPHP_XMPP { } public function loadSession() { - if(isset($_SESSION['XMPPHP_BOSH']) and is_array($_SESSION['XMPPHP_BOSH'])) { - foreach($_SESSION['XMPPHP_BOSH'] as $key => $value) { - #print "Loading $key as $value
"; - $this->$key = $value; - } - } + if(isset($_SESSION['XMPPHP_BOSH_RID'])) $this->rid = $_SESSION['XMPPHP_BOSH_RID']; + if(isset($_SESSION['XMPPHP_BOSH_SID'])) $this->sid = $_SESSION['XMPPHP_BOSH_SID']; + if(isset($_SESSION['XMPPHP_BOSH_authed'])) $this->authed = $_SESSION['XMPPHP_BOSH_authed']; + 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() { - $_SESSION['XMPPHP_BOSH'] = Array(); - $_SESSION['XMPPHP_BOSH']['rid'] = (string) $this->rid; - $_SESSION['XMPPHP_BOSH']['sid'] = (string) $this->sid; - $_SESSION['XMPPHP_BOSH']['authed'] = (boolean) $this->authed; + $_SESSION['XMPPHP_BOSH_RID'] = (string) $this->rid; + $_SESSION['XMPPHP_BOSH_SID'] = (string) $this->sid; + $_SESSION['XMPPHP_BOSH_authed'] = (boolean) $this->authed; + $_SESSION['XMPPHP_BOSH_jid'] = (string) $this->jid; + $_SESSION['XMPPHP_BOSH_fulljid'] = (string) $this->fulljid; } } diff --git a/XMPPHP/XMPP.php b/XMPPHP/XMPP.php index 780aec6..0d5369b 100644 --- a/XMPPHP/XMPP.php +++ b/XMPPHP/XMPP.php @@ -246,7 +246,11 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream { $this->send("{$this->resource}"); } else { $this->log->log("Attempting Auth..."); + if ($this->password) { $this->send("" . base64_encode("\x00" . $this->user . "\x00" . $this->password) . ""); + } else { + $this->send(""); + } } } @@ -282,6 +286,8 @@ class XMPPHP_XMPP extends XMPPHP_XMLStream { if($xml->attrs['type'] == 'result') { $this->log->log("Bound to " . $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(); $this->addIdHandler($id, 'session_start_handler');