mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-11 01:14:57 +08:00
Merge remote-tracking branch 'upsteam/master'
This commit is contained in:
commit
2c9d38dffa
@ -86,18 +86,18 @@ internal class MemberImpl(
|
||||
} else if (myPermission == MemberPermission.MEMBER) {
|
||||
return false
|
||||
}
|
||||
try {
|
||||
return try {
|
||||
bot.network.run {
|
||||
val response = TroopManagement.Mute(
|
||||
TroopManagement.Mute(
|
||||
client = bot.client,
|
||||
groupCode = group.id,
|
||||
memberUin = this@MemberImpl.id,
|
||||
timeInSecond = durationSeconds
|
||||
).sendAndExpect<TroopManagement.Mute.Response>()
|
||||
}
|
||||
return true
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
return false
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,8 +89,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
|
||||
is LoginPacket.LoginPacketResponse.DeviceLockLogin -> {
|
||||
response = LoginPacket.SubCommand20(
|
||||
bot.client,
|
||||
response.t402,
|
||||
response.t403
|
||||
response.t402
|
||||
).sendAndExpect()
|
||||
continue@mainloop
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ internal data class RequestPushNotify(
|
||||
@Suppress("ArrayInDataClass")
|
||||
@Serializable
|
||||
internal data class MsgInfo(
|
||||
@SerialId(0) val lFromUin: Long = 0L,
|
||||
@SerialId(1) val uMsgTime: Long = 0L,
|
||||
@SerialId(0) val lFromUin: Long? = 0L,
|
||||
@SerialId(1) val uMsgTime: Long? = 0L,
|
||||
@SerialId(2) val shMsgType: Short,
|
||||
@SerialId(3) val shMsgSeq: Short,
|
||||
@SerialId(4) val strMsg: String?,
|
||||
|
@ -360,7 +360,7 @@ internal object KnownPacketFactories {
|
||||
}
|
||||
|
||||
@UseExperimental(ExperimentalContracts::class)
|
||||
internal inline fun <I : IoBuffer, R> I.withUse(block: I.() -> R): R {
|
||||
internal inline fun <R> IoBuffer.withUse(block: IoBuffer.() -> R): R {
|
||||
contract {
|
||||
callsInPlace(block, kotlin.contracts.InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
@ -372,7 +372,7 @@ internal inline fun <I : IoBuffer, R> I.withUse(block: I.() -> R): R {
|
||||
}
|
||||
|
||||
@UseExperimental(ExperimentalContracts::class)
|
||||
internal inline fun <I : ByteReadPacket, R> I.withUse(block: I.() -> R): R {
|
||||
internal inline fun <R> ByteReadPacket.withUse(block: ByteReadPacket.() -> R): R {
|
||||
contract {
|
||||
callsInPlace(block, kotlin.contracts.InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
|
@ -146,8 +146,7 @@ fun BytePacketBuilder.t116(
|
||||
fun BytePacketBuilder.t100(
|
||||
appId: Long = 16,
|
||||
subAppId: Long = 537062845,
|
||||
appClientVersion: Int,
|
||||
sigMap: Int
|
||||
appClientVersion: Int
|
||||
) {
|
||||
writeShort(0x100)
|
||||
writeShortLVPacket {
|
||||
@ -156,7 +155,7 @@ fun BytePacketBuilder.t100(
|
||||
writeInt(appId.toInt())
|
||||
writeInt(subAppId.toInt())
|
||||
writeInt(appClientVersion)
|
||||
writeInt(34869472) // 34869472?
|
||||
writeInt(34869472) // sigMap, 34869472?
|
||||
} shouldEqualsTo 22
|
||||
}
|
||||
|
||||
|
@ -72,8 +72,7 @@ internal object LoginPacket : OutgoingPacketFactory<LoginPacket.LoginPacketRespo
|
||||
@UseExperimental(MiraiInternalAPI::class)
|
||||
operator fun invoke(
|
||||
client: QQAndroidClient,
|
||||
t402: ByteArray,
|
||||
t403: ByteArray
|
||||
t402: ByteArray
|
||||
): OutgoingPacket = buildLoginOutgoingPacket(client, bodyType = 2) { sequenceId ->
|
||||
writeSsoPacket(client, subAppId, commandName, sequenceId = sequenceId) {
|
||||
writeOicqRequestPacket(client, EncryptMethodECDH7(client.ecdh), 0x0810) {
|
||||
@ -96,10 +95,7 @@ internal object LoginPacket : OutgoingPacketFactory<LoginPacket.LoginPacketRespo
|
||||
private const val subAppId = 537062845L
|
||||
@UseExperimental(MiraiInternalAPI::class)
|
||||
operator fun invoke(
|
||||
client: QQAndroidClient,
|
||||
t174: ByteArray,
|
||||
t402: ByteArray,
|
||||
phoneNumber: String
|
||||
client: QQAndroidClient
|
||||
): OutgoingPacket = buildLoginOutgoingPacket(client, bodyType = 2) { sequenceId ->
|
||||
writeSsoPacket(client, subAppId, commandName, sequenceId = sequenceId, unknownHex = "01 00 00 00 00 00 00 00 00 00 01 00") {
|
||||
writeOicqRequestPacket(client, EncryptMethodECDH7(client.ecdh), 0x0810) {
|
||||
@ -163,7 +159,7 @@ internal object LoginPacket : OutgoingPacketFactory<LoginPacket.LoginPacketRespo
|
||||
if (ConfigManager.get_loginWithPicSt()) appIdList = longArrayOf(1600000226L)
|
||||
*/
|
||||
t116(client.miscBitMap, client.subSigMap)
|
||||
t100(appId, subAppId, client.appClientVersion, client.mainSigMap or 0xC0)
|
||||
t100(appId, subAppId, client.appClientVersion)
|
||||
t107(0)
|
||||
|
||||
// t108(byteArrayOf())
|
||||
@ -310,7 +306,7 @@ internal object LoginPacket : OutgoingPacketFactory<LoginPacket.LoginPacketRespo
|
||||
@UseExperimental(MiraiDebugAPI::class)
|
||||
override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): LoginPacketResponse {
|
||||
|
||||
val subCommand = readUShort().toInt()
|
||||
discardExact(2) // subCommand
|
||||
// println("subCommand=$subCommand")
|
||||
val type = readUByte()
|
||||
// println("type=$type")
|
||||
@ -703,7 +699,7 @@ internal object LoginPacket : OutgoingPacketFactory<LoginPacket.LoginPacketRespo
|
||||
private fun QQAndroidClient.analysisTlv149(t149: ByteArray): LoginPacketResponse.Error {
|
||||
|
||||
return t149.read {
|
||||
val type: Short = readShort()
|
||||
discardExact(2) //type
|
||||
val title: String = readUShortLVString()
|
||||
val content: String = readUShortLVString()
|
||||
val otherInfo: String = readUShortLVString()
|
||||
|
@ -1,31 +0,0 @@
|
||||
package net.mamoe.mirai.qqandroid.network.protocol.packet.login
|
||||
|
||||
|
||||
import kotlinx.io.core.ByteReadPacket
|
||||
import net.mamoe.mirai.data.Packet
|
||||
import net.mamoe.mirai.qqandroid.QQAndroidBot
|
||||
import net.mamoe.mirai.qqandroid.network.QQAndroidClient
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.*
|
||||
|
||||
internal object TransEmpPacket : OutgoingPacketFactory<TransEmpPacket.Response>("wtlogin.trans_emp") {
|
||||
|
||||
private const val appId = 16L
|
||||
private const val subAppId = 537062845L
|
||||
|
||||
@Suppress("FunctionName")
|
||||
fun SubCommand1(
|
||||
client: QQAndroidClient
|
||||
): OutgoingPacket = buildLoginOutgoingPacket(client, bodyType = 2) {
|
||||
writeOicqRequestPacket(client, EncryptMethodECDH135(client.ecdh), TODO()) {
|
||||
|
||||
// oicq.wlogin_sdk.request.trans_emp_1#packTransEmpBody
|
||||
}
|
||||
}
|
||||
|
||||
object Response : Packet
|
||||
|
||||
|
||||
override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): Response {
|
||||
TODO("not implemented")
|
||||
}
|
||||
}
|
@ -175,7 +175,7 @@ fun ByteReadPacket.analysisOneFullPacket(): ByteReadPacket = debugIfFail("Failed
|
||||
readShort().toInt().takeIf { it != 8001 }?.let {
|
||||
println("这个包不是 oicqRequest")
|
||||
return@debugIfFail this
|
||||
println(" got new protocolVersion=$it")
|
||||
//println(" got new protocolVersion=$it")
|
||||
}
|
||||
val commandId = readUShort().toInt()
|
||||
println(" commandId=0x${commandId.toShort().toUHexString()}")
|
||||
|
@ -11,7 +11,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
|
||||
*/
|
||||
class At @MiraiInternalAPI constructor(val target: Long, val display: String) : Message {
|
||||
@UseExperimental(MiraiInternalAPI::class)
|
||||
constructor(member: Member) : this(member.id, member.groupCard)
|
||||
constructor(member: Member) : this(member.id, "@${member.groupCard}")
|
||||
|
||||
override fun toString(): String = display
|
||||
|
||||
|
@ -76,7 +76,7 @@ suspend fun main() {
|
||||
startsWith("profile", removePrefix = true) {
|
||||
val account = it.trim()
|
||||
if (account.isNotEmpty()) {
|
||||
account.toLong().qq()
|
||||
bot.getFriend(account.toLong())
|
||||
} else {
|
||||
sender
|
||||
}.queryProfile().toString().reply()
|
||||
|
Loading…
Reference in New Issue
Block a user