internal void ImageReply(int size, uint crc32, uint uin) { stMsg outMsg = BuildMsgInfo(uin, string.Empty); stMsgImageReply outMsgImageReply = BuildImageReply(size, crc32); ForwardImage(outMsg, outMsgImageReply); }
private void ForwardImage(stMsg outMsg, stMsgImageReply outMsgImageReply) { imageBuffEl buffEl = imageBuff.popSave(outMsg.Recipient); byte[][] imagePack = sHGG.ArrayChop <byte>(buffEl.bin, 1800); byte[] filename = StrToByteArray(buffEl.path); for (int i = 0; i < imagePack.Length; i++) { outMsg.Header.Size = 13 + (uint)imagePack[i].Length; // msg outMsg.Header.Size += 9; // image reply struct if (i == 0) { outMsg.Header.Size += (uint)(filename.Length + 1); // image name } outMsgImageReply.Flag = (i > 0) ? (byte)0x6 : (byte)0x5; ForwardData(RawSerialize(outMsg), 21 + outMsg.Message.Length); ForwardData(RawSerialize(outMsgImageReply), 9); if (i == 0) { ForwardData(filename); ForwardData(new byte[] { 0 }); } ForwardData(imagePack[i]); } }
private void ForwardMessage(stMsg outMsg, stMsgRecs outRecs, int[] recs, stMsgRich outMsgRich, List <stMsgRichFormat> outRichList, int listLength) { outMsg.Header.Size = 13 + (uint)outMsg.Message.Length; if (outRichList.Count > 0) { outMsg.Header.Size += (uint)listLength + 3; } if (recs.Length > 0) { outMsg.Header.Size += (uint)(5 + (4 * recs.Length)); } ForwardData(RawSerialize(outMsg), 21 + outMsg.Message.Length); if (recs.Length > 0) { ForwardData(RawSerialize(outRecs), 5); for (int i = 0; i < recs.Length; i++) { ForwardData(RawSerialize(recs[i])); } } if (outRichList.Count > 0) { ForwardData(RawSerialize(outMsgRich), 3); outRichList.ForEach(delegate(stMsgRichFormat formatItem) { int rgbOffset = (formatItem.RGB != null) ? 6 : 3; ForwardData(RawSerialize(formatItem), rgbOffset); }); } return; }
private stMsg BuildMsgInfo(uint uin, string msg) { stMsg outMsg = new stMsg(); outMsg.Header.Type = OUT_MESSAGE; outMsg.Seq = 0; outMsg.Class = MESSAGE_CLASS_CHAT; outMsg.Message = msg; outMsg.Recipient = uin; return(outMsg); }
private void BuildImage(int recNum, string msg, int imgPos, int[] recs, SortedDictionary <short, string> msgFormat, bool conference, byte[] bin, string path) { stMsg outMsg = BuildMsgInfo((uint)recs[recNum], msg); stMsgImage outMsgImage = BuildImageQuery(bin, outMsg.Recipient, path); int listLength; List <stMsgRichFormat> outMsgRichFormat = BuildRichImg(out listLength, imgPos); stMsgRich outMsgRich = BuildRichInfo(listLength); if (!conference) { ForwardImageRequest(outMsg, outMsgRich, outMsgRichFormat, listLength, outMsgImage); } }
private void BuildMessage(int recNum, string msg, int[] recs, SortedDictionary <short, string> msgFormat, bool conference) { stMsg outMsg = BuildMsgInfo((uint)recs[recNum], msg); stMsgRecs outMsgRecs = BuildRecipientsInfo(recs.Length); int listLength; List <stMsgRichFormat> outMsgRichFormat = BuildRichText(ref msgFormat, out listLength); stMsgRich outMsgRich = BuildRichInfo(listLength); if (!conference) { ForwardMessage(outMsg, new stMsgRecs(), new int[0], outMsgRich, outMsgRichFormat, listLength); } else { ForwardMessage(outMsg, outMsgRecs, recs, outMsgRich, outMsgRichFormat, listLength); } }
private void ForwardImageRequest(stMsg outMsg, stMsgRich outMsgRich, List <stMsgRichFormat> outRichList, int listLength, stMsgImage image) { outMsg.Header.Size = 13 + (uint)outMsg.Message.Length; if (outRichList.Count > 0) { outMsg.Header.Size += (uint)listLength + 3; } ForwardData(RawSerialize(outMsg), 21 + outMsg.Message.Length); if (outRichList.Count > 0) { ForwardData(RawSerialize(outMsgRich), 3); outRichList.ForEach(delegate(stMsgRichFormat formatItem) { ForwardData(RawSerialize(formatItem), 3); ForwardData(RawSerialize(image), 10); }); } return; }