Commit e1004f12 authored by Him188's avatar Him188

Fix #220

parent c6059ab9
......@@ -273,13 +273,21 @@ internal fun List<ImMsgBody.Elem>.joinToMessageChain(groupIdOrZero: Long, bot: B
}
element.lightApp != null -> {
val content = runWithBugReport("解析 lightApp", { element.lightApp.data.toUHexString() }) {
MiraiPlatformUtils.unzip(element.lightApp.data, 1).encodeToString()
when (element.lightApp.data[0].toInt()) {
0 -> element.lightApp.data.encodeToString(offset = 1)
1 -> MiraiPlatformUtils.unzip(element.lightApp.data, 1).encodeToString()
else -> error("unknown compression flag=${element.lightApp.data[0]}")
}
}
message.add(LightApp(content))
}
element.richMsg != null -> {
val content = runWithBugReport("解析 richMsg", { element.richMsg.template1.toUHexString() }) {
MiraiPlatformUtils.unzip(element.richMsg.template1, 1).encodeToString()
when (element.richMsg.template1[0].toInt()) {
0 -> element.richMsg.template1.encodeToString(offset = 1)
1 -> MiraiPlatformUtils.unzip(element.richMsg.template1, 1).encodeToString()
else -> error("unknown compression flag=${element.richMsg.template1[0]}")
}
}
when (element.richMsg.serviceId) {
// 5: 使用微博长图转换功能分享到QQ群
......
......@@ -93,7 +93,8 @@ internal fun UByteArray.toUHexString(separator: String = " ", offset: Int = 0, l
}
@Suppress("NOTHING_TO_INLINE")
internal inline fun ByteArray.encodeToString(charset: Charset = Charsets.UTF_8): String = String(this, charset = charset)
internal inline fun ByteArray.encodeToString(offset: Int = 0, charset: Charset = Charsets.UTF_8): String =
String(this, charset = charset, offset = offset)
@PublishedApi
internal inline fun ByteArray.toReadPacket(offset: Int = 0, length: Int = this.size - offset) =
......
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