mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-29 02:00:21 +08:00
60d360baad
* [core] update protocol * [core] fix t106 decryption key * [core] handle t543 * [core] revert t106 * [core] revert native test pow data * [core] split build version and apk version name * [core] pass time to t1 instead of time diff * [core] remove unused t106 writer & rename param ip to ipv4 of t1 and t106 * [core] implement qimei for t545 TODO: aes and rsa crypto for nativeMain * [core] fix base64 decode for android in rsa * [core] fix unix timestamp parsing on native and add more tests * [api] DeviceInfo move `androidId` to main constructor and adjust test. * [api] do not request qimei when protocol is neither ANDROID_PHONE nor ANDROID_PAD * [api] implement aes crypto for native target * [api] rsa crypto for multi-platform * [api] crypto test * [api] move freePointer util * [api] openssl api compatibility * [core] add explicit `androidId` param * [core] remove unused `tlvCount` * [core] optimize crypto * [core] move Qimei to network package * [core] move appId to protocol * [core] lazily initialize qimeiLogger * [core] write byte array to BIO mem * [core] move qimei to client, add direct serializer for DeviceInfo * [core] optimize DeviceInfoDelegateSerializer * [core] real user-agent when requesting qimei * [core] use `DeviceInfo.version.release` * [core] remove unused wtlogin packet * [core] do what constructor serializer should do * [core] fix endless cache validation caused by not upgrading device info file. * [core] request qimei before fast-login * [core] tlv order * [core] remove wrong tests and print more detail when deserialize failed. * [core] device info upgrade for native * [core] request qimei after validating cache * [core] DeviceInfo compatibility * [core] DeviceInfo test name * [core] compatibility serializer * [core] disable rsa crypto test on android unit test * [core] move rsa impl to jvmBase * action * import * api dump * api dump * revert wrong api dumps * [core] Deprecate DeviceInfo constructor and serializer, provide `serializeToString` and `deserializeFromString` for replacement * rerun ci * optimize * use serializer directly * optimize test * revert * [core] CacheValidator use `DeviceInfo.serializeToString()` instead of direct serializer * Remove `println` in `DeviceInfoManager` * Add legacy deserialize overload for ABI compatibility * Remove uncompleted docs for DeviceInfo * Suppress DeviceInfo deprecation warnings for internal usages --------- Co-authored-by: Him188 <Him188@mamoe.net> |
||
---|---|---|
.. | ||
compatibility-validation | ||
src | ||
build.gradle.kts | ||
README.md |
mirai-core-api
mirai 核心 API 模块。本文档帮助读者了解该模块的主要架构。
mirai 为多平台设计。支持 Android 和 JVM 双平台,拥有多个源集。
commonMain
:平台无关的通用代码。绝大部分代码都存在与这个源集。jvmMain
:桌面 JVM 平台的特别实现。androidMain
:Android 平台的特别实现。阅读源码通常阅读
src/commonMain
架构
包名 | 描述 |
---|---|
net.mamoe.mirai |
mirai 核心 API |
.contact |
联系人类型。如群 Group ,好友 Friend |
.event |
事件框架。提供事件对象的基类以及监听事件的方法 |
.event.events |
事件的定义。包含许多事件的具体类, 如消息事件 MessageEvent |
.message |
消息系统 |
.message.data |
提供对富文本聊天消息及其元素多样性的抽象 |
.message.code |
提供一个易于阅读的消息字符串表示方式 |
.message.action |
提供与消息有关的动作的抽象,如戳一戳 |
.utils |
一些工具类 |
.internal |
内部实现 |
.internal.event |
事件框架的实现 |
net.mamoe.mirai
IMirai
API 模块与协议实现模块的对接接口。
- 单例
- 通过
ServiceLoader
寻找协议实现。 - 若
ServiceLoader
在特定环境下不可用,外部可在 Kotlin 在调用任何 Mirai API 之前覆盖实例:@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") // 必要 net.mamoe.mirai._MiraiInstance.set(net.mamoe.mirai.internal.MiraiImpl())
Bot
表示一个机器人对象(账户)。
- 通过 BotFactory 构造
- 是功能的入口点----大部分操作都直接或间接经过
Bot
- 持有联系人(好友和群)对象列表
- 可获得事件通道
net.mamoe.mirai.contact
联系人系统。docs/Contacts
net.mamoe.mirai.event
事件系统。docs/Contacts
net.mamoe.mirai.event.events
事件列表。README
net.mamoe.mirai.message
消息系统。
MessageReceipt
在发送消息(Contact.sendMessage
)后收到的回执。
MessageSerializers
kotlinx.serialization 序列化支持。
net.mamoe.mirai.message.data
对富文本聊天消息及其元素多样性的抽象。
一个消息元素最基本的接口为 Message.