TLVs as $TLV) { print $TLV->toString () . "\n"; if ($TLV instanceof OSCAR_TLV_Rendezvous_ServiceData) { $TLV2711 = $TLV; $myData = $TLV->Data; break; } } // Parse the data if (($Data->Service != Oscar_Common::toGUID (OSCAR_TLV_Helper_Capability::AIM_FILETRANSFER_SEND)) || ($Data->State != Oscar_TLV_Rendezvous::STATE_PROPOSE)) { print "Filetransfer discarded\n\n"; return; } $Subtype = Oscar_common::str2int16 ($myData, 0, true); $Count = Oscar_common::str2int16 ($myData, 0, true); $Size = Oscar_common::str2int32 ($myData, 0, true); $Files = array (); for ($f = 0; $f < $Count; $f++) { for ($p = 0; $p < strlen ($myData); $p++) if ($myData [$p] == chr (0)) break; $Files [$f] = substr ($myData, 0, $p); $myData = substr ($myData, $p + 1); if ($myData == "") break; } # TODO: Accept the transfer $this->acceptTransfer ($Message->Username, $Message->Cookie); } // }}} // {{{ acceptTransfer /** * Accept an incoming transfer * * @param string $From * @param string $Cookie * * @access public * @return bool **/ public function acceptTransfer ($From, $Cookie) { return self::respond ($From, $Cookie, Oscar_TLV_Rendezvous::STATE_ACCEPT); } // }}} // {{{ rejectTransfer /** * Accept an incoming transfer * * @param string $From * @param string $Cookie * * @access public * @return bool **/ public function rejectTransfer ($From, $Cookie) { return self::respond ($From, $Cookie, Oscar_TLV_Rendezvous::STATE_CANCEL); } // }}} // {{{ respond /** * Generate a response to an incoming file-transfer * * @param string $From * @param string $Cookie * @param enum $State * * @access private * @return bool **/ private function respond ($From, $Cookie, $State) { // Create a new Message $SNAC = new Oscar_SNAC_ICBM_Message ($this->Parent); $SNAC->Cookie = $Cookie; $SNAC->Channel = 0x0002; $SNAC->Username = $From; // Create Rendezvous-TLV $TLV = new Oscar_TLV_Rendezvous ($this->Parent); $TLV->State = $State; $TLV->Cookie = $Cookie; $TLV->Service = Oscar_Common::toGUID (OSCAR_TLV_Helper_Capability::AIM_FILETRANSFER_RECV); // Append TLV to message and submit $SNAC->addTLV ($TLV); return $SNAC->writeFLAP (); } // }}} } ?>