Try fix group list

This commit is contained in:
Him188 2020-01-31 19:58:18 +08:00
parent 07fab04a90
commit c044c64b82
4 changed files with 24 additions and 12 deletions

View File

@ -111,6 +111,8 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
2
).sendAndExpect<FriendList.GetFriendGroupList.Response>()
*/
delay(2000)
val data = FriendList.GetTroopList(
bot.client
).sendAndExpect<FriendList.GetTroopList.Response>()

View File

@ -54,12 +54,13 @@ internal class FriendList {
GetTroopListReqV2Simplify.serializer(),
GetTroopListReqV2Simplify(
uin = client.uin,
getMSFMsgFlag = 0,
groupFlagExt = 1,
shVersion = 7,
getMSFMsgFlag = 0, // const
groupFlagExt = 1,// const
shVersion = 7, // const
dwCompanyId = 0,
versionNum = 1,
getLongGroupName = 1
versionNum = 1, // const
vecGroupInfo = listOf(),
getLongGroupName = 1// const
)
)
)

View File

@ -294,13 +294,15 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse>("wt
data class UnsafeLogin(val url: String) : LoginPacketResponse()
class SMSVerifyCodeNeeded(val t402: ByteArray, val t403: ByteArray) : LoginPacketResponse(){
class SMSVerifyCodeNeeded(val t402: ByteArray, val t403: ByteArray) : LoginPacketResponse() {
override fun toString(): String {
return "LoginPacketResponse.SMSVerifyCodeNeeded"
}
}
class DeviceLockLogin(val t402: ByteArray, val t403: ByteArray) : LoginPacketResponse()
class DeviceLockLogin(val t402: ByteArray, val t403: ByteArray) : LoginPacketResponse() {
override fun toString(): String = "LoginPacket.LoginPacketResponse.DeviceLockLogin"
}
}
@InternalAPI

View File

@ -12,6 +12,7 @@ import net.mamoe.mirai.utils.cryptor.ECDH
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
/*
*/
@ -67,7 +68,6 @@ private fun processFullPacketWithoutLength(packet: ByteReadPacket) {
PacketLogger.verbose("包类型(flag2) = $flag2. (可能是 ${if (flag2 == 2) "sso" else "uni"})")
val flag3 = readByte().toInt()
check(flag3 == 0) { "Illegal flag3. Expected 0, got $flag3" }
val uinAccount = readString(readInt() - 4)//uin
@ -88,9 +88,9 @@ private fun processFullPacketWithoutLength(packet: ByteReadPacket) {
this.readBytes().tryDecryptOrNull()?.toReadPacket()
}?.debugPrint("sso/uni body=")?.let {
if (flag1 == 0x0A) {
parseSsoFrame(it)
parseSsoFrame(flag3, it)
} else {
parseSsoFrame(it)
parseSsoFrame(flag3, it)
}
}?.let {
val bytes = it.data.readBytes()
@ -205,7 +205,7 @@ private fun ByteReadPacket.parseOicqResponse(body: ByteReadPacket.() -> Unit) {
* 解析 SSO 层包装
*/
@UseExperimental(ExperimentalUnsignedTypes::class)
private fun parseSsoFrame(input: ByteReadPacket): KnownPacketFactories.IncomingPacket {
private fun parseSsoFrame(flag3: Int, input: ByteReadPacket): KnownPacketFactories.IncomingPacket {
val commandName: String
val ssoSequenceId: Int
@ -232,7 +232,14 @@ private fun parseSsoFrame(input: ByteReadPacket): KnownPacketFactories.IncomingP
println("找不到包 PacketFactory")
PacketLogger.verbose("传递给 PacketFactory 的数据 = ${input.readBytes().toUHexString()}")
}
return KnownPacketFactories.IncomingPacket(packetFactory, ssoSequenceId, input)
var data = input.readBytes()
if (flag3 == 1) {
data = data.unzip(offset = 4)
} else {
}
return KnownPacketFactories.IncomingPacket(packetFactory, ssoSequenceId, data.toReadPacket())
}