Fix: delete notify sent from tx server

This commit is contained in:
ryoii 2020-04-24 21:16:54 +08:00
parent ac20f2b365
commit f5112aaac5

View File

@ -50,6 +50,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.*
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.GroupInfoImpl
import net.mamoe.mirai.qqandroid.network.protocol.packet.chat.NewContact
import net.mamoe.mirai.qqandroid.network.protocol.packet.list.FriendList
import net.mamoe.mirai.qqandroid.utils._miraiContentToString
import net.mamoe.mirai.qqandroid.utils.io.serialization.readProtoBuf
import net.mamoe.mirai.qqandroid.utils.io.serialization.readUniPacket
import net.mamoe.mirai.qqandroid.utils.io.serialization.toByteArray
@ -206,8 +207,17 @@ internal class MessageSvc {
.filterNot { it.msg == null }
.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()
}
val group = bot.getGroupByUinOrNull(msg.msgHead.fromUin)
if (msg.msgHead.authUin == bot.id) {
if (group != null) {
@ -221,14 +231,33 @@ 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
if (group.members.contains(msg.msgHead.authUin)) {
return@mapNotNull null
}
return@mapNotNull MemberJoinEvent.Active(group.newMember(msg.getNewMemberInfo())
.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) {
val instance = bot.client.getFriendSeq()
@ -303,17 +332,6 @@ internal class MessageSvc {
}
return@mapNotNull null
}
34 -> { // 主动入群
// 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
if (group.members.contains(msg.msgHead.authUin)) {
return@mapNotNull null
}
return@mapNotNull MemberJoinEvent.Active(group.newMember(msg.getNewMemberInfo())
.also { group.members.delegate.addLast(it) })
}
// 732: 27 0B 60 E7 0C 01 3E 03 3F A2 5E 90 60 E2 00 01 44 71 47 90 00 00 02 58
else -> {
bot.network.logger.debug { "unknown PbGetMsg type ${msg.msgHead.msgType}" }