* @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 */ /** * 0x0014 client Grant future authorization to client */ require_once ("oscar/snac/helper/tlv.php"); require_once ("oscar/snac/helper/uin.php"); require_once ("oscar/snac/helper/error.php"); require_once ("oscar/snac/feedbag/items.php"); require_once ("oscar/snac/feedbag/reply.php"); require_once ("oscar/snac/feedbag/insert.php"); require_once ("oscar/snac/feedbag/remove.php"); require_once ("oscar/snac/feedbag/update.php"); require_once ("oscar/snac/feedbag/authrequest.php"); require_once ("oscar/snac/feedbag/selfremove.php"); class Oscar_SNAC_SSI extends Oscar_SNAC { const SNAC_FAMILY = 0x0013; const SNAC_VERSION = 0x0004; const SNAC_TOOLID = 0x0110; const SNAC_TOOL_VERSION = 0x164F; } class Oscar_SNAC_SSI_Error extends Oscar_SNAC_Helper_Error { /* About this class */ const SNAC_FAMILY = 0x0013; const SNAC_SERVICE = 0x0001; } class Oscar_SNAC_SSI_Request extends Oscar_SNAC { /* About this class */ const SNAC_FAMILY = 0x0013; const SNAC_SERVICE = 0x0002; } class Oscar_SNAC_SSI_Response extends Oscar_SNAC_Helper_TLV { /* About this class */ const SNAC_FAMILY = 0x0013; const SNAC_SERVICE = 0x0003; } class Oscar_SNAC_SSI_Request_Roster extends Oscar_SNAC { /* About this class */ const SNAC_FAMILY = 0x0013; const SNAC_SERVICE = 0x0004; } class Oscar_SNAC_SSI_Checkout extends Oscar_SNAC { /* About this class */ const SNAC_FAMILY = 0x0013; const SNAC_SERVICE = 0x0005; public $ModTime = 0; public $Counter = 0; // {{{ parse /** * Parse contents of incoming packet * * @access public * @return void */ public function parse () { $this->ModTime = Oscar_Common::str2int32 ($this->Data, 0, true); $this->Counter = Oscar_Common::str2int16 ($this->Data, 0, true); } // }}} // {{{ generate /** * Generate this SNAC-Packet * * @access public * @return string */ public function generate () { $this->Data = Oscar_Common::int32tostr ($this->ModTime) . Oscar_Common::int16tostr ($this->Counter); return parent::generate (); } // }}} } class Oscar_SNAC_SSI_Active extends Oscar_SNAC { /* About this class */ const SNAC_FAMILY = 0x0013; const SNAC_SERVICE = 0x0007; } class Oscar_SNAC_SSI_Roster_Transaction_Reply extends Oscar_SNAC { /* About this class */ const SNAC_FAMILY = 0x0013; const SNAC_SERVICE = 0x000E; /* Reply-types */ const REPLY_SUCCESS = 0x0000; const REPLY_UPDATE_NOTFOUND = 0x0002; const REPLY_ADD_EXISTS = 0x0003; const REPLY_ADD_ERROR = 0x000A; const REPLY_ADD_LIMIT = 0x000C; const REPLY_ADD_INVALID_PROTO = 0x000D; const REPLY_ADD_AUTHFAIL = 0x000E; public $Replies = array (); // {{{ parse /** * Parse response from server * * @access public * @return void */ public function parse () { // Reset replies $this->Replies = array (); // Parse replies on this SNAC while ($this->Data != "") $this->Replies [] = Oscar_Common::str2int16 ($this->Data, 0, true); // Forward the replies to our roster if (is_object ($Parent = self::getOSCAR ()) && is_object ($Roster = $Parent->getRoster ()) && is_object ($Transaction = $Roster->getLocalTransaction ())) $Transaction->reply ($this->Replies); } // }}} } class Oscar_SNAC_SSI_Unchanged extends Oscar_SNAC { /* About this class */ const SNAC_FAMILY = 0x0013; const SNAC_SERVICE = 0x000F; } class Oscar_SNAC_SSI_Roster_Start_Transaction extends Oscar_SNAC { /* About this SNAC */ const SNAC_FAMILY = 0x0013; const SNAC_SERVICE = 0x0011; public $Import = false; // {{{ parse /** * Parse response from server * * @access public * @return void */ public function parse () { $this->Import = (Oscar_Common::str2int32 ($this->Data, 0) == 0x00010000); if (is_object ($Parent = self::getOSCAR ()) && is_object ($Roster = $Parent->getRoster ()) && is_object ($Transaction = $Roster->getLocalTransaction ())) $Transaction->start (); } // }}} // {{{ generate /** * Prepare this SNAC to be submitted * * @access public * @return string */ public function generate () { if ($this->Import) $this->Data = Oscar_Common::int32tostr (0x00010000); else $this->Data = ""; return parent::generate (); } // }}} } class Oscar_SNAC_SSI_Roster_Finish_Transaction extends Oscar_SNAC { /* About this SNAC */ const SNAC_FAMILY = 0x0013; const SNAC_SERVICE = 0x0012; // {{{ parse /** * Parse response from server * * @access public * @return void */ public function parse () { if (is_object ($Parent = self::getOSCAR ()) && is_object ($Roster = $Parent->getRoster ()) && is_object ($Transaction = $Roster->getLocalTransaction ())) $Transaction->finishTransaction (); } // }}} // {{{ generate /** * Prepare this SNAC to be submitted * * @access public * @return string */ public function generate () { $this->Data = ""; return parent::generate (); } // }}} } class Oscar_SNAC_SSI_Grant_Future_Authorization extends Oscar_SNAC_Helper_UIN { /* About this SNAC */ const SNAC_FAMILY = 0x0013; const SNAC_SERVICE = 0x0014; public $Reason = ""; // {{{ parse /** * Parse response from server * * @access public * @return void */ public function parse () { // Parse the UIN-Part parent::parse (); // Get the reason-string from SNAC $this->Reason = Oscar_Common::string16 ($this->Data, 0, true); // Make sure that there is no data left $this->Data = ""; } // }}} // {{{ generate /** * Prepare this packet for submission * * @access public * @return string */ public function generate () { $this->Data = Oscar_Common::toString16 ($this->Reason); return parent::generate (); } // }}} } class Oscar_SNAC_SSI_Future_Authorization extends Oscar_SNAC_SSI_Grant_Future_Authorization { /* About this SNAC */ const SNAC_FAMILY = 0x0013; const SNAC_SERVICE = 0x0015; /** * This one is very similar to SNAC_SSI_Grant_Future_Authorization and is mostly * handled there **/ // {{{ parse /** * Parse this SNAC and run callbacks * * @access public * @return void */ public function parse () { // Parse this SNAC parent::parse (); // Try to run callbacks if (is_object ($this->Parent)) $this->Parent->authorizationReply ($this->Username, $this->Reason, $this->Accepted, true); } // }}} } /** * Request the authorization from another entity to add it to our roster * * @remark Use this if you want to add someone else * * @class SNAC_SSI_Request_Authorization **/ class Oscar_SNAC_SSI_Request_Authorization extends Oscar_SNAC_SSI_Grant_Future_Authorization { /* About this SNAC */ const SNAC_FAMILY = 0x0013; const SNAC_SERVICE = 0x0018; } /** * Grant or deny authorization after an incoming SNAC_SSI_Authorization_Request * * @class SNAC_SSI_Reply_Authorization **/ class Oscar_SNAC_SSI_Reply_Authorization extends Oscar_SNAC_Helper_UIN { /* About this SNAC */ const SNAC_FAMILY = 0x0013; const SNAC_SERVICE = 0x001A; public $Reason = ""; public $Accepted = false; // {{{ parse /** * Parse response from server * * @access public * @return void */ public function parse () { // Parse the UIN-Part parent::parse (); // Parse the accept-flag $this->Accepted = (Oscar_Common::str2int8 ($this->Data, 0, true) == 1); // Get the reason-string from SNAC $this->Reason = Oscar_Common::string16 ($this->Data, 0, true); // Make sure that there is no data left $this->Data = ""; } // }}} // {{{ generate /** * Prepare this packet for submission * * @access public * @return string */ public function generate () { $this->Data = Oscar_Common::int8tostr ($this->Accepted ? 1 : 0) . Oscar_Common::toString16 ($this->Reason); return parent::generate (); } // }}} } /** * This SNAC is received when someone authorizes or rejects an authorization-request * * @class SNAC_SSI_Authorization_Reply **/ class Oscar_SNAC_SSI_Authorization_Reply extends Oscar_SNAC_SSI_Reply_Authorization { /* About this SNAC */ const SNAC_FAMILY = 0x0013; const SNAC_SERVICE = 0x001B; /** * This is just the same as SNAC_SSI_Reply_Authorization but sent by * the server to us **/ // {{{ parse /** * Parse this SNAC and run callbacks * * @access public * @return void */ public function parse () { // Parse this SNAC parent::parse (); // Try to run callbacks if (is_object ($this->Parent)) $this->Parent->authorizationReply ($this->Username, $this->Reason, $this->Accepted, false); } // }}} } /** * This SNAC is received when someone else adds you to his roster * * @remark This SNAC just carries the UIN of the entity to remove from * Everything is done in SNAC_UIN * @class SNAC_SSI_Added */ class Oscar_SNAC_SSI_Added extends Oscar_SNAC_Helper_UIN { /* About this SNAC */ const SNAC_FAMILY = 0x0013; const SNAC_SERVICE = 0x001C; // {{{ parse /** * Parse this SNAC and run callbacks * * @access public * @return void */ public function parse () { // Parse this SNAC parent::parse (); // Try to run callbacks if (is_object ($this->Parent)) $this->Parent->remoteRosterUpdate ($this->Username); } // }}} } ?>