mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-24 14:30:09 +08:00
Rename st
to St
This commit is contained in:
parent
22096a9f44
commit
224b8058e8
@ -9,7 +9,7 @@ internal class GetTroopListReqV2Simplify(
|
||||
@SerialId(0) val uin: Long,
|
||||
@SerialId(1) val getMSFMsgFlag: Byte? = null,
|
||||
@SerialId(2) val vecCookies: ByteArray? = null,
|
||||
@SerialId(3) val vecGroupInfo: List<stTroopNumSimplify>? = null,
|
||||
@SerialId(3) val vecGroupInfo: List<StTroopNumSimplify>? = null,
|
||||
@SerialId(4) val groupFlagExt: Byte? = null,
|
||||
@SerialId(5) val shVersion: Int? = null,
|
||||
@SerialId(6) val dwCompanyId: Long? = null,
|
||||
@ -18,7 +18,7 @@ internal class GetTroopListReqV2Simplify(
|
||||
) : JceStruct
|
||||
|
||||
@Serializable
|
||||
internal class stTroopNumSimplify(
|
||||
internal class StTroopNumSimplify(
|
||||
@SerialId(0) val groupCode: Long,
|
||||
@SerialId(1) val dwGroupInfoSeq: Long? = null,
|
||||
@SerialId(2) val dwGroupFlagExt: Long? = null,
|
||||
@ -29,20 +29,20 @@ internal class stTroopNumSimplify(
|
||||
@Serializable
|
||||
internal class GetTroopListRespV2(
|
||||
@SerialId(0) val uin: Long,
|
||||
@SerialId(1) val troopcount: Short,
|
||||
@SerialId(1) val troopCount: Short,
|
||||
@SerialId(2) val result: Int,
|
||||
@SerialId(3) val errorCode: Short? = null,
|
||||
@SerialId(4) val vecCookies: ByteArray? = null,
|
||||
@SerialId(5) val vecTroopList: List<stTroopNum>? = null,
|
||||
@SerialId(6) val vecTroopListDel: List<stTroopNum>? = null,
|
||||
@SerialId(7) val vecTroopRank: List<stGroupRankInfo>? = null,
|
||||
@SerialId(8) val vecFavGroup: List<stFavoriteGroup>? = null,
|
||||
@SerialId(9) val vecTroopListExt: List<stTroopNum>? = null
|
||||
@SerialId(5) val vecTroopList: List<StTroopNum>? = null,
|
||||
@SerialId(6) val vecTroopListDel: List<StTroopNum>? = null,
|
||||
@SerialId(7) val vecTroopRank: List<StGroupRankInfo>? = null,
|
||||
@SerialId(8) val vecFavGroup: List<StFavoriteGroup>? = null,
|
||||
@SerialId(9) val vecTroopListExt: List<StTroopNum>? = null
|
||||
) : JceStruct
|
||||
|
||||
|
||||
@Serializable
|
||||
internal class stTroopNum(
|
||||
internal class StTroopNum(
|
||||
@SerialId(0) val groupUin: Long,
|
||||
@SerialId(1) val groupCode: Long,
|
||||
@SerialId(2) val flag: Byte? = null,
|
||||
@ -52,8 +52,8 @@ internal class stTroopNum(
|
||||
@SerialId(6) val dwGroupFlagExt: Long? = null,
|
||||
@SerialId(7) val dwGroupRankSeq: Long? = null,
|
||||
@SerialId(8) val dwCertificationType: Long? = null,
|
||||
@SerialId(9) val dwShutupTimestamp: Long? = null,
|
||||
@SerialId(10) val dwMyShutupTimestamp: Long? = null,
|
||||
@SerialId(9) val dwShutUpTimestamp: Long? = null,
|
||||
@SerialId(10) val dwMyShutUpTimestamp: Long? = null,
|
||||
@SerialId(11) val dwCmdUinUinFlag: Long? = null,
|
||||
@SerialId(12) val dwAdditionalFlag: Long? = null,
|
||||
@SerialId(13) val dwGroupTypeFlag: Long? = null,
|
||||
@ -81,11 +81,11 @@ internal class stTroopNum(
|
||||
) : JceStruct
|
||||
|
||||
@Serializable
|
||||
internal class stGroupRankInfo(
|
||||
internal class StGroupRankInfo(
|
||||
@SerialId(0) val dwGroupCode: Long,
|
||||
@SerialId(1) val groupRankSysFlag: Byte? = null,
|
||||
@SerialId(2) val groupRankUserFlag: Byte? = null,
|
||||
@SerialId(3) val vecRankMap: List<stLevelRankPair>? = null,
|
||||
@SerialId(3) val vecRankMap: List<StLevelRankPair>? = null,
|
||||
@SerialId(4) val dwGroupRankSeq: Long? = null,
|
||||
@SerialId(5) val ownerName: String? = "",
|
||||
@SerialId(6) val adminName: String? = "",
|
||||
@ -93,7 +93,7 @@ internal class stGroupRankInfo(
|
||||
) : JceStruct
|
||||
|
||||
@Serializable
|
||||
internal class stFavoriteGroup(
|
||||
internal class StFavoriteGroup(
|
||||
@SerialId(0) val dwGroupCode: Long,
|
||||
@SerialId(1) val dwTimestamp: Long? = null,
|
||||
@SerialId(2) val dwSnsFlag: Long? = 1L,
|
||||
@ -101,7 +101,7 @@ internal class stFavoriteGroup(
|
||||
) : JceStruct
|
||||
|
||||
@Serializable
|
||||
internal class stLevelRankPair(
|
||||
internal class StLevelRankPair(
|
||||
@SerialId(0) val dwLevel: Long? = null,
|
||||
@SerialId(1) val rank: String? = ""
|
||||
) : JceStruct
|
||||
@ -124,7 +124,7 @@ internal class GetTroopMemberListResp(
|
||||
@SerialId(0) val uin: Long,
|
||||
@SerialId(1) val groupCode: Long,
|
||||
@SerialId(2) val groupUin: Long,
|
||||
@SerialId(3) val vecTroopMember: List<stTroopMemberInfo>,
|
||||
@SerialId(3) val vecTroopMember: List<StTroopMemberInfo>,
|
||||
@SerialId(4) val nextUin: Long,
|
||||
@SerialId(5) val result: Int,
|
||||
@SerialId(6) val errorCode: Short? = null,
|
||||
@ -133,7 +133,7 @@ internal class GetTroopMemberListResp(
|
||||
) : JceStruct
|
||||
|
||||
@Serializable
|
||||
internal class stTroopMemberInfo(
|
||||
internal class StTroopMemberInfo(
|
||||
@SerialId(0) val memberUin: Long,
|
||||
@SerialId(1) val faceId: Short,
|
||||
@SerialId(2) val age: Byte,
|
||||
|
@ -15,13 +15,10 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.list.FriendList
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.login.ConfigPushSvc
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.login.LoginPacket
|
||||
import net.mamoe.mirai.qqandroid.network.protocol.packet.login.StatSvc
|
||||
import net.mamoe.mirai.utils.DefaultLogger
|
||||
import net.mamoe.mirai.utils.MiraiLoggerWithSwitch
|
||||
import net.mamoe.mirai.utils.*
|
||||
import net.mamoe.mirai.utils.cryptor.adjustToPublicKey
|
||||
import net.mamoe.mirai.utils.cryptor.decryptBy
|
||||
import net.mamoe.mirai.utils.io.*
|
||||
import net.mamoe.mirai.utils.unzip
|
||||
import net.mamoe.mirai.utils.withSwitch
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.contract
|
||||
import kotlin.jvm.JvmName
|
||||
@ -155,6 +152,7 @@ internal object KnownPacketFactories {
|
||||
* full packet without length
|
||||
*/
|
||||
// do not inline. Exceptions thrown will not be reported correctly
|
||||
@UseExperimental(MiraiInternalAPI::class)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
suspend fun <T : Packet> parseIncomingPacket(bot: QQAndroidBot, rawInput: Input, consumer: PacketConsumer<T>) = with(rawInput) {
|
||||
// login
|
||||
@ -250,7 +248,7 @@ internal object KnownPacketFactories {
|
||||
/**
|
||||
* 解析 SSO 层包装
|
||||
*/
|
||||
@UseExperimental(ExperimentalUnsignedTypes::class)
|
||||
@UseExperimental(ExperimentalUnsignedTypes::class, MiraiInternalAPI::class)
|
||||
private fun parseSsoFrame(bot: QQAndroidBot, input: ByteReadPacket): IncomingPacket {
|
||||
val commandName: String
|
||||
val ssoSequenceId: Int
|
||||
|
@ -27,7 +27,6 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket
|
||||
import net.mamoe.mirai.qqandroid.utils.toMessageChain
|
||||
import net.mamoe.mirai.qqandroid.utils.toRichTextElems
|
||||
import net.mamoe.mirai.utils.MiraiInternalAPI
|
||||
import net.mamoe.mirai.utils.cryptor.contentToString
|
||||
import net.mamoe.mirai.utils.currentTimeSeconds
|
||||
import kotlin.math.absoluteValue
|
||||
import kotlin.random.Random
|
||||
@ -86,13 +85,13 @@ internal class MessageSvc {
|
||||
}
|
||||
|
||||
@UseExperimental(MiraiInternalAPI::class)
|
||||
internal class GetMsgSuccess(delegate: MutableList<FriendMessage>) : Response(MsgSvc.SyncFlag.STOP, delegate)
|
||||
internal class GetMsgSuccess(delegate: List<FriendMessage>) : Response(MsgSvc.SyncFlag.STOP, delegate)
|
||||
|
||||
/**
|
||||
* 不要直接 expect 这个 class. 它可能
|
||||
*/
|
||||
@MiraiInternalAPI
|
||||
open class Response(internal val syncFlagFromServer: MsgSvc.SyncFlag, delegate: MutableList<FriendMessage>) : MultiPacket<FriendMessage>(delegate),
|
||||
open class Response(internal val syncFlagFromServer: MsgSvc.SyncFlag, delegate: List<FriendMessage>) : MultiPacket<FriendMessage>(delegate),
|
||||
BroadcastControllable {
|
||||
override val shouldBroadcast: Boolean
|
||||
get() = syncFlagFromServer == MsgSvc.SyncFlag.STOP
|
||||
@ -102,13 +101,15 @@ internal class MessageSvc {
|
||||
}
|
||||
}
|
||||
|
||||
object EmptyResponse : Response(MsgSvc.SyncFlag.STOP, emptyList())
|
||||
|
||||
@UseExperimental(MiraiInternalAPI::class)
|
||||
override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): Response {
|
||||
// 00 00 01 0F 08 00 12 00 1A 34 08 FF C1 C4 F1 05 10 FF C1 C4 F1 05 18 E6 ED B9 C3 02 20 89 FE BE A4 06 28 8A CA 91 D1 0C 48 9B A5 BD 9B 0A 58 DE 9D 99 F8 08 60 1D 68 FF C1 C4 F1 05 70 00 20 02 2A 9D 01 08 F3 C1 C4 F1 05 10 A2 FF 8C F0 03 18 01 22 8A 01 0A 2A 08 A2 FF 8C F0 03 10 DD F1 92 B7 07 18 A6 01 20 0B 28 AE F9 01 30 F4 C1 C4 F1 05 38 A7 E3 D8 D4 84 80 80 80 01 B8 01 CD B5 01 12 08 08 01 10 00 18 00 20 00 1A 52 0A 50 0A 27 08 00 10 F4 C1 C4 F1 05 18 A7 E3 D8 D4 04 20 00 28 0C 30 00 38 86 01 40 22 4A 0C E5 BE AE E8 BD AF E9 9B 85 E9 BB 91 12 08 0A 06 0A 04 4E 4D 53 4C 12 15 AA 02 12 9A 01 0F 80 01 01 C8 01 00 F0 01 00 F8 01 00 90 02 00 12 04 4A 02 08 00 30 01 2A 15 08 97 A2 C1 F1 05 10 95 A6 F5 E5 0C 18 01 30 01 40 01 48 81 01 2A 10 08 D3 F7 B5 F1 05 10 DD F1 92 B7 07 18 01 30 01 38 00 42 00 48 00
|
||||
val resp = readProtoBuf(MsgSvc.PbGetMsgResp.serializer())
|
||||
|
||||
if (resp.result != 0) {
|
||||
println("!!! Result=${resp.result} !!!: " + resp.contentToString())
|
||||
// println("!!! Result=${resp.result} !!!: " + resp.contentToString())
|
||||
return GetMsgSuccess(mutableListOf())
|
||||
}
|
||||
|
||||
@ -117,9 +118,12 @@ internal class MessageSvc {
|
||||
bot.client.c2cMessageSync.msgCtrlBuf = resp.msgCtrlBuf
|
||||
|
||||
if (resp.uinPairMsgs == null) {
|
||||
return GetMsgSuccess(mutableListOf())
|
||||
return EmptyResponse
|
||||
}
|
||||
|
||||
if (!bot.firstLoginSucceed)
|
||||
return EmptyResponse
|
||||
|
||||
val messages = resp.uinPairMsgs.asSequence().filterNot { it.msg == null }.flatMap { it.msg!!.asSequence() }.mapNotNull {
|
||||
when (it.msgHead.msgType) {
|
||||
166 -> FriendMessage(
|
||||
@ -132,7 +136,7 @@ internal class MessageSvc {
|
||||
}.toMutableList()
|
||||
if (resp.syncFlag == MsgSvc.SyncFlag.STOP) {
|
||||
messages.ifEmpty {
|
||||
return GetMsgSuccess(messages)
|
||||
return EmptyResponse
|
||||
}
|
||||
return GetMsgSuccess(mutableListOf(messages.last()))
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ internal class FriendList {
|
||||
}
|
||||
|
||||
class Response(
|
||||
val members: List<stTroopMemberInfo>,
|
||||
val members: List<StTroopMemberInfo>,
|
||||
val nextUin: Long
|
||||
) : Packet {
|
||||
override fun toString(): String = "Friendlist.GetTroopMemberList.Response"
|
||||
@ -76,7 +76,7 @@ internal class FriendList {
|
||||
}
|
||||
|
||||
class Response(
|
||||
val groups: List<stTroopNum>
|
||||
val groups: List<StTroopNum>
|
||||
) : Packet {
|
||||
override fun toString(): String = "FriendList.GetFriendGroupList.Response"
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ object NoPakcet : Packet
|
||||
/**
|
||||
* PacketFactory 可以一次解析多个包出来. 它们将会被分别广播.
|
||||
*/
|
||||
open class MultiPacket<P : Packet>(internal val delegate: MutableList<P>) : List<P> by delegate, Packet {
|
||||
open class MultiPacket<P : Packet>(internal val delegate: List<P>) : List<P> by delegate, Packet {
|
||||
override fun toString(): String {
|
||||
return "MultiPacket<${this.firstOrNull()?.let { it::class.simpleName } ?: "?"}>"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user