Make account internal

This commit is contained in:
Him188 2020-03-07 00:24:37 +08:00
parent 03f873276a
commit e222465ded
7 changed files with 16 additions and 20 deletions

View File

@ -160,7 +160,7 @@ internal open class QQAndroidClient(
@UseExperimental(RawAccountIdUse::class)
@Suppress("PropertyName")
internal var _uin: Long = bot.account.id
internal var _uin: Long = bot.uin
var t530: ByteArray? = null
var t528: ByteArray? = null

View File

@ -54,12 +54,6 @@ actual abstract class Bot actual constructor() : CoroutineScope, LowLevelBotAPIA
*/
actual abstract val context: Context
/**
* 账号信息
*/
@MiraiInternalAPI
actual abstract val account: BotAccount
/**
* QQ 号码. 实际类型为 uint
*/

View File

@ -70,12 +70,6 @@ expect abstract class Bot() : CoroutineScope, LowLevelBotAPIAccessor {
*/
abstract val context: Context
/**
* 账号信息
*/
@MiraiInternalAPI
abstract val account: BotAccount
/**
* QQ 号码. 实际类型为 uint
*/

View File

@ -12,6 +12,7 @@
package net.mamoe.mirai
import io.ktor.utils.io.core.toByteArray
import net.mamoe.mirai.utils.MiraiExperimentalAPI
import net.mamoe.mirai.utils.MiraiInternalAPI
import net.mamoe.mirai.utils.md5
import kotlin.annotation.AnnotationTarget.*
@ -23,6 +24,8 @@ data class BotAccount(
*/
@RawAccountIdUse
val id: Long,
@MiraiExperimentalAPI
@MiraiInternalAPI
val passwordMd5: ByteArray // md5
) {
constructor(id: Long, passwordPlainText: String) : this(id, md5(passwordPlainText.toByteArray()))

View File

@ -40,9 +40,11 @@ abstract class BotImpl<N : BotNetworkHandler> constructor(
?: CoroutineExceptionHandler { _, e -> logger.error("An exception was thrown under a coroutine of Bot", e) })
override val context: Context by context.unsafeWeakRef()
@Suppress("CanBePrimaryConstructorProperty") // for logger
@UseExperimental(LowLevelAPI::class)
@Suppress("CanBePrimaryConstructorProperty", "OverridingDeprecatedMember") // for logger
final override val account: BotAccount = account
@Suppress("DEPRECATION_ERROR")
@UseExperimental(RawAccountIdUse::class)
override val uin: Long
get() = account.id

View File

@ -17,6 +17,7 @@ import net.mamoe.mirai.data.GroupInfo
import net.mamoe.mirai.data.MemberInfo
import net.mamoe.mirai.message.data.MessageSource
import net.mamoe.mirai.utils.MiraiExperimentalAPI
import net.mamoe.mirai.utils.MiraiInternalAPI
import net.mamoe.mirai.utils.WeakRef
/**
@ -37,6 +38,14 @@ annotation class LowLevelAPI
@Suppress("FunctionName", "unused")
@LowLevelAPI
interface LowLevelBotAPIAccessor {
/**
* 账号信息
*/
@Deprecated("将来会做修改", level = DeprecationLevel.ERROR)
@MiraiExperimentalAPI
@LowLevelAPI
@MiraiInternalAPI
abstract val account: BotAccount
/**
* 构造一个 [_lowLevelNewQQ] 对象. 它持有对 [Bot] 的弱引用([WeakRef]).

View File

@ -64,12 +64,6 @@ actual abstract class Bot actual constructor() : CoroutineScope, LowLevelBotAPIA
*/
actual abstract val context: Context
/**
* 账号信息
*/
@MiraiInternalAPI
actual abstract val account: BotAccount
/**
* QQ 号码. 实际类型为 uint
*/