Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
fda2040d
Commit
fda2040d
authored
Feb 10, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update docs
parent
d1b1c765
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
33 additions
and
91 deletions
+33
-91
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/event/ForceOfflineEvent.kt
...tlin/net/mamoe/mirai/qqandroid/event/ForceOfflineEvent.kt
+0
-23
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
...moe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.kt
...ndroid/network/protocol/packet/chat/receive/MessageSvc.kt
+1
-5
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt
.../src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/ConnectionOccupiedEvent.kt
...in/kotlin/net.mamoe.mirai/data/ConnectionOccupiedEvent.kt
+0
-17
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupInfo.kt
...e/src/commonMain/kotlin/net.mamoe.mirai/data/GroupInfo.kt
+0
-36
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/Profile.kt
...ore/src/commonMain/kotlin/net.mamoe.mirai/data/Profile.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/MessageSubscribers.kt
...onMain/kotlin/net.mamoe.mirai/event/MessageSubscribers.kt
+7
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/ForceOfflineEvent.kt
.../kotlin/net.mamoe.mirai/event/events/ForceOfflineEvent.kt
+13
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/MiraiLogger.kt
...rc/commonMain/kotlin/net.mamoe.mirai/utils/MiraiLogger.kt
+2
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/WeakRef.kt
...re/src/commonMain/kotlin/net.mamoe.mirai/utils/WeakRef.kt
+7
-6
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/event/ForceOfflineEvent.kt
deleted
100644 → 0
View file @
d1b1c765
/*
* 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.qqandroid.event
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.event.events.BotEvent
/**
* 被挤下线
*/
data class
ForceOfflineEvent
(
override
val
bot
:
Bot
,
val
title
:
String
,
val
tips
:
String
)
:
BotEvent
(),
Packet
\ No newline at end of file
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
View file @
fda2040d
...
...
@@ -21,6 +21,7 @@ import kotlinx.io.core.use
import
net.mamoe.mirai.contact.ContactList
import
net.mamoe.mirai.contact.Member
import
net.mamoe.mirai.contact.MemberPermission
import
net.mamoe.mirai.event.events.ForceOfflineEvent
import
net.mamoe.mirai.data.MultiPacket
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.event.*
...
...
@@ -29,7 +30,6 @@ import net.mamoe.mirai.qqandroid.GroupImpl
import
net.mamoe.mirai.qqandroid.MemberImpl
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.QQImpl
import
net.mamoe.mirai.qqandroid.event.ForceOfflineEvent
import
net.mamoe.mirai.qqandroid.event.PacketReceivedEvent
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc
import
net.mamoe.mirai.qqandroid.network.protocol.packet.*
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.kt
View file @
fda2040d
...
...
@@ -11,13 +11,13 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive
import
kotlinx.io.core.ByteReadPacket
import
kotlinx.io.core.discardExact
import
net.mamoe.mirai.event.events.ForceOfflineEvent
import
net.mamoe.mirai.data.MultiPacket
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.event.BroadcastControllable
import
net.mamoe.mirai.message.FriendMessage
import
net.mamoe.mirai.message.data.MessageChain
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.event.ForceOfflineEvent
import
net.mamoe.mirai.qqandroid.io.serialization.decodeUniPacket
import
net.mamoe.mirai.qqandroid.io.serialization.readProtoBuf
import
net.mamoe.mirai.qqandroid.io.serialization.toByteArray
...
...
@@ -32,11 +32,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgComm
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.MsgSvc
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.SyncCookie
import
net.mamoe.mirai.qqandroid.network.protocol.packet.*
import
net.mamoe.mirai.qqandroid.message.toMessageChain
import
net.mamoe.mirai.qqandroid.message.toRichTextElems
import
net.mamoe.mirai.utils.MiraiDebugAPI
import
net.mamoe.mirai.utils.MiraiInternalAPI
import
net.mamoe.mirai.utils.cryptor.contentToString
import
net.mamoe.mirai.utils.currentTimeSeconds
import
kotlin.math.absoluteValue
import
kotlin.random.Random
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt
View file @
fda2040d
...
...
@@ -28,7 +28,7 @@ interface Contact : CoroutineScope {
* 这个联系人所属 [Bot].
*/
@WeakRefProperty
val
bot
:
Bot
// weak ref
val
bot
:
Bot
/**
* 可以是 QQ 号码或者群号码.
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/ConnectionOccupiedEvent.kt
deleted
100644 → 0
View file @
d1b1c765
/*
* 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.data
/**
* 被挤下线. 只能获取到中文的消息
*/
inline
class
ConnectionOccupiedEvent
(
val
message
:
String
)
:
EventPacket
{
override
fun
toString
():
String
=
"ConnectionOccupiedEvent(${message.replace("
\
n
", "").replace("
\
r
", "")})"
}
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupInfo.kt
deleted
100644 → 0
View file @
d1b1c765
/*
* 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.data
import
net.mamoe.mirai.contact.ContactList
import
net.mamoe.mirai.contact.Group
import
net.mamoe.mirai.contact.Member
import
kotlin.jvm.JvmField
/**
* 群资料
*/
@Suppress
(
"MemberVisibilityCanBePrivate"
)
// 将来使用
class
GroupInfo
(
@JvmField
internal
var
_group
:
Group
,
@JvmField
internal
var
_owner
:
Member
,
@JvmField
internal
var
_name
:
String
,
@JvmField
internal
var
_announcement
:
String
,
@JvmField
internal
var
_members
:
ContactList
<
Member
>
)
{
val
group
:
Group
get
()
=
_group
val
owner
:
Member
get
()
=
_owner
val
name
:
String
get
()
=
_name
val
announcement
:
String
get
()
=
_announcement
val
members
:
ContactList
<
Member
>
get
()
=
_members
override
fun
toString
():
String
=
"GroupInfo(id=${group.id}, owner=$owner, name=$name, announcement=$announcement, members=${members.idContentString}"
}
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/Profile.kt
View file @
fda2040d
...
...
@@ -53,7 +53,7 @@ data class Profile(
/**
* 性别
*/
// 在 Android 中 enum 的使用被严格控制.
*/
enum
class
Gender
(
val
value
:
Byte
)
{
SECRET
(
0
),
MALE
(
1
),
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/MessageSubscribers.kt
View file @
fda2040d
...
...
@@ -180,6 +180,12 @@ class MessageSubscribersBuilder<T : MessagePacket<*, *>>(
infix
fun
nand
(
another
:
ListeningFilter
):
ListeningFilter
=
ListeningFilter
{
!
filter
.
invoke
(
this
,
it
)
||
!
another
.
filter
.
invoke
(
this
,
it
)
}
/**
* 进行逻辑 `not`
*/
fun
not
():
ListeningFilter
=
ListeningFilter
{
!
filter
.
invoke
(
this
,
it
)
}
/**
* 启动事件监听.
*/
...
...
@@ -359,7 +365,7 @@ class MessageSubscribersBuilder<T : MessagePacket<*, *>>(
*/
@MessageDsl
inline
fun
sentByFriend
(
crossinline
onEvent
:
MessageListener
<
FriendMessage
>):
Listener
<
T
>
=
content
({
this
is
FriendMessage
}){
content
({
this
is
FriendMessage
})
{
onEvent
(
this
as
FriendMessage
,
it
)
}
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/ForceOfflineEvent.kt
0 → 100644
View file @
fda2040d
package
net.mamoe.mirai.event.events
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.data.Packet
/**
* 被挤下线
*/
data class
ForceOfflineEvent
(
override
val
bot
:
Bot
,
val
title
:
String
,
val
tips
:
String
)
:
BotEvent
(),
Packet
\ No newline at end of file
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/MiraiLogger.kt
View file @
fda2040d
...
...
@@ -42,6 +42,8 @@ fun MiraiLogger.withSwitch(default: Boolean = true): MiraiLoggerWithSwitch = Mir
*
* 在定义 logger 变量时, 请一直使用 [MiraiLogger] 或者 [MiraiLoggerWithSwitch].
*
* Mirai 内建三种日志实现, 分别是 [SimpleLogger], [PlatformLogger], [SilentLogger]
*
* @see SimpleLogger 简易 logger, 它将所有的日志记录操作都转移给 lambda `(String?, Throwable?) -> Unit`
* @see PlatformLogger 各个平台下的默认日志记录实现.
* @see SilentLogger 忽略任何日志记录操作的 logger 实例.
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/WeakRef.kt
View file @
fda2040d
...
...
@@ -13,6 +13,8 @@ package net.mamoe.mirai.utils
import
kotlin.reflect.KProperty
// TODO: 2020/2/10 添加中文 doc
/**
* WeakRef that `getValue` for delegation throws an [IllegalStateException] if the referent is released by GC. Therefore it returns notnull value only
*/
...
...
@@ -32,13 +34,12 @@ operator fun <T> UnsafeWeakRef<T>.getValue(thisRef: Any?, property: KProperty<*>
/**
* Weak Reference.
*
In JVM, this is implemented as a typealias
to `WeakReference` from JDK.
*
On JVM, it is implemented as a typealias referring
to `WeakReference` from JDK.
*
* Reference details:
* In JVM, instances of objects are stored in the Heap and are accessed via references.
* GC can automatically collect and release the memory used by objects that are not directly referred by any other.
* WeakReference is not direct reference, therefore it does no influence on garbage collection.
* Using weak reference can help GC with that.
* Details:
* On JVM, instances of objects are stored in the JVM Heap and are accessed via references.
* GC(garbage collection) can automatically collect and release the memory used by objects that are not directly referred by any other.
* [WeakRef] is not a direct reference, therefore it doesn't hinder GC.
*
* @see weakRef provides a WeakRef
* @see unsafeWeakRef provides a UnsafeWeakRef
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment