Fix ConfigPush

This commit is contained in:
Him188 2020-04-12 17:24:17 +08:00
parent e23f91bac1
commit e6ef03f60d
7 changed files with 142 additions and 31 deletions

View File

@ -433,7 +433,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
"${packet.sender.nick}(${packet.sender.id}) -> ${packet.message.toString().singleLine()}"
}
is Event -> bot.logger.verbose { "Event: ${packet.toString().singleLine()}" }
else -> logger.verbose { "Event: ${packet.toString().singleLine()}" }
else -> logger.verbose { "Packet: ${packet.toString().singleLine()}" }
}
}

View File

@ -12,6 +12,7 @@ package net.mamoe.mirai.qqandroid.network.protocol.data.jce
import kotlinx.serialization.Serializable
import net.mamoe.mirai.qqandroid.network.Packet
import net.mamoe.mirai.qqandroid.utils.io.JceStruct
import net.mamoe.mirai.qqandroid.utils.io.ProtoBuf
import net.mamoe.mirai.qqandroid.utils.io.serialization.jce.JceId
@Serializable
@ -63,13 +64,46 @@ internal class DomainIpInfo(
@Serializable
internal class DomainIpList(
@JceId(0) val uDomainType: Int,
@JceId(1) val vIplist: List<DomainIpInfo>
@JceId(1) val vIplist: List<DomainIpInfo>,
@JceId(2) val unknown: ByteArray // added
) : JceStruct
@Serializable
internal class _340(
@JceId(1) val field1315: List<_339>,
@JceId(3) val field1316: List<_339>,
@JceId(4) val field1317: Int,
@JceId(5) val field1318: Byte? = 0,
@JceId(6) val field1319: Byte? = 0,
@JceId(7) val field1320: Int? = 1,
@JceId(8) val field1321: List<_339>? = null,
@JceId(9) val field1322: List<_339>? = null,
@JceId(10) val field1323: List<_339>? = null,
@JceId(11) val field1324: List<_339>? = null,
@JceId(12) val field1325: List<_339>? = null,
@JceId(13) val field1326: List<_339>? = null,
@JceId(14) val netType: Byte? = 0,
@JceId(15) val heThreshold: Int? = 0,
@JceId(16) val policyId: String? = ""
) : ProtoBuf
@Serializable
internal class _339(
@JceId(1) val field1298: String = "",
@JceId(2) val field1299: Int = 0,
@JceId(3) val field1300: Byte = 0,
@JceId(4) val field1301: Byte = 0,
@JceId(5) val field1302: Byte? = 0,
@JceId(6) val field1303: Int? = 8,
@JceId(7) val field1304: Byte? = 0,
@JceId(8) val field1305: String = "",
@JceId(9) val field1306: String = ""
) : JceStruct
@Serializable
internal class FileStoragePushFSSvcList(
@JceId(0) val vUpLoadList: List<FileStorageServerListInfo>,
@JceId(1) val vPicDownLoadList: List<FileStorageServerListInfo>,
@JceId(0) val vUpLoadList: List<FileStorageServerListInfo> = listOf(),
@JceId(1) val vPicDownLoadList: List<FileStorageServerListInfo> = listOf(),
@JceId(2) val vGPicDownLoadList: List<FileStorageServerListInfo>? = null,
@JceId(3) val vQzoneProxyServiceList: List<FileStorageServerListInfo>? = null,
@JceId(4) val vUrlEncodeServiceList: List<FileStorageServerListInfo>? = null,

View File

@ -29,7 +29,7 @@ private fun <T> Sequence<T>.joinToStringPrefixed(prefix: String, transform: (T)
}
private val SoutvLogger by lazy { DefaultLogger("soutv") }
internal fun Any?.soutv(name: String) {
internal fun Any?.soutv(name: String = "unnamed") {
@Suppress("DEPRECATION")
SoutvLogger.debug { "$name = ${this._miraiContentToString()}" }
}

View File

@ -231,7 +231,7 @@ internal class JceDecoder(
SimpleByteArrayReader
}
Jce.LIST -> ListReader
else -> error("type mismatch. Expected SIMPLE_LIST or LIST, got ${it.type} instead")
else -> error("type mismatch. Expected SIMPLE_LIST or LIST, got $it instead")
}
}
}

View File

@ -12,6 +12,7 @@ package net.mamoe.mirai.qqandroid.utils.io.serialization.jce
import kotlinx.io.core.*
import net.mamoe.mirai.qqandroid.utils.io.readString
import net.mamoe.mirai.qqandroid.utils.io.serialization.JceCharset
import net.mamoe.mirai.qqandroid.utils.toUHexString
/**
@ -193,7 +194,7 @@ internal class JceInput(
Jce.BYTE -> input.readByte().toInt()
Jce.SHORT -> input.readShort().toInt()
Jce.INT -> input.readInt()
else -> error("type mismatch: ${head.type}")
else -> error("type mismatch: $head, remaining=${input.readBytes().toUHexString()}")
}
}
@ -202,7 +203,7 @@ internal class JceInput(
Jce.ZERO_TYPE -> 0
Jce.BYTE -> input.readByte().toShort()
Jce.SHORT -> input.readShort()
else -> error("type mismatch: ${head.type}")
else -> error("type mismatch: $head")
}
}
@ -222,7 +223,7 @@ internal class JceInput(
return when (head.type) {
Jce.ZERO_TYPE -> 0
Jce.BYTE -> input.readByte()
else -> error("type mismatch: ${head.type}")
else -> error("type mismatch: $head")
}
}
@ -230,7 +231,7 @@ internal class JceInput(
return when (head.type) {
Jce.ZERO_TYPE -> 0f
Jce.FLOAT -> input.readFloat()
else -> error("type mismatch: ${head.type}")
else -> error("type mismatch: $head")
}
}
@ -243,7 +244,7 @@ internal class JceInput(
input.readUInt().toInt().also { require(it in 1 until 104857600) { "bad string length: $it" } },
charset = charset.kotlinCharset
)
else -> error("type mismatch: ${head.type}, expecting 6 or 7 (for string)")
else -> error("type mismatch: $head, expecting 6 or 7 (for string)")
}
}
@ -252,7 +253,7 @@ internal class JceInput(
12 -> 0.0
4 -> input.readFloat().toDouble()
5 -> input.readDouble()
else -> error("type mismatch: ${head.type}")
else -> error("type mismatch: $head")
}
}