..
Author: abhinavsingh
Exemple #1
0
 public function wait_for_sasl_response($event, $args)
 {
     switch ($event) {
         case "stanza_cb":
             $stanza = $args[0];
             if ($stanza->name == 'failure' && $stanza->ns == XMPP::NS_SASL) {
                 $reason = $stanza->children[0]->name;
                 //JAXLLogger::debug("sasl failed with reason ".$reason."");
                 $this->handle_auth_failure($reason);
                 return "logged_out";
             } elseif ($stanza->name == 'challenge' && $stanza->ns == XMPP::NS_SASL) {
                 $challenge = $stanza->text;
                 $this->send_challenge_response($challenge);
                 return "wait_for_sasl_response";
             } elseif ($stanza->name == 'success' && $stanza->ns == XMPP::NS_SASL) {
                 $this->xml->reset_parser();
                 $this->send_start_stream($this->jid);
                 return "wait_for_stream_start";
             } else {
                 JAXLLogger::debug("got unhandled sasl response");
             }
             return "wait_for_sasl_response";
             break;
         default:
             JAXLLogger::debug("uncatched {$event}");
             return $this->handle_other($event, $args);
             //return array("wait_for_sasl_response", 0);
             break;
     }
 }
 function test_xml_stream_callbacks()
 {
     $xml = new JAXLXmlStream();
     $xml->set_callback(array(&$this, "xml_start_cb"), array(&$this, "xml_end_cb"), array(&$this, "xml_stanza_cb"));
     $xml->parse('<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client">');
     $xml->parse('<features>');
     $xml->parse('<mechanisms>');
     $xml->parse('</mechanisms>');
     $xml->parse('</features>');
     $xml->parse('</stream:stream>');
 }