Commit 368abbe1 authored by Him188's avatar Him188

Add unknown statuses

parent 62088295
...@@ -26,13 +26,18 @@ enum class OnlineStatus( ...@@ -26,13 +26,18 @@ enum class OnlineStatus(
*/ */
OFFLINE(0x02u), OFFLINE(0x02u),
/** UNKNOWN1(0x20u),
* ? UNKNOWN2(0x46u),
*/ UNKNOWN3(0x14u),
UNKNOWN(0x20u) UNKNOWN4(0xC9u),
UNKNOWN5(0x1Eu),
; ;
// TODO: 2019/10/29 what is 0x20u // TODO: 2019/10/29 what is 0x20u
// TODO: 2019/11/11 what is 0x46u
// TODO: 2019/11/11 what is 0x14u
// TODO: 2019/11/11 0xC9u
// TODO: 2019/11/11 0x1Eu
companion object { companion object {
fun ofId(id: UByte): OnlineStatus? = values().firstOrNull { it.id == id } fun ofId(id: UByte): OnlineStatus? = values().firstOrNull { it.id == id }
} }
......
...@@ -3,6 +3,7 @@ package net.mamoe.mirai.utils ...@@ -3,6 +3,7 @@ package net.mamoe.mirai.utils
import kotlinx.io.core.ByteReadPacket import kotlinx.io.core.ByteReadPacket
import kotlinx.io.core.IoBuffer import kotlinx.io.core.IoBuffer
import kotlinx.io.pool.useInstance import kotlinx.io.pool.useInstance
import net.mamoe.mirai.network.protocol.tim.packet.Decrypter
import net.mamoe.mirai.network.protocol.tim.packet.DecrypterByteArray import net.mamoe.mirai.network.protocol.tim.packet.DecrypterByteArray
import net.mamoe.mirai.utils.io.* import net.mamoe.mirai.utils.io.*
import kotlin.experimental.and import kotlin.experimental.and
...@@ -123,6 +124,8 @@ fun ByteReadPacket.decryptBy(key: ByteArray): ByteReadPacket = decryptAsByteArra ...@@ -123,6 +124,8 @@ fun ByteReadPacket.decryptBy(key: ByteArray): ByteReadPacket = decryptAsByteArra
fun ByteReadPacket.decryptBy(key: IoBuffer): ByteReadPacket = decryptAsByteArray(key) { data -> ByteReadPacket(data, 0) } fun ByteReadPacket.decryptBy(key: IoBuffer): ByteReadPacket = decryptAsByteArray(key) { data -> ByteReadPacket(data, 0) }
fun ByteReadPacket.decryptBy(key: Decrypter): ByteReadPacket = key.decrypt(this)
fun ByteReadPacket.decryptBy(keyHex: String): ByteReadPacket = decryptBy(keyHex.hexToBytes()) fun ByteReadPacket.decryptBy(keyHex: String): ByteReadPacket = decryptBy(keyHex.hexToBytes())
inline fun <R> ByteReadPacket.decryptAsByteArray(key: ByteArray, consumer: (ByteArray) -> R): R = inline fun <R> ByteReadPacket.decryptAsByteArray(key: ByteArray, consumer: (ByteArray) -> R): R =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment