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
192a83de
Commit
192a83de
authored
Jan 31, 2020
by
jiahua.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
troop List
parent
06515bc0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
125 additions
and
17 deletions
+125
-17
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
...moe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
+11
-4
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
+81
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt
.../mirai/qqandroid/network/protocol/packet/PacketFactory.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/FriendListPacket.kt
...qandroid/network/protocol/packet/list/FriendListPacket.kt
+32
-12
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
View file @
192a83de
...
@@ -102,19 +102,26 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
...
@@ -102,19 +102,26 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
override
suspend
fun
init
()
{
override
suspend
fun
init
()
{
//start updating friend/group list
//start updating friend/group list
bot
.
logger
.
info
(
"Start updating friend/group list"
)
bot
.
logger
.
info
(
"Start updating friend/group list"
)
/*
/*
val data = FriendList.GetFriendGroupList(
val data = FriendList.GetFriendGroupList(
bot.client,
bot.client,
0,
0,
1
,
20
,
0,
0,
2
0
).sendAndExpect<FriendList.GetFriendGroupList.Response>()
).sendAndExpect<FriendList.GetFriendGroupList.Response>()
*/
println(data.contentToString())
*/
val
data
=
FriendList
.
GetTroopList
(
val
data
=
FriendList
.
GetTroopList
(
bot
.
client
bot
.
client
).
sendAndExpect
<
FriendList
.
GetTroopList
.
Response
>()
).
sendAndExpect
<
FriendList
.
GetTroopList
.
Response
>(
100000
)
println
(
data
.
contentToString
())
println
(
data
.
contentToString
())
}
}
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/TroopList.kt
View file @
192a83de
...
@@ -24,3 +24,84 @@ internal class stTroopNumSimplify(
...
@@ -24,3 +24,84 @@ internal class stTroopNumSimplify(
@SerialId
(
2
)
val
dwGroupFlagExt
:
Long
?
=
null
,
@SerialId
(
2
)
val
dwGroupFlagExt
:
Long
?
=
null
,
@SerialId
(
3
)
val
dwGroupRankSeq
:
Long
?
=
null
@SerialId
(
3
)
val
dwGroupRankSeq
:
Long
?
=
null
)
:
JceStruct
)
:
JceStruct
@Serializable
internal
class
GetTroopListRespV2
(
@SerialId
(
0
)
val
uin
:
Long
,
@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
<
st
TroopNum
>?
=
null
,
@SerialId
(
6
)
val
vecTroopListDel
:
List
<
st
TroopNum
>?
=
null
,
@SerialId
(
7
)
val
vecTroopRank
:
List
<
st
GroupRankInfo
>?
=
null
,
@SerialId
(
8
)
val
vecFavGroup
:
List
<
st
FavoriteGroup
>?
=
null
,
@SerialId
(
9
)
val
vecTroopListExt
:
List
<
st
TroopNum
>?
=
null
)
:
JceStruct
@Serializable
internal
class
st
TroopNum
(
@SerialId
(
0
)
val
groupUin
:
Long
,
@SerialId
(
1
)
val
groupCode
:
Long
,
@SerialId
(
2
)
val
flag
:
Byte
?
=
null
,
@SerialId
(
3
)
val
dwGroupInfoSeq
:
Long
?
=
null
,
@SerialId
(
4
)
val
groupName
:
String
?
=
""
,
@SerialId
(
5
)
val
groupMemo
:
String
?
=
""
,
@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
(
11
)
val
dwCmdUinUinFlag
:
Long
?
=
null
,
@SerialId
(
12
)
val
dwAdditionalFlag
:
Long
?
=
null
,
@SerialId
(
13
)
val
dwGroupTypeFlag
:
Long
?
=
null
,
@SerialId
(
14
)
val
dwGroupSecType
:
Long
?
=
null
,
@SerialId
(
15
)
val
dwGroupSecTypeInfo
:
Long
?
=
null
,
@SerialId
(
16
)
val
dwGroupClassExt
:
Long
?
=
null
,
@SerialId
(
17
)
val
dwAppPrivilegeFlag
:
Long
?
=
null
,
@SerialId
(
18
)
val
dwSubscriptionUin
:
Long
?
=
null
,
@SerialId
(
19
)
val
dwMemberNum
:
Long
?
=
null
,
@SerialId
(
20
)
val
dwMemberNumSeq
:
Long
?
=
null
,
@SerialId
(
21
)
val
dwMemberCardSeq
:
Long
?
=
null
,
@SerialId
(
22
)
val
dwGroupFlagExt3
:
Long
?
=
null
,
@SerialId
(
23
)
val
dwGroupOwnerUin
:
Long
?
=
null
,
@SerialId
(
24
)
val
isConfGroup
:
Byte
?
=
null
,
@SerialId
(
25
)
val
isModifyConfGroupFace
:
Byte
?
=
null
,
@SerialId
(
26
)
val
isModifyConfGroupName
:
Byte
?
=
null
,
@SerialId
(
27
)
val
dwCmduinJoinTime
:
Long
?
=
null
,
@SerialId
(
28
)
val
ulCompanyId
:
Long
?
=
null
,
@SerialId
(
29
)
val
dwMaxGroupMemberNum
:
Long
?
=
null
,
@SerialId
(
30
)
val
dwCmdUinGroupMask
:
Long
?
=
null
,
@SerialId
(
31
)
val
udwHLGuildAppid
:
Long
?
=
null
,
@SerialId
(
32
)
val
udwHLGuildSubType
:
Long
?
=
null
,
@SerialId
(
33
)
val
udwCmdUinRingtoneID
:
Long
?
=
null
,
@SerialId
(
34
)
val
udwCmdUinFlagEx2
:
Long
?
=
null
)
:
JceStruct
@Serializable
internal
class
st
GroupRankInfo
(
@SerialId
(
0
)
val
dwGroupCode
:
Long
,
@SerialId
(
1
)
val
groupRankSysFlag
:
Byte
?
=
null
,
@SerialId
(
2
)
val
groupRankUserFlag
:
Byte
?
=
null
,
@SerialId
(
3
)
val
vecRankMap
:
List
<
st
LevelRankPair
>?
=
null
,
@SerialId
(
4
)
val
dwGroupRankSeq
:
Long
?
=
null
,
@SerialId
(
5
)
val
ownerName
:
String
?
=
""
,
@SerialId
(
6
)
val
adminName
:
String
?
=
""
,
@SerialId
(
7
)
val
dwOfficeMode
:
Long
?
=
null
)
:
JceStruct
@Serializable
internal
class
st
FavoriteGroup
(
@SerialId
(
0
)
val
dwGroupCode
:
Long
,
@SerialId
(
1
)
val
dwTimestamp
:
Long
?
=
null
,
@SerialId
(
2
)
val
dwSnsFlag
:
Long
?
=
1L
,
@SerialId
(
3
)
val
dwOpenTimestamp
:
Long
?
=
null
)
:
JceStruct
@Serializable
internal
class
st
LevelRankPair
(
@SerialId
(
0
)
val
dwLevel
:
Long
?
=
null
,
@SerialId
(
1
)
val
rank
:
String
?
=
""
)
:
JceStruct
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt
View file @
192a83de
...
@@ -67,7 +67,7 @@ internal object KnownPacketFactories : List<PacketFactory<*>> by mutableListOf(
...
@@ -67,7 +67,7 @@ internal object KnownPacketFactories : List<PacketFactory<*>> by mutableListOf(
MessageSvc
.
PushForceOffline
,
MessageSvc
.
PushForceOffline
,
MessageSvc
.
PbSendMsg
,
MessageSvc
.
PbSendMsg
,
FriendList
.
GetFriendGroupList
,
FriendList
.
GetFriendGroupList
,
FriendList
.
GetTroopList
Simplify
FriendList
.
GetTroopList
)
{
)
{
// SvcReqMSFLoginNotify 自己的其他设备上限
// SvcReqMSFLoginNotify 自己的其他设备上限
// MessageSvc.PushReaded 电脑阅读了别人的消息, 告知手机
// MessageSvc.PushReaded 电脑阅读了别人的消息, 告知手机
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/FriendListPacket.kt
View file @
192a83de
...
@@ -8,16 +8,20 @@ import net.mamoe.mirai.qqandroid.io.serialization.jceRequestSBuffer
...
@@ -8,16 +8,20 @@ import net.mamoe.mirai.qqandroid.io.serialization.jceRequestSBuffer
import
net.mamoe.mirai.qqandroid.io.serialization.toByteArray
import
net.mamoe.mirai.qqandroid.io.serialization.toByteArray
import
net.mamoe.mirai.qqandroid.io.serialization.writeJceStruct
import
net.mamoe.mirai.qqandroid.io.serialization.writeJceStruct
import
net.mamoe.mirai.qqandroid.network.QQAndroidClient
import
net.mamoe.mirai.qqandroid.network.QQAndroidClient
import
net.mamoe.mirai.qqandroid.network.protocol.data.jce.*
import
net.mamoe.mirai.qqandroid.network.protocol.data.jce.GetFriendListReq
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.GetFriendListResp
import
net.mamoe.mirai.qqandroid.network.protocol.data.jce.GetTroopListReqV2Simplify
import
net.mamoe.mirai.qqandroid.network.protocol.data.jce.GetTroopListReqV2Simplify
import
net.mamoe.mirai.qqandroid.network.protocol.data.jce.GroupInfo
import
net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPacket
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.data.proto.Vec0xd50
import
net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
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.PacketFactory
import
net.mamoe.mirai.qqandroid.network.protocol.packet.PacketFactory
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.cryptor.contentToString
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.discardExact
import
net.mamoe.mirai.utils.io.readRemainingBytes
import
net.mamoe.mirai.utils.io.readRemainingBytes
import
net.mamoe.mirai.utils.io.toUHexString
import
net.mamoe.mirai.utils.io.toUHexString
...
@@ -25,15 +29,28 @@ import net.mamoe.mirai.utils.io.toUHexString
...
@@ -25,15 +29,28 @@ import net.mamoe.mirai.utils.io.toUHexString
internal
class
FriendList
{
internal
class
FriendList
{
internal
object
GetTroopListSimplify
:
/**
PacketFactory
<
GetTroopListSimplify
.
Response
>(
"friendlist.GetTroopListReqV2"
)
{
* Get Troop List不一定会得到服务器的回应 据推测与群数量有关
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
GetTroopListSimplify
.
Response
{
* 因此 应对timeout方法做出处理
println
(
"获取到了GetTroopList的回信"
)
* timeout时间应不小于 8s?
println
(
this
.
readRemainingBytes
().
toUHexString
())
*
return
Response
()
*/
internal
object
GetTroopList
:
PacketFactory
<
GetTroopList
.
Response
>(
"friendlist.GetTroopListReqV2"
)
{
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
GetTroopList
.
Response
{
debugPrint
()
this
.
discardExact
(
4
)
val
res
=
this
.
decodeUniPacket
(
GetTroopListRespV2
.
serializer
())
println
(
res
.
contentToString
())
return
Response
(
)
}
}
class
Response
:
Packet
{
class
Response
(
)
:
Packet
{
override
fun
toString
():
String
=
"FriendList.GetFriendGroupList.Response"
override
fun
toString
():
String
=
"FriendList.GetFriendGroupList.Response"
}
}
...
@@ -49,7 +66,6 @@ internal class FriendList {
...
@@ -49,7 +66,6 @@ internal class FriendList {
iVersion
=
3
,
iVersion
=
3
,
cPacketType
=
0
x00
,
cPacketType
=
0
x00
,
iMessageType
=
0
x00000
,
iMessageType
=
0
x00000
,
iRequestId
=
1921334513
,
sBuffer
=
jceRequestSBuffer
(
sBuffer
=
jceRequestSBuffer
(
"GetTroopListReqV2Simplify"
,
"GetTroopListReqV2Simplify"
,
GetTroopListReqV2Simplify
.
serializer
(),
GetTroopListReqV2Simplify
.
serializer
(),
...
@@ -69,16 +85,20 @@ internal class FriendList {
...
@@ -69,16 +85,20 @@ internal class FriendList {
}
}
}
}
internal
object
GetFriendGroupList
:
PacketFactory
<
GetFriendGroupList
.
Response
>(
"friendlist.getFriendGroupList"
)
{
internal
object
GetFriendGroupList
:
PacketFactory
<
GetFriendGroupList
.
Response
>(
"friendlist.getFriendGroupList"
)
{
class
Response
(
class
Response
:
Packet
{
val
totalFriendCount
:
Short
,
val
friendList
:
List
<
FriendInfo
>
)
:
Packet
{
override
fun
toString
():
String
=
"FriendList.GetFriendGroupList.Response"
override
fun
toString
():
String
=
"FriendList.GetFriendGroupList.Response"
}
}
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
Response
{
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
Response
{
this
.
discardExact
(
4
)
this
.
discardExact
(
4
)
val
res
=
this
.
decodeUniPacket
(
GetFriendListResp
.
serializer
())
val
res
=
this
.
decodeUniPacket
(
GetFriendListResp
.
serializer
())
println
(
res
.
contentToString
())
return
Response
(
return
Response
()
res
.
totoalFriendCount
,
res
.
vecFriendInfo
.
orEmpty
()
)
}
}
operator
fun
invoke
(
operator
fun
invoke
(
...
...
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