예제 #1
0
        /// <summary>
        /// Processes requested chat room information -- SNAC(0D,09)
        /// </summary>
        /// <param name="dp">A <see cref="DataPacket"/> object containing SNAC(0D,09)</param>
        public void ProcessChatRoomInformation(DataPacket dp)
        {
            ushort maxRooms = 0xFFFF;
            ReadOnlyCollection <Tlv> exchangeTlvs = null;
            ChatRoom newRoom = null;

            // Parse the response
            using (TlvBlock tlvs = new TlvBlock(dp.Data.ReadByteArrayToEnd()))
            {
                maxRooms = tlvs.ReadByte(0x0002);
                if (tlvs.HasTlv(0x0003))
                {
                    exchangeTlvs = tlvs.ReadAllTlvs(0x0003);
                }
                if (tlvs.HasTlv(0x0004))
                {
                    newRoom = new ChatRoom(new ByteStream(tlvs.ReadByteArray(0x0004)));
                }
            }

            // If this packet was received in response to a chat room creation request,
            // request a new chat room connection from the BOS connection
            if (newRoom != null)
            {
                RequestChatRoomConnection(newRoom);
            }
        }