Merge remote-tracking branch 'origin/master'

This commit is contained in:
liujiahua123123 2019-12-15 15:57:41 +08:00
commit 84b2aa4acd
2 changed files with 10 additions and 6 deletions

View File

@ -11,6 +11,8 @@ import net.mamoe.mirai.contact.Group
import net.mamoe.mirai.contact.Member
import net.mamoe.mirai.getGroup
import net.mamoe.mirai.qqAccount
import net.mamoe.mirai.utils.io.debugPrintIfFail
import net.mamoe.mirai.utils.io.readRemainingBytes
import net.mamoe.mirai.utils.io.toUHexString
// region mute
@ -76,10 +78,12 @@ sealed class UnmuteEvent : EventOfMute() {
// endregion
internal object Unknown0x02DCPacketFlag0x0EMaybeMutePacket : EventOfMute() {
internal class Unknown0x02DCPacketFlag0x0EMaybeMutePacket(
val remaining: ByteArray
) : EventOfMute() {
override val operator: Member get() = error("Getting a field from Unknown0x02DCPacketFlag0x0EMaybeMutePacket")
override val group: Group get() = error("Getting a field from Unknown0x02DCPacketFlag0x0EMaybeMutePacket")
override fun toString(): String = "Unknown0x02DCPacketFlag0x0EMaybeMutePacket"
override fun toString(): String = "Unknown0x02DCPacketFlag0x0EMaybeMutePacket(remaining=${remaining.toUHexString()})"
}
sealed class EventOfMute : EventPacket {
@ -123,10 +127,10 @@ internal object MemberMuteEventPacketParserAndHandler : KnownEventParserAndHandl
0x0Eu -> {
//00 00 00 0E 00 08 00 02 00 01 00
// 0A 00 04 01 00 00 00 35 DB 60 A2 11 00 3E 08 07 20 A2 C1 ED AE 03 5A 34 08 A2 FF 8C F0 03 1A 19 08 F4 0E 10 FE 8C D3 EF 05 18 84 A1 F8 F9 06 20 00 28 00 30 A2 FF 8C F0 03 2A 0D 08 00 12 09 08 F4 0E 10 00 18 01 20 00 30 00 38 00
Unknown0x02DCPacketFlag0x0EMaybeMutePacket
Unknown0x02DCPacketFlag0x0EMaybeMutePacket(readRemainingBytes())
}
0x11u -> {
0x11u -> debugPrintIfFail("解析禁言包(0x02DC)时"){ // 猜测这个失败是撤回??
discardExact(15)
discardExact(2)
val group = bot.getGroup(readUInt())

View File

@ -67,7 +67,7 @@ fun Input.readTLVMap(expectingEOF: Boolean = false, tagSize: Int = 1): MutableMa
2 -> readUShort()
else -> error("Unsupported tag size: $tagSize")
}
} catch (e: EOFException) {
} catch (e: Exception) { // java.nio.BufferUnderflowException is not a EOFException...
if (expectingEOF) {
return map
}
@ -79,7 +79,7 @@ fun Input.readTLVMap(expectingEOF: Boolean = false, tagSize: Int = 1): MutableMa
check(!map.containsKey(type.toUInt())) {
"Count not readTLVMap: duplicated key 0x${type.toUInt().toUHexString("")}. " +
"map=$map" +
", duplicating value=${this.readUShortLVByteArray()}" +
", duplicating value=${this.readUShortLVByteArray().toUHexString()}" +
", remaining=" + if (expectingEOF) this.readBytes().toUHexString() else "[Not expecting EOF]"
}
try {