Add MessageSource.time

This commit is contained in:
Him188 2020-02-20 13:24:27 +08:00
parent f5a6040668
commit 3d4ff807af
2 changed files with 7 additions and 0 deletions

View File

@ -21,6 +21,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.data.proto.SourceMsg
internal inline class MessageSourceFromServer( internal inline class MessageSourceFromServer(
val delegate: ImMsgBody.SourceMsg val delegate: ImMsgBody.SourceMsg
) : MessageSource { ) : MessageSource {
override val time: Long get() = delegate.time.toLong() and 0xFFFFFFFF
override val messageUid: Long get() = delegate.pbReserve.loadAs(SourceMsg.ResvAttr.serializer()).origUids!! override val messageUid: Long get() = delegate.pbReserve.loadAs(SourceMsg.ResvAttr.serializer()).origUids!!
override val sourceMessage: MessageChain get() = delegate.toMessageChain() override val sourceMessage: MessageChain get() = delegate.toMessageChain()
override val senderId: Long get() = delegate.senderUin override val senderId: Long get() = delegate.senderUin
@ -32,6 +33,7 @@ internal inline class MessageSourceFromServer(
internal inline class MessageSourceFromMsg( internal inline class MessageSourceFromMsg(
val delegate: MsgComm.Msg val delegate: MsgComm.Msg
) : MessageSource { ) : MessageSource {
override val time: Long get() = delegate.msgHead.msgTime.toLong() and 0xFFFFFFFF
override val messageUid: Long get() = delegate.msgBody.richText.attr!!.random.toLong() override val messageUid: Long get() = delegate.msgBody.richText.attr!!.random.toLong()
override val sourceMessage: MessageChain get() = delegate.toMessageChain() override val sourceMessage: MessageChain get() = delegate.toMessageChain()
override val senderId: Long get() = delegate.msgHead.fromUin override val senderId: Long get() = delegate.msgHead.fromUin

View File

@ -31,6 +31,11 @@ interface MessageSource : Message {
*/ */
val messageUid: Long val messageUid: Long
/**
* 发送时间, 单位为秒
*/
val time: Long
/** /**
* 发送人号码 * 发送人号码
*/ */