/// <summary> /// Processes a newly received offline message for the specified UIN /// </summary> /// <remarks>This is called from the ICQ manager, which receives the incoming /// offline message packet and sends it here for processing</remarks> internal void ReadIcqOfflineMessage(String uin, ByteStream stream) { String sender = stream.ReadUintLE().ToString(); // Read in the date information (GMT) ushort year = stream.ReadUshortLE(); byte month = stream.ReadByte(); byte day = stream.ReadByte(); byte hourGmt = stream.ReadByte(); byte minute = stream.ReadByte(); DateTime received = new DateTime(year, month, day, hourGmt, minute, 0, DateTimeKind.Utc); // Read in message type information byte messageType = stream.ReadByte(); byte messageFlags = stream.ReadByte(); Encoding messageEncoding = GetOfflineMessageEncoding(messageType); OfflineIM im = new OfflineIM(sender); im.ReceivedOn = received; im.Message = Encoding.Unicode.GetString( Encoding.Convert(messageEncoding, Encoding.Unicode, stream.ReadByteArray(stream.ReadUshortLE() - 1))); im.IsAutoResponse = (messageFlags == 0x03) || (messageType == 0xE8); // Store it for delivery to the client AcceptIcbmOIM(im); }