Commit b25729ea authored by Him188's avatar Him188

Add OnlineStatus.UNKNOWN

parent acbba3c5
...@@ -23,7 +23,7 @@ internal object FriendOnlineStatusChangedPacket : SessionPacketFactory<FriendSta ...@@ -23,7 +23,7 @@ internal object FriendOnlineStatusChangedPacket : SessionPacketFactory<FriendSta
discardExact(8) discardExact(8)
val statusId = readUByte() val statusId = readUByte()
val status = OnlineStatus.ofId(statusId.toInt()) val status = OnlineStatus.ofIdOrNull(statusId.toInt()) ?: OnlineStatus.UNKNOWN
return FriendStatusChanged(handler.bot.getQQ(qq), status) return FriendStatusChanged(handler.bot.getQQ(qq), status)
} }
......
...@@ -35,7 +35,12 @@ enum class OnlineStatus(val id: Int) { ...@@ -35,7 +35,12 @@ enum class OnlineStatus(val id: Int) {
/** /**
* 离线但接收消息 * 离线但接收消息
*/ */
RECEIVE_OFFLINE_MESSAGE(95); RECEIVE_OFFLINE_MESSAGE(95),
/**
* 解析错误等
*/
UNKNOWN(-1);
companion object { companion object {
fun ofId(id: Int): OnlineStatus = values().first { it.id == id } fun ofId(id: Int): OnlineStatus = values().first { it.id == id }
......
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