TLVs as $TLV) { print $TLV->toString () . "\n"; if ($TLV instanceof OSCAR_TLV_Rendezvous_ServiceData) { $myData = $TLV->Data; break; } } // Parse the data $Block1 = OSCAR_Common::string16 ($myData, 0, true, true); $Block2 = OSCAR_Common::string16 ($myData, 0, true, true); // This is just guessed /** * 0x01 MTYPE_PLAIN Plain text (simple) message * 0x02 MTYPE_CHAT Chat request message * 0x03 MTYPE_FILEREQ File request / file ok message * 0x04 MTYPE_URL URL message (0xFE formatted) * 0x06 MTYPE_AUTHREQ Authorization request message (0xFE formatted) * 0x07 MTYPE_AUTHDENY Authorization denied message (0xFE formatted) * 0x08 MTYPE_AUTHOK Authorization given message (empty) * 0x09 MTYPE_SERVER Message from OSCAR server (0xFE formatted) * 0x0C MTYPE_ADDED "You-were-added" message (0xFE formatted) * 0x0D MTYPE_WWP Web pager message (0xFE formatted) * 0x0E MTYPE_EEXPRESS Email express message (0xFE formatted) * 0x13 MTYPE_CONTACTS Contact list message * 0x1A MTYPE_PLUGIN Plugin message described by text string * 0xE8 MTYPE_AUTOAWAY Auto away message * 0xE9 MTYPE_AUTOBUSY Auto occupied message * 0xEA MTYPE_AUTONA Auto not available message * 0xEB MTYPE_AUTODND Auto do not disturb message * 0xEC MTYPE_AUTOFFC Auto free for chat message */ $Type = OSCAR_Common::str2int8 ($myData, 0, true); /** * 0x01 MFLAG_NORMAL Normal message * 0x03 MFLAG_AUTO Auto-message flag * 0x80 MFLG_MULTI This is multiple recipients message */ $Flag = OSCAR_Common::str2int8 ($myData, 0, true); $Status = OSCAR_Common::str2int16 ($myData, 0, true, true); $Priority = OSCAR_Common::str2int16 ($myData, 0, true, true); // This is experimental stuff $addMessage1 = Oscar_Common::string16 ($myData, 0, true, true); $addMessage2 = Oscar_Common::string16 ($myData, 0, true, true); $Counter = Oscar_Common::str2int16 ($myData, 0, true, true); $Plugin = Oscar_Common::GUID ($myData, 0, true); $pFlag = Oscar_Common::str2int16 ($myData, 0, true, true); // Away-Message request # TODO: Plugin has to be {81 1A 18 BC 0E 6C 18 47 A5 91 6F 18 DC C7 6F 1A} if (($Flag == 0x00) && ($Type == 0x1A)) { $msg = ""; if (is_object ($this->Parent)) $msg = $this->Parent->getAwayMessage (); $SNAC = new OSCAR_SNAC_ICBM_Message_ACK ($this->Parent); $SNAC->Cookie = $Message->Cookie; $SNAC->Channel = $Message->Channel; $SNAC->Username = $Message->Username; $SNAC->Reason = OSCAR_SNAC_ICBM_Message_ACK::REASON_CHANNEL; $SNAC->Channel2 = Oscar_Common::toString16 ($Block1, true) . Oscar_Common::toString16 ($Block2, true) . OSCAR_Common::int8toStr ($Type) . OSCAR_Common::int8toStr ($Flag) . OSCAR_Common::int32toStr (0x00000000) . OSCAR_Common::int16toStr (0x0000) . OSCAR_Common::int16toStr ($Counter, true) . $Plugin . OSCAR_Common::int16toStr ($pFlag, true) . Oscar_Common::toString32 ("Away Status Message", true) . OSCAR_Common::int8toStr (0x00) . OSCAR_Common::int32toStr (0x00000000) . OSCAR_Common::int32toStr (0x00000000) . OSCAR_Common::int32toStr (0x00000000) . OSCAR_Common::int32toStr (0x00000000) . OSCAR_Common::int32toStr (strlen ($msg) + 4, true) . Oscar_Common::toString32 ($msg, true) . Oscar_Common::toString32 ("text/plain", true); return $SNAC->writeFLAP (); } elseif (($Flag == 0x03) && ($Type >= 0xE8) && ($Type <= 0xEC)) { $msg = ""; if (is_object ($this->Parent)) $msg = utf8_decode ($this->Parent->getAwayMessage ()); // Generate the response $SNAC = new OSCAR_SNAC_ICBM_Message_ACK ($this->Parent); $SNAC->Cookie = $Message->Cookie; $SNAC->Channel = $Message->Channel; $SNAC->Username = $Message->Username; $SNAC->Reason = OSCAR_SNAC_ICBM_Message_ACK::REASON_CHANNEL; $SNAC->Channel2 = Oscar_Common::toString16 ($Block1, true) . Oscar_Common::toString16 ($Block2, true) . OSCAR_Common::int8toStr ($Type) . OSCAR_Common::int8toStr ($Flag) . OSCAR_Common::int32toStr (0x00000000) . OSCAR_Common::int16toStr (strlen ($msg) + 1, true) . $msg . chr (0); return $SNAC->writeFLAP (); } print "Received Extended TLV\n" . " B1 " . bin2hex ($Block1) . "\n" . " B2 " . bin2hex ($Block2) . "\n" . " T 0x" . dechex ($Type) . "\n" . " F 0x" . dechex ($Flag) . "\n" . " M1 " . bin2hex ($addMessage1) . "\n" . " M2 " . bin2hex ($addMessage2) . "\n" . " C 0x" . dechex ($Counter) . "\n" . " P " . bin2hex ($Plugin) . "\n" . " PF 0x" . dechex ($pFlag) . "\n" . " D " . bin2hex ($myData) . "\n"; } // }}} } ?>