Commit 0f91587a authored by Him188's avatar Him188

Fix nameCard deserializing

parent fdef3bdb
...@@ -84,12 +84,12 @@ internal class OnlinePush { ...@@ -84,12 +84,12 @@ internal class OnlinePush {
val group = bot.getGroupOrNull(pbPushMsg.msg.msgHead.groupInfo!!.groupCode) ?: return null // 机器人还正在进群 val group = bot.getGroupOrNull(pbPushMsg.msg.msgHead.groupInfo!!.groupCode) ?: return null // 机器人还正在进群
val sender = group[pbPushMsg.msg.msgHead.fromUin] as MemberImpl val sender = group[pbPushMsg.msg.msgHead.fromUin] as MemberImpl
val name = extraInfo?.groupCard?.run { val name = extraInfo?.groupCard?.run {
try { kotlin.runCatching {
loadAs(Oidb0x8fc.CommCardNameBuf.serializer()).richCardName!!.first { it.text.isNotEmpty() } if (this[0] == 0x0A.toByte() && this[1] == 0x0A.toByte() && this[2] == 0x0A.toByte() && this[3] == 0x08.toByte())
.text.encodeToString() loadAs(Oidb0x8fc.CommCardNameBuf.serializer()).richCardName?.firstOrNull { it.text.isNotEmpty() }
} catch (e: Exception) { ?.text?.encodeToString()
encodeToString() else return@runCatching null
} }.getOrNull() ?: encodeToString()
} ?: pbPushMsg.msg.msgHead.groupInfo.groupCard // 没有 extraInfo 就从 head 里取 } ?: pbPushMsg.msg.msgHead.groupInfo.groupCard // 没有 extraInfo 就从 head 里取
val flags = extraInfo?.flags ?: 0 val flags = extraInfo?.flags ?: 0
......
...@@ -10,7 +10,7 @@ internal object ByteArrayPool : DefaultPool<ByteArray>(256) { ...@@ -10,7 +10,7 @@ internal object ByteArrayPool : DefaultPool<ByteArray>(256) {
/** /**
* 每一个 [ByteArray] 的大小 * 每一个 [ByteArray] 的大小
*/ */
const val BUFFER_SIZE: Int = 81920 / 2 const val BUFFER_SIZE: Int = 8192 * 8
override fun produceInstance(): ByteArray = ByteArray(BUFFER_SIZE) override fun produceInstance(): ByteArray = ByteArray(BUFFER_SIZE)
......
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