diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt index 45d355a82..0a7e89c04 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt @@ -25,7 +25,6 @@ import kotlinx.io.core.Input import kotlinx.io.core.discardExact import kotlinx.io.core.readAvailable import kotlinx.io.core.use -import kotlinx.io.pool.useInstance import kotlinx.serialization.InternalSerializationApi import net.mamoe.mirai.qqandroid.network.QQAndroidClient import net.mamoe.mirai.qqandroid.network.protocol.data.proto.CSDataHighwayHead @@ -109,8 +108,8 @@ internal object HighwayHelper { ) { require(imageInput is Input || imageInput is InputStream || imageInput is ByteReadChannel) { "unsupported imageInput: ${imageInput::class.simpleName}" } require(fileMd5.size == 16) { "bad md5. Required size=16, got ${fileMd5.size}" } - // require(ticket.size == 128) { "bad uKey. Required size=128, got ${ticket.size}" } - // require(commandId == 2 || commandId == 1) { "bad commandId. Must be 1 or 2" } + // require(ticket.size == 128) { "bad uKey. Required size=128, got ${ticket.size}" } + // require(commandId == 2 || commandId == 1) { "bad commandId. Must be 1 or 2" } val socket = PlatformSocket() socket.connect(serverIp, serverPort) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/highway.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/highway.kt index 563bc2d64..2329335a2 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/highway.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/highway.kt @@ -30,7 +30,8 @@ import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray import net.mamoe.mirai.utils.MiraiInternalAPI @OptIn(MiraiInternalAPI::class, InternalSerializationApi::class) -internal fun createImageDataPacketSequence( // RequestDataTrans +internal fun createImageDataPacketSequence( + // RequestDataTrans client: QQAndroidClient, command: String, appId: Int = 537062845, @@ -42,11 +43,11 @@ internal fun createImageDataPacketSequence( // RequestDataTrans data: Any, dataSize: Int, fileMd5: ByteArray, - sizePerPacket: Int = 8192.coerceAtMost(ByteArrayPool.BUFFER_SIZE) + sizePerPacket: Int = ByteArrayPool.BUFFER_SIZE ): Flow { ByteArrayPool.checkBufferSize(sizePerPacket) require(data is Input || data is InputStream || data is ByteReadChannel) { "unsupported data: ${data::class.simpleName}" } - // require(ticket.size == 128) { "bad uKey. Required size=128, got ${ticket.size}" } + // require(ticket.size == 128) { "bad uKey. Required size=128, got ${ticket.size}" } require(data !is ByteReadPacket || data.remaining.toInt() == dataSize) { "bad input. given dataSize=$dataSize, but actual readRemaining=${(data as ByteReadPacket).remaining}" } val flow = when (data) { @@ -78,7 +79,7 @@ internal fun createImageDataPacketSequence( // RequestDataTrans localeId = localId ), msgSeghead = CSDataHighwayHead.SegHead( - // cacheAddr = 812157193, + // cacheAddr = 812157193, datalength = chunkedInput.bufferSize, dataoffset = offset, filesize = dataSize.toLong(), diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/ConfigPush.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/ConfigPush.kt index 9cb44f044..3a3782eac 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/ConfigPush.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/ConfigPush.kt @@ -64,7 +64,8 @@ internal class DomainIpInfo( internal class DomainIpList( @JceId(0) val uDomainType: Int, @JceId(1) val vIplist: List, - @JceId(2) val unknown: ByteArray // added + @JceId(2) val unknown: ByteArray? = null, + @JceId(4) val int: Int? = null// added ) : JceStruct @Serializable