From 71875269310ab0e73652f8223f704cdbe29a209d Mon Sep 17 00:00:00 2001 From: Him188 Date: Mon, 6 Jan 2020 18:33:57 +0800 Subject: [PATCH] Make OutgoingPacket Not extending Packet --- .../qqandroid/network/protocol/packet/OutgoingPacketAndroid.kt | 3 +-- .../net.mamoe.mirai.timpc/network/packet/OutgoingPacket.kt | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/OutgoingPacketAndroid.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/OutgoingPacketAndroid.kt index b4522e65c..526be7187 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/OutgoingPacketAndroid.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/OutgoingPacketAndroid.kt @@ -5,7 +5,6 @@ import kotlinx.io.core.BytePacketBuilder import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.buildPacket import kotlinx.io.core.writeFully -import net.mamoe.mirai.data.Packet import net.mamoe.mirai.qqandroid.network.QQAndroidClient import net.mamoe.mirai.qqandroid.network.protocol.packet.login.PacketId import net.mamoe.mirai.qqandroid.utils.ECDH @@ -24,7 +23,7 @@ internal class OutgoingPacket constructor( val packetId: PacketId, val sequenceId: Short, val delegate: ByteReadPacket -) : Packet { +) { val name: String by lazy { name ?: packetId.toString() } diff --git a/mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/OutgoingPacket.kt b/mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/OutgoingPacket.kt index 0b9f50697..b4d9d3fef 100644 --- a/mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/OutgoingPacket.kt +++ b/mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/OutgoingPacket.kt @@ -25,7 +25,7 @@ class OutgoingPacket( val packetId: PacketId, val sequenceId: UShort, val delegate: ByteReadPacket -) : Packet { +) { val name: String by lazy { name ?: packetId.toString() }