1
0
mirror of https://github.com/mamoe/mirai.git synced 2025-04-25 21:23:55 +08:00

Change id type to UByte

This commit is contained in:
Him188 2019-10-07 13:01:55 +08:00
parent 2b3deb24d3
commit 2c35f9e416
3 changed files with 7 additions and 4 deletions
mirai-console/src/main/java/net/mamoe/mirai
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai
network/protocol/tim/packet/login
utils

View File

@ -175,7 +175,7 @@ object MiraiServer {
val strings = it.split("----").dropLastWhile { it.isEmpty() }.toTypedArray()
val bot = Bot(BotAccount(strings[0].toLong(), strings[1]), Console())
if (runBlocking { bot.network.login(200) } === LoginState.SUCCESS) {
if (runBlocking { bot.login() } === LoginState.SUCCESS) {
bot.green("Login succeed")
return bot
}

View File

@ -1,3 +1,5 @@
@file:Suppress("EXPERIMENTAL_API_USAGE")
package net.mamoe.mirai.network.protocol.tim.packet.login
import net.mamoe.mirai.network.protocol.tim.TIMProtocol
@ -25,7 +27,7 @@ class ClientChangeOnlineStatusPacket(
this.writeHex(TIMProtocol.fixVer2)
this.encryptAndWrite(sessionKey) {
writeHex("01 00")
writeByte(loginStatus.id)
writeByte(loginStatus.id.toInt())
writeHex("00 01 00 01 00 04 00 00 00 00")
}
}

View File

@ -1,3 +1,4 @@
@file:Suppress("EXPERIMENTAL_UNSIGNED_LITERALS", "EXPERIMENTAL_API_USAGE")
package net.mamoe.mirai.utils
/**
@ -8,10 +9,10 @@ package net.mamoe.mirai.utils
*/
enum class ClientLoginStatus(
// TODO: 2019/8/31 add more ClientLoginStatus
val id: Int//1 ubyte
val id: UByte//1 ubyte
) {
/**
* 我在线上
*/
ONLINE(0x0A)
ONLINE(0x0Au)
}