Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
7d1a6ef8
Commit
7d1a6ef8
authored
Jan 30, 2020
by
jiahua.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
troop List
parent
db7d0e83
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
17 deletions
+86
-17
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
...moe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
+7
-2
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/TroopList.kt
...oe/mirai/qqandroid/network/protocol/data/jce/TroopList.kt
+26
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt
.../mirai/qqandroid/network/protocol/packet/PacketFactory.kt
+2
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/FriendListPacket.kt
...qandroid/network/protocol/packet/list/FriendListPacket.kt
+51
-14
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
View file @
7d1a6ef8
...
...
@@ -95,12 +95,17 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
//start updating friend/group list
bot
.
logger
.
info
(
"Start updating friend/group list"
)
/*
val data = FriendList.GetFriendGroupList(
bot.client,
0,
1
0
,
1,
0,
0
2
).sendAndExpect<FriendList.GetFriendGroupList.Response>()
*/
val
data
=
FriendList
.
GetTroopList
(
bot
.
client
).
sendAndExpect
<
FriendList
.
GetFriendGroupList
.
Response
>()
println
(
data
.
contentToString
())
}
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/TroopList.kt
0 → 100644
View file @
7d1a6ef8
package
net.mamoe.mirai.qqandroid.network.protocol.data.jce
import
kotlinx.serialization.SerialId
import
kotlinx.serialization.Serializable
import
net.mamoe.mirai.qqandroid.io.JceStruct
@Serializable
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
<
st
TroopNumSimplify
>?
=
null
,
@SerialId
(
4
)
val
groupFlagExt
:
Byte
?
=
null
,
@SerialId
(
5
)
val
shVersion
:
Int
?
=
null
,
@SerialId
(
6
)
val
dwCompanyId
:
Long
?
=
null
,
@SerialId
(
7
)
val
versionNum
:
Long
?
=
null
,
@SerialId
(
8
)
val
getLongGroupName
:
Byte
?
=
null
)
:
JceStruct
@Serializable
internal
class
st
TroopNumSimplify
(
@SerialId
(
0
)
val
groupCode
:
Long
,
@SerialId
(
1
)
val
dwGroupInfoSeq
:
Long
?
=
null
,
@SerialId
(
2
)
val
dwGroupFlagExt
:
Long
?
=
null
,
@SerialId
(
3
)
val
dwGroupRankSeq
:
Long
?
=
null
)
:
JceStruct
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt
View file @
7d1a6ef8
...
...
@@ -66,7 +66,8 @@ internal object KnownPacketFactories : List<PacketFactory<*>> by mutableListOf(
MessageSvc
.
PbGetMsg
,
MessageSvc
.
PushForceOffline
,
MessageSvc
.
PbSendMsg
,
FriendList
.
GetFriendGroupList
FriendList
.
GetFriendGroupList
,
FriendList
.
GetTroopList
)
{
// SvcReqMSFLoginNotify 自己的其他设备上限
// MessageSvc.PushReaded 电脑阅读了别人的消息, 告知手机
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/FriendListPacket.kt
View file @
7d1a6ef8
...
...
@@ -3,13 +3,11 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.list
import
kotlinx.io.core.ByteReadPacket
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.io.serialization.decodeUniPacket
import
net.mamoe.mirai.qqandroid.io.serialization.jceRequestSBuffer
import
net.mamoe.mirai.qqandroid.io.serialization.toByteArray
import
net.mamoe.mirai.qqandroid.io.serialization.writeJceStruct
import
net.mamoe.mirai.qqandroid.io.serialization.*
import
net.mamoe.mirai.qqandroid.network.QQAndroidClient
import
net.mamoe.mirai.qqandroid.network.protocol.data.jce.GetFriendListReq
import
net.mamoe.mirai.qqandroid.network.protocol.data.jce.GetFriendListResp
import
net.mamoe.mirai.qqandroid.network.protocol.data.jce.GetTroopListReqV2Simplify
import
net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPacket
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.Vec0xd50
import
net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
...
...
@@ -19,26 +17,65 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket
import
net.mamoe.mirai.utils.cryptor.contentToString
import
net.mamoe.mirai.utils.io.debugPrint
import
net.mamoe.mirai.utils.io.discardExact
import
net.mamoe.mirai.utils.io.readRemainingBytes
import
net.mamoe.mirai.utils.io.toUHexString
internal
class
FriendList
{
internal
object
GetFriendGroupList
:
PacketFactory
<
GetFriendGroupList
.
Response
>(
"friendlist.getFriendGroupList"
)
{
internal
object
GetTroopList
:
PacketFactory
<
GetTroopList
.
Response
>(
"friendlist.GetTroopListReqV2"
)
{
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
GetTroopList
.
Response
{
println
(
"获取到了GetTroopList的回信"
)
println
(
this
.
readRemainingBytes
().
toUHexString
())
return
Response
()
}
class
Response
:
Packet
{
override
fun
toString
():
String
=
"FriendList.GetFriendGroupList.Response"
}
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
Response
{
operator
fun
invoke
(
client
:
QQAndroidClient
):
OutgoingPacket
{
return
buildOutgoingUniPacket
(
client
,
bodyType
=
1
,
key
=
client
.
wLoginSigInfo
.
d2Key
)
{
writeJceStruct
(
RequestPacket
.
serializer
(),
RequestPacket
(
sFuncName
=
"GetTroopListReqV2Simplify"
,
sServantName
=
"mqq.IMService.FriendListServiceServantObj"
,
iVersion
=
3
,
cPacketType
=
0
x00
,
iMessageType
=
0
x00000
,
iRequestId
=
1921334513
,
sBuffer
=
jceRequestSBuffer
(
"GetTroopListReqV2Simplify"
,
GetTroopListReqV2Simplify
.
serializer
(),
GetTroopListReqV2Simplify
(
uin
=
client
.
uin
,
getMSFMsgFlag
=
0
,
groupFlagExt
=
1
,
shVersion
=
7
,
dwCompanyId
=
0
,
versionNum
=
1
,
getLongGroupName
=
1
)
)
)
)
}
}
}
println
(
this
.
apply
{
this
.
discardExact
(
4
)
}
.
decodeUniPacket
(
GetFriendListResp
.
serializer
())
.
contentToString
()
)
internal
object
GetFriendGroupList
:
PacketFactory
<
GetFriendGroupList
.
Response
>(
"friendlist.getFriendGroupList"
)
{
class
Response
:
Packet
{
override
fun
toString
():
String
=
"FriendList.GetFriendGroupList.Response"
}
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
Response
{
this
.
discardExact
(
4
)
val
res
=
this
.
decodeUniPacket
(
GetFriendListResp
.
serializer
())
println
(
res
.
contentToString
())
return
Response
()
}
...
...
@@ -73,7 +110,7 @@ internal class FriendList {
startIndex
=
friendListStartIndex
.
toShort
(),
getfriendCount
=
friendListCount
.
toShort
(),
groupid
=
0
,
ifGetGroupInfo
=
if
(
friendListStartIndex
<=
0
)
{
ifGetGroupInfo
=
if
(
groupListCount
<=
0
)
{
0
}
else
{
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment