Fix missing file

This commit is contained in:
Him188 2020-02-03 23:03:30 +08:00
parent b240370f20
commit 9c15287305
5 changed files with 26 additions and 9 deletions

View File

@ -163,12 +163,11 @@ internal class GroupImpl(
Highway.RequestDataTrans(
uin = bot.uin,
command = "PicUp.DataUp",
buildVer = bot.client.buildVer,
sequenceId = bot.client.nextHighwayDataTransSequenceId(),
uKey = response.uKey,
data = image.input,
dataSize = image.inputSize.toInt(),
md5 = image.md5,
sequenceId = bot.client.nextHighwayDataTransSequenceId()
md5 = image.md5
)
)
// }
@ -182,6 +181,7 @@ internal class GroupImpl(
println(proto.contentToString())
println(readBytes(bodyLength).toUHexString())
}
socket.close()
val resourceId = image.calculateImageResourceId()
return NotOnlineImageFromFile(
resourceId = resourceId,

View File

@ -67,13 +67,12 @@ object Highway {
uin: Long,
command: String,
sequenceId: Int,
buildVer: String,
appId: Int = 537062845,
dataFlag: Int = 4096,
commandId: Int = 2,
localId: Int = 2052,
uKey: ByteArray,
data: Input,
dataSize: Int,
md5: ByteArray
@ -87,7 +86,6 @@ object Highway {
appid = appId,
dataflag = dataFlag,
commandId = commandId,
buildVer = buildVer,
localeId = localId
)
val segHead = CSDataHighwayHead.SegHead(
@ -97,6 +95,7 @@ object Highway {
md5 = md5,
fileMd5 = md5
)
//println(data.readBytes().toUHexString())
return Codec.buildC2SData(dataHighwayHead, segHead, EMPTY_BYTE_ARRAY, null, data, dataSize)
}
@ -121,9 +120,9 @@ object Highway {
writeInt(head.size)
writeInt(bodySize)
writeFully(head)
body.copyTo(this)
check(body.copyTo(this).toInt() == bodySize) { "bad body size" }
writeByte(41)
}
}.also { println(it.remaining) }
}
}
}

View File

@ -5,6 +5,7 @@ import kotlinx.io.pool.useInstance
import net.mamoe.mirai.data.Packet
import net.mamoe.mirai.event.Subscribable
import net.mamoe.mirai.qqandroid.QQAndroidBot
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.TroopManagement
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image.ImageUpPacket
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image.ImgStore
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image.LongConn

View File

@ -0,0 +1,16 @@
package net.mamoe.mirai.qqandroid.utils
fun Int.toIpV4AddressString(): String {
@Suppress("NAME_SHADOWING")
var var0 = this.toLong() and 0xFFFFFFFF
return buildString {
for (var2 in 3 downTo 0) {
append(255L and var0 % 256L)
var0 /= 256L
if (var2 != 0) {
append('.')
}
}
}
}

View File

@ -34,7 +34,8 @@ fun File.toExternalImage(): ExternalImage {
md5 = this.inputStream().use { it.md5() },
imageFormat = this.nameWithoutExtension,
input = this.inputStream().asInput(IoBuffer.Pool),
inputSize = this.length()
inputSize = this.length(),
filename = this.name
)
}