mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 02:20:14 +08:00
Fix nameCard deserializing
This commit is contained in:
parent
fdef3bdbdd
commit
0f91587ae7
@ -84,12 +84,12 @@ internal class OnlinePush {
|
||||
val group = bot.getGroupOrNull(pbPushMsg.msg.msgHead.groupInfo!!.groupCode) ?: return null // 机器人还正在进群
|
||||
val sender = group[pbPushMsg.msg.msgHead.fromUin] as MemberImpl
|
||||
val name = extraInfo?.groupCard?.run {
|
||||
try {
|
||||
loadAs(Oidb0x8fc.CommCardNameBuf.serializer()).richCardName!!.first { it.text.isNotEmpty() }
|
||||
.text.encodeToString()
|
||||
} catch (e: Exception) {
|
||||
encodeToString()
|
||||
}
|
||||
kotlin.runCatching {
|
||||
if (this[0] == 0x0A.toByte() && this[1] == 0x0A.toByte() && this[2] == 0x0A.toByte() && this[3] == 0x08.toByte())
|
||||
loadAs(Oidb0x8fc.CommCardNameBuf.serializer()).richCardName?.firstOrNull { it.text.isNotEmpty() }
|
||||
?.text?.encodeToString()
|
||||
else return@runCatching null
|
||||
}.getOrNull() ?: encodeToString()
|
||||
} ?: pbPushMsg.msg.msgHead.groupInfo.groupCard // 没有 extraInfo 就从 head 里取
|
||||
|
||||
val flags = extraInfo?.flags ?: 0
|
||||
|
@ -10,7 +10,7 @@ internal object ByteArrayPool : DefaultPool<ByteArray>(256) {
|
||||
/**
|
||||
* 每一个 [ByteArray] 的大小
|
||||
*/
|
||||
const val BUFFER_SIZE: Int = 81920 / 2
|
||||
const val BUFFER_SIZE: Int = 8192 * 8
|
||||
|
||||
override fun produceInstance(): ByteArray = ByteArray(BUFFER_SIZE)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user