mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-07 16:40:43 +08:00
Fix ServiceMessage not refined in ANDROID_WATCH
; fix #1652
This commit is contained in:
parent
456903628e
commit
b42a57736d
@ -489,7 +489,23 @@ internal object ReceiveMessageTransformer {
|
|||||||
else -> error("unknown compression flag=${richMsg.template1[0]}")
|
else -> error("unknown compression flag=${richMsg.template1[0]}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
when (richMsg.serviceId) {
|
|
||||||
|
fun findStringProperty(name: String): String {
|
||||||
|
return content.substringAfter("$name=\"", "").substringBefore("\"", "")
|
||||||
|
}
|
||||||
|
|
||||||
|
val serviceId = when (val sid = richMsg.serviceId) {
|
||||||
|
0 -> {
|
||||||
|
val serviceIdStr = findStringProperty("serviceID")
|
||||||
|
if (serviceIdStr.isEmpty() || serviceIdStr.isBlank()) {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
serviceIdStr.toIntOrNull() ?: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> sid
|
||||||
|
}
|
||||||
|
when (serviceId) {
|
||||||
// 5: 使用微博长图转换功能分享到QQ群
|
// 5: 使用微博长图转换功能分享到QQ群
|
||||||
/*
|
/*
|
||||||
<?xml version="1.0" encoding="utf-8"?><msg serviceID="5" templateID="12345" brief="[分享]想要沐浴阳光,就别钻进
|
<?xml version="1.0" encoding="utf-8"?><msg serviceID="5" templateID="12345" brief="[分享]想要沐浴阳光,就别钻进
|
||||||
@ -507,9 +523,6 @@ internal object ReceiveMessageTransformer {
|
|||||||
* [LongMessageInternal], [ForwardMessage]
|
* [LongMessageInternal], [ForwardMessage]
|
||||||
*/
|
*/
|
||||||
35 -> {
|
35 -> {
|
||||||
fun findStringProperty(name: String): String {
|
|
||||||
return content.substringAfter("$name=\"", "").substringBefore("\"", "")
|
|
||||||
}
|
|
||||||
|
|
||||||
val resId = findStringProperty("m_resid")
|
val resId = findStringProperty("m_resid")
|
||||||
|
|
||||||
@ -539,7 +552,7 @@ internal object ReceiveMessageTransformer {
|
|||||||
|
|
||||||
// 104 新群员入群的消息
|
// 104 新群员入群的消息
|
||||||
else -> {
|
else -> {
|
||||||
builder.add(SimpleServiceMessage(richMsg.serviceId, content))
|
builder.add(SimpleServiceMessage(serviceId, content))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user