* @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 */ class Oscar_TLV_Status extends Oscar_TLV { /* Type / Identifier of this record */ const TYPE = 0x0006; const MAX_LENGTH = 0x04; const LENGTH = 0x04; /* Status-Types */ const STATUS_OFFLINE = -1; const STATUS_ONLINE = 0x0000; const STATUS_AWAY = 0x0001; const STATUS_DND = 0x0002; # const STATUS_DND = 0x0013; const STATUS_NA = 0x0004; # const STATUS_NA = 0x5; const STATUS_OCCUPIED = 0x0010; # const STATUS_OCCUPIED = 0x0011; const STATUS_FREEFORCHAT = 0x0020; const STATUS_INVISIBLE = 0x0100; /* Flags */ const FLAG_WEBAWAY = 0x0001; const FLAG_SHOWIP = 0x0002; const FLAG_BIRTHDAY = 0x0008; const FLAG_WEBFRONT = 0x0020; const FLAG_DCDISABLED = 0x0100; const FLAG_DCAUTH = 0x1000; const FLAG_DCCONT = 0x2000; public $Status = 0; public $Flags = 0; // {{{ __construct /** * @param object $Parent (optional) * @param int $Status (optional) * @param int $Flags (optional) * * @access public * @return void */ public function __construct (&$Parent = null, $Status = self::STATUS_ONLINE, $Flags = 0) { parent::__construct ($Parent, self::TYPE); $this->Status = $Status; $this->Flags = $Flags; } // }}} // {{{ parse /** * Parse packet * * @access public * @return void */ public function parse () { $this->Flags = Oscar_Common::str2int16 ($this->Data, 0, true); $this->Status = Oscar_Common::str2int16 ($this->Data, 0, true); // Check if we have to rewrite the status (due to unknown data) $Map = array ( 0x0013 => self::STATUS_DND, 0x0005 => self::STATUS_NA, 0x0011 => self::STATUS_OCCUPIED, ); // Rewrite the status if (isset ($Map [$this->Status])) $this->Status = $Map [$this->Status]; } // }}} // {{{ generate /** * @access public * @return string */ public function generate () { $this->Data = Oscar_Common::int16tostr ($this->Flags) . Oscar_Common::int16tostr ($this->Status); return parent::generate (); } // }}} } ?>