mirror of
https://github.com/mamoe/mirai.git
synced 2025-04-25 04:50:26 +08:00
[core] Fix up previous commit 81a09549e7
This commit is contained in:
parent
d0f825b0b0
commit
2baba6a1f3
mirai-core/src
commonMain/kotlin/network/protocol/packet
nativeTest/kotlin/network
@ -25,7 +25,7 @@ import net.mamoe.mirai.utils.KEY_16_ZEROS
|
||||
import net.mamoe.mirai.utils.TestOnly
|
||||
import kotlin.random.Random
|
||||
|
||||
@kotlin.Suppress("unused")
|
||||
@Suppress("unused")
|
||||
internal class OutgoingPacketWithRespType<R : Packet?> constructor(
|
||||
remark: String?,
|
||||
commandName: String,
|
||||
@ -83,7 +83,7 @@ internal inline fun <R : Packet?> OutgoingPacketFactory<R>.buildOutgoingUniPacke
|
||||
key: ByteArray = client.wLoginSigInfo.d2Key,
|
||||
extraData: ByteReadPacket = BRP_STUB,
|
||||
sequenceId: Int = client.nextSsoSequenceId(),
|
||||
body: BytePacketBuilder.(sequenceId: Int) -> Unit
|
||||
crossinline body: BytePacketBuilder.(sequenceId: Int) -> Unit
|
||||
): OutgoingPacketWithRespType<R> {
|
||||
|
||||
return OutgoingPacketWithRespType(remark, commandName, sequenceId, buildPacket {
|
||||
@ -114,7 +114,7 @@ internal inline fun <R : Packet?> IncomingPacketFactory<R>.buildResponseUniPacke
|
||||
key: ByteArray = client.wLoginSigInfo.d2Key,
|
||||
extraData: ByteReadPacket = BRP_STUB,
|
||||
sequenceId: Int = client.nextSsoSequenceId(),
|
||||
body: BytePacketBuilder.(sequenceId: Int) -> Unit = {}
|
||||
crossinline body: BytePacketBuilder.(sequenceId: Int) -> Unit = {}
|
||||
): OutgoingPacketWithRespType<R> {
|
||||
@Suppress("DuplicatedCode")
|
||||
return OutgoingPacketWithRespType(name, commandName, sequenceId, buildPacket {
|
||||
@ -141,7 +141,7 @@ private inline fun BytePacketBuilder.writeUniPacket(
|
||||
commandName: String,
|
||||
unknownData: ByteArray,
|
||||
extraData: ByteReadPacket = BRP_STUB,
|
||||
body: BytePacketBuilder.() -> Unit
|
||||
crossinline body: BytePacketBuilder.() -> Unit
|
||||
) {
|
||||
writeIntLVPacket(lengthOffset = { it + 4 }) {
|
||||
commandName.let {
|
||||
@ -176,7 +176,7 @@ internal inline fun <R : Packet?> OutgoingPacketFactory<R>.buildLoginOutgoingPac
|
||||
remark: String? = null,
|
||||
commandName: String = this.commandName,
|
||||
key: ByteArray = KEY_16_ZEROS,
|
||||
body: BytePacketBuilder.(sequenceId: Int) -> Unit
|
||||
crossinline body: BytePacketBuilder.(sequenceId: Int) -> Unit
|
||||
): OutgoingPacketWithRespType<R> {
|
||||
val sequenceId: Int = client.nextSsoSequenceId()
|
||||
|
||||
@ -214,7 +214,7 @@ internal inline fun BytePacketBuilder.writeSsoPacket(
|
||||
extraData: ByteReadPacket = BRP_STUB,
|
||||
unknownHex: String = "01 00 00 00 00 00 00 00 00 00 01 00",
|
||||
sequenceId: Int,
|
||||
body: BytePacketBuilder.() -> Unit
|
||||
crossinline body: BytePacketBuilder.() -> Unit
|
||||
) {
|
||||
|
||||
/* send
|
||||
|
@ -271,7 +271,7 @@ internal class TroopManagement {
|
||||
private inline fun impl(
|
||||
client: QQAndroidClient,
|
||||
groupCode: Long,
|
||||
info: Oidb0x89a.Groupinfo.() -> Unit
|
||||
crossinline info: Oidb0x89a.Groupinfo.() -> Unit
|
||||
): OutgoingPacket {
|
||||
return buildOutgoingUniPacket(client) {
|
||||
writeProtoBuf(
|
||||
|
@ -112,8 +112,8 @@ internal object MessageSvcPbSendMsg : OutgoingPacketFactory<MessageSvcPbSendMsg.
|
||||
private inline fun buildOutgoingMessageCommon(
|
||||
client: QQAndroidClient,
|
||||
message: MessageChain,
|
||||
fragmentTranslator: (MessageChain) -> ImMsgBody.MsgBody,
|
||||
pbSendMsgReq: (
|
||||
crossinline fragmentTranslator: (MessageChain) -> ImMsgBody.MsgBody,
|
||||
crossinline pbSendMsgReq: (
|
||||
msgBody: ImMsgBody.MsgBody,
|
||||
msgSeq: Int,
|
||||
msgRand: Int,
|
||||
|
@ -523,7 +523,7 @@ internal class LengthDelimitedPacketReaderTest : AbstractTest() {
|
||||
)
|
||||
}
|
||||
|
||||
private inline fun buildLVPacket(block: BytePacketBuilder.() -> Unit): ByteReadPacket {
|
||||
private inline fun buildLVPacket(crossinline block: BytePacketBuilder.() -> Unit): ByteReadPacket {
|
||||
contract {
|
||||
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user