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
6e6c1d81
Commit
6e6c1d81
authored
Feb 08, 2020
by
jiahua.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OnlinePushPack JCEs
parent
f18007f6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
6 deletions
+55
-6
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/OnlinePush.kt
...mirai/qqandroid/network/protocol/data/proto/OnlinePush.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
+1
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.kt
...ndroid/network/protocol/packet/chat/receive/OnlinePush.kt
+26
-4
mirai-core-qqandroid/src/jvmTest/kotlin/test/ProtoBufDataClassGenerator.kt
...oid/src/jvmTest/kotlin/test/ProtoBufDataClassGenerator.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/BotConfiguration.kt
...mmonMain/kotlin/net.mamoe.mirai/utils/BotConfiguration.kt
+1
-1
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/OnlinePush.kt
View file @
6e6c1d81
...
...
@@ -15,4 +15,30 @@ internal class MsgOnlinePush {
@SerialId
(
4
)
val
pingFlag
:
Int
=
0
,
@SerialId
(
9
)
val
generalFlag
:
Int
=
0
)
:
ProtoBuf
}
@Serializable
class
OnlinePushTrans
:
ProtoBuf
{
@Serializable
class
ExtGroupKeyInfo
(
@SerialId
(
1
)
val
curMaxSeq
:
Int
=
0
,
@SerialId
(
2
)
val
curTime
:
Long
=
0L
)
:
ProtoBuf
@Serializable
class
PbMsgInfo
(
@SerialId
(
1
)
val
fromUin
:
Long
=
0L
,
@SerialId
(
2
)
val
toUin
:
Long
=
0L
,
@SerialId
(
3
)
val
msgType
:
Int
=
0
,
@SerialId
(
4
)
val
msgSubtype
:
Int
=
0
,
@SerialId
(
5
)
val
msgSeq
:
Int
=
0
,
@SerialId
(
6
)
val
msgUid
:
Long
=
0L
,
@SerialId
(
7
)
val
msgTime
:
Int
=
0
,
@SerialId
(
8
)
val
realMsgTime
:
Int
=
0
,
@SerialId
(
9
)
val
nickName
:
String
=
""
,
@SerialId
(
10
)
val
msgData
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
11
)
val
svrIp
:
Int
=
0
,
@SerialId
(
12
)
val
extGroupKeyInfo
:
OnlinePushTrans
.
ExtGroupKeyInfo
?
=
null
,
@SerialId
(
17
)
val
generalFlag
:
Int
=
0
)
:
ProtoBuf
}
\ No newline at end of file
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt
View file @
6e6c1d81
...
...
@@ -133,6 +133,7 @@ internal object KnownPacketFactories {
object
IncomingFactories
:
List
<
IncomingPacketFactory
<
*
>>
by
mutableListOf
(
OnlinePush
.
PbPushGroupMsg
,
OnlinePush
.
ReqPush
,
OnlinePush
.
PbPushTransMsg
,
MessageSvc
.
PushNotify
,
ConfigPushSvc
.
PushReq
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.kt
View file @
6e6c1d81
...
...
@@ -12,13 +12,16 @@ import net.mamoe.mirai.event.broadcast
import
net.mamoe.mirai.message.GroupMessage
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.io.serialization.decodeUniPacket
import
net.mamoe.mirai.qqandroid.io.serialization.loadAs
import
net.mamoe.mirai.qqandroid.io.serialization.readProtoBuf
import
net.mamoe.mirai.qqandroid.network.protocol.data.jce.MsgInfo
import
net.mamoe.mirai.qqandroid.network.protocol.data.jce.OnlinePushPack
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgOnlinePush
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.OnlinePushTrans
import
net.mamoe.mirai.qqandroid.network.protocol.packet.IncomingPacketFactory
import
net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket
import
net.mamoe.mirai.qqandroid.network.protocol.packet.buildResponseUniPacket
import
net.mamoe.mirai.qqandroid.utils.toMessageChain
import
net.mamoe.mirai.utils.cryptor.contentToString
import
net.mamoe.mirai.utils.io.discardExact
...
...
@@ -82,13 +85,29 @@ internal class OnlinePush {
}
}
internal
object
PbPushTransMsg
:
IncomingPacketFactory
<
Packet
>(
"OnlinePush.PbPushTransMsg"
)
{
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
,
sequenceId
:
Int
):
Packet
{
val
content
=
this
.
readProtoBuf
(
OnlinePushTrans
.
PbMsgInfo
.
serializer
())
println
(
content
.
contentToString
())
return
NoPakcet
}
override
suspend
fun
QQAndroidBot
.
handle
(
packet
:
Packet
,
sequenceId
:
Int
):
OutgoingPacket
?
{
return
buildResponseUniPacket
(
client
,
commandName
=
"OnlinePush.RespPush"
,
sequenceId
=
sequenceId
)
{
}
}
}
//0C 01 B1 89 BE 09 5E 3D 72 A6 00 01 73 68 FC 06 00 00 00 3C
internal
object
ReqPush
:
IncomingPacketFactory
<
Packet
>(
"OnlinePush.ReqPush"
)
{
@ExperimentalUnsignedTypes
@UseExperimental
(
ExperimentalStdlibApi
::
class
)
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
,
sequenceId
:
Int
):
Packet
{
val
reqPushMsg
=
decodeUniPacket
(
OnlinePushPack
.
SvcReqPushMsg
.
serializer
(),
"req"
)
println
(
reqPushMsg
.
contentToString
())
reqPushMsg
.
vMsgInfos
.
forEach
{
msgInfo
:
MsgInfo
->
var
debug
=
""
msgInfo
.
vMsg
!!
.
read
{
...
...
@@ -152,9 +171,10 @@ internal class OnlinePush {
}
}
}
else
if
(
msgInfo
.
shMsgType
.
toInt
()
==
528
)
{
val
content
=
msgInfo
.
vMsg
.
loadAs
(
OnlinePushPack
.
MsgType0x210
.
serializer
())
println
(
content
.
contentToString
())
}
else
if
(
msgInfo
.
shMsgType
.
toInt
()
==
4352
)
{
println
(
"4352"
)
}
else
{
println
(
"unknown shtype ${msgInfo.shMsgType.toInt()}"
)
}
...
...
@@ -167,7 +187,9 @@ internal class OnlinePush {
override
suspend
fun
QQAndroidBot
.
handle
(
packet
:
Packet
,
sequenceId
:
Int
):
OutgoingPacket
?
{
return
null
return
buildResponseUniPacket
(
client
,
commandName
=
"OnlinePush.RespPush"
,
sequenceId
=
sequenceId
)
{
}
}
}
}
\ No newline at end of file
mirai-core-qqandroid/src/jvmTest/kotlin/test/ProtoBufDataClassGenerator.kt
View file @
6e6c1d81
...
...
@@ -16,7 +16,7 @@ fun main() {
println
(
File
(
"""
E:\Projects\QQAndroidFF\app\src\main\java\tencent\im\statsvc\getonline
/Users/jiahua.liu/Desktop/QQAndroid-F/app/src/main/java/com/tencent/pb/onlinepush/
"""
.
trimIndent
()
)
.
generateUnarrangedClasses
().
toMutableList
().
arrangeClasses
().
joinToString
(
"\n\n"
)
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/BotConfiguration.kt
View file @
6e6c1d81
...
...
@@ -49,7 +49,7 @@ class BotConfiguration {
/**
* 心跳周期. 过长会导致被服务器断开连接.
*/
var
heartbeatPeriodMillis
:
Long
=
30
.
secondsToMillis
var
heartbeatPeriodMillis
:
Long
=
30
0
.
secondsToMillis
/**
* 每次心跳时等待结果的时间.
* 一旦心跳超时, 整个网络服务将会重启 (将消耗约 5s). 除正在进行的任务 (如图片上传) 会被中断外, 事件和插件均不受影响.
...
...
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