Fix #1674, apply right nick and remark impl to contact design (#1678)

* Fix #1674, apply right nick and remark impl for contact design

* Fix build, add missed member impl

* Fix wrong delegate in AbstractMember impl

Co-authored-by: sandtechnology <a1294790523@hotmail.com>

Co-authored-by: Him188 <him188@mamoe.net>
This commit is contained in:
sandtechnology 2021-11-16 22:54:39 +08:00 committed by GitHub
parent 736f52275f
commit 4e3873c3d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 2 deletions

View File

@ -21,8 +21,12 @@ internal sealed class AbstractMember(
parentCoroutineContext: CoroutineContext,
memberInfo: MemberInfo,
) : AbstractUser(group.bot, parentCoroutineContext, memberInfo), Member {
final override val info: MemberInfoImpl = memberInfo.cast()
override var nick: String by info::nick
override var remark: String by info::remark
override val nameCard: String get() = info.nameCard
override val specialTitle: String get() = info.specialTitle
override var permission: MemberPermission by info::permission

View File

@ -62,8 +62,8 @@ internal sealed class AbstractUser(
) : User, AbstractContact(bot, parentCoroutineContext) {
final override val id: Long = userInfo.uin
final override var nick: String = userInfo.nick
final override val remark: String = userInfo.remark
abstract override val nick: String
abstract override val remark: String
val messageSeq = AtomicIntSeq.forMessageSeq()
val fragmentedMessageMerger = C2CPkgMsgParsingCache()

View File

@ -63,6 +63,8 @@ internal class FriendImpl(
parentCoroutineContext: CoroutineContext,
override val info: FriendInfoImpl,
) : Friend, AbstractUser(bot, parentCoroutineContext, info) {
override var nick: String by info::nick
override var remark: String by info::remark
override suspend fun delete() {
check(bot.friends[id] != null) {
"Friend $id had already been deleted"

View File

@ -48,6 +48,8 @@ internal class StrangerImpl(
parentCoroutineContext: CoroutineContext,
override val info: StrangerInfo,
) : Stranger, AbstractUser(bot, parentCoroutineContext, info) {
override val nick: String by info::nick
override val remark: String by info::remark
override suspend fun delete() {
check(bot.strangers[this.id] != null) {
"Stranger ${this.id} had already been deleted"