2
0
Эх сурвалжийг харах

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/FriendListPacket.kt
Him188 5 жил өмнө
parent
commit
bc860a2d0d

+ 6 - 5
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt

@@ -74,12 +74,13 @@ internal class MemberImpl(
 
 
 @UseExperimental(MiraiInternalAPI::class)
 @UseExperimental(MiraiInternalAPI::class)
 internal class GroupImpl(
 internal class GroupImpl(
-    bot: QQAndroidBot, override val coroutineContext: CoroutineContext, override val id: Long,
-    override val owner: Member,
-    override val name: String,
-    override val announcement: String,
-    override val members: ContactList<Member>
+    bot: QQAndroidBot, override val coroutineContext: CoroutineContext, override val id: Long
 ) : ContactImpl(), Group {
 ) : ContactImpl(), Group {
+    override lateinit var owner: Member
+    override lateinit var name: String
+    override lateinit var announcement: String
+    override lateinit var members: ContactList<Member>
+
     override val internalId: GroupInternalId = GroupId(id).toInternalId()
     override val internalId: GroupInternalId = GroupId(id).toInternalId()
 
 
     override fun getMember(id: Long): Member =
     override fun getMember(id: Long): Member =

+ 10 - 0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt

@@ -163,6 +163,16 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
 
 
     }
     }
 
 
+    suspend fun getTroopMemberList(groupUni: Long) {
+        bot.logger.info("开始群[$groupUni]成员")
+        val data = FriendList.GetTroopMemberList(
+            bot.client,
+            groupUni,
+            0
+        ).sendAndExpect<FriendList.GetFriendGroupList.Response>(timeoutMillis = 1000)
+        println(data.contentToString())
+    }
+
     /**
     /**
      * 缓存超时处理的 [Job]. 超时后将清空缓存, 以免阻碍后续包的处理
      * 缓存超时处理的 [Job]. 超时后将清空缓存, 以免阻碍后续包的处理
      */
      */

+ 63 - 0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/TroopList.kt

@@ -116,4 +116,67 @@ internal class GetTroopMemberListReq(
     @SerialId(5) val reqType: Long? = null,
     @SerialId(5) val reqType: Long? = null,
     @SerialId(6) val getListAppointTime: Long? = null,
     @SerialId(6) val getListAppointTime: Long? = null,
     @SerialId(7) val richCardNameVer: Byte? = null
     @SerialId(7) val richCardNameVer: Byte? = null
+) : JceStruct
+
+
+@Serializable
+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(4) val nextUin: Long,
+    @SerialId(5) val result: Int,
+    @SerialId(6) val errorCode: Short? = null,
+    @SerialId(7) val officeMode: Long? = null,
+    @SerialId(8) val nextGetTime: Long? = null
+) : JceStruct
+
+@Serializable
+internal class stTroopMemberInfo(
+    @SerialId(0) val memberUin: Long,
+    @SerialId(1) val faceId: Short,
+    @SerialId(2) val age: Byte,
+    @SerialId(3) val gender: Byte,
+    @SerialId(4) val nick: String = "",
+    @SerialId(5) val status: Byte = 20,
+    @SerialId(6) val sShowName: String? = "",
+    @SerialId(8) val sName: String? = "",
+    @SerialId(9) val cGender: Byte? = null,
+    @SerialId(10) val sPhone: String? = "",
+    @SerialId(11) val sEmail: String? = "",
+    @SerialId(12) val sMemo: String? = "",
+    @SerialId(13) val autoRemark: String? = "",
+    @SerialId(14) val dwMemberLevel: Long? = null,
+    @SerialId(15) val dwJoinTime: Long? = null,
+    @SerialId(16) val dwLastSpeakTime: Long? = null,
+    @SerialId(17) val dwCreditLevel: Long? = null,
+    @SerialId(18) val dwFlag: Long? = null,
+    @SerialId(19) val dwFlagExt: Long? = null,
+    @SerialId(20) val dwPoint: Long? = null,
+    @SerialId(21) val concerned: Byte? = null,
+    @SerialId(22) val shielded: Byte? = null,
+    @SerialId(23) val sSpecialTitle: String? = "",
+    @SerialId(24) val dwSpecialTitleExpireTime: Long? = null,
+    @SerialId(25) val job: String? = "",
+    @SerialId(26) val apolloFlag: Byte? = null,
+    @SerialId(27) val dwApolloTimestamp: Long? = null,
+    @SerialId(28) val dwGlobalGroupLevel: Long? = null,
+    @SerialId(29) val dwTitleId: Long? = null,
+    @SerialId(30) val dwShutupTimestap: Long? = null,
+    @SerialId(31) val dwGlobalGroupPoint: Long? = null,
+    @SerialId(32) val qzusrinfo: QzoneUserInfo? = null,
+    @SerialId(33) val richCardNameVer: Byte? = null,
+    @SerialId(34) val dwVipType: Long? = null,
+    @SerialId(35) val dwVipLevel: Long? = null,
+    @SerialId(36) val dwBigClubLevel: Long? = null,
+    @SerialId(37) val dwBigClubFlag: Long? = null,
+    @SerialId(38) val dwNameplate: Long? = null,
+    @SerialId(39) val vecGroupHonor: ByteArray? = null
+) : JceStruct
+
+@Serializable
+internal class QzoneUserInfo(
+    @SerialId(0) val eStarState: Int? = null,
+    @SerialId(1) val extendInfo: Map<String, String>? = null
 ) : JceStruct
 ) : JceStruct

+ 13 - 4
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/FriendListPacket.kt

@@ -16,6 +16,11 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
 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.network.protocol.packet.list.FriendList.GetFriendGroupList.decode
+import net.mamoe.mirai.utils.io.debugIfFail
+import net.mamoe.mirai.utils.io.debugPrintThis
+import net.mamoe.mirai.utils.io.debugPrintln
+import net.mamoe.mirai.utils.io.discardExact
 
 
 
 
 internal class FriendList {
 internal class FriendList {
@@ -23,7 +28,10 @@ internal class FriendList {
     internal object GetTroopMemberList :
     internal object GetTroopMemberList :
         OutgoingPacketFactory<GetTroopMemberList.Response>("friendlist.GetTroopMemberListReq") {
         OutgoingPacketFactory<GetTroopMemberList.Response>("friendlist.GetTroopMemberListReq") {
         override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): GetTroopMemberList.Response {
         override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): GetTroopMemberList.Response {
-            TODO()
+            val res = this.debugIfFail { this.decodeUniPacket(GetTroopMemberListResp.serializer()) }
+            return Response(
+                res.vecTroopMember
+            )
         }
         }
 
 
         operator fun invoke(
         operator fun invoke(
@@ -46,7 +54,7 @@ internal class FriendList {
                                 uin = client.uin,
                                 uin = client.uin,
                                 groupCode = GroupId(targetGroupId).toInternalId().value,
                                 groupCode = GroupId(targetGroupId).toInternalId().value,
                                 groupUin = targetGroupId,
                                 groupUin = targetGroupId,
-                                nextUin = 0,
+                                nextUin = nextUin,
                                 reqType = 0
                                 reqType = 0
                             )
                             )
                         )
                         )
@@ -56,15 +64,16 @@ internal class FriendList {
         }
         }
 
 
         class Response(
         class Response(
-
+            val members: List<stTroopMemberInfo>
         ) : Packet {
         ) : Packet {
-            override fun toString(): String = "FriendList.GetFriendGroupList.Response"
+            override fun toString(): String = "Friendlist.GetTroopMemberList.Response"
         }
         }
 
 
     }
     }
 
 
     internal object GetTroopListSimplify :
     internal object GetTroopListSimplify :
         OutgoingPacketFactory<GetTroopListSimplify.Response>("friendlist.GetTroopListReqV2") {
         OutgoingPacketFactory<GetTroopListSimplify.Response>("friendlist.GetTroopListReqV2") {
+
         override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): Response {
         override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): Response {
             val res = this.decodeUniPacket(GetTroopListRespV2.serializer())
             val res = this.decodeUniPacket(GetTroopListRespV2.serializer())
             return Response(res.vecTroopList.orEmpty())
             return Response(res.vecTroopList.orEmpty())