* @revision 03 * @license http://creativecommons.org/licenses/by-sa/3.0/de/ Creative Commons Attribution-Share Alike 3.0 Germany * @homepage http://oss.tiggerswelt.net/oscar/ * @copyright Copyright © 2009 tiggersWelt.net */ require_once ("oscar/snac/helper/tlv.php"); class Oscar_SNAC_Auth_LoginReply extends Oscar_SNAC_Helper_TLV { const SNAC_FAMILY = 0x0017; const SNAC_SERVICE = 0x0003; // {{{ getTLVClasses /** * Retrive a list of prefered TLV-Types for this SNAC * * @access protected * @return array */ protected function getTLVClasses () { return array ( "Oscar_TLV_Logon_Username", "Oscar_TLV_Logon_Server", "Oscar_TLV_Logon_Cookie", "Oscar_TLV_Logon_Error", ); } // }}} // {{{ isSuccess /** * Check wheter login-attemp was successful * * @access public * @return bool **/ public function isSuccess () { if (!is_object ($Error = parent::findTLV ('Oscar_TLV_Logon_Error'))) return true; if ($Error->Value != 0x1C) return false; return ($this->getServer () !== false); } // }}} // {{{ getServer /** * Retrive the hostname to connect to * * @access public * @return string **/ public function getServer () { if (!is_object ($TLV = parent::findTLV ("Oscar_TLV_Logon_Server"))) return false; return $TLV->Hostname; } // }}} // {{{ getPort /** * Retrive the port to connect to * * @access public * @return int **/ public function getPort () { if (!is_object ($TLV = parent::findTLV ("Oscar_TLV_Logon_Server"))) return false; return $TLV->Port; } // }}} // {{{ getCookie /** * Retrive the cookie to authenticate to BOS with * * @access public * @return string **/ public function getCookie () { if (!is_object ($TLV = parent::findTLV ("Oscar_TLV_Logon_Cookie"))) return false; return $TLV; } // }}} } ?>