Message receiver is working!

This commit is contained in:
Him188moe 2019-09-01 00:04:50 +08:00
parent 0dbcd18ce8
commit 418f95db65
3 changed files with 11 additions and 4 deletions

View File

@ -232,10 +232,14 @@ class RobotNetworkHandler(val number: Int, private val password: String) {
//group message
}
is ServerUnknownEventPacket -> {
is UnknownServerEventPacket -> {
//unknown message event
}
is UnknownServerPacket -> {
}
is ServerVerificationCodePacketEncrypted -> onPacketReceived(packet.decrypt(this.token00BA))
is ServerLoginResponseVerificationCodePacketEncrypted -> onPacketReceived(packet.decrypt())
is ServerLoginResponseResendPacketEncrypted -> onPacketReceived(packet.decrypt(this.tgtgtKey!!))

View File

@ -29,7 +29,7 @@ open class ClientMessageResponsePacket(
/**
* 群聊和好友消息分
* 群聊和好友消息分
*/
@PacketId("00 17")
class ServerMessageEventPacketRaw(
@ -61,11 +61,11 @@ class ServerMessageEventPacketRaw(
//"02 10", "00 12" -> ServerUnknownEventPacket(this.input, packetId, eventIdentity)
else -> ServerUnknownEventPacket(this.input, packetId, eventIdentity)
else -> UnknownServerEventPacket(this.input, packetId, eventIdentity)
}
}
class ServerUnknownEventPacket(input: DataInputStream, packetId: ByteArray, eventIdentity: ByteArray) : ServerEventPacket(input, packetId, eventIdentity)
class UnknownServerEventPacket(input: DataInputStream, packetId: ByteArray, eventIdentity: ByteArray) : ServerEventPacket(input, packetId, eventIdentity)
@PacketId("00 17")
class ServerMessageEventPacketRawEncoded(input: DataInputStream, val packetId: ByteArray) : ServerPacket(input) {

View File

@ -1,5 +1,6 @@
package net.mamoe.mirai.network.packet
import net.mamoe.mirai.util.toUHexString
import net.mamoe.mirai.utils.MiraiLogger
import java.io.ByteArrayOutputStream
import java.io.DataInputStream
@ -55,6 +56,8 @@ class ServerGroupMessageEventPacket(input: DataInputStream, packetId: ByteArray,
group = this.input.goto(51).readInt()
qq = this.input.goto(56).readInt()
val fontLength = this.input.goto(108).readShort()
println(this.input.goto(110 + fontLength).readNBytes(2).toUHexString())
messageType = when (val id = this.input.goto(110 + fontLength + 2).readByte().toInt()) {
19 -> MessageType.NORMAL
14 -> MessageType.XML