* @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_ICBM_Notifycation extends Oscar_SNAC_ICBM_Message_Server_ACK { /* About this class */ const SNAC_FAMILY = 0x0004; const SNAC_SERVICE = 0x0014; /* Types of this class */ const EVENT_NONE = 0x0000; const EVENT_TYPED = 0x0001; const EVENT_TYPING = 0x0002; const EVENT_CLOSED = 0x000F; public $Type = 0x0000; // {{{ parse /** * @access public * @return void */ public function parse () { // Parse the packet parent::parse (); $this->Type = Oscar_Common::str2int16 ($this->Data, 0, true); // Forward the event if (!is_object ($Parent = self::getOSCAR ()) || !is_object ($Roster = $Parent->getRoster ()) || !is_object ($Contact = $Roster->getContact ($this->Username))) return; switch ($this->Type) { case self::EVENT_NONE: $Contact->typingStopped (); break; case self::EVENT_TYPED: $Contact->typingPaused (); break; case self::EVENT_TYPING: $Contact->typingStarted (); break; case self::EVENT_CLOSED: $Contact->typingEnded (); break; } } // }}} // {{{ generate /** * Generate a new message * * @access public * @return string */ public function generate () { $this->Data = $this->Cookie . Oscar_Common::int16tostr ($this->Channel) . Oscar_Common::int8tostr (strlen ($this->Username)) . $this->Username . Oscar_Common::int16tostr ($this->Type); return Oscar_SNAC::generate (); } // }}} } ?>