mirai/mirai-core
Eritque arcus fea1d28488
[core] Support friend group (#2113)
* feat: support friend group

* remove unnecessary modifications

* toByteArray2

* support friendGroup, with api dump

* support rename, with api dump

* modify as required

* modify as required

* reverse

* doc

* FriendGroups

* api dump

* modify as required

* fix CI

* FriendGroup sync notice

* api dump

* modify as required

* immutable

* add friends: ContactList in FriendGroup

* more sync notice

* modify log content

* Change `FriendGroup.friends` to `Collection<Friend>`

* Fix `FriendGroup.friends.isEmpty()`

* modified as require, untested

* del count and online count in info

* change import

* fix missing import

* set @since 2.13 and modified as required

* modified as required

* modified as required

* doc

* change friendGroupId type to Int?

* api dumped

* change friendGroupId type to Int?

* introduce null to friendGroupId

* modified as required

* chore

* api dump

* chore: remark

* change int? to int

* api dump

* Update mirai-core-api/src/commonMain/kotlin/data/FriendGroups.kt

Co-authored-by: Him188 <Him188@mamoe.net>

* Move FriendGroup and FriendGroups to contact.friendgroup

* Make `Friend.friendGroup` not null

* add FriendGroups.default for default group

* Redesign FriendGroup interface

Co-authored-by: Karlatemp <kar@kasukusakura.com>
Co-authored-by: Him188 <Him188@mamoe.net>
2022-08-26 16:56:09 +08:00
..
compatibility-validation Fix project structure for Dokka 2022-01-06 20:26:52 +00:00
src [core] Support friend group (#2113) 2022-08-26 16:56:09 +08:00
.gitignore Implement mirai-core for native 2022-07-20 00:30:16 +08:00
build.gradle.kts Configure shadow relocation and add checks for multiplatform publishing 2022-07-20 00:30:16 +08:00
README.md Update docs and improve source code readability 2021-05-09 15:31:50 +08:00

mirai-core

mirai 核心实现模块。首先阅读 mirai-core-api/README.md

本文仅介绍重要部分。

架构

包名 描述
net.mamoe.mirai.internal mirai 核心 API 的实现
.contact 联系人实现
.message 消息系统的实现
.network 网络层实现
.utils 工具类

net.mamoe.mirai.internal.contact

AbstractContact

AbstractContact.kt

所有 Contact 实现的基类. 实现生命周期等.

SendMessageHandler

SendMessageHandler.kt

处理 mirai 消息系统 Message 到协议数据结构的转换, 并处理长消息上传, 音乐转发上传等.

net.mamoe.mirai.internal.message

ReceiveMessageTransformer

ReceiveMessageHandler.kt

处理协议数据结构到 Message 的转换. 设有 RefinableMessage 处理长消息下载, 合并转发下载并展开等.

RefinableMessage

RefinableMessage.kt

支持处理长消息下载, 合并转发下载并展开等.

Image 实现

imagesImpl.kt

图片的实现的基类为 AbstractImage.

在底层协议, 群图片与私聊图片很不同. 因此图片实现可以是 GroupImageFriendImage.

图片又细分了 OnlineImageOfflineImage. 故有 OnlineGroupImage 等四个类型, 及他们分别的 Impl.

OnlineImage 为通过 Contact.uploadImage 上传得到的, 或刚刚从服务器接收的图片对象. OfflineImage 则为反序列化得到的对象.

MessageSource 实现

MessageSourceInternal.kt

MessageSource 在协议底层十分复杂,