mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-23 14:20:24 +08:00
nothing
This commit is contained in:
parent
5b8dbf590c
commit
418b342a1d
@ -16,6 +16,11 @@ import net.mamoe.mirai.qqandroid.io.JceOutput
|
||||
import net.mamoe.mirai.utils.io.toUHexString
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
fun <T> ByteArray.loadAs(deserializer: DeserializationStrategy<T>, c: Charset): T {
|
||||
return Jce.byCharSet(c).load(deserializer, this)
|
||||
}
|
||||
|
||||
|
||||
enum class JceCharset(val kotlinCharset: Charset) {
|
||||
GBK(Charset.forName("GBK")),
|
||||
UTF8(Charset.forName("UTF8"))
|
||||
@ -355,4 +360,6 @@ class Jce private constructor(private val charset: JceCharset, context: SerialMo
|
||||
TODO()
|
||||
}
|
||||
|
||||
override fun <T>
|
||||
|
||||
}
|
||||
|
@ -3,9 +3,9 @@ package net.mamoe.mirai.qqandroid.network.protocol.jce
|
||||
import kotlinx.serialization.SerialId
|
||||
import kotlinx.serialization.Serializable
|
||||
import net.mamoe.mirai.qqandroid.io.JceStruct
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
|
||||
|
||||
private val EMPTY_MAP = mapOf<String, String>()
|
||||
private val EMPTY_SBUFFER_MAP = mapOf<Int, ByteArray>()
|
||||
|
||||
@Serializable
|
||||
class RequestPacket(
|
||||
@ -15,7 +15,7 @@ class RequestPacket(
|
||||
@SerialId(4) val iRequestId: Int = 0,
|
||||
@SerialId(5) val sServantName: String = "",
|
||||
@SerialId(6) val sFuncName: String = "",
|
||||
@SerialId(7) val sBuffer: ByteArray = EMPTY_BYTE_ARRAY,
|
||||
@SerialId(7) val sBuffer: Map<Int, ByteArray> = EMPTY_SBUFFER_MAP,
|
||||
@SerialId(8) val iTimeout: Int = 0,
|
||||
@SerialId(9) val context: Map<String, String> = EMPTY_MAP,
|
||||
@SerialId(10) val status: Map<String, String> = EMPTY_MAP
|
||||
|
@ -1,16 +1,26 @@
|
||||
package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive
|
||||
|
||||
import kotlinx.io.core.ByteReadPacket
|
||||
import kotlinx.io.core.discardExact
|
||||
import net.mamoe.mirai.qqandroid.QQAndroidBot
|
||||
import net.mamoe.mirai.qqandroid.io.readJceRequestBufferMapVersion2ToJceStruct
|
||||
import net.mamoe.mirai.qqandroid.io.serialization.Jce
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.jce.RequestPacket
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.PacketFactory
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.data.RequestPushNotify
|
||||
import net.mamoe.mirai.utils.cryptor.contentToString
|
||||
import net.mamoe.mirai.utils.io.readRemainingBytes
|
||||
|
||||
class MessageSvc {
|
||||
internal object PushNotify : PacketFactory<RequestPushNotify>("MessageSvc.PushNotify") {
|
||||
override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): RequestPushNotify {
|
||||
val messageNotification = readJceRequestBufferMapVersion2ToJceStruct(RequestPushNotify)
|
||||
val req = Jce.UTF8.load(
|
||||
RequestPacket.serializer(),
|
||||
this.apply { discardExact(8) }.readRemainingBytes()
|
||||
)
|
||||
val messageNotification = Jce.UTF8.load(
|
||||
RequestPushNotify.serializer(),
|
||||
req.sBuffer[0]!!
|
||||
)
|
||||
println(messageNotification.contentToString())
|
||||
TODO()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user