* @revision 04 * @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/tlv/helper/capability.php"); class OSCAR_Capability { protected $Parent = null; // {{{ __construct /** * Create a new Extension * * @param object $Parent (optional) Our parent OSCAR-Instance * * @access friendly * @return void */ function __construct ($Parent = null) { // Register in our parent class if (is_object ($this->Parent = $Parent)) $Parent->registerCapability ($this); } // }}} // {{{ getCapabilityID /** * Get the "human readable" capabilityID from this extension * * @access public * @return string */ public function getCapabilityID () { $c = get_class ($this); if (!defined ($k = $c . "::CAPABILITY")) return false; return constant ($k); } // }}} // {{{ matchGUID /** * Check if we can handle a given GUID * * @param string $GUID * * @access public * @return bool */ public function matchGUID ($GUID) { // Check if GUID is binary if (strlen ($GUID) == 16) $GUID = strtoupper (bin2hex ($GUID)); // Check wheter we have to clean up elseif (strlen ($GUID) != 32) $GUID = OSCAR_TLV_Helper_Capability::stripCapability ($GUID); // Compare with our own ID $GUIDs = $this->getCapabilityID (); if (!is_array ($GUIDs)) $GUIDs = array ($GUIDs); foreach ($GUIDs as $myGUID) if ($GUID == OSCAR_TLV_Helper_Capability::stripCapability ($myGUID)) return true; return false; } // }}} // {{{ handle /** * Handle an incoming message for this Extension * * @param object $Message The original Message * @param object $TLV_Data The DATA-TLV from TLVs * * @access public * @return void */ public function handle ($Message, $TLV_Data) { trigger_error ("Received Message to extension"); return false; } // }}} } ?>