Message receiver is working!

This commit is contained in:
Him188moe 2019-08-31 23:29:59 +08:00
parent 6350638e40
commit c5b01fbf5f
4 changed files with 20 additions and 5 deletions

View File

@ -73,6 +73,9 @@ abstract class ServerPacket(val input: DataInputStream) : Packet {
"08 28 04 34" -> ServerSessionKeyResponsePacketEncrypted(stream)
"00 81 EC 78" -> UnknownPacket(stream)
"00 81 AD 7A" -> UnknownPacket(stream)
else -> when (idHex.substring(0, 5)) {
"00 EC" -> ServerLoginSuccessPacket(stream)
"00 1D" -> ServerSKeyResponsePacketEncrypted(stream)
@ -85,7 +88,6 @@ abstract class ServerPacket(val input: DataInputStream) : Packet {
"00 CE", "00 17" -> ServerMessageEventPacketRawEncoded(stream, idHex.hexToBytes())
else -> throw IllegalArgumentException(idHex)
}
}

View File

@ -0,0 +1,12 @@
package net.mamoe.mirai.network.packet.server
import java.io.DataInputStream
/**
* @author Him188moe
*/
class UnknownPacket(input: DataInputStream) : ServerPacket(input) {
override fun decode() {
}
}

View File

@ -67,9 +67,9 @@ class ServerMessageEventPacketRaw(
"00 A6" -> ServerFriendMessageEventPacket(this.input, packetId, eventIdentity)
"02 10" -> ServerUnknownEventPacket(this.input, packetId, eventIdentity)
//"02 10", "00 12" -> ServerUnknownEventPacket(this.input, packetId, eventIdentity)
else -> throw IllegalArgumentException(typeHex)
else -> ServerUnknownEventPacket(this.input, packetId, eventIdentity)
}
}

View File

@ -57,7 +57,6 @@ 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.toString())
messageType = when (val id = this.input.goto(110 + fontLength + 2).readByte().toInt()) {
19 -> MessageType.NORMAL
14 -> MessageType.XML
@ -130,8 +129,10 @@ class ServerGroupMessageEventPacket(input: DataInputStream, packetId: ByteArray,
}
class ServerFriendMessageEventPacket(input: DataInputStream, packetId: ByteArray, eventIdentity: ByteArray) : ServerEventPacket(input, packetId, eventIdentity) {
var qq: Int = 0
lateinit var message: String
override fun decode() {
TODO("FRIEND 解析")
}
}