Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
Switch private variables and method to protected to allow class exten…
Browse files Browse the repository at this point in the history
…ding
  • Loading branch information
Piotr committed Jul 1, 2012
1 parent 3731b7a commit dc87417
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions lib/XmppPrebind.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();


/**
Expand Down Expand Up @@ -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);
}
Expand All @@ -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));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -291,7 +291,7 @@ private function sendSessionIfRequired() {
*
* @return string Response
*/
private function sendInitialConnection() {
protected function sendInitialConnection() {
$domDocument = $this->buildBody();
$body = self::getBodyFromDomDocument($domDocument);

Expand All @@ -311,7 +311,7 @@ private function sendInitialConnection() {
*
* @return string Challenge
*/
private function sendChallenge() {
protected function sendChallenge() {
$domDocument = $this->buildBody();
$body = self::getBodyFromDomDocument($domDocument);

Expand All @@ -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');
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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) {
Expand All @@ -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);
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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));

Expand All @@ -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);
}
Expand All @@ -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);

Expand All @@ -592,7 +592,7 @@ private static function getBodyFromXml($xml) {
*
* @return int
*/
private function getAndIncrementRid() {
protected function getAndIncrementRid() {
return $this->rid++;
}

Expand Down

0 comments on commit dc87417

Please sign in to comment.