mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-05 07:30:09 +08:00
Merge remote-tracking branch 'origin/fixGroup' into dev
This commit is contained in:
commit
486a0dc5cb
@ -148,22 +148,22 @@ internal class NewContact {
|
||||
return struct?.msg?.run {
|
||||
//this.soutv("SystemMsg")
|
||||
when (subType) {
|
||||
1 -> { //管理员邀请
|
||||
when (c2cInviteJoinGroupFlag) {
|
||||
1 -> { // 处理被邀请入群 或 处理成员入群申请
|
||||
when (groupMsgType) {
|
||||
1 -> {
|
||||
// 被邀请入群
|
||||
BotInvitedJoinGroupRequestEvent(
|
||||
bot, struct.msgSeq, actionUin,
|
||||
groupCode, groupName, actionUinNick
|
||||
)
|
||||
}
|
||||
0 -> {
|
||||
// 成员申请入群
|
||||
MemberJoinRequestEvent(
|
||||
bot, struct.msgSeq, msgAdditional,
|
||||
struct.reqUin, groupCode, groupName, reqUinNick
|
||||
)
|
||||
}
|
||||
2 -> {
|
||||
// 被邀请入群
|
||||
BotInvitedJoinGroupRequestEvent(
|
||||
bot, struct.msgSeq, actionUin,
|
||||
groupCode, groupName, actionUinNick
|
||||
)
|
||||
}
|
||||
else -> throw contextualBugReportException(
|
||||
"parse SystemMsgNewGroup, subType=1",
|
||||
this._miraiContentToString(),
|
||||
@ -171,16 +171,14 @@ internal class NewContact {
|
||||
)
|
||||
}
|
||||
}
|
||||
2 -> {
|
||||
// 被邀请入群, 自动同意
|
||||
2 -> { // 被邀请入群, 自动同意, 不需处理
|
||||
|
||||
val group = bot.getNewGroup(groupCode) ?: return null
|
||||
val invitor = group[actionUin]
|
||||
|
||||
BotJoinGroupEvent.Invite(invitor)
|
||||
}
|
||||
3 -> {
|
||||
// 已被请他管理员处理
|
||||
3 -> { // 已被请他管理员处理
|
||||
null
|
||||
}
|
||||
5 -> {
|
||||
|
@ -44,6 +44,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgoingUniPacket
|
||||
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.toByteArray
|
||||
import net.mamoe.mirai.qqandroid.utils.io.serialization.writeProtoBuf
|
||||
@ -190,6 +191,20 @@ internal object MessageSvcPbGetMsg : OutgoingPacketFactory<MessageSvcPbGetMsg.Re
|
||||
34 -> { // 与 33 重复
|
||||
return@mapNotNull null
|
||||
}
|
||||
|
||||
85 -> bot.groupListModifyLock.withLock { // 其他客户端入群
|
||||
val group = bot.getGroupByUinOrNull(msg.msgHead.fromUin)
|
||||
if (msg.msgHead.toUin == bot.id && group == null) {
|
||||
|
||||
val newGroup = bot.getNewGroup(Group.calculateGroupCodeByGroupUin(msg.msgHead.fromUin))
|
||||
?: return@mapNotNull null
|
||||
bot.groups.delegate.addLast(newGroup)
|
||||
return@mapNotNull BotJoinGroupEvent.Active(newGroup)
|
||||
} else {
|
||||
// unknown
|
||||
return@mapNotNull null
|
||||
}
|
||||
}
|
||||
/*
|
||||
34 -> { // 主动入群
|
||||
|
||||
|
@ -81,7 +81,9 @@ internal object OnlinePushReqPush : IncomingPacketFactory<OnlinePushReqPush.ReqP
|
||||
val packets: Sequence<Packet> = reqPushMsg.vMsgInfos.deco(bot.client) { msgInfo ->
|
||||
when (msgInfo.shMsgType.toInt()) {
|
||||
732 -> {
|
||||
val group = bot.getGroup(readUInt().toLong())
|
||||
val group = bot.getGroupOrNull(readUInt().toLong())
|
||||
?: return@deco emptySequence() // group has not been initialized
|
||||
|
||||
GroupImpl.checkIsInstance(group)
|
||||
|
||||
val internalType = readByte().toInt()
|
||||
|
Loading…
Reference in New Issue
Block a user