mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-09 18:00:33 +08:00
Simplify
This commit is contained in:
parent
66fb009627
commit
ab98206d18
@ -42,11 +42,7 @@ internal abstract class PacketFactory<out TPacket : Packet, TDecrypter : Decrypt
|
|||||||
}
|
}
|
||||||
|
|
||||||
@JvmName("decode0")
|
@JvmName("decode0")
|
||||||
private suspend inline fun <P : Packet> PacketFactory<P, *>.decode(bot: QQAndroidBot, packet: ByteReadPacket): P {
|
private suspend inline fun <P : Packet> PacketFactory<P, *>.decode(bot: QQAndroidBot, packet: ByteReadPacket): P = packet.decode(bot)
|
||||||
return this.run {
|
|
||||||
packet.decode(bot)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val DECRYPTER_16_ZERO = ByteArray(16)
|
private val DECRYPTER_16_ZERO = ByteArray(16)
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse, Log
|
|||||||
val subCommand = readShort().toInt()
|
val subCommand = readShort().toInt()
|
||||||
println("subCommand=$subCommand")
|
println("subCommand=$subCommand")
|
||||||
val type = readByte()
|
val type = readByte()
|
||||||
println("type=$subCommand")
|
println("type=$type")
|
||||||
debugDiscardExact(3)
|
debugDiscardExact(3)
|
||||||
val tlvMap: Map<Int, ByteArray> = this.readTLVMap()
|
val tlvMap: Map<Int, ByteArray> = this.readTLVMap()
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ fun Input.readTLVMap(expectingEOF: Boolean = true, tagSize: Int): MutableMap<Int
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
map[type] = this.readUShortLVByteArray()
|
map[type] = this.readUShortLVByteArray()
|
||||||
} catch (e: RuntimeException) { // BufferUnderflowException
|
} catch (e: Exception) { // BufferUnderflowException, java.io.EOFException
|
||||||
if (expectingEOF) {
|
if (expectingEOF) {
|
||||||
return map
|
return map
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user