From ee89f22c87bed424013801fd206bf36caeede00e Mon Sep 17 00:00:00 2001 From: Him188 Date: Thu, 9 Apr 2020 15:56:45 +0800 Subject: [PATCH] Fix kick --- .../net/mamoe/mirai/qqandroid/contact/MemberImpl.kt | 4 ++-- .../network/protocol/packet/chat/TroopManagement.kt | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/MemberImpl.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/MemberImpl.kt index 8f591f234..c51261e0b 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/MemberImpl.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/MemberImpl.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -@file:Suppress("EXPERIMENTAL_API_USAGE") +@file:Suppress("EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR") package net.mamoe.mirai.qqandroid.contact @@ -206,7 +206,7 @@ internal class MemberImpl constructor( message = message ).sendAndExpect() - check(response.success) { "kick failed: $message" } + check(response.success) { "kick failed: ${response.ret}" } MemberLeaveEvent.Kick(this@MemberImpl, null).broadcast() } diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/TroopManagement.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/TroopManagement.kt index 58cee7ec0..502b39f97 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/TroopManagement.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/TroopManagement.kt @@ -146,14 +146,17 @@ internal class TroopManagement { internal object Kick : OutgoingPacketFactory("OidbSvc.0x8a0_0") { override suspend fun ByteReadPacket.decode(bot: QQAndroidBot): Response { + val ret = this.readBytes() + .loadAs(OidbSso.OIDBSSOPkg.serializer()).bodybuffer.loadAs(Oidb0x8a0.RspBody.serializer()).msgKickResult!![0].optUint32Result return Response( - this.readBytes() - .loadAs(OidbSso.OIDBSSOPkg.serializer()).bodybuffer.loadAs(Oidb0x8a0.RspBody.serializer()).msgKickResult!![0].optUint32Result == 1 + ret == 0, + ret ) } class Response( - val success: Boolean + val success: Boolean, + val ret: Int ) : Packet { override fun toString(): String = "TroopManagement.Kick.Response($success)" }