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
034de9f1
Commit
034de9f1
authored
Jan 30, 2020
by
jiahua.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
friend list packet
parent
c7950560
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
262 additions
and
2 deletions
+262
-2
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
...moe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
+14
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/FriendListRequest.kt
.../qqandroid/network/protocol/data/jce/FriendListRequest.kt
+30
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/FriendListCommon.kt
...qqandroid/network/protocol/data/proto/FriendListCommon.kt
+97
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Msg.kt
.../mamoe/mirai/qqandroid/network/protocol/data/proto/Msg.kt
+114
-1
mirai-core-qqandroid/src/jvmTest/kotlin/test/ProtoBufDataClassGenerator.kt
...oid/src/jvmTest/kotlin/test/ProtoBufDataClassGenerator.kt
+7
-1
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
View file @
034de9f1
...
...
@@ -18,6 +18,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.KnownPacketFactories
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.PacketLogger
import
net.mamoe.mirai.qqandroid.network.protocol.packet.list.FriendListPacket
import
net.mamoe.mirai.qqandroid.network.protocol.packet.login.LoginPacket
import
net.mamoe.mirai.qqandroid.network.protocol.packet.login.LoginPacket.LoginPacketResponse.*
import
net.mamoe.mirai.qqandroid.network.protocol.packet.login.StatSvc
...
...
@@ -87,6 +88,19 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
println
(
"d2key=${bot.client.wLoginSigInfo.d2Key.toUHexString()}"
)
StatSvc
.
Register
(
bot
.
client
).
sendAndExpect
<
StatSvc
.
Register
.
Response
>()
println
(
"登陆完成 开始尝试获取friendList"
)
println
(
"登陆完成 开始尝试获取friendList"
)
println
(
"登陆完成 开始尝试获取friendList"
)
println
(
"登陆完成 开始尝试获取friendList"
)
println
(
"登陆完成 开始尝试获取friendList"
)
FriendListPacket
(
bot
.
client
,
0
,
10
,
0
,
5
).
sendAndExpect
<
FriendListPacket
.
GetFriendListResponse
>()
}
/**
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/FriendListRequest.kt
0 → 100644
View file @
034de9f1
package
net.mamoe.mirai.qqandroid.network.protocol.data.jce
import
kotlinx.serialization.SerialId
import
kotlinx.serialization.Serializable
import
net.mamoe.mirai.qqandroid.io.JceStruct
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.Vec0xd50
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.Vec0xd6b
@Serializable
internal
class
GetFriendListReq
(
@SerialId
(
0
)
val
reqtype
:
Int
?
=
null
,
@SerialId
(
1
)
val
ifReflush
:
Byte
?
=
null
,
@SerialId
(
2
)
val
uin
:
Long
?
=
null
,
@SerialId
(
3
)
val
startIndex
:
Short
?
=
null
,
@SerialId
(
4
)
val
getfriendCount
:
Short
?
=
null
,
@SerialId
(
5
)
val
groupid
:
Byte
?
=
null
,
@SerialId
(
6
)
val
ifGetGroupInfo
:
Byte
?
=
null
,
@SerialId
(
7
)
val
groupstartIndex
:
Byte
?
=
null
,
@SerialId
(
8
)
val
getgroupCount
:
Byte
?
=
null
,
@SerialId
(
9
)
val
ifGetMSFGroup
:
Byte
?
=
null
,
@SerialId
(
10
)
val
ifShowTermType
:
Byte
?
=
null
,
@SerialId
(
11
)
val
version
:
Long
?
=
null
,
@SerialId
(
12
)
val
uinList
:
List
<
Long
>?
=
null
,
@SerialId
(
13
)
val
eAppType
:
Int
=
0
,
@SerialId
(
14
)
val
ifGetDOVId
:
Byte
?
=
null
,
@SerialId
(
15
)
val
ifGetBothFlag
:
Byte
?
=
null
,
@SerialId
(
16
)
val
vec0xd50Req
:
Vec0xd50
.
ReqBody
?
=
null
,
@SerialId
(
17
)
val
vec0xd6bReq
:
Vec0xd6b
.
ReqBody
?
=
null
,
@SerialId
(
18
)
val
vecSnsTypelist
:
List
<
Long
>?
=
null
)
:
JceStruct
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/FriendListCommon.kt
0 → 100644
View file @
034de9f1
package
net.mamoe.mirai.qqandroid.network.protocol.data.proto
import
kotlinx.serialization.SerialId
import
kotlinx.serialization.Serializable
import
net.mamoe.mirai.qqandroid.io.ProtoBuf
import
net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
@Serializable
class
Vec0xd50
:
ProtoBuf
{
@Serializable
class
ExtSnsFrdData
(
@SerialId
(
1
)
val
frdUin
:
Long
=
0L
,
@SerialId
(
91001
)
val
musicSwitch
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
101001
)
val
mutualmarkAlienation
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
141001
)
val
mutualmarkScore
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
151001
)
val
ksingSwitch
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
181001
)
val
lbsShare
:
ByteArray
=
EMPTY_BYTE_ARRAY
)
:
ProtoBuf
@Serializable
class
RspBody
(
@SerialId
(
1
)
val
msgUpdateData
:
List
<
Vec0xd50
.
ExtSnsFrdData
>?
=
null
,
@SerialId
(
11
)
val
over
:
Int
=
0
,
@SerialId
(
12
)
val
nextStart
:
Int
=
0
,
@SerialId
(
13
)
val
uint64UnfinishedUins
:
List
<
Long
>?
=
null
)
:
ProtoBuf
@Serializable
class
ReqBody
(
@SerialId
(
1
)
val
appid
:
Long
=
0L
,
@SerialId
(
2
)
val
maxPkgSize
:
Int
=
0
,
@SerialId
(
3
)
val
startTime
:
Int
=
0
,
@SerialId
(
4
)
val
startIndex
:
Int
=
0
,
@SerialId
(
5
)
val
reqNum
:
Int
=
0
,
@SerialId
(
6
)
val
uinList
:
List
<
Long
>?
=
null
,
@SerialId
(
91001
)
val
reqMusicSwitch
:
Int
=
0
,
@SerialId
(
101001
)
val
reqMutualmarkAlienation
:
Int
=
0
,
@SerialId
(
141001
)
val
reqMutualmarkScore
:
Int
=
0
,
@SerialId
(
151001
)
val
reqKsingSwitch
:
Int
=
0
,
@SerialId
(
181001
)
val
reqMutualmarkLbsshare
:
Int
=
0
)
:
ProtoBuf
@Serializable
class
KSingRelationInfo
(
@SerialId
(
1
)
val
flag
:
Int
=
0
)
:
ProtoBuf
}
@Serializable
class
Vec0xd6b
:
ProtoBuf
{
@Serializable
class
ReqBody
(
@SerialId
(
1
)
val
maxPkgSize
:
Int
=
0
,
@SerialId
(
2
)
val
startTime
:
Int
=
0
,
@SerialId
(
11
)
val
uinList
:
List
<
Long
>?
=
null
)
:
ProtoBuf
@Serializable
class
RspBody
(
@SerialId
(
11
)
val
msgMutualmarkData
:
List
<
Vec0xd6b
.
MutualMarkData
>?
=
null
,
@SerialId
(
12
)
val
uint64UnfinishedUins
:
List
<
Long
>?
=
null
)
:
ProtoBuf
@Serializable
class
MutualMarkData
(
@SerialId
(
1
)
val
frdUin
:
Long
=
0L
,
@SerialId
(
2
)
val
result
:
Int
=
0
// @SerialId(11) val mutualmarkInfo: List<Mutualmark.MutualMark>? = null
)
:
ProtoBuf
}
@Serializable
class
Mutualmark
:
ProtoBuf
{
@Serializable
class
MutualmarkInfo
(
@SerialId
(
1
)
val
lastActionTime
:
Long
=
0L
,
@SerialId
(
2
)
val
level
:
Int
=
0
,
@SerialId
(
3
)
val
lastChangeTime
:
Long
=
0L
,
@SerialId
(
4
)
val
continueDays
:
Int
=
0
,
@SerialId
(
5
)
val
wildcardWording
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
6
)
val
notifyTime
:
Long
=
0L
,
@SerialId
(
7
)
val
iconStatus
:
Long
=
0L
,
@SerialId
(
8
)
val
iconStatusEndTime
:
Long
=
0L
,
@SerialId
(
9
)
val
closeFlag
:
Int
=
0
,
@SerialId
(
10
)
val
resourceInfo
:
ByteArray
=
EMPTY_BYTE_ARRAY
)
:
ProtoBuf
@Serializable
class
ResourceInfo17
(
@SerialId
(
1
)
val
dynamicUrl
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
2
)
val
staticUrl
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
3
)
val
cartoonUrl
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
4
)
val
cartoonMd5
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
5
)
val
playCartoon
:
Int
=
0
,
@SerialId
(
6
)
val
word
:
ByteArray
=
EMPTY_BYTE_ARRAY
)
:
ProtoBuf
}
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Msg.kt
View file @
034de9f1
...
...
@@ -1160,4 +1160,117 @@ class ObjMsg : ProtoBuf {
@SerialId
(
7
)
val
msgContentInfo
:
List
<
MsgContentInfo
>?
=
null
,
@SerialId
(
8
)
val
reportIdShow
:
Int
=
0
)
:
ProtoBuf
}
\ No newline at end of file
}
@Serializable
class
Submsgtype0xc7
:
ProtoBuf
{
@Serializable
class
RelationalChainChange
(
@SerialId
(
1
)
val
appid
:
Long
=
0L
,
@SerialId
(
2
)
val
srcUin
:
Long
=
0L
,
@SerialId
(
3
)
val
dstUin
:
Long
=
0L
,
@SerialId
(
4
)
val
changeType
:
Int
/* enum */
=
1
,
@SerialId
(
5
)
val
msgRelationalChainInfoOld
:
Submsgtype0xc7
.
RelationalChainInfo
?
=
null
,
@SerialId
(
6
)
val
msgRelationalChainInfoNew
:
Submsgtype0xc7
.
RelationalChainInfo
?
=
null
,
@SerialId
(
7
)
val
msgToDegradeInfo
:
Submsgtype0xc7
.
ToDegradeInfo
?
=
null
,
@SerialId
(
20
)
val
relationalChainInfos
:
List
<
Submsgtype0xc7
.
RelationalChainInfos
>?
=
null
,
@SerialId
(
100
)
val
uint32FeatureId
:
List
<
Int
>?
=
null
)
:
ProtoBuf
@Serializable
class
FriendShipFlagNotify
(
@SerialId
(
1
)
val
dstUin
:
Long
=
0L
,
@SerialId
(
2
)
val
level1
:
Int
=
0
,
@SerialId
(
3
)
val
level2
:
Int
=
0
,
@SerialId
(
4
)
val
continuityDays
:
Int
=
0
,
@SerialId
(
5
)
val
chatFlag
:
Int
=
0
,
@SerialId
(
6
)
val
lastChatTime
:
Long
=
0L
,
@SerialId
(
7
)
val
notifyTime
:
Long
=
0L
,
@SerialId
(
8
)
val
seq
:
Int
=
0
)
:
ProtoBuf
@Serializable
class
ToDegradeItem
(
@SerialId
(
1
)
val
type
:
Int
/* enum */
=
1
,
@SerialId
(
2
)
val
oldLevel
:
Int
=
0
,
@SerialId
(
3
)
val
newLevel
:
Int
=
0
,
@SerialId
(
11
)
val
continuityDays
:
Int
=
0
,
@SerialId
(
12
)
val
lastActionTime
:
Long
=
0L
)
:
ProtoBuf
@Serializable
class
RelationalChainInfo
(
@SerialId
(
1
)
val
type
:
Int
/* enum */
=
1
,
@SerialId
(
2
)
val
attr
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
1002
)
val
intimateInfo
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
91001
)
val
musicSwitch
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
101001
)
val
mutualmarkAlienation
:
ByteArray
=
EMPTY_BYTE_ARRAY
)
:
ProtoBuf
@Serializable
class
ForwardBody
(
@SerialId
(
1
)
val
notifyType
:
Int
=
0
,
@SerialId
(
2
)
val
opType
:
Int
=
0
,
@SerialId
(
3000
)
val
msgHotFriendNotify
:
Submsgtype0xc7
.
HotFriendNotify
?
=
null
,
@SerialId
(
4000
)
val
msgRelationalChainChange
:
Submsgtype0xc7
.
RelationalChainChange
?
=
null
)
:
ProtoBuf
@Serializable
class
HotFriendNotify
(
@SerialId
(
1
)
val
dstUin
:
Long
=
0L
,
@SerialId
(
2
)
val
praiseHotLevel
:
Int
=
0
,
@SerialId
(
3
)
val
chatHotLevel
:
Int
=
0
,
@SerialId
(
4
)
val
praiseHotDays
:
Int
=
0
,
@SerialId
(
5
)
val
chatHotDays
:
Int
=
0
,
@SerialId
(
6
)
val
closeLevel
:
Int
=
0
,
@SerialId
(
7
)
val
closeDays
:
Int
=
0
,
@SerialId
(
8
)
val
praiseFlag
:
Int
=
0
,
@SerialId
(
9
)
val
chatFlag
:
Int
=
0
,
@SerialId
(
10
)
val
closeFlag
:
Int
=
0
,
@SerialId
(
11
)
val
notifyTime
:
Long
=
0L
,
@SerialId
(
12
)
val
lastPraiseTime
:
Long
=
0L
,
@SerialId
(
13
)
val
lastChatTime
:
Long
=
0L
,
@SerialId
(
14
)
val
qzoneHotLevel
:
Int
=
0
,
@SerialId
(
15
)
val
qzoneHotDays
:
Int
=
0
,
@SerialId
(
16
)
val
qzoneFlag
:
Int
=
0
,
@SerialId
(
17
)
val
lastQzoneTime
:
Long
=
0L
,
@SerialId
(
51
)
val
showRecheckEntry
:
Int
=
0
,
@SerialId
(
52
)
val
wildcardWording
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
100
)
val
loverFlag
:
Int
=
0
,
@SerialId
(
200
)
val
keyHotLevel
:
Int
=
0
,
@SerialId
(
201
)
val
keyHotDays
:
Int
=
0
,
@SerialId
(
202
)
val
keyFlag
:
Int
=
0
,
@SerialId
(
203
)
val
lastKeyTime
:
Long
=
0L
,
@SerialId
(
204
)
val
keyWording
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
205
)
val
keyTransFlag
:
Int
=
0
,
@SerialId
(
206
)
val
loverKeyBusinessType
:
Int
=
0
,
@SerialId
(
207
)
val
loverKeySubBusinessType
:
Int
=
0
,
@SerialId
(
208
)
val
loverKeyMainWording
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
209
)
val
loverKeyLinkWording
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
300
)
val
boatLevel
:
Int
=
0
,
@SerialId
(
301
)
val
boatDays
:
Int
=
0
,
@SerialId
(
302
)
val
boatFlag
:
Int
=
0
,
@SerialId
(
303
)
val
lastBoatTime
:
Int
=
0
,
@SerialId
(
304
)
val
boatWording
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
400
)
val
notifyType
:
Int
=
0
,
@SerialId
(
401
)
val
msgFriendshipFlagNotify
:
Submsgtype0xc7
.
FriendShipFlagNotify
?
=
null
)
:
ProtoBuf
@Serializable
class
RelationalChainInfos
(
@SerialId
(
1
)
val
msgRelationalChainInfoOld
:
Submsgtype0xc7
.
RelationalChainInfo
?
=
null
,
@SerialId
(
2
)
val
msgRelationalChainInfoNew
:
Submsgtype0xc7
.
RelationalChainInfo
?
=
null
)
:
ProtoBuf
@Serializable
class
ToDegradeInfo
(
@SerialId
(
1
)
val
toDegradeItem
:
List
<
Submsgtype0xc7
.
ToDegradeItem
>?
=
null
,
@SerialId
(
2
)
val
nick
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
3
)
val
notifyTime
:
Long
=
0L
)
:
ProtoBuf
@Serializable
class
MsgBody
(
@SerialId
(
1
)
val
msgModInfos
:
List
<
Submsgtype0xc7
.
ForwardBody
>?
=
null
)
:
ProtoBuf
}
mirai-core-qqandroid/src/jvmTest/kotlin/test/ProtoBufDataClassGenerator.kt
View file @
034de9f1
...
...
@@ -6,7 +6,7 @@ import java.io.File
fun
main
()
{
println
(
File
(
"""/Users/jiahua.liu/Desktop/QQAndroid-F/app/src/main/java/tencent/im/s2c/msgtype0x210/submsgtype0x
1a/
"""
)
File
(
"""/Users/jiahua.liu/Desktop/QQAndroid-F/app/src/main/java/tencent/im/s2c/msgtype0x210/submsgtype0x
c7/bussinfo/mutualmark
"""
)
.
generateUnarrangedClasses
().
toMutableList
().
arrangeClasses
().
joinToString
(
"\n\n"
)
)
}
...
...
@@ -350,11 +350,17 @@ fun String.adjustClassName(): String {
when
(
this
.
trim
())
{
"ByteStringMicro"
->
return
"ByteArray"
}
if
(
this
.
isEmpty
()){
return
""
}
return
String
(
this
.
adjustName
().
toCharArray
().
apply
{
this
[
0
]
=
this
[
0
].
toUpperCase
()
})
}
fun
String
.
adjustName
():
String
{
val
result
=
this
.
toCharArray
()
if
(
result
.
size
==
0
){
return
""
}
result
[
0
]
=
result
[
0
].
toLowerCase
()
for
(
index
in
result
.
indices
)
{
if
(
result
[
index
]
==
'_'
)
{
...
...
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