mirror of
https://github.com/whitechi73/OpenShamrock.git
synced 2024-08-14 13:12:17 +08:00
Shamrock
: fix comm_elem parser
This commit is contained in:
parent
50d7dfa06d
commit
4283651b1e
@ -8,5 +8,5 @@ import protobuf.message.element.*
|
||||
data class MessageElement(
|
||||
@ProtoNumber(1) val text: TextElement? = null,
|
||||
@ProtoNumber(51) val json: JsonElement? = null,
|
||||
@ProtoNumber(53) val richMedia: RichMediaElement? = null,
|
||||
@ProtoNumber(53) val commElem: CommonElement? = null,
|
||||
)
|
@ -4,7 +4,7 @@ import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.protobuf.ProtoNumber
|
||||
|
||||
@Serializable
|
||||
data class RichMediaElement(
|
||||
data class CommonElement(
|
||||
@ProtoNumber(1) val type: Int? = null,
|
||||
@ProtoNumber(2) val data: ByteArray? = null,
|
||||
@ProtoNumber(3) val u1: Int? = null,
|
@ -109,19 +109,22 @@ internal object PrimitiveListener {
|
||||
}
|
||||
|
||||
private fun onGroupMessage(msgTime: Long, body: MessageBody) {
|
||||
body.rich?.elements?.filter {
|
||||
it.richMedia != null
|
||||
}?.map {
|
||||
ProtoBuf.decodeFromByteArray<RichMediaForPicData>(it.richMedia!!.data!!)
|
||||
}?.forEach {
|
||||
it.display?.show?.download?.url?.let {
|
||||
RKEY_PATTERN.matcher(it).takeIf {
|
||||
it.find()
|
||||
}?.group(1)?.let { rkey ->
|
||||
LogCenter.log("更新NT RKEY成功:$rkey")
|
||||
RichProtoSvc.multiMediaRKey = rkey
|
||||
runCatching {
|
||||
body.rich?.elements?.filter {
|
||||
it.commElem != null && it.commElem!!.type == 48
|
||||
}?.map {
|
||||
ProtoBuf.decodeFromByteArray<RichMediaForPicData>(it.commElem!!.data!!)
|
||||
}?.forEach {
|
||||
it.display?.show?.download?.url?.let {
|
||||
RKEY_PATTERN.matcher(it).takeIf {
|
||||
it.find()
|
||||
}?.group(1)?.let { rkey ->
|
||||
LogCenter.log("更新NT RKEY成功:$rkey")
|
||||
RichProtoSvc.multiMediaRKey = rkey
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user