Review contact infos and make them serializable

This commit is contained in:
Him188 2021-02-06 20:22:14 +08:00
parent 311df7d22b
commit 9211f697cf
21 changed files with 143 additions and 59 deletions

View File

@ -623,6 +623,7 @@ public abstract interface class net/mamoe/mirai/data/FriendInfo : net/mamoe/mira
public abstract fun getNick ()Ljava/lang/String;
public abstract fun getRemark ()Ljava/lang/String;
public abstract fun getUin ()J
public abstract fun setRemark (Ljava/lang/String;)V
}
public class net/mamoe/mirai/data/FriendInfoImpl : net/mamoe/mirai/data/FriendInfo {
@ -2077,6 +2078,7 @@ public abstract interface class net/mamoe/mirai/event/events/BotOfflineEvent$Cau
}
public final class net/mamoe/mirai/event/events/BotOfflineEvent$Dropped : net/mamoe/mirai/event/events/BotOfflineEvent, net/mamoe/mirai/event/events/BotOfflineEvent$CauseAware, net/mamoe/mirai/event/events/BotPassiveEvent, net/mamoe/mirai/internal/network/Packet {
public fun <init> (Lnet/mamoe/mirai/Bot;Ljava/lang/Throwable;)V
public final fun component1 ()Lnet/mamoe/mirai/Bot;
public final fun component2 ()Ljava/lang/Throwable;
public final fun copy (Lnet/mamoe/mirai/Bot;Ljava/lang/Throwable;)Lnet/mamoe/mirai/event/events/BotOfflineEvent$Dropped;
@ -2091,6 +2093,7 @@ public final class net/mamoe/mirai/event/events/BotOfflineEvent$Dropped : net/ma
}
public final class net/mamoe/mirai/event/events/BotOfflineEvent$Force : net/mamoe/mirai/event/events/BotOfflineEvent, net/mamoe/mirai/event/events/BotPassiveEvent, net/mamoe/mirai/internal/network/Packet {
public fun <init> (Lnet/mamoe/mirai/Bot;Ljava/lang/String;Ljava/lang/String;)V
public final fun component1 ()Lnet/mamoe/mirai/Bot;
public final fun component2 ()Ljava/lang/String;
public final fun component3 ()Ljava/lang/String;
@ -2107,6 +2110,7 @@ public final class net/mamoe/mirai/event/events/BotOfflineEvent$Force : net/mamo
}
public final class net/mamoe/mirai/event/events/BotOfflineEvent$MsfOffline : net/mamoe/mirai/event/events/BotOfflineEvent, net/mamoe/mirai/event/events/BotOfflineEvent$CauseAware, net/mamoe/mirai/event/events/BotPassiveEvent, net/mamoe/mirai/internal/network/Packet {
public fun <init> (Lnet/mamoe/mirai/Bot;Ljava/lang/Throwable;)V
public final fun component1 ()Lnet/mamoe/mirai/Bot;
public final fun component2 ()Ljava/lang/Throwable;
public final fun copy (Lnet/mamoe/mirai/Bot;Ljava/lang/Throwable;)Lnet/mamoe/mirai/event/events/BotOfflineEvent$MsfOffline;
@ -2121,6 +2125,7 @@ public final class net/mamoe/mirai/event/events/BotOfflineEvent$MsfOffline : net
}
public final class net/mamoe/mirai/event/events/BotOfflineEvent$PacketFactoryErrorCode : net/mamoe/mirai/event/events/BotOfflineEvent, net/mamoe/mirai/event/events/BotOfflineEvent$CauseAware, net/mamoe/mirai/event/events/BotPassiveEvent, net/mamoe/mirai/internal/network/Packet {
public fun <init> (ILnet/mamoe/mirai/Bot;Ljava/lang/Throwable;)V
public final fun component1 ()I
public final fun component2 ()Lnet/mamoe/mirai/Bot;
public final fun component3 ()Ljava/lang/Throwable;
@ -2137,6 +2142,7 @@ public final class net/mamoe/mirai/event/events/BotOfflineEvent$PacketFactoryErr
}
public final class net/mamoe/mirai/event/events/BotOfflineEvent$RequireReconnect : net/mamoe/mirai/event/events/BotOfflineEvent, net/mamoe/mirai/event/events/BotPassiveEvent, net/mamoe/mirai/internal/network/Packet {
public fun <init> (Lnet/mamoe/mirai/Bot;)V
public final fun component1 ()Lnet/mamoe/mirai/Bot;
public final fun copy (Lnet/mamoe/mirai/Bot;)Lnet/mamoe/mirai/event/events/BotOfflineEvent$RequireReconnect;
public static synthetic fun copy$default (Lnet/mamoe/mirai/event/events/BotOfflineEvent$RequireReconnect;Lnet/mamoe/mirai/Bot;ILjava/lang/Object;)Lnet/mamoe/mirai/event/events/BotOfflineEvent$RequireReconnect;
@ -2149,6 +2155,7 @@ public final class net/mamoe/mirai/event/events/BotOfflineEvent$RequireReconnect
}
public final class net/mamoe/mirai/event/events/BotOnlineEvent : net/mamoe/mirai/event/AbstractEvent, net/mamoe/mirai/event/events/BotActiveEvent {
public fun <init> (Lnet/mamoe/mirai/Bot;)V
public final fun component1 ()Lnet/mamoe/mirai/Bot;
public final fun copy (Lnet/mamoe/mirai/Bot;)Lnet/mamoe/mirai/event/events/BotOnlineEvent;
public static synthetic fun copy$default (Lnet/mamoe/mirai/event/events/BotOnlineEvent;Lnet/mamoe/mirai/Bot;ILjava/lang/Object;)Lnet/mamoe/mirai/event/events/BotOnlineEvent;
@ -2162,6 +2169,7 @@ public abstract interface class net/mamoe/mirai/event/events/BotPassiveEvent : n
}
public final class net/mamoe/mirai/event/events/BotReloginEvent : net/mamoe/mirai/event/AbstractEvent, net/mamoe/mirai/event/events/BotActiveEvent, net/mamoe/mirai/event/events/BotEvent {
public fun <init> (Lnet/mamoe/mirai/Bot;Ljava/lang/Throwable;)V
public final fun component1 ()Lnet/mamoe/mirai/Bot;
public final fun component2 ()Ljava/lang/Throwable;
public final fun copy (Lnet/mamoe/mirai/Bot;Ljava/lang/Throwable;)Lnet/mamoe/mirai/event/events/BotReloginEvent;

View File

@ -11,6 +11,7 @@
package net.mamoe.mirai.contact
import kotlinx.serialization.Serializable
import net.mamoe.mirai.Bot
import kotlin.internal.InlineOnly

View File

@ -17,9 +17,16 @@ public interface FriendInfo : UserInfo {
public override val nick: String
public override val remark: String
public override var remark: String
}
@Deprecated(
"Moved to net.mamoe.mirai.internal.contact.FriendInfoImpl. Kept for binary compatibility.",
ReplaceWith("FriendInfoImpl", "net.mamoe.mirai.internal.contact.FriendInfoImpl"),
level = DeprecationLevel.HIDDEN
)
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@LowLevelApi
public open class FriendInfoImpl(
override val uin: Long,

View File

@ -9,6 +9,7 @@
package net.mamoe.mirai.internal
import contact.StrangerImpl
import io.ktor.client.*
import io.ktor.client.engine.okhttp.*
import io.ktor.client.features.*
@ -25,6 +26,8 @@ import net.mamoe.mirai.data.*
import net.mamoe.mirai.event.broadcast
import net.mamoe.mirai.event.events.*
import net.mamoe.mirai.internal.contact.*
import net.mamoe.mirai.internal.contact.info.FriendInfoImpl
import net.mamoe.mirai.internal.contact.info.MemberInfoImpl
import net.mamoe.mirai.internal.message.*
import net.mamoe.mirai.internal.network.highway.*
import net.mamoe.mirai.internal.network.protocol.data.jce.SvcDevLoginInfo

View File

@ -18,8 +18,9 @@ import net.mamoe.mirai.LowLevelApi
import net.mamoe.mirai.Mirai
import net.mamoe.mirai.contact.*
import net.mamoe.mirai.data.*
import net.mamoe.mirai.internal.contact.info.FriendInfoImpl
import net.mamoe.mirai.internal.contact.OtherClientImpl
import net.mamoe.mirai.internal.contact.StrangerInfoImpl
import net.mamoe.mirai.internal.contact.info.StrangerInfoImpl
import net.mamoe.mirai.internal.contact.checkIsGroupImpl
import net.mamoe.mirai.internal.contact.uin
import net.mamoe.mirai.internal.message.*

View File

@ -12,6 +12,7 @@ package net.mamoe.mirai.internal.contact
import net.mamoe.mirai.contact.Member
import net.mamoe.mirai.contact.MemberPermission
import net.mamoe.mirai.data.MemberInfo
import net.mamoe.mirai.internal.contact.info.MemberInfoImpl
import net.mamoe.mirai.utils.cast
import net.mamoe.mirai.utils.getValue
import net.mamoe.mirai.utils.unsafeWeakRef

View File

@ -40,9 +40,6 @@ import kotlin.coroutines.CoroutineContext
internal val User.info: UserInfo? get() = this.castOrNull<AbstractUser>()?.info
internal open class UserInfoImpl(override val uin: Long, override val nick: String, override val remark: String = "") :
UserInfo
internal abstract class AbstractUser(
bot: Bot,
coroutineContext: CoroutineContext,

View File

@ -23,10 +23,10 @@ import kotlinx.atomicfu.atomic
import net.mamoe.mirai.LowLevelApi
import net.mamoe.mirai.contact.Friend
import net.mamoe.mirai.data.FriendInfo
import net.mamoe.mirai.data.FriendInfoImpl
import net.mamoe.mirai.event.events.FriendMessagePostSendEvent
import net.mamoe.mirai.event.events.FriendMessagePreSendEvent
import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.internal.contact.info.FriendInfoImpl
import net.mamoe.mirai.internal.network.protocol.packet.list.FriendList
import net.mamoe.mirai.internal.utils.C2CPkgMsgParsingCache
import net.mamoe.mirai.message.MessageReceipt
@ -42,15 +42,6 @@ internal fun net.mamoe.mirai.internal.network.protocol.data.jce.FriendInfo.toMir
remark
)
@OptIn(ExperimentalContracts::class)
internal inline fun FriendInfo.checkIsInfoImpl(): FriendInfoImpl {
contract {
returns() implies (this@checkIsInfoImpl is FriendInfoImpl)
}
check(this is FriendInfoImpl) { "A FriendInfo instance is not instance of checkIsInfoImpl. Your instance: ${this::class.qualifiedName}" }
return this
}
@OptIn(ExperimentalContracts::class)
internal inline fun Friend.checkIsFriendImpl(): FriendImpl {
contract {

View File

@ -20,6 +20,7 @@ import net.mamoe.mirai.data.MemberInfo
import net.mamoe.mirai.event.broadcast
import net.mamoe.mirai.event.events.*
import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.internal.contact.info.MemberInfoImpl
import net.mamoe.mirai.internal.message.*
import net.mamoe.mirai.internal.network.BdhSession
import net.mamoe.mirai.internal.network.handler.QQAndroidBotNetworkHandler

View File

@ -9,6 +9,7 @@
package net.mamoe.mirai.internal.contact
import contact.StrangerImpl
import net.mamoe.mirai.contact.*
import net.mamoe.mirai.event.nextEventOrNull
import net.mamoe.mirai.internal.MiraiImpl

View File

@ -15,17 +15,19 @@
"INVISIBLE_REFERENCE"
)
package net.mamoe.mirai.internal.contact
package contact
import kotlinx.atomicfu.AtomicInt
import kotlinx.atomicfu.atomic
import net.mamoe.mirai.LowLevelApi
import net.mamoe.mirai.contact.*
import net.mamoe.mirai.data.FriendInfoImpl
import net.mamoe.mirai.data.StrangerInfo
import net.mamoe.mirai.event.events.StrangerMessagePostSendEvent
import net.mamoe.mirai.event.events.StrangerMessagePreSendEvent
import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.internal.contact.AbstractUser
import net.mamoe.mirai.internal.contact.StrangerSendMessageHandler
import net.mamoe.mirai.internal.contact.sendMessageImpl
import net.mamoe.mirai.internal.message.OnlineMessageSourceToStrangerImpl
import net.mamoe.mirai.internal.network.protocol.packet.list.StrangerList
import net.mamoe.mirai.message.MessageReceipt
@ -36,20 +38,6 @@ import kotlin.contracts.contract
import kotlin.coroutines.CoroutineContext
internal class StrangerInfoImpl(
override val uin: Long, override val nick: String, override val fromGroup: Long = 0,
override val remark: String = ""
) : StrangerInfo
@OptIn(ExperimentalContracts::class)
internal inline fun StrangerInfo.checkIsInfoImpl(): FriendInfoImpl {
contract {
returns() implies (this@checkIsInfoImpl is StrangerInfoImpl)
}
check(this is FriendInfoImpl) { "A StrangerInfo instance is not instance of StrangerInfoImpl. Your instance: ${this::class.qualifiedName}" }
return this
}
@OptIn(ExperimentalContracts::class)
internal inline fun Stranger.checkIsImpl(): StrangerImpl {
contract {

View File

@ -0,0 +1,21 @@
/*
* Copyright 2020 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
package net.mamoe.mirai.internal.contact.info
import kotlinx.serialization.Serializable
import net.mamoe.mirai.data.FriendInfo
// since 2.4, for serialization
@Serializable
internal data class FriendInfoImpl(
override val uin: Long,
override var nick: String,
override var remark: String,
) : FriendInfo

View File

@ -0,0 +1,44 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
package net.mamoe.mirai.internal.contact.info
import kotlinx.serialization.Serializable
import net.mamoe.mirai.data.GroupInfo
import net.mamoe.mirai.internal.network.Packet
import net.mamoe.mirai.internal.network.protocol.data.jce.StTroopNum
@Serializable
internal data class GroupInfoImpl(
override val uin: Long,
override val owner: Long,
override val groupCode: Long,
override val memo: String,
override val name: String,
override val allowMemberInvite: Boolean,
override val allowAnonymousChat: Boolean,
override val autoApprove: Boolean,
override val confessTalk: Boolean,
override val muteAll: Boolean,
override val botMuteTimestamp: Int,
) : GroupInfo, Packet, Packet.NoLog {
constructor(stTroopNum: StTroopNum) : this(
uin = stTroopNum.groupUin,
owner = stTroopNum.dwGroupOwnerUin,
groupCode = stTroopNum.groupCode,
memo = stTroopNum.groupMemo,
name = stTroopNum.groupName,
allowMemberInvite = stTroopNum.dwGroupFlagExt?.and(0x000000c0) != 0L,
allowAnonymousChat = stTroopNum.dwGroupFlagExt?.and(0x40000000) == 0L,
autoApprove = stTroopNum.dwGroupFlagExt3?.and(0x00100000) == 0L,
confessTalk = stTroopNum.dwGroupFlagExt3?.and(0x00002000) == 0L,
muteAll = stTroopNum.dwShutUpTimestamp != 0L,
botMuteTimestamp = stTroopNum.dwMyShutUpTimestamp?.toInt() ?: 0,
)
}

View File

@ -7,15 +7,17 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
package net.mamoe.mirai.internal.contact
package net.mamoe.mirai.internal.contact.info
import kotlinx.serialization.Serializable
import net.mamoe.mirai.contact.MemberPermission
import net.mamoe.mirai.data.MemberInfo
import net.mamoe.mirai.internal.network.QQAndroidClient
import net.mamoe.mirai.internal.network.protocol.data.jce.StTroopMemberInfo
import net.mamoe.mirai.utils.currentTimeSeconds
internal class MemberInfoImpl(
@Serializable
internal data class MemberInfoImpl(
override val uin: Long,
override var nick: String,
override var permission: MemberPermission,
@ -27,7 +29,7 @@ internal class MemberInfoImpl(
override val joinTimestamp: Int = currentTimeSeconds().toInt(),
override var lastSpeakTimestamp: Int = 0,
override val isOfficialBot: Boolean = false
) : MemberInfo, UserInfoImpl(uin, nick, remark) {
) : MemberInfo {
constructor(
client: QQAndroidClient,
jceInfo: StTroopMemberInfo,

View File

@ -0,0 +1,23 @@
/*
* Copyright 2019-2021 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
package net.mamoe.mirai.internal.contact.info
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import net.mamoe.mirai.data.StrangerInfo
@SerialName("StrangerInfo")
@Serializable
internal class StrangerInfoImpl(
override val uin: Long,
override val nick: String,
override val fromGroup: Long = 0,
override val remark: String = ""
) : StrangerInfo

View File

@ -9,6 +9,7 @@
package net.mamoe.mirai.internal.network
import contact.StrangerImpl
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.cancel
import kotlinx.coroutines.coroutineScope
@ -17,9 +18,12 @@ import kotlinx.coroutines.sync.Semaphore
import kotlinx.coroutines.sync.withPermit
import net.mamoe.mirai.Mirai
import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.internal.contact.*
import net.mamoe.mirai.internal.contact.FriendImpl
import net.mamoe.mirai.internal.contact.GroupImpl
import net.mamoe.mirai.internal.contact.info.GroupInfoImpl
import net.mamoe.mirai.internal.contact.info.StrangerInfoImpl
import net.mamoe.mirai.internal.contact.toMiraiFriendInfo
import net.mamoe.mirai.internal.network.protocol.data.jce.StTroopNum
import net.mamoe.mirai.internal.network.protocol.packet.chat.GroupInfoImpl
import net.mamoe.mirai.internal.network.protocol.packet.chat.TroopManagement
import net.mamoe.mirai.internal.network.protocol.packet.list.FriendList
import net.mamoe.mirai.internal.network.protocol.packet.list.StrangerList
@ -27,6 +31,10 @@ import net.mamoe.mirai.utils.info
import net.mamoe.mirai.utils.retryCatching
import net.mamoe.mirai.utils.verbose
internal interface ContactCache {
}
internal interface ContactUpdater {
suspend fun loadAll()

View File

@ -13,14 +13,13 @@ import kotlinx.io.core.ByteReadPacket
import kotlinx.io.core.buildPacket
import kotlinx.io.core.readBytes
import kotlinx.io.core.toByteArray
import net.mamoe.mirai.LowLevelApi
import net.mamoe.mirai.contact.Member
import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.internal.contact.info.GroupInfoImpl
import net.mamoe.mirai.internal.network.Packet
import net.mamoe.mirai.internal.network.QQAndroidClient
import net.mamoe.mirai.internal.network.protocol.data.jce.ModifyGroupCardReq
import net.mamoe.mirai.internal.network.protocol.data.jce.RequestPacket
import net.mamoe.mirai.internal.network.protocol.data.jce.StTroopNum
import net.mamoe.mirai.internal.network.protocol.data.jce.stUinInfo
import net.mamoe.mirai.internal.network.protocol.data.proto.*
import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket
@ -28,24 +27,6 @@ import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory
import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket
import net.mamoe.mirai.internal.utils.io.serialization.*
import net.mamoe.mirai.utils.daysToSeconds
import net.mamoe.mirai.data.GroupInfo as MiraiGroupInfo
@OptIn(LowLevelApi::class)
internal class GroupInfoImpl(
private val stTroopNum: StTroopNum
) : MiraiGroupInfo, Packet, Packet.NoLog {
override val uin: Long get() = stTroopNum.groupUin
override val owner: Long get() = stTroopNum.dwGroupOwnerUin
override val groupCode: Long get() = stTroopNum.groupCode
override val memo: String get() = stTroopNum.groupMemo
override val name: String get() = stTroopNum.groupName
override val allowMemberInvite get() = stTroopNum.dwGroupFlagExt?.and(0x000000c0) != 0L
override val allowAnonymousChat get() = stTroopNum.dwGroupFlagExt?.and(0x40000000) == 0L
override val autoApprove get() = stTroopNum.dwGroupFlagExt3?.and(0x00100000) == 0L
override val confessTalk get() = stTroopNum.dwGroupFlagExt3?.and(0x00002000) == 0L
override val muteAll: Boolean get() = stTroopNum.dwShutUpTimestamp != 0L
override val botMuteTimestamp: Int get() = stTroopNum.dwMyShutUpTimestamp?.toInt() ?: 0
}
internal class TroopManagement {

View File

@ -11,6 +11,7 @@
package net.mamoe.mirai.internal.network.protocol.packet.chat.receive
import contact.checkIsImpl
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.delay
@ -29,6 +30,8 @@ import net.mamoe.mirai.event.broadcast
import net.mamoe.mirai.event.events.*
import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.internal.contact.*
import net.mamoe.mirai.internal.contact.info.MemberInfoImpl
import net.mamoe.mirai.internal.contact.info.StrangerInfoImpl
import net.mamoe.mirai.internal.message.OnlineMessageSourceFromFriendImpl
import net.mamoe.mirai.internal.message.refine
import net.mamoe.mirai.internal.message.toMessageChainOnline
@ -42,7 +45,7 @@ import net.mamoe.mirai.internal.network.protocol.data.proto.SubMsgType0x7
import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket
import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacketFactory
import net.mamoe.mirai.internal.network.protocol.packet.buildOutgoingUniPacket
import net.mamoe.mirai.internal.network.protocol.packet.chat.GroupInfoImpl
import net.mamoe.mirai.internal.contact.info.GroupInfoImpl
import net.mamoe.mirai.internal.network.protocol.packet.chat.NewContact
import net.mamoe.mirai.internal.network.protocol.packet.list.FriendList
import net.mamoe.mirai.internal.utils.*

View File

@ -23,6 +23,7 @@ import net.mamoe.mirai.event.events.GroupMessageSyncEvent
import net.mamoe.mirai.event.events.MemberCardChangeEvent
import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.internal.contact.*
import net.mamoe.mirai.internal.contact.info.MemberInfoImpl
import net.mamoe.mirai.internal.message.refine
import net.mamoe.mirai.internal.message.toMessageChainOnline
import net.mamoe.mirai.internal.network.Packet

View File

@ -23,6 +23,7 @@ import net.mamoe.mirai.contact.NormalMember
import net.mamoe.mirai.event.events.*
import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.internal.contact.*
import net.mamoe.mirai.internal.contact.info.MemberInfoImpl
import net.mamoe.mirai.internal.message.contextualBugReportException
import net.mamoe.mirai.internal.network.MultiPacketByIterable
import net.mamoe.mirai.internal.network.Packet

View File

@ -21,12 +21,13 @@ import kotlinx.serialization.Serializable
import kotlinx.serialization.protobuf.ProtoNumber
import net.mamoe.mirai.Mirai
import net.mamoe.mirai.contact.*
import net.mamoe.mirai.data.FriendInfoImpl
import net.mamoe.mirai.data.GroupHonorType
import net.mamoe.mirai.event.broadcast
import net.mamoe.mirai.event.events.*
import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.internal.contact.*
import net.mamoe.mirai.internal.contact.info.FriendInfoImpl
import net.mamoe.mirai.internal.contact.info.MemberInfoImpl
import net.mamoe.mirai.internal.network.MultiPacketBySequence
import net.mamoe.mirai.internal.network.Packet
import net.mamoe.mirai.internal.network.QQAndroidClient
@ -708,7 +709,7 @@ internal object Transformers528 : Map<Long, Lambda528> by mapOf(
return this.msgFrdRmk.asSequence().mapNotNull {
val friend = bot.getFriend(it.fuin) ?: return@mapNotNull null
val old: String
friend.checkIsFriendImpl().friendInfo.checkIsInfoImpl()
friend.checkIsFriendImpl().friendInfo
.also { info -> old = info.remark }
.remark = it.rmkName
// TODO: 2020/4/10 ADD REMARK QUERY