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;
}
}