Commit f3cf0004 authored by Him188's avatar Him188

Fix values

parent b6d91545
...@@ -20,7 +20,6 @@ import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc ...@@ -20,7 +20,6 @@ import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc
import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket
import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacketFactory
import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket
import net.mamoe.mirai.qqandroid.utils._miraiContentToString
import net.mamoe.mirai.qqandroid.utils.io.serialization.readProtoBuf import net.mamoe.mirai.qqandroid.utils.io.serialization.readProtoBuf
import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray
import net.mamoe.mirai.qqandroid.utils.io.serialization.writeProtoBuf import net.mamoe.mirai.qqandroid.utils.io.serialization.writeProtoBuf
...@@ -93,7 +92,7 @@ internal class PbMessageSvc { ...@@ -93,7 +92,7 @@ internal class PbMessageSvc {
fromUin = client.bot.id, fromUin = client.bot.id,
toUin = toUin, toUin = toUin,
msgSeq = messageSequenceId, msgSeq = messageSequenceId,
msgUid = 1000000000000000000L or messageRandom.toULong().toLong(), msgUid = 0x0100000000000000L or messageRandom.toLong().and(0xFFFF_FFFF),
msgTime = time.toLong(), msgTime = time.toLong(),
routingHead = MsgSvc.RoutingHead( routingHead = MsgSvc.RoutingHead(
grpTmp = MsgSvc.GrpTmp(groupUin, toUin) grpTmp = MsgSvc.GrpTmp(groupUin, toUin)
...@@ -124,7 +123,7 @@ internal class PbMessageSvc { ...@@ -124,7 +123,7 @@ internal class PbMessageSvc {
fromUin = client.bot.id, fromUin = client.bot.id,
toUin = toUin, toUin = toUin,
msgSeq = messageSequenceId, msgSeq = messageSequenceId,
msgUid = 1000000000000000000L or messageRandom.toULong().toLong(), msgUid = 0x1000000000000000L or messageRandom.toLong().and(0xFFFF_FFFF),
msgTime = time.toLong(), msgTime = time.toLong(),
routingHead = MsgSvc.RoutingHead( routingHead = MsgSvc.RoutingHead(
c2c = MsgSvc.C2C( c2c = MsgSvc.C2C(
......
...@@ -49,7 +49,6 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.* ...@@ -49,7 +49,6 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.*
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.GroupInfoImpl import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.GroupInfoImpl
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.NewContact import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.NewContact
import net.mamoe.mirai.qqandroid.network.protocol.packet.list.FriendList import net.mamoe.mirai.qqandroid.network.protocol.packet.list.FriendList
import net.mamoe.mirai.qqandroid.utils._miraiContentToString
import net.mamoe.mirai.qqandroid.utils.io.serialization.decodeUniPacket import net.mamoe.mirai.qqandroid.utils.io.serialization.decodeUniPacket
import net.mamoe.mirai.qqandroid.utils.io.serialization.readProtoBuf import net.mamoe.mirai.qqandroid.utils.io.serialization.readProtoBuf
import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray
...@@ -132,7 +131,7 @@ internal class MessageSvc { ...@@ -132,7 +131,7 @@ internal class MessageSvc {
open class Response(internal val syncFlagFromServer: MsgSvc.SyncFlag, delegate: List<Packet>) : open class Response(internal val syncFlagFromServer: MsgSvc.SyncFlag, delegate: List<Packet>) :
MultiPacketByIterable<Packet>(delegate) { MultiPacketByIterable<Packet>(delegate) {
override fun toString(): String = override fun toString(): String =
"MessageSvc.PbGetMsg.Response($syncFlagFromServer=$syncFlagFromServer, messages=<Iterable>))" "MessageSvc.PbGetMsg.Response(syncFlagFromServer=$syncFlagFromServer, messages=<Iterable>))"
} }
object EmptyResponse : GetMsgSuccess(emptyList()) object EmptyResponse : GetMsgSuccess(emptyList())
...@@ -370,12 +369,13 @@ internal class MessageSvc { ...@@ -370,12 +369,13 @@ internal class MessageSvc {
message: MessageChain, message: MessageChain,
crossinline sourceCallback: (MessageSourceToFriendImpl) -> Unit crossinline sourceCallback: (MessageSourceToFriendImpl) -> Unit
): OutgoingPacket { ): OutgoingPacket {
val rand = Random.nextInt().absoluteValue
val source = MessageSourceToFriendImpl( val source = MessageSourceToFriendImpl(
id = Random.nextInt().absoluteValue, id = rand,
sender = client.bot, sender = client.bot,
target = qq, target = qq,
time = currentTimeSeconds.toInt(), time = currentTimeSeconds.toInt(),
sequenceId = client.atomicNextMessageSequenceId(), sequenceId = rand,
originalMessage = message originalMessage = message
) )
sourceCallback(source) sourceCallback(source)
...@@ -406,7 +406,7 @@ internal class MessageSvc { ...@@ -406,7 +406,7 @@ internal class MessageSvc {
), ),
msgSeq = source.sequenceId, msgSeq = source.sequenceId,
msgRand = source.id, msgRand = source.id,
syncCookie = SyncCookie(time = source.time.toULong().toLong()).toByteArray(SyncCookie.serializer()) syncCookie = SyncCookie(time = source.time.toLong()).toByteArray(SyncCookie.serializer())
// msgVia = 1 // msgVia = 1
) )
) )
...@@ -454,7 +454,7 @@ internal class MessageSvc { ...@@ -454,7 +454,7 @@ internal class MessageSvc {
), ),
msgSeq = source.sequenceId, msgSeq = source.sequenceId,
msgRand = source.id, msgRand = source.id,
syncCookie = SyncCookie(time = source.time.toULong().toLong()).toByteArray(SyncCookie.serializer()) syncCookie = SyncCookie(time = source.time.toLong()).toByteArray(SyncCookie.serializer())
) )
) )
} }
......
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