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