diff --git a/lib/XmppPrebind.php b/lib/XmppPrebind.php index 76e4b18..d1fd8a2 100644 --- a/lib/XmppPrebind.php +++ b/lib/XmppPrebind.php @@ -38,32 +38,32 @@ class XmppPrebind { const SERVICE_NAME = 'xmpp'; - private $jabberHost = ''; - private $boshUri = ''; - private $resource = ''; + protected $jabberHost = ''; + protected $boshUri = ''; + protected $resource = ''; - private $debug = false; + protected $debug = false; /** * FirePHP Instance * * @var FirePHP */ - private $firePhp = null; + protected $firePhp = null; - private $useGzip = false; - private $useSsl = false; - private $encryption = self::ENCRYPTION_PLAIN; + protected $useGzip = false; + protected $useSsl = false; + protected $encryption = self::ENCRYPTION_PLAIN; - private $jid = ''; - private $password = ''; + protected $jid = ''; + protected $password = ''; - private $rid = ''; - private $sid = ''; + protected $rid = ''; + protected $sid = ''; - private $doSession = false; - private $doBind = false; + protected $doSession = false; + protected $doBind = false; - private $mechanisms = array(); + protected $mechanisms = array(); /** @@ -196,7 +196,7 @@ public function getSessionInfo() { * @param string $msg * @param string $label */ - private function debug($msg, $label = null) { + protected function debug($msg, $label = null) { if ($this->firePhp) { $this->firePhp->log($msg, $label); } @@ -207,7 +207,7 @@ private function debug($msg, $label = null) { * * @return string Response */ - private function sendRestart() { + protected function sendRestart() { $domDocument = $this->buildBody(); $body = self::getBodyFromDomDocument($domDocument); $body->appendChild(self::getNewTextAttribute($domDocument, 'to', $this->jabberHost)); @@ -237,7 +237,7 @@ private function sendRestart() { * * @return string Response */ - private function sendBindIfRequired() { + protected function sendBindIfRequired() { if ($this->doBind) { $domDocument = $this->buildBody(); $body = self::getBodyFromDomDocument($domDocument); @@ -265,7 +265,7 @@ private function sendBindIfRequired() { /** * Send session if there's a session node in the restart response (within stream:features) */ - private function sendSessionIfRequired() { + protected function sendSessionIfRequired() { if ($this->doSession) { $domDocument = $this->buildBody(); $body = self::getBodyFromDomDocument($domDocument); @@ -291,7 +291,7 @@ private function sendSessionIfRequired() { * * @return string Response */ - private function sendInitialConnection() { + protected function sendInitialConnection() { $domDocument = $this->buildBody(); $body = self::getBodyFromDomDocument($domDocument); @@ -311,7 +311,7 @@ private function sendInitialConnection() { * * @return string Challenge */ - private function sendChallenge() { + protected function sendChallenge() { $domDocument = $this->buildBody(); $body = self::getBodyFromDomDocument($domDocument); @@ -334,7 +334,7 @@ private function sendChallenge() { * @param Auth_SASL_Common $auth * @return string Auth XML to send */ - private function buildPlainAuth(Auth_SASL_Common $auth) { + protected function buildPlainAuth(Auth_SASL_Common $auth) { $authString = $auth->getResponse(self::getNodeFromJid($this->jid), $this->password, self::getBareJidFromJid($this->jid)); $authString = base64_encode($authString); $this->debug($authString, 'PLAIN Auth String'); @@ -357,7 +357,7 @@ private function buildPlainAuth(Auth_SASL_Common $auth) { * @param Auth_SASL_Common $auth * @return string Auth XML to send */ - private function sendChallengeAndBuildDigestMd5Auth(Auth_SASL_Common $auth) { + protected function sendChallengeAndBuildDigestMd5Auth(Auth_SASL_Common $auth) { $challenge = $this->sendChallenge(); $authString = $auth->getResponse(self::getNodeFromJid($this->jid), $this->password, $challenge, $this->jabberHost, self::SERVICE_NAME); @@ -386,7 +386,7 @@ private function sendChallengeAndBuildDigestMd5Auth(Auth_SASL_Common $auth) { * @param Auth_SASL_Common $auth * @return string Auth XML to send */ - private function sendChallengeAndBuildCramMd5Auth(Auth_SASL_Common $auth) { + protected function sendChallengeAndBuildCramMd5Auth(Auth_SASL_Common $auth) { $challenge = $this->sendChallenge(); $authString = $auth->getResponse(self::getNodeFromJid($this->jid), $this->password, $challenge); @@ -412,7 +412,7 @@ private function sendChallengeAndBuildCramMd5Auth(Auth_SASL_Common $auth) { * CRAM-MD5 and DIGEST-MD5 reply with an additional challenge response which must be replied to. * After this additional reply, the server should reply with "success". */ - private function replyToChallengeResponse($challengeResponse) { + protected function replyToChallengeResponse($challengeResponse) { $body = self::getBodyFromXml($challengeResponse); $challenge = base64_decode((string)$body->firstChild->nodeValue); if (strpos($challenge, 'rspauth') === false) { @@ -435,7 +435,7 @@ private function replyToChallengeResponse($challengeResponse) { * @param string $xml * @return string Response */ - private function send($xml) { + protected function send($xml) { $ch = curl_init($this->boshUri); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); @@ -500,7 +500,7 @@ public static function compatibleGzInflate($gzData) { * * @return DOMDocument */ - private function buildBody() { + protected function buildBody() { $xml = new DOMDocument('1.0', 'UTF-8'); $body = $xml->createElement('body'); @@ -554,7 +554,7 @@ public static function getNodeFromJid($jid) { * @param string $value * @return DOMNode */ - private static function getNewTextAttribute($domDocument, $attributeName, $value) { + protected static function getNewTextAttribute($domDocument, $attributeName, $value) { $attribute = $domDocument->createAttribute($attributeName); $attribute->appendChild($domDocument->createTextNode($value)); @@ -567,7 +567,7 @@ private static function getNewTextAttribute($domDocument, $attributeName, $value * @param DOMDocument $domDocument * @return DOMNode */ - private static function getBodyFromDomDocument($domDocument) { + protected static function getBodyFromDomDocument($domDocument) { $body = $domDocument->getElementsByTagName('body'); return $body->item(0); } @@ -579,7 +579,7 @@ private static function getBodyFromDomDocument($domDocument) { * @param string $xml * @return DOMNode */ - private static function getBodyFromXml($xml) { + protected static function getBodyFromXml($xml) { $domDocument = new DOMDocument(); $domDocument->loadXml($xml); @@ -592,7 +592,7 @@ private static function getBodyFromXml($xml) { * * @return int */ - private function getAndIncrementRid() { + protected function getAndIncrementRid() { return $this->rid++; }