* @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 */ /** * 0x0005 client Request user info * 0x0007 client Watcher sub request * 0x0008 server Watcher notification * 0x0009 client Update directory info request * 0x000A server Update directory info reply * 0x000B client Query for SNAC(02,0C) * 0x000C server Reply to SNAC(02,0B) * 0x000F client Update user directory interests * 0x0010 server Update user directory interests reply */ require_once ("oscar/snac/helper/tlv.php"); require_once ("oscar/snac/helper/error.php"); class Oscar_SNAC_Locate extends Oscar_SNAC { const SNAC_FAMILY = 0x0002; const SNAC_VERSION = 0x0001; const SNAC_TOOLID = 0x0110; const SNAC_TOOL_VERSION = 0x164F; } class Oscar_SNAC_Locate_Error extends Oscar_SNAC_Helper_Error { /* About this class */ const SNAC_FAMILY = 0x0002; const SNAC_SERVICE = 0x0001; } class Oscar_SNAC_Locate_Request extends Oscar_SNAC { /* About this class */ const SNAC_FAMILY = 0x0002; const SNAC_SERVICE = 0x0002; } class Oscar_SNAC_Locate_Response extends Oscar_SNAC_Helper_TLV { /* About this class */ const SNAC_FAMILY = 0x0002; const SNAC_SERVICE = 0x0003; } class Oscar_SNAC_Locate_Info extends Oscar_SNAC_Helper_TLV { /* About this class */ const SNAC_FAMILY = 0x0002; const SNAC_SERVICE = 0x0004; // {{{ __construct /** * Constructor of this SNAC * * @param object $Parent (optional) * @param array $Capabilities (optional) * * @access public * @return void */ public function __construct ($Parent = null, $Capabilities = array ()) { parent::__construct ($Parent); if (count ($Capabilities) > 0) { $TLV = new Oscar_TLV_Locate_Capability; foreach ($Capabilities as $Capa) $TLV->addCapability ($Capa); $this->TLVs [] = $TLV; } } // }}} // {{{ setMessage /** * Set Away-Message * * @param string $Message * * @access public * @return void */ public function setMessage ($Message) { // Setup MIME-Type if (!is_object ($TLV = self::findTLV (Oscar_TLV_Unavailable_Type::TYPE))) self::addTLV (new Oscar_TLV_Unavailable_Type ($this->Parent, "text/plain; charset=utf-8")); else $TLV->ContentType = "text/plain; charset=utf-8"; // Set the message if (!is_object ($TLV = self::findTLV (Oscar_TLV_Unavailable_Data::TYPE))) self::addTLV (new Oscar_TLV_Unavailable_Data ($this->Parent, $Message)); else $TLV->Message = $Message; } // }}} } class Oscar_SNAC_Locate_User_Info_Reply extends Oscar_SNAC_Helper_TLV { /* About this class */ const SNAC_FAMILY = 0x0002; const SNAC_SERVICE = 0x0006; public $Username = ""; public $WarnLevel = 0; // {{{ parse /** * Parse all data in this SNAC * * @access public * @return void */ public function parse () { $this->Prefered_TLV_Types = array ( "Oscar_TLV_DC_Info", "Oscar_TLV_IPAddr", "Oscar_TLV_Status", "Oscar_TLV_RegistrationTime", "Oscar_TLV_Unavailable_Type", "Oscar_TLV_Unavailable_Data", ); // This is a generic type self::parseBuddyInfo (); parent::parse (); if (is_object ($this->Parent)) { $MSG = null; $Type = null; foreach ($this->TLVs as $TLV) if ($TLV instanceof Oscar_TLV_Unavailable_Data) $MSG = $TLV; elseif ($TLV instanceof Oscar_TLV_Unavailable_Type) $Type = $TLV; if (is_object ($MSG)) $this->Parent->receiveAwayMessage ($this->Username, $MSG->Message, (is_object ($Type) ? $Type->ContentType : "text/plain")); } } // }}} } class Oscar_SNAC_Locate_Query_User_Info extends Oscar_SNAC { /* About this class */ const SNAC_FAMILY = 0x0002; const SNAC_SERVICE = 0x0015; /* Query types */ const QUERY_SIGNATURE = 0x00000001; const QUERY_AWAYMESSAGE = 0x00000002; const QUERY_CAPABILITY = 0x00000004; const QUERY_CERTS = 0x00000008; const QUERY_HTMLINFO = 0x00000400; /* Informations on this SNAC */ public $Query = 0; public $Username = ""; // {{{ parse /** * @access public * @return void */ public function parse () { // Get the query-type $this->Query = OSCAR_Common::str2int32 ($this->Data, 0, true); // Get the Username $this->Username = OSCAR_Common::string08 ($this->Data, 0, true); } // }}} // {{{ generate /** * Create string-representation of this class * * @access public * @return string */ public function generate () { $this->Data = OSCAR_Common::int32tostr ($this->Query) . OSCAR_Common::int8tostr (strlen ($this->Username)) . $this->Username; return parent::generate (); } // }}} } ?>