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
dc0df986
Commit
dc0df986
authored
Jan 31, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix sync cookie
parent
18cf5621
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
9 deletions
+31
-9
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
...moe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt
...tlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/SyncCookie.kt
...mirai/qqandroid/network/protocol/data/proto/SyncCookie.kt
+16
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.kt
...ndroid/network/protocol/packet/chat/receive/MessageSvc.kt
+8
-4
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/FriendListPacket.kt
...qandroid/network/protocol/packet/list/FriendListPacket.kt
+5
-3
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
View file @
dc0df986
...
@@ -108,7 +108,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
...
@@ -108,7 +108,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
*/
*/
val
data
=
FriendList
.
GetTroopList
(
val
data
=
FriendList
.
GetTroopList
(
bot
.
client
bot
.
client
).
sendAndExpect
<
FriendList
.
Get
FriendGrou
pList
.
Response
>()
).
sendAndExpect
<
FriendList
.
Get
Troo
pList
.
Response
>()
println
(
data
.
contentToString
())
println
(
data
.
contentToString
())
}
}
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt
View file @
dc0df986
...
@@ -111,7 +111,7 @@ internal open class QQAndroidClient(
...
@@ -111,7 +111,7 @@ internal open class QQAndroidClient(
val
protocolVersion
:
Short
=
8001
val
protocolVersion
:
Short
=
8001
class
C2cMessageSyncData
{
class
C2cMessageSyncData
{
var
syncCookie
=
EMPTY_BYTE_ARRAY
var
syncCookie
:
ByteArray
?
=
null
var
pubAccountCookie
=
EMPTY_BYTE_ARRAY
var
pubAccountCookie
=
EMPTY_BYTE_ARRAY
var
syncFlag
:
Int
=
0
var
syncFlag
:
Int
=
0
var
msgCtrlBuf
:
ByteArray
=
EMPTY_BYTE_ARRAY
var
msgCtrlBuf
:
ByteArray
=
EMPTY_BYTE_ARRAY
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/SyncCookie.kt
0 → 100644
View file @
dc0df986
package
net.mamoe.mirai.qqandroid.network.protocol.data.proto
import
kotlinx.serialization.SerialId
import
kotlinx.serialization.Serializable
import
net.mamoe.mirai.qqandroid.io.ProtoBuf
@Serializable
class
SyncCookie
(
@SerialId
(
2
)
val
time
:
Long
,
@SerialId
(
3
)
val
unknown1
:
Long
=
2994099792
,
@SerialId
(
4
)
val
unknown2
:
Long
=
3497826378
,
@SerialId
(
5
)
val
const1
:
Long
=
1680172298
,
@SerialId
(
6
)
val
const2
:
Long
=
2424173273
,
@SerialId
(
7
)
val
unknown3
:
Long
=
83
,
@SerialId
(
8
)
val
unknown4
:
Long
=
0
)
:
ProtoBuf
\ No newline at end of file
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.kt
View file @
dc0df986
...
@@ -10,6 +10,7 @@ import net.mamoe.mirai.qqandroid.QQAndroidBot
...
@@ -10,6 +10,7 @@ import net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.event.ForceOfflineEvent
import
net.mamoe.mirai.qqandroid.event.ForceOfflineEvent
import
net.mamoe.mirai.qqandroid.io.serialization.decodeUniPacket
import
net.mamoe.mirai.qqandroid.io.serialization.decodeUniPacket
import
net.mamoe.mirai.qqandroid.io.serialization.readRemainingAsProtoBuf
import
net.mamoe.mirai.qqandroid.io.serialization.readRemainingAsProtoBuf
import
net.mamoe.mirai.qqandroid.io.serialization.toByteArray
import
net.mamoe.mirai.qqandroid.io.serialization.writeProtoBuf
import
net.mamoe.mirai.qqandroid.io.serialization.writeProtoBuf
import
net.mamoe.mirai.qqandroid.network.QQAndroidClient
import
net.mamoe.mirai.qqandroid.network.QQAndroidClient
import
net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPushForceOffline
import
net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPushForceOffline
...
@@ -17,6 +18,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPushNotify
...
@@ -17,6 +18,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.data.jce.RequestPushNotify
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgComm
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgComm
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.SyncCookie
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
...
@@ -41,7 +43,7 @@ internal class MessageSvc {
...
@@ -41,7 +43,7 @@ internal class MessageSvc {
override
suspend
fun
QQAndroidBot
.
handle
(
packet
:
RequestPushNotify
)
{
override
suspend
fun
QQAndroidBot
.
handle
(
packet
:
RequestPushNotify
)
{
network
.
run
{
network
.
run
{
PbGetMsg
(
client
,
packet
).
sendAndExpect
<
MultiPacket
<
FriendMessage
>>()
PbGetMsg
(
client
,
packet
.
stMsgInfo
?.
uMsgTime
?:
0
).
sendAndExpect
<
MultiPacket
<
FriendMessage
>>()
}
}
}
}
}
}
...
@@ -56,7 +58,7 @@ internal class MessageSvc {
...
@@ -56,7 +58,7 @@ internal class MessageSvc {
operator
fun
invoke
(
operator
fun
invoke
(
client
:
QQAndroidClient
,
client
:
QQAndroidClient
,
from
:
RequestPushNotify
msgTime
:
Long
//PbPushMsg.msg.msgHead.msgTime
):
OutgoingPacket
=
buildOutgoingUniPacket
(
):
OutgoingPacket
=
buildOutgoingUniPacket
(
client
,
client
,
extraData
=
EXTRA_DATA
.
toReadPacket
()
extraData
=
EXTRA_DATA
.
toReadPacket
()
...
@@ -64,14 +66,16 @@ internal class MessageSvc {
...
@@ -64,14 +66,16 @@ internal class MessageSvc {
writeProtoBuf
(
writeProtoBuf
(
MsgSvc
.
PbGetMsgReq
.
serializer
(),
MsgSvc
.
PbGetMsgReq
.
serializer
(),
MsgSvc
.
PbGetMsgReq
(
MsgSvc
.
PbGetMsgReq
(
msgReqType
=
from
.
ctype
.
toInt
(),
msgReqType
=
1
,
// from.ctype.toInt()
contextFlag
=
1
,
contextFlag
=
1
,
rambleFlag
=
0
,
rambleFlag
=
0
,
latestRambleNumber
=
20
,
latestRambleNumber
=
20
,
otherRambleNumber
=
3
,
otherRambleNumber
=
3
,
onlineSyncFlag
=
1
,
onlineSyncFlag
=
1
,
whisperSessionId
=
0
,
// serverBuf = from.serverBuf ?: EMPTY_BYTE_ARRAY,
// serverBuf = from.serverBuf ?: EMPTY_BYTE_ARRAY,
syncCookie
=
client
.
c2cMessageSync
.
syncCookie
,
syncCookie
=
client
.
c2cMessageSync
.
syncCookie
?:
SyncCookie
(
msgTime
).
toByteArray
(
SyncCookie
.
serializer
()).
also
{
client
.
c2cMessageSync
.
syncCookie
=
it
},
syncFlag
=
1
syncFlag
=
1
// syncFlag = client.c2cMessageSync.syncFlag,
// syncFlag = client.c2cMessageSync.syncFlag,
//msgCtrlBuf = client.c2cMessageSync.msgCtrlBuf,
//msgCtrlBuf = client.c2cMessageSync.msgCtrlBuf,
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/FriendListPacket.kt
View file @
dc0df986
...
@@ -3,7 +3,10 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.list
...
@@ -3,7 +3,10 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.list
import
kotlinx.io.core.ByteReadPacket
import
kotlinx.io.core.ByteReadPacket
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.io.serialization.*
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.network.QQAndroidClient
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.GetFriendListReq
import
net.mamoe.mirai.qqandroid.network.protocol.data.jce.GetFriendListResp
import
net.mamoe.mirai.qqandroid.network.protocol.data.jce.GetFriendListResp
...
@@ -15,7 +18,6 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket
...
@@ -15,7 +18,6 @@ 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.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
...
@@ -24,7 +26,7 @@ import net.mamoe.mirai.utils.io.toUHexString
...
@@ -24,7 +26,7 @@ import net.mamoe.mirai.utils.io.toUHexString
internal
class
FriendList
{
internal
class
FriendList
{
internal
object
GetTroopList
:
PacketFactory
<
GetTroopList
.
Response
>(
"friendlist.GetTroopListReqV2"
)
{
internal
object
GetTroopList
:
PacketFactory
<
GetTroopList
.
Response
>(
"friendlist.GetTroopListReqV2"
)
{
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
GetTroopList
.
Response
{
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
Response
{
println
(
"获取到了GetTroopList的回信"
)
println
(
"获取到了GetTroopList的回信"
)
println
(
this
.
readRemainingBytes
().
toUHexString
())
println
(
this
.
readRemainingBytes
().
toUHexString
())
return
Response
()
return
Response
()
...
...
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