mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-31 19:40:24 +08:00
Enhanced output
This commit is contained in:
parent
09495c0ca9
commit
2c108b17a2
@ -279,7 +279,7 @@ class RobotNetworkHandler(private val robot: Robot) : Closeable {
|
||||
*/
|
||||
inner class DebugHandler : PacketHandler() {
|
||||
override fun onPacketReceived(packet: ServerPacket) {
|
||||
if (!packet.javaClass.name.endsWith("Encrypted")) {
|
||||
if (!packet.javaClass.name.endsWith("Encrypted") && !packet.javaClass.name.endsWith("Raw")) {
|
||||
robot notice "Packet received: $packet"
|
||||
}
|
||||
if (packet is ServerEventPacket) {
|
||||
|
@ -49,7 +49,7 @@ class ClientVerificationCodeTransmissionRequestPacket(
|
||||
@PacketId("00 BA 32")
|
||||
@ExperimentalUnsignedTypes
|
||||
class ClientVerificationCodeSubmitPacket(
|
||||
private val packetId: Int,
|
||||
private val packetIdLast: Int,
|
||||
private val qq: Long,
|
||||
private val token0825: ByteArray,
|
||||
private val verificationCode: String,
|
||||
@ -60,7 +60,7 @@ class ClientVerificationCodeSubmitPacket(
|
||||
}
|
||||
|
||||
override fun encode() {
|
||||
this.writeByte(packetId)//part of packet id
|
||||
this.writeByte(packetIdLast)//part of packet id
|
||||
|
||||
this.writeQQ(qq)
|
||||
this.writeHex(Protocol.fixVer)
|
||||
@ -84,6 +84,10 @@ class ClientVerificationCodeSubmitPacket(
|
||||
it.writeHex(Protocol.key00BAFix)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getFixedId(): String {
|
||||
return this.idHex + " " + packetIdLast
|
||||
}
|
||||
}
|
||||
|
||||
@ExperimentalUnsignedTypes
|
||||
@ -120,12 +124,12 @@ fun main() {
|
||||
@PacketId("00 BA 31")
|
||||
@ExperimentalUnsignedTypes
|
||||
class ClientVerificationCodeRefreshPacket(
|
||||
private val packetId: Int,
|
||||
private val packetIdLast: Int,
|
||||
private val qq: Long,
|
||||
private val token0825: ByteArray
|
||||
) : ClientPacket() {
|
||||
override fun encode() {
|
||||
this.writeByte(packetId)//part of packet id
|
||||
this.writeByte(packetIdLast)//part of packet id
|
||||
|
||||
this.writeQQ(qq)
|
||||
this.writeHex(Protocol.fixVer)
|
||||
@ -141,19 +145,17 @@ class ClientVerificationCodeRefreshPacket(
|
||||
it.writeHex(Protocol.key00BAFix)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getFixedId(): String {
|
||||
return this.idHex + " " + packetIdLast
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证码输入错误
|
||||
*/
|
||||
@PacketId("00 BA 32")
|
||||
class ServerVerificationCodeWrongPacket(input: DataInputStream, val dataSize: Int, packetId: ByteArray) : ServerVerificationCodeTransmissionPacket(input, dataSize, packetId) {
|
||||
|
||||
override fun decode() {
|
||||
MiraiLogger debug dataSize
|
||||
super.decode()
|
||||
}
|
||||
}
|
||||
class ServerVerificationCodeWrongPacket(input: DataInputStream, dataSize: Int, packetId: ByteArray) : ServerVerificationCodeTransmissionPacket(input, dataSize, packetId)
|
||||
|
||||
/**
|
||||
* 服务器发送验证码图片文件一部分过来
|
||||
@ -183,6 +185,10 @@ open class ServerVerificationCodeTransmissionPacket(input: DataInputStream, priv
|
||||
this.token00BA = this.input.readNBytesAt(dataSize - 56 - 2, 40)
|
||||
this.packetIdLast = packetId[3].toInt()
|
||||
}
|
||||
|
||||
override fun getFixedId(): String {
|
||||
return this.idHex + " " + packetIdLast
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -17,8 +17,13 @@ class ClientChangeOnlineStatusPacket(
|
||||
private val loginStatus: ClientLoginStatus
|
||||
|
||||
) : ClientPacket() {
|
||||
override fun getFixedId(): String {
|
||||
return this.idHex + " ?? ??";
|
||||
}
|
||||
|
||||
override fun encode() {
|
||||
this.writeRandom(2)//part of packet id
|
||||
|
||||
this.writeQQ(qq)
|
||||
this.writeHex(Protocol.fixVer2)
|
||||
this.encryptAndWrite(sessionKey) {
|
||||
|
Loading…
Reference in New Issue
Block a user