* @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 */ /** * Handle SNAC-Errors * * @class SNAC_Helper_Error **/ class Oscar_SNAC_Helper_Error extends Oscar_SNAC { public $Code = 0; public $Subcode = 0; // {{{ parse /** * Parse this error * * @access public * @return void */ public function parse () { $this->Code = Oscar_Common::str2int16 ($this->Data, 0, true); if ($this->Data != "") { $TLV = Oscar_TLV::parseTLV ($this->Data); $this->Subcode = Oscar_Common::str2int16 ($TLV->Data); } print "Got Stream-Error: " . self::toString () . "\n"; } // }}} // {{{ generate /** * Generate raw packet for transmission * * @access public * @return string */ public function generate () { $this->Data = Oscar_Common::int16tostr ($this->Code); if ($this->Subcode != 0) { $TLV = new Oscar_TLV ($this->Parent, 0x0008, Oscar_Common::int16tostr ($this->Subcode)); $this->Data .= $TLV->generate (); } return parent::generate (); } // }}} // {{{ toString /** * Get descriptive error * * @access public * @return string */ public function toString () { switch ($this->Code) { case 0x01: return "Invalid SNAC Header"; case 0x02: return "Server rate limit exceeded"; case 0x03: return "Client rate limit exceeded"; case 0x04: return "Recipient is not logged in"; case 0x05: return "Requested service unavailable"; case 0x06: return "Requested service not defined"; case 0x07: return "You sent obsolete SNAC"; case 0x08: return "Not supported by server"; case 0x09: return "Not supported by client"; case 0x0A: return "Refused by client"; case 0x0B: return "Reply too big"; case 0x0C: return "Responses lost"; case 0x0D: return "Request denied"; case 0x0E: return "Incorrect SNAC format"; case 0x0F: return "Insufficient rights"; case 0x10: return "In local permit/deny (recipient blocked)"; case 0x11: return "Sender too evil"; case 0x12: return "Receiver too evil"; case 0x13: return "User temporarily unavailable"; case 0x14: return "No match"; case 0x15: return "List overflow"; case 0x16: return "Request ambiguous"; case 0x17: return "Server queue full"; case 0x18: return "Not while on AOL"; default: return "Unknown Error"; } } // }}} } ?>