From 4834e20be067669877fe300e53a69fb198f8f08b Mon Sep 17 00:00:00 2001
From: Him188 <Him188@mamoe.net>
Date: Sun, 31 Jan 2021 15:41:21 +0800
Subject: [PATCH] Fix apng upload #939

---
 mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt      | 2 +-
 .../kotlin/network/protocol/data/proto/Cmd0x388.kt         | 7 +++++++
 .../kotlin/network/protocol/packet/chat/image/ImgStore.kt  | 4 ++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt b/mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt
index 4b50a1705..8edb3e22c 100644
--- a/mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt
+++ b/mirai-core/src/commonMain/kotlin/contact/GroupImpl.kt
@@ -144,7 +144,7 @@ internal class GroupImpl(
                 uin = bot.id,
                 groupCode = id,
                 md5 = resource.md5,
-                size = resource.size
+                size = resource.size,
             ).sendAndExpect()
 
             when (response) {
diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x388.kt b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x388.kt
index 5ca072217..ccc4b023e 100644
--- a/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x388.kt
+++ b/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/Cmd0x388.kt
@@ -206,6 +206,13 @@ internal class TryUpImgReq(
         @ProtoNumber(6) @JvmField val fileName: String = "",
         @ProtoNumber(7) @JvmField val srcTerm: Int = 0,
         @ProtoNumber(8) @JvmField val platformType: Int = 0,
+        /**
+         * if uinType = 1 then 1 else2
+         *
+        UIN_QQ = new UINTYPE(0, 0, "UIN_QQ");
+        UIN_EMAIL = new UINTYPE(1, 1, "UIN_EMAIL");
+        UIN_MOBILE = new UINTYPE(2, 2, "UIN_MOBILE");
+         */
         @ProtoNumber(9) @JvmField val buType: Int = 0,
         @ProtoNumber(10) @JvmField val picWidth: Int = 0,
         @ProtoNumber(11) @JvmField val picHeight: Int = 0,
diff --git a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/ImgStore.kt b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/ImgStore.kt
index c729fc29a..2db43b2a4 100644
--- a/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/ImgStore.kt
+++ b/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/image/ImgStore.kt
@@ -41,12 +41,12 @@ internal class ImgStore {
             size: Long,
             picWidth: Int = 0, // not orthodox
             picHeight: Int = 0, // not orthodox
-            picType: Int = 1000,
+            picType: Int = 2001,
             fileId: Long = 0,
             filename: String = getRandomString(16) + ".gif", // make server happier
             srcTerm: Int = 5,
             platformType: Int = 9,
-            buType: Int = 1,
+            buType: Int = 2,
             appPicType: Int = 1006,
             originalPic: Int = 0
         ): OutgoingPacket = buildOutgoingUniPacket(client) {