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
769b6ce2
Commit
769b6ce2
authored
Apr 24, 2020
by
ryoii
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete notify uniformly
parent
f5112aaa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
45 deletions
+32
-45
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/NewContact.kt
...irai/qqandroid/network/protocol/packet/chat/NewContact.kt
+0
-24
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
+32
-21
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/NewContact.kt
View file @
769b6ce2
...
...
@@ -186,28 +186,4 @@ internal class NewContact {
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
)
=
null
}
}
internal
object
Del
:
OutgoingPacketFactory
<
Nothing
?
>(
"MessageSvc.PbDeleteMsg"
)
{
internal
operator
fun
invoke
(
client
:
QQAndroidClient
,
header
:
MsgComm
.
MsgHead
)
=
buildOutgoingUniPacket
(
client
)
{
writeProtoBuf
(
MsgSvc
.
PbDeleteMsgReq
.
serializer
(),
MsgSvc
.
PbDeleteMsgReq
(
msgItems
=
listOf
(
MsgSvc
.
PbDeleteMsgReq
.
MsgItem
(
fromUin
=
header
.
fromUin
,
toUin
=
header
.
toUin
,
// 群为84、好友为187。但是群通过其他方法删除,测试通过187也能删除群消息。
msgType
=
187
,
msgSeq
=
header
.
msgSeq
,
msgUid
=
header
.
msgUid
)
)
)
)
}
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
)
=
null
}
}
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.kt
View file @
769b6ce2
...
...
@@ -208,16 +208,14 @@ internal class MessageSvc {
.
flatMapConcat
{
it
.
msg
!!
.
asFlow
()
}
.
mapNotNull
<
MsgComm
.
Msg
,
Packet
>
{
msg
->
println
(
msg
.
_miraiContentToString
())
when
(
msg
.
msgHead
.
msgType
)
{
33
->
{
// 邀请入群
// 删除消息
bot
.
network
.
run
{
NewContact
.
Del
(
bot
.
client
,
msg
.
msgHead
).
sendWithoutExpect
()
Del
(
bot
.
client
,
msg
.
msgHead
).
sendWithoutExpect
()
}
when
(
msg
.
msgHead
.
msgType
)
{
33
->
{
// 邀请入群
val
group
=
bot
.
getGroupByUinOrNull
(
msg
.
msgHead
.
fromUin
)
if
(
msg
.
msgHead
.
authUin
==
bot
.
id
)
{
if
(
group
!=
null
)
{
...
...
@@ -231,17 +229,16 @@ internal class MessageSvc {
}
else
{
group
?:
return
@
mapNotNull
null
if
(
group
.
members
.
contains
(
msg
.
msgHead
.
authUin
))
{
return
@
mapNotNull
null
}
return
@
mapNotNull
MemberJoinEvent
.
Invite
(
group
.
newMember
(
msg
.
getNewMemberInfo
())
.
also
{
group
.
members
.
delegate
.
addLast
(
it
)
})
}
}
34
->
{
// 主动入群
// 删除消息
bot
.
network
.
run
{
NewContact
.
Del
(
bot
.
client
,
msg
.
msgHead
).
sendWithoutExpect
()
}
// 27 0B 60 E7 01 44 71 47 90 03 3E 03 3F A2 06 B4 B4 BD A8 D5 DF 00 30 36 42 35 35 46 45 32 45 35 36 43 45 45 44 30 38 30 35 31 41 35 42 37 36 39 35 34 45 30 46 43 43 36 36 45 44 43 46 45 43 42 39 33 41 41 44 32 32
val
group
=
bot
.
getGroupByUinOrNull
(
msg
.
msgHead
.
fromUin
)
group
?:
return
@
mapNotNull
null
...
...
@@ -253,10 +250,6 @@ internal class MessageSvc {
.
also
{
group
.
members
.
delegate
.
addLast
(
it
)
})
}
166
->
{
// 删除消息
bot
.
network
.
run
{
NewContact
.
Del
(
bot
.
client
,
msg
.
msgHead
).
sendWithoutExpect
()
}
if
(
msg
.
msgHead
.
fromUin
==
bot
.
id
)
{
loop
@
while
(
true
)
{
...
...
@@ -317,18 +310,12 @@ internal class MessageSvc {
84
->
{
// 请求入群验证
bot
.
network
.
run
{
NewContact
.
SystemMsgNewGroup
(
bot
.
client
).
sendWithoutExpect
()
// 处理后要向服务器提交已阅,否则登陆时会重复收到事件
NewContact
.
Del
(
bot
.
client
,
msg
.
msgHead
).
sendWithoutExpect
()
}
return
@
mapNotNull
null
}
187
->
{
// 请求加好友验证
bot
.
network
.
run
{
NewContact
.
SystemMsgNewFriend
(
bot
.
client
).
sendWithoutExpect
()
// 处理后要向服务器提交已阅,否则登陆时会重复收到事件
NewContact
.
Del
(
bot
.
client
,
msg
.
msgHead
).
sendWithoutExpect
()
}
return
@
mapNotNull
null
}
...
...
@@ -556,5 +543,29 @@ internal class MessageSvc {
}
}
}
internal
object
Del
:
OutgoingPacketFactory
<
Nothing
?
>(
"MessageSvc.PbDeleteMsg"
)
{
internal
operator
fun
invoke
(
client
:
QQAndroidClient
,
header
:
MsgComm
.
MsgHead
)
=
buildOutgoingUniPacket
(
client
)
{
writeProtoBuf
(
MsgSvc
.
PbDeleteMsgReq
.
serializer
(),
MsgSvc
.
PbDeleteMsgReq
(
msgItems
=
listOf
(
MsgSvc
.
PbDeleteMsgReq
.
MsgItem
(
fromUin
=
header
.
fromUin
,
toUin
=
header
.
toUin
,
// 群为84、好友为187。但是群通过其他方法删除,测试通过187也能删除群消息。
msgType
=
187
,
msgSeq
=
header
.
msgSeq
,
msgUid
=
header
.
msgUid
)
)
)
)
}
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
)
=
null
}
}
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