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
60b6eab7
Commit
60b6eab7
authored
Mar 04, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Update to Kotlin 1.3.70"
This reverts commit
2e57e358
parent
b62151ea
Changes
72
Hide whitespace changes
Inline
Side-by-side
Showing
72 changed files
with
164 additions
and
175 deletions
+164
-175
README-eng.md
README-eng.md
+1
-1
docs/guide_quick_start.md
docs/guide_quick_start.md
+1
-1
gradle.properties
gradle.properties
+1
-1
mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroid.kt
...androidMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroid.kt
+2
-2
mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
...roidMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
...ommonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
+5
-5
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
...mmonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
+8
-8
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/Jce.kt
.../kotlin/net/mamoe/mirai/qqandroid/io/serialization/Jce.kt
+5
-5
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/MessageSourceImpl.kt
...in/net/mamoe/mirai/qqandroid/message/MessageSourceImpl.kt
+3
-3
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/messages.kt
...Main/kotlin/net/mamoe/mirai/qqandroid/message/messages.kt
+4
-6
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
...moe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
+3
-3
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt
...tlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt
+2
-2
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt
...et/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt
+3
-3
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/highway.kt
...tlin/net/mamoe/mirai/qqandroid/network/highway/highway.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/EncryptMethod.kt
.../mirai/qqandroid/network/protocol/packet/EncryptMethod.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/OutgoingPacketAndroid.kt
...qandroid/network/protocol/packet/OutgoingPacketAndroid.kt
+6
-6
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt
.../mirai/qqandroid/network/protocol/packet/PacketFactory.kt
+6
-6
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
+3
-5
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.kt
...ndroid/network/protocol/packet/chat/receive/OnlinePush.kt
+3
-3
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/WtLogin.kt
.../mirai/qqandroid/network/protocol/packet/login/WtLogin.kt
+5
-5
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/inline.kt
...mmonMain/kotlin/net/mamoe/mirai/qqandroid/utils/inline.kt
+1
-1
mirai-core-qqandroid/src/commonTest/kotlin/test/printing.kt
mirai-core-qqandroid/src/commonTest/kotlin/test/printing.kt
+1
-1
mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroid.kt
...src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroid.kt
+1
-1
mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
.../jvmMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
+2
-2
mirai-core-qqandroid/src/jvmTest/kotlin/test/ProtoBufDataClassGenerator.kt
...oid/src/jvmTest/kotlin/test/ProtoBufDataClassGenerator.kt
+2
-2
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/Bot.kt
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/Bot.kt
+2
-4
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/BotJavaHappyAPI.kt
...src/androidMain/kotlin/net/mamoe/mirai/BotJavaHappyAPI.kt
+3
-3
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Contact.kt
...src/androidMain/kotlin/net/mamoe/mirai/contact/Contact.kt
+1
-1
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Member.kt
.../src/androidMain/kotlin/net/mamoe/mirai/contact/Member.kt
+1
-1
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/message/MessagePacket.kt
...droidMain/kotlin/net/mamoe/mirai/message/MessagePacket.kt
+1
-1
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/message/MessageReceipt.kt
...roidMain/kotlin/net/mamoe/mirai/message/MessageReceipt.kt
+2
-2
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/SystemDeviceInfo.kt
...roidMain/kotlin/net/mamoe/mirai/utils/SystemDeviceInfo.kt
+1
-1
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/io/PlatformSocket.kt
...oidMain/kotlin/net/mamoe/mirai/utils/io/PlatformSocket.kt
+1
-1
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/platformAndroid.kt
...droidMain/kotlin/net/mamoe/mirai/utils/platformAndroid.kt
+2
-2
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt
+2
-2
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt
...-core/src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt
+3
-3
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/contact/ContactList.kt
.../commonMain/kotlin/net.mamoe.mirai/contact/ContactList.kt
+4
-4
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt
...e/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/MemberPermission.kt
...onMain/kotlin/net.mamoe.mirai/contact/MemberPermission.kt
+2
-2
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/Event.kt
...core/src/commonMain/kotlin/net.mamoe.mirai/event/Event.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/BotEvents.kt
...mmonMain/kotlin/net.mamoe.mirai/event/events/BotEvents.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/types.kt
...c/commonMain/kotlin/net.mamoe.mirai/event/events/types.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/internal/InternalEventListeners.kt
.../net.mamoe.mirai/event/internal/InternalEventListeners.kt
+3
-3
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscribeMessages.kt
...monMain/kotlin/net.mamoe.mirai/event/subscribeMessages.kt
+6
-6
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscriber.kt
...src/commonMain/kotlin/net.mamoe.mirai/event/subscriber.kt
+6
-6
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/javaHappy.kt
...i-core/src/commonMain/kotlin/net.mamoe.mirai/javaHappy.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/lowLevelApi.kt
...core/src/commonMain/kotlin/net.mamoe.mirai/lowLevelApi.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/MessagePacket.kt
...ommonMain/kotlin/net.mamoe.mirai/message/MessagePacket.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/At.kt
.../src/commonMain/kotlin/net.mamoe.mirai/message/data/At.kt
+0
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt
...c/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt
+4
-4
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/QuoteReply.kt
...monMain/kotlin/net.mamoe.mirai/message/data/QuoteReply.kt
+3
-3
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/BotNetworkHandler.kt
...nMain/kotlin/net.mamoe.mirai/network/BotNetworkHandler.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/DeviceInfo.kt
...src/commonMain/kotlin/net.mamoe.mirai/utils/DeviceInfo.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/annotataions.kt
...c/commonMain/kotlin/net.mamoe.mirai/utils/annotataions.kt
+3
-3
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/channels.kt
...e/src/commonMain/kotlin/net.mamoe.mirai/utils/channels.kt
+4
-4
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/byteArrays.kt
.../commonMain/kotlin/net.mamoe.mirai/utils/io/byteArrays.kt
+3
-3
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/chunked.kt
...src/commonMain/kotlin/net.mamoe.mirai/utils/io/chunked.kt
+4
-4
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/input.kt
...e/src/commonMain/kotlin/net.mamoe.mirai/utils/io/input.kt
+2
-4
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/output.kt
.../src/commonMain/kotlin/net.mamoe.mirai/utils/io/output.kt
+1
-1
mirai-core/src/commonTest/kotlin/net.mamoe.mirai.message.data/CombinedMessageTest.kt
...otlin/net.mamoe.mirai.message.data/CombinedMessageTest.kt
+2
-2
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/Bot.kt
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/Bot.kt
+2
-4
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/BotJavaHappyAPI.kt
...ore/src/jvmMain/kotlin/net/mamoe/mirai/BotJavaHappyAPI.kt
+3
-3
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Contact.kt
...ore/src/jvmMain/kotlin/net/mamoe/mirai/contact/Contact.kt
+1
-1
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Member.kt
...core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Member.kt
+1
-1
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/MessagePacket.kt
...c/jvmMain/kotlin/net/mamoe/mirai/message/MessagePacket.kt
+1
-1
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/MessageReceipt.kt
.../jvmMain/kotlin/net/mamoe/mirai/message/MessageReceipt.kt
+2
-2
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/PlatformUtilsJvm.kt
.../jvmMain/kotlin/net/mamoe/mirai/utils/PlatformUtilsJvm.kt
+1
-1
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/SystemDeviceInfo.kt
.../jvmMain/kotlin/net/mamoe/mirai/utils/SystemDeviceInfo.kt
+2
-2
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/io/PlatformSocket.kt
...jvmMain/kotlin/net/mamoe/mirai/utils/io/PlatformSocket.kt
+1
-1
mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/utils/LockFreeLinkedListTest.kt
...st/kotlin/net/mamoe/mirai/utils/LockFreeLinkedListTest.kt
+2
-2
No files found.
README-eng.md
View file @
60b6eab7
...
@@ -71,7 +71,7 @@ If you meet any problem or have any questions, be free to open a issue. Our goal
...
@@ -71,7 +71,7 @@ If you meet any problem or have any questions, be free to open a issue. Our goal
## Requirements
## Requirements
Kotlin 1.3.
70
Kotlin 1.3.
61
On JVM: Java 6
On JVM: Java 6
...
...
docs/guide_quick_start.md
View file @
60b6eab7
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
## 构建需求
## 构建需求
-
Kotlin 1.3.
70
(必须)
-
Kotlin 1.3.
61
(必须)
-
JDK 6 或更高 (必须)
-
JDK 6 或更高 (必须)
-
Android SDK 29 (可选, 用于编译安卓目标)
-
Android SDK 29 (可选, 用于编译安卓目标)
...
...
gradle.properties
View file @
60b6eab7
...
@@ -5,7 +5,7 @@ miraiVersion=0.24.1
...
@@ -5,7 +5,7 @@ miraiVersion=0.24.1
kotlin.incremental.multiplatform
=
true
kotlin.incremental.multiplatform
=
true
kotlin.parallel.tasks.in.project
=
true
kotlin.parallel.tasks.in.project
=
true
# kotlin
# kotlin
kotlinVersion
=
1.3.
70
kotlinVersion
=
1.3.
61
# kotlin libraries
# kotlin libraries
serializationVersion
=
0.20.0-1.3.70-eap-274-2
serializationVersion
=
0.20.0-1.3.70-eap-274-2
coroutinesVersion
=
1.3.3
coroutinesVersion
=
1.3.3
...
...
mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroid.kt
View file @
60b6eab7
...
@@ -21,7 +21,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
...
@@ -21,7 +21,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
*/
*/
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
actual
object
QQAndroid
:
BotFactory
{
actual
object
QQAndroid
:
BotFactory
{
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
@JvmName
(
"newBot"
)
@JvmName
(
"newBot"
)
actual
override
fun
Bot
(
context
:
Context
,
qq
:
Long
,
password
:
String
,
configuration
:
BotConfiguration
):
Bot
{
actual
override
fun
Bot
(
context
:
Context
,
qq
:
Long
,
password
:
String
,
configuration
:
BotConfiguration
):
Bot
{
return
QQAndroidBot
(
context
,
BotAccount
(
qq
,
password
),
configuration
)
return
QQAndroidBot
(
context
,
BotAccount
(
qq
,
password
),
configuration
)
...
@@ -30,7 +30,7 @@ actual object QQAndroid : BotFactory {
...
@@ -30,7 +30,7 @@ actual object QQAndroid : BotFactory {
/**
/**
* 使用指定的 [配置][configuration] 构造 [Bot] 实例
* 使用指定的 [配置][configuration] 构造 [Bot] 实例
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
@JvmName
(
"newBot"
)
@JvmName
(
"newBot"
)
actual
override
fun
Bot
(
actual
override
fun
Bot
(
context
:
Context
,
context
:
Context
,
...
...
mirai-core-qqandroid/src/androidMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
View file @
60b6eab7
...
@@ -14,7 +14,7 @@ import net.mamoe.mirai.utils.BotConfiguration
...
@@ -14,7 +14,7 @@ import net.mamoe.mirai.utils.BotConfiguration
import
net.mamoe.mirai.utils.Context
import
net.mamoe.mirai.utils.Context
import
net.mamoe.mirai.utils.MiraiInternalAPI
import
net.mamoe.mirai.utils.MiraiInternalAPI
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
internal
actual
class
QQAndroidBot
internal
actual
class
QQAndroidBot
actual
constructor
(
actual
constructor
(
context
:
Context
,
context
:
Context
,
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
View file @
60b6eab7
...
@@ -367,7 +367,7 @@ internal fun GroupImpl.Companion.checkIsInstance(expression: Boolean) {
...
@@ -367,7 +367,7 @@ internal fun GroupImpl.Companion.checkIsInstance(expression: Boolean) {
}
}
@Suppress
(
"PropertyName"
)
@Suppress
(
"PropertyName"
)
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
internal
class
GroupImpl
(
internal
class
GroupImpl
(
bot
:
QQAndroidBot
,
override
val
coroutineContext
:
CoroutineContext
,
bot
:
QQAndroidBot
,
override
val
coroutineContext
:
CoroutineContext
,
override
val
id
:
Long
,
override
val
id
:
Long
,
...
@@ -383,7 +383,7 @@ internal class GroupImpl(
...
@@ -383,7 +383,7 @@ internal class GroupImpl(
override
lateinit
var
owner
:
Member
override
lateinit
var
owner
:
Member
@
OptIn
(
MiraiExperimentalAPI
::
class
)
@
UseExperimental
(
MiraiExperimentalAPI
::
class
)
override
val
botAsMember
:
Member
by
lazy
{
override
val
botAsMember
:
Member
by
lazy
{
Member
(
object
:
MemberInfo
{
Member
(
object
:
MemberInfo
{
override
val
nameCard
:
String
override
val
nameCard
:
String
...
@@ -401,7 +401,7 @@ internal class GroupImpl(
...
@@ -401,7 +401,7 @@ internal class GroupImpl(
})
})
}
}
@
OptIn
(
MiraiExperimentalAPI
::
class
)
@
UseExperimental
(
MiraiExperimentalAPI
::
class
)
override
lateinit
var
botPermission
:
MemberPermission
override
lateinit
var
botPermission
:
MemberPermission
var
_botMuteTimestamp
:
Int
=
groupInfo
.
botMuteRemaining
var
_botMuteTimestamp
:
Int
=
groupInfo
.
botMuteRemaining
...
@@ -557,10 +557,10 @@ internal class GroupImpl(
...
@@ -557,10 +557,10 @@ internal class GroupImpl(
TODO
(
"not implemented"
)
TODO
(
"not implemented"
)
}
}
@
OptIn
(
MiraiExperimentalAPI
::
class
)
@
UseExperimental
(
MiraiExperimentalAPI
::
class
)
override
fun
Member
(
memberInfo
:
MemberInfo
):
Member
{
override
fun
Member
(
memberInfo
:
MemberInfo
):
Member
{
return
MemberImpl
(
return
MemberImpl
(
@
OptIn
(
LowLevelAPI
::
class
)
@
UseExperimental
(
LowLevelAPI
::
class
)
bot
.
_lowLevelNewQQ
(
memberInfo
)
as
QQImpl
,
bot
.
_lowLevelNewQQ
(
memberInfo
)
as
QQImpl
,
this
,
this
,
this
.
coroutineContext
,
this
.
coroutineContext
,
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
View file @
60b6eab7
...
@@ -36,14 +36,14 @@ import net.mamoe.mirai.utils.*
...
@@ -36,14 +36,14 @@ import net.mamoe.mirai.utils.*
import
kotlin.collections.asSequence
import
kotlin.collections.asSequence
import
kotlin.coroutines.CoroutineContext
import
kotlin.coroutines.CoroutineContext
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
internal
expect
class
QQAndroidBot
constructor
(
internal
expect
class
QQAndroidBot
constructor
(
context
:
Context
,
context
:
Context
,
account
:
BotAccount
,
account
:
BotAccount
,
configuration
:
BotConfiguration
configuration
:
BotConfiguration
)
:
QQAndroidBotBase
)
:
QQAndroidBotBase
@
OptIn
(
MiraiInternalAPI
::
class
,
MiraiExperimentalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
,
MiraiExperimentalAPI
::
class
)
internal
abstract
class
QQAndroidBotBase
constructor
(
internal
abstract
class
QQAndroidBotBase
constructor
(
context
:
Context
,
context
:
Context
,
account
:
BotAccount
,
account
:
BotAccount
,
...
@@ -69,7 +69,7 @@ internal abstract class QQAndroidBotBase constructor(
...
@@ -69,7 +69,7 @@ internal abstract class QQAndroidBotBase constructor(
override
val
friends
:
ContactList
<
QQ
>
=
ContactList
(
LockFreeLinkedList
())
override
val
friends
:
ContactList
<
QQ
>
=
ContactList
(
LockFreeLinkedList
())
override
val
selfQQ
:
QQ
by
lazy
{
override
val
selfQQ
:
QQ
by
lazy
{
@
OptIn
(
LowLevelAPI
::
class
)
@
UseExperimental
(
LowLevelAPI
::
class
)
_lowLevelNewQQ
(
object
:
FriendInfo
{
_lowLevelNewQQ
(
object
:
FriendInfo
{
override
val
uin
:
Long
get
()
=
this
@QQAndroidBotBase
.
uin
override
val
uin
:
Long
get
()
=
this
@QQAndroidBotBase
.
uin
override
val
nick
:
String
get
()
=
this
@QQAndroidBotBase
.
nick
override
val
nick
:
String
get
()
=
this
@QQAndroidBotBase
.
nick
...
@@ -101,7 +101,7 @@ internal abstract class QQAndroidBotBase constructor(
...
@@ -101,7 +101,7 @@ internal abstract class QQAndroidBotBase constructor(
return
groups
.
delegate
.
getOrNull
(
uin
)
return
groups
.
delegate
.
getOrNull
(
uin
)
}
}
@
OptIn
(
LowLevelAPI
::
class
)
@
UseExperimental
(
LowLevelAPI
::
class
)
override
suspend
fun
_lowLevelQueryGroupList
():
Sequence
<
Long
>
{
override
suspend
fun
_lowLevelQueryGroupList
():
Sequence
<
Long
>
{
return
network
.
run
{
return
network
.
run
{
FriendList
.
GetTroopListSimplify
(
bot
.
client
)
FriendList
.
GetTroopListSimplify
(
bot
.
client
)
...
@@ -109,7 +109,7 @@ internal abstract class QQAndroidBotBase constructor(
...
@@ -109,7 +109,7 @@ internal abstract class QQAndroidBotBase constructor(
}.
groups
.
asSequence
().
map
{
it
.
groupUin
.
shl
(
32
)
and
it
.
groupCode
}
}.
groups
.
asSequence
().
map
{
it
.
groupUin
.
shl
(
32
)
and
it
.
groupCode
}
}
}
@
OptIn
(
LowLevelAPI
::
class
)
@
UseExperimental
(
LowLevelAPI
::
class
)
override
suspend
fun
_lowLevelQueryGroupInfo
(
groupCode
:
Long
):
GroupInfo
=
network
.
run
{
override
suspend
fun
_lowLevelQueryGroupInfo
(
groupCode
:
Long
):
GroupInfo
=
network
.
run
{
TroopManagement
.
GetGroupInfo
(
TroopManagement
.
GetGroupInfo
(
client
=
bot
.
client
,
client
=
bot
.
client
,
...
@@ -117,7 +117,7 @@ internal abstract class QQAndroidBotBase constructor(
...
@@ -117,7 +117,7 @@ internal abstract class QQAndroidBotBase constructor(
).
sendAndExpect
<
GroupInfoImpl
>(
retry
=
2
)
).
sendAndExpect
<
GroupInfoImpl
>(
retry
=
2
)
}
}
@
OptIn
(
LowLevelAPI
::
class
)
@
UseExperimental
(
LowLevelAPI
::
class
)
override
suspend
fun
_lowLevelQueryGroupMemberList
(
override
suspend
fun
_lowLevelQueryGroupMemberList
(
groupUin
:
Long
,
groupUin
:
Long
,
groupCode
:
Long
,
groupCode
:
Long
,
...
@@ -187,7 +187,7 @@ internal abstract class QQAndroidBotBase constructor(
...
@@ -187,7 +187,7 @@ internal abstract class QQAndroidBotBase constructor(
}
}
}
}
@
OptIn
(
LowLevelAPI
::
class
)
@
UseExperimental
(
LowLevelAPI
::
class
)
override
suspend
fun
_lowLevelRecallFriendMessage
(
friendId
:
Long
,
messageId
:
Long
,
time
:
Long
)
{
override
suspend
fun
_lowLevelRecallFriendMessage
(
friendId
:
Long
,
messageId
:
Long
,
time
:
Long
)
{
network
.
run
{
network
.
run
{
val
response
:
PbMessageSvc
.
PbMsgWithDraw
.
Response
=
val
response
:
PbMessageSvc
.
PbMsgWithDraw
.
Response
=
...
@@ -198,7 +198,7 @@ internal abstract class QQAndroidBotBase constructor(
...
@@ -198,7 +198,7 @@ internal abstract class QQAndroidBotBase constructor(
}
}
}
}
@
OptIn
(
LowLevelAPI
::
class
)
@
UseExperimental
(
LowLevelAPI
::
class
)
override
suspend
fun
_lowLevelRecallGroupMessage
(
groupId
:
Long
,
messageId
:
Long
)
{
override
suspend
fun
_lowLevelRecallGroupMessage
(
groupId
:
Long
,
messageId
:
Long
)
{
network
.
run
{
network
.
run
{
val
response
:
PbMessageSvc
.
PbMsgWithDraw
.
Response
=
val
response
:
PbMessageSvc
.
PbMsgWithDraw
.
Response
=
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/Jce.kt
View file @
60b6eab7
...
@@ -96,7 +96,7 @@ class Jce private constructor(private val charset: JceCharset, override val cont
...
@@ -96,7 +96,7 @@ class Jce private constructor(private val charset: JceCharset, override val cont
* From: com.qq.taf.jce.JceOutputStream
* From: com.qq.taf.jce.JceOutputStream
*/
*/
@Suppress
(
"unused"
,
"MemberVisibilityCanBePrivate"
)
@Suppress
(
"unused"
,
"MemberVisibilityCanBePrivate"
)
@
OptIn
(
ExperimentalIoApi
::
class
)
@
UseExperimental
(
ExperimentalIoApi
::
class
)
private
open
inner
class
JceEncoder
(
private
open
inner
class
JceEncoder
(
internal
val
output
:
BytePacketBuilder
internal
val
output
:
BytePacketBuilder
)
:
TaggedEncoder
<
Int
>()
{
)
:
TaggedEncoder
<
Int
>()
{
...
@@ -120,7 +120,7 @@ class Jce private constructor(private val charset: JceCharset, override val cont
...
@@ -120,7 +120,7 @@ class Jce private constructor(private val charset: JceCharset, override val cont
else
->
throw
SerializationException
(
"Primitives are not supported at top-level"
)
else
->
throw
SerializationException
(
"Primitives are not supported at top-level"
)
}
}
@
OptIn
(
ImplicitReflectionSerializer
::
class
)
@
UseExperimental
(
ImplicitReflectionSerializer
::
class
)
@Suppress
(
"UNCHECKED_CAST"
,
"NAME_SHADOWING"
)
@Suppress
(
"UNCHECKED_CAST"
,
"NAME_SHADOWING"
)
override
fun
<
T
>
encodeSerializableValue
(
serializer
:
SerializationStrategy
<
T
>,
value
:
T
)
=
override
fun
<
T
>
encodeSerializableValue
(
serializer
:
SerializationStrategy
<
T
>,
value
:
T
)
=
when
{
when
{
...
@@ -546,7 +546,7 @@ class Jce private constructor(private val charset: JceCharset, override val cont
...
@@ -546,7 +546,7 @@ class Jce private constructor(private val charset: JceCharset, override val cont
}
}
@
OptIn
(
ExperimentalUnsignedTypes
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
internal
inner
class
JceInput
(
internal
inner
class
JceInput
(
@PublishedApi
@PublishedApi
internal
val
input
:
ByteReadPacket
,
internal
val
input
:
ByteReadPacket
,
...
@@ -711,7 +711,7 @@ class Jce private constructor(private val charset: JceCharset, override val cont
...
@@ -711,7 +711,7 @@ class Jce private constructor(private val charset: JceCharset, override val cont
}
while
(
head
.
type
.
toInt
()
!=
11
)
}
while
(
head
.
type
.
toInt
()
!=
11
)
}
}
@
OptIn
(
ExperimentalUnsignedTypes
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
@PublishedApi
@PublishedApi
internal
fun
skipField
(
type
:
Byte
)
=
when
(
type
.
toInt
())
{
internal
fun
skipField
(
type
:
Byte
)
=
when
(
type
.
toInt
())
{
0
->
this
.
input
.
discardExact
(
1
)
0
->
this
.
input
.
discardExact
(
1
)
...
@@ -843,7 +843,7 @@ internal inline fun <R> Jce.JceInput.skipToTagOrNull(tag: Int, block: (JceHead)
...
@@ -843,7 +843,7 @@ internal inline fun <R> Jce.JceInput.skipToTagOrNull(tag: Int, block: (JceHead)
}
}
}
}
@
OptIn
(
ExperimentalUnsignedTypes
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
inline
class
JceHead
(
private
val
value
:
Long
)
{
inline
class
JceHead
(
private
val
value
:
Long
)
{
constructor
(
tag
:
Int
,
type
:
Byte
)
:
this
(
tag
.
toLong
().
shl
(
32
)
or
type
.
toLong
())
constructor
(
tag
:
Int
,
type
:
Byte
)
:
this
(
tag
.
toLong
().
shl
(
32
)
or
type
.
toLong
())
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/MessageSourceImpl.kt
View file @
60b6eab7
...
@@ -253,7 +253,7 @@ internal class MessageSourceFromSendFriend(
...
@@ -253,7 +253,7 @@ internal class MessageSourceFromSendFriend(
val
sequenceId
:
Int
,
val
sequenceId
:
Int
,
override
val
originalMessage
:
MessageChain
override
val
originalMessage
:
MessageChain
)
:
MessageSourceFromSend
()
{
)
:
MessageSourceFromSend
()
{
@
OptIn
(
ExperimentalCoroutinesApi
::
class
)
@
UseExperimental
(
ExperimentalCoroutinesApi
::
class
)
override
val
id
:
Long
override
val
id
:
Long
get
()
=
sequenceId
.
toLong
().
shl
(
32
)
or
get
()
=
sequenceId
.
toLong
().
shl
(
32
)
or
messageRandom
.
toLong
().
and
(
0
xFFFFFFFF
)
messageRandom
.
toLong
().
and
(
0
xFFFFFFFF
)
...
@@ -277,12 +277,12 @@ internal class MessageSourceFromSendGroup(
...
@@ -277,12 +277,12 @@ internal class MessageSourceFromSendGroup(
)
:
MessageSourceFromSend
()
{
)
:
MessageSourceFromSend
()
{
private
lateinit
var
sequenceIdDeferred
:
Deferred
<
Int
>
private
lateinit
var
sequenceIdDeferred
:
Deferred
<
Int
>
@
OptIn
(
ExperimentalCoroutinesApi
::
class
)
@
UseExperimental
(
ExperimentalCoroutinesApi
::
class
)
override
val
id
:
Long
override
val
id
:
Long
get
()
=
sequenceIdDeferred
.
getCompleted
().
toLong
().
shl
(
32
)
or
get
()
=
sequenceIdDeferred
.
getCompleted
().
toLong
().
shl
(
32
)
or
messageRandom
.
toLong
().
and
(
0
xFFFFFFFF
)
messageRandom
.
toLong
().
and
(
0
xFFFFFFFF
)
@
OptIn
(
MiraiExperimentalAPI
::
class
)
@
UseExperimental
(
MiraiExperimentalAPI
::
class
)
internal
fun
startWaitingSequenceId
(
coroutineScope
:
CoroutineScope
)
{
internal
fun
startWaitingSequenceId
(
coroutineScope
:
CoroutineScope
)
{
sequenceIdDeferred
=
sequenceIdDeferred
=
coroutineScope
.
subscribingGetAsync
<
OnlinePush
.
PbPushGroupMsg
.
SendGroupMessageReceipt
,
Int
>(
coroutineScope
.
subscribingGetAsync
<
OnlinePush
.
PbPushGroupMsg
.
SendGroupMessageReceipt
,
Int
>(
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/messages.kt
View file @
60b6eab7
...
@@ -219,7 +219,7 @@ private val atAllData = ImMsgBody.Elem(
...
@@ -219,7 +219,7 @@ private val atAllData = ImMsgBody.Elem(
)
)
)
)
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
internal
fun
MessageChain
.
toRichTextElems
(
forGroup
:
Boolean
):
MutableList
<
ImMsgBody
.
Elem
>
{
internal
fun
MessageChain
.
toRichTextElems
(
forGroup
:
Boolean
):
MutableList
<
ImMsgBody
.
Elem
>
{
val
elements
=
mutableListOf
<
ImMsgBody
.
Elem
>()
val
elements
=
mutableListOf
<
ImMsgBody
.
Elem
>()
...
@@ -332,7 +332,7 @@ internal class OnlineFriendImageImpl(
...
@@ -332,7 +332,7 @@ internal class OnlineFriendImageImpl(
}
}
}
}
@
OptIn
(
ExperimentalUnsignedTypes
::
class
,
MiraiInternalAPI
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
,
MiraiInternalAPI
::
class
)
internal
fun
MsgComm
.
Msg
.
toMessageChain
():
MessageChain
{
internal
fun
MsgComm
.
Msg
.
toMessageChain
():
MessageChain
{
val
elements
=
this
.
msgBody
.
richText
.
elems
val
elements
=
this
.
msgBody
.
richText
.
elems
...
@@ -343,7 +343,7 @@ internal fun MsgComm.Msg.toMessageChain(): MessageChain {
...
@@ -343,7 +343,7 @@ internal fun MsgComm.Msg.toMessageChain(): MessageChain {
}
}
// These two functions are not identical, dont combine.
// These two functions are not identical, dont combine.
@
OptIn
(
ExperimentalUnsignedTypes
::
class
,
MiraiInternalAPI
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
,
MiraiInternalAPI
::
class
)
internal
fun
ImMsgBody
.
SourceMsg
.
toMessageChain
():
MessageChain
{
internal
fun
ImMsgBody
.
SourceMsg
.
toMessageChain
():
MessageChain
{
val
elements
=
this
.
elems
!!
val
elements
=
this
.
elems
!!
...
@@ -368,9 +368,7 @@ private fun MessageChain.removeAtIfHasQuoteReply(): MessageChain =
...
@@ -368,9 +368,7 @@ private fun MessageChain.removeAtIfHasQuoteReply(): MessageChain =
}.asMessageChain()
}.asMessageChain()
} else this*/
} else this*/
@OptIn
(
@UseExperimental
(
MiraiInternalAPI
::
class
,
ExperimentalUnsignedTypes
::
class
,
MiraiDebugAPI
::
class
,
LowLevelAPI
::
class
)
MiraiInternalAPI
::
class
,
ExperimentalUnsignedTypes
::
class
,
MiraiDebugAPI
::
class
,
LowLevelAPI
::
class
)
internal
fun
List
<
ImMsgBody
.
Elem
>.
joinToMessageChain
(
message
:
MessageChainBuilder
)
{
internal
fun
List
<
ImMsgBody
.
Elem
>.
joinToMessageChain
(
message
:
MessageChainBuilder
)
{
this
.
forEach
{
this
.
forEach
{
when
{
when
{
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
View file @
60b6eab7
...
@@ -44,7 +44,7 @@ import kotlin.jvm.Volatile
...
@@ -44,7 +44,7 @@ import kotlin.jvm.Volatile
import
kotlin.time.ExperimentalTime
import
kotlin.time.ExperimentalTime
@Suppress
(
"MemberVisibilityCanBePrivate"
)
@Suppress
(
"MemberVisibilityCanBePrivate"
)
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
internal
class
QQAndroidBotNetworkHandler
(
bot
:
QQAndroidBot
)
:
BotNetworkHandler
()
{
internal
class
QQAndroidBotNetworkHandler
(
bot
:
QQAndroidBot
)
:
BotNetworkHandler
()
{
override
val
bot
:
QQAndroidBot
by
bot
.
unsafeWeakRef
()
override
val
bot
:
QQAndroidBot
by
bot
.
unsafeWeakRef
()
override
val
supervisor
:
CompletableJob
=
SupervisorJob
(
bot
.
coroutineContext
[
Job
])
override
val
supervisor
:
CompletableJob
=
SupervisorJob
(
bot
.
coroutineContext
[
Job
])
...
@@ -182,7 +182,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
...
@@ -182,7 +182,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
internal
var
pendingIncomingPackets
:
LockFreeLinkedList
<
KnownPacketFactories
.
IncomingPacket
<
*
>>?
=
internal
var
pendingIncomingPackets
:
LockFreeLinkedList
<
KnownPacketFactories
.
IncomingPacket
<
*
>>?
=
LockFreeLinkedList
()
LockFreeLinkedList
()
@
OptIn
(
MiraiExperimentalAPI
::
class
,
ExperimentalTime
::
class
)
@
UseExperimental
(
MiraiExperimentalAPI
::
class
,
ExperimentalTime
::
class
)
override
suspend
fun
init
():
Unit
=
coroutineScope
{
override
suspend
fun
init
():
Unit
=
coroutineScope
{
check
(
bot
.
isActive
)
{
"bot is dead therefore network can't init"
}
check
(
bot
.
isActive
)
{
"bot is dead therefore network can't init"
}
check
(
this
@QQAndroidBotNetworkHandler
.
isActive
)
{
"network is dead therefore can't init"
}
check
(
this
@QQAndroidBotNetworkHandler
.
isActive
)
{
"network is dead therefore can't init"
}
...
@@ -371,7 +371,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
...
@@ -371,7 +371,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
*
*
* @param input 一个完整的包的内容, 去掉开头的 int 包长度
* @param input 一个完整的包的内容, 去掉开头的 int 包长度
*/
*/
@
OptIn
(
ExperimentalCoroutinesApi
::
class
)
@
UseExperimental
(
ExperimentalCoroutinesApi
::
class
)
fun
parsePacketAsync
(
input
:
Input
):
Job
{
fun
parsePacketAsync
(
input
:
Input
):
Job
{
return
this
.
launch
(
start
=
CoroutineStart
.
ATOMIC
)
{
return
this
.
launch
(
start
=
CoroutineStart
.
ATOMIC
)
{
input
.
use
{
parsePacket
(
it
)
}
input
.
use
{
parsePacket
(
it
)
}
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt
View file @
60b6eab7
...
@@ -40,7 +40,7 @@ import net.mamoe.mirai.utils.io.*
...
@@ -40,7 +40,7 @@ import net.mamoe.mirai.utils.io.*
DOMAINS
DOMAINS
Pskey: "openmobile.qq.com"
Pskey: "openmobile.qq.com"
*/
*/
@
OptIn
(
MiraiExperimentalAPI
::
class
,
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiExperimentalAPI
::
class
,
MiraiInternalAPI
::
class
)
@PublishedApi
@PublishedApi
internal
open
class
QQAndroidClient
(
internal
open
class
QQAndroidClient
(
context
:
Context
,
context
:
Context
,
...
@@ -158,7 +158,7 @@ internal open class QQAndroidClient(
...
@@ -158,7 +158,7 @@ internal open class QQAndroidClient(
*/
*/
val
uin
:
Long
get
()
=
_uin
val
uin
:
Long
get
()
=
_uin
@
OptIn
(
RawAccountIdUse
::
class
)
@
UseExperimental
(
RawAccountIdUse
::
class
)
@Suppress
(
"PropertyName"
)
@Suppress
(
"PropertyName"
)
internal
var
_uin
:
Long
=
bot
.
account
.
id
internal
var
_uin
:
Long
=
bot
.
account
.
id
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/HighwayHelper.kt
View file @
60b6eab7
...
@@ -35,7 +35,7 @@ import net.mamoe.mirai.utils.io.ByteArrayPool
...
@@ -35,7 +35,7 @@ import net.mamoe.mirai.utils.io.ByteArrayPool
import
net.mamoe.mirai.utils.io.PlatformSocket
import
net.mamoe.mirai.utils.io.PlatformSocket
import
net.mamoe.mirai.utils.io.withUse
import
net.mamoe.mirai.utils.io.withUse
@
OptIn
(
MiraiInternalAPI
::
class
,
InternalSerializationApi
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
,
InternalSerializationApi
::
class
)
@Suppress
(
"SpellCheckingInspection"
)
@Suppress
(
"SpellCheckingInspection"
)
internal
suspend
fun
HttpClient
.
postImage
(
internal
suspend
fun
HttpClient
.
postImage
(
htcmd
:
String
,
htcmd
:
String
,
...
@@ -93,9 +93,9 @@ internal suspend fun HttpClient.postImage(
...
@@ -93,9 +93,9 @@ internal suspend fun HttpClient.postImage(
}
}
}
==
HttpStatusCode
.
OK
}
==
HttpStatusCode
.
OK
@
OptIn
(
MiraiInternalAPI
::
class
,
InternalSerializationApi
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
,
InternalSerializationApi
::
class
)
internal
object
HighwayHelper
{
internal
object
HighwayHelper
{
@
OptIn
(
InternalCoroutinesApi
::
class
)
@
UseExperimental
(
InternalCoroutinesApi
::
class
)
suspend
fun
uploadImage
(
suspend
fun
uploadImage
(
client
:
QQAndroidClient
,
client
:
QQAndroidClient
,
serverIp
:
String
,
serverIp
:
String
,
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/highway/highway.kt
View file @
60b6eab7
...
@@ -22,7 +22,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
...
@@ -22,7 +22,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
import
net.mamoe.mirai.utils.MiraiInternalAPI
import
net.mamoe.mirai.utils.MiraiInternalAPI
import
net.mamoe.mirai.utils.io.*
import
net.mamoe.mirai.utils.io.*
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
internal
fun
createImageDataPacketSequence
(
// RequestDataTrans
internal
fun
createImageDataPacketSequence
(
// RequestDataTrans
client
:
QQAndroidClient
,
client
:
QQAndroidClient
,
command
:
String
,
command
:
String
,
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/EncryptMethod.kt
View file @
60b6eab7
...
@@ -16,7 +16,7 @@ import net.mamoe.mirai.utils.cryptor.ECDHKeyPair
...
@@ -16,7 +16,7 @@ import net.mamoe.mirai.utils.cryptor.ECDHKeyPair
import
net.mamoe.mirai.utils.io.encryptAndWrite
import
net.mamoe.mirai.utils.io.encryptAndWrite
import
net.mamoe.mirai.utils.io.writeShortLVByteArray
import
net.mamoe.mirai.utils.io.writeShortLVByteArray
@
OptIn
(
ExperimentalUnsignedTypes
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
internal
interface
EncryptMethod
{
internal
interface
EncryptMethod
{
val
id
:
Int
val
id
:
Int
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/OutgoingPacketAndroid.kt
View file @
60b6eab7
...
@@ -31,7 +31,7 @@ internal class OutgoingPacket constructor(
...
@@ -31,7 +31,7 @@ internal class OutgoingPacket constructor(
internal
val
KEY_16_ZEROS
=
ByteArray
(
16
)
internal
val
KEY_16_ZEROS
=
ByteArray
(
16
)
internal
val
EMPTY_BYTE_ARRAY
=
ByteArray
(
0
)
internal
val
EMPTY_BYTE_ARRAY
=
ByteArray
(
0
)
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
internal
inline
fun
OutgoingPacketFactory
<*>.
buildOutgoingUniPacket
(
internal
inline
fun
OutgoingPacketFactory
<*>.
buildOutgoingUniPacket
(
client
:
QQAndroidClient
,
client
:
QQAndroidClient
,
bodyType
:
Byte
=
1
,
// 1: PB?
bodyType
:
Byte
=
1
,
// 1: PB?
...
@@ -64,7 +64,7 @@ internal inline fun OutgoingPacketFactory<*>.buildOutgoingUniPacket(
...
@@ -64,7 +64,7 @@ internal inline fun OutgoingPacketFactory<*>.buildOutgoingUniPacket(
}
}
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
internal
inline
fun
IncomingPacketFactory
<*>.
buildResponseUniPacket
(
internal
inline
fun
IncomingPacketFactory
<*>.
buildResponseUniPacket
(
client
:
QQAndroidClient
,
client
:
QQAndroidClient
,
bodyType
:
Byte
=
1
,
// 1: PB?
bodyType
:
Byte
=
1
,
// 1: PB?
...
@@ -95,7 +95,7 @@ internal inline fun IncomingPacketFactory<*>.buildResponseUniPacket(
...
@@ -95,7 +95,7 @@ internal inline fun IncomingPacketFactory<*>.buildResponseUniPacket(
})
})
}
}
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
internal
inline
fun
BytePacketBuilder
.
writeUniPacket
(
internal
inline
fun
BytePacketBuilder
.
writeUniPacket
(
commandName
:
String
,
commandName
:
String
,
unknownData
:
ByteArray
,
unknownData
:
ByteArray
,
...
@@ -128,7 +128,7 @@ internal val NO_ENCRYPT: ByteArray = ByteArray(0)
...
@@ -128,7 +128,7 @@ internal val NO_ENCRYPT: ByteArray = ByteArray(0)
/**
/**
* com.tencent.qphone.base.util.CodecWarpper#encodeRequest(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, byte[], int, int, java.lang.String, byte, byte, byte, byte[], byte[], boolean)
* com.tencent.qphone.base.util.CodecWarpper#encodeRequest(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, byte[], int, int, java.lang.String, byte, byte, byte, byte[], byte[], boolean)
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
internal
inline
fun
OutgoingPacketFactory
<*>.
buildLoginOutgoingPacket
(
internal
inline
fun
OutgoingPacketFactory
<*>.
buildLoginOutgoingPacket
(
client
:
QQAndroidClient
,
client
:
QQAndroidClient
,
bodyType
:
Byte
,
bodyType
:
Byte
,
...
@@ -166,7 +166,7 @@ internal inline fun OutgoingPacketFactory<*>.buildLoginOutgoingPacket(
...
@@ -166,7 +166,7 @@ internal inline fun OutgoingPacketFactory<*>.buildLoginOutgoingPacket(
private
inline
val
BRP_STUB
get
()
=
ByteReadPacket
.
Empty
private
inline
val
BRP_STUB
get
()
=
ByteReadPacket
.
Empty
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
internal
inline
fun
BytePacketBuilder
.
writeSsoPacket
(
internal
inline
fun
BytePacketBuilder
.
writeSsoPacket
(
client
:
QQAndroidClient
,
client
:
QQAndroidClient
,
subAppId
:
Long
,
subAppId
:
Long
,
...
@@ -232,7 +232,7 @@ internal inline fun BytePacketBuilder.writeSsoPacket(
...
@@ -232,7 +232,7 @@ internal inline fun BytePacketBuilder.writeSsoPacket(
writeIntLVPacket
(
lengthOffset
=
{
it
+
4
},
builder
=
body
)
writeIntLVPacket
(
lengthOffset
=
{
it
+
4
},
builder
=
body
)
}
}
@
OptIn
(
ExperimentalUnsignedTypes
::
class
,
MiraiInternalAPI
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
,
MiraiInternalAPI
::
class
)
internal
fun
BytePacketBuilder
.
writeOicqRequestPacket
(
internal
fun
BytePacketBuilder
.
writeOicqRequestPacket
(
client
:
QQAndroidClient
,
client
:
QQAndroidClient
,
encryptMethod
:
EncryptMethod
,
encryptMethod
:
EncryptMethod
,
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt
View file @
60b6eab7
...
@@ -47,7 +47,7 @@ internal sealed class PacketFactory<TPacket : Packet?> {
...
@@ -47,7 +47,7 @@ internal sealed class PacketFactory<TPacket : Packet?> {
*
*
* @param TPacket 服务器回复包解析结果
* @param TPacket 服务器回复包解析结果
*/
*/
@
OptIn
(
ExperimentalUnsignedTypes
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
internal
abstract
class
OutgoingPacketFactory
<
TPacket
:
Packet
?>(
internal
abstract
class
OutgoingPacketFactory
<
TPacket
:
Packet
?>(
/**
/**
* 命令名. 如 `wtlogin.login`, `ConfigPushSvc.PushDomain`
* 命令名. 如 `wtlogin.login`, `ConfigPushSvc.PushDomain`
...
@@ -116,7 +116,7 @@ internal val PacketLogger: MiraiLoggerWithSwitch = DefaultLogger("Packet").withS
...
@@ -116,7 +116,7 @@ internal val PacketLogger: MiraiLoggerWithSwitch = DefaultLogger("Packet").withS
/**
/**
* 已知的数据包工厂列表.
* 已知的数据包工厂列表.
*/
*/
@
OptIn
(
ExperimentalUnsignedTypes
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
internal
object
KnownPacketFactories
{
internal
object
KnownPacketFactories
{
object
OutgoingFactories
:
List
<
OutgoingPacketFactory
<
*
>>
by
mutableListOf
(
object
OutgoingFactories
:
List
<
OutgoingPacketFactory
<
*
>>
by
mutableListOf
(
WtLogin
.
Login
,
WtLogin
.
Login
,
...
@@ -163,7 +163,7 @@ internal object KnownPacketFactories {
...
@@ -163,7 +163,7 @@ internal object KnownPacketFactories {
* full packet without length
* full packet without length
*/
*/
// do not inline. Exceptions thrown will not be reported correctly
// do not inline. Exceptions thrown will not be reported correctly
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
@Suppress
(
"UNCHECKED_CAST"
)
@Suppress
(
"UNCHECKED_CAST"
)
suspend
fun
<
T
:
Packet
?
>
parseIncomingPacket
(
bot
:
QQAndroidBot
,
rawInput
:
Input
,
consumer
:
PacketConsumer
<
T
>)
=
with
(
rawInput
)
{
suspend
fun
<
T
:
Packet
?
>
parseIncomingPacket
(
bot
:
QQAndroidBot
,
rawInput
:
Input
,
consumer
:
PacketConsumer
<
T
>)
=
with
(
rawInput
)
{
// login
// login
...
@@ -225,7 +225,7 @@ internal object KnownPacketFactories {
...
@@ -225,7 +225,7 @@ internal object KnownPacketFactories {
}
}
}
}
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
internal
suspend
fun
<
T
:
Packet
?
>
handleIncomingPacket
(
it
:
IncomingPacket
<
T
>,
bot
:
QQAndroidBot
,
flag2
:
Int
,
consumer
:
PacketConsumer
<
T
>)
{
internal
suspend
fun
<
T
:
Packet
?
>
handleIncomingPacket
(
it
:
IncomingPacket
<
T
>,
bot
:
QQAndroidBot
,
flag2
:
Int
,
consumer
:
PacketConsumer
<
T
>)
{
if
(
it
.
packetFactory
==
null
)
{
if
(
it
.
packetFactory
==
null
)
{
bot
.
network
.
logger
.
debug
(
"Received commandName: ${it.commandName}"
)
bot
.
network
.
logger
.
debug
(
"Received commandName: ${it.commandName}"
)
...
@@ -274,7 +274,7 @@ internal object KnownPacketFactories {
...
@@ -274,7 +274,7 @@ internal object KnownPacketFactories {
/**
/**
* 解析 SSO 层包装
* 解析 SSO 层包装
*/
*/
@
OptIn
(
ExperimentalUnsignedTypes
::
class
,
MiraiInternalAPI
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
,
MiraiInternalAPI
::
class
)
private
fun
parseSsoFrame
(
bot
:
QQAndroidBot
,
input
:
ByteReadPacket
):
IncomingPacket
<
*
>
{
private
fun
parseSsoFrame
(
bot
:
QQAndroidBot
,
input
:
ByteReadPacket
):
IncomingPacket
<
*
>
{
val
commandName
:
String
val
commandName
:
String
val
ssoSequenceId
:
Int
val
ssoSequenceId
:
Int
...
@@ -335,7 +335,7 @@ internal object KnownPacketFactories {
...
@@ -335,7 +335,7 @@ internal object KnownPacketFactories {
return
IncomingPacket
(
packetFactory
,
ssoSequenceId
,
packet
,
commandName
)
return
IncomingPacket
(
packetFactory
,
ssoSequenceId
,
packet
,
commandName
)
}
}
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
private
suspend
fun
<
T
:
Packet
?
>
ByteReadPacket
.
parseOicqResponse
(
private
suspend
fun
<
T
:
Packet
?
>
ByteReadPacket
.
parseOicqResponse
(
bot
:
QQAndroidBot
,
bot
:
QQAndroidBot
,
packetFactory
:
OutgoingPacketFactory
<
T
>,
packetFactory
:
OutgoingPacketFactory
<
T
>,
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.kt
View file @
60b6eab7
...
@@ -73,7 +73,7 @@ internal class MessageSvc {
...
@@ -73,7 +73,7 @@ internal class MessageSvc {
/**
/**
* 获取好友消息和消息记录
* 获取好友消息和消息记录
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
internal
object
PbGetMsg
:
OutgoingPacketFactory
<
PbGetMsg
.
Response
>(
"MessageSvc.PbGetMsg"
)
{
internal
object
PbGetMsg
:
OutgoingPacketFactory
<
PbGetMsg
.
Response
>(
"MessageSvc.PbGetMsg"
)
{
operator
fun
invoke
(
operator
fun
invoke
(
client
:
QQAndroidClient
,
client
:
QQAndroidClient
,
...
@@ -104,7 +104,7 @@ internal class MessageSvc {
...
@@ -104,7 +104,7 @@ internal class MessageSvc {
)
)
}
}
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
open
class
GetMsgSuccess
(
delegate
:
List
<
Packet
>)
:
Response
(
MsgSvc
.
SyncFlag
.
STOP
,
delegate
)
{
open
class
GetMsgSuccess
(
delegate
:
List
<
Packet
>)
:
Response
(
MsgSvc
.
SyncFlag
.
STOP
,
delegate
)
{
override
fun
toString
():
String
=
"MessageSvc.PbGetMsg.GetMsgSuccess(messages=<Iterable>))"
override
fun
toString
():
String
=
"MessageSvc.PbGetMsg.GetMsgSuccess(messages=<Iterable>))"
}
}
...
@@ -121,7 +121,7 @@ internal class MessageSvc {
...
@@ -121,7 +121,7 @@ internal class MessageSvc {
object
EmptyResponse
:
GetMsgSuccess
(
emptyList
())
object
EmptyResponse
:
GetMsgSuccess
(
emptyList
())
@
OptIn
(
MiraiInternalAPI
::
class
,
MiraiExperimentalAPI
::
class
,
FlowPreview
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
,
MiraiExperimentalAPI
::
class
,
FlowPreview
::
class
)
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
Response
{
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
Response
{
// 00 00 01 0F 08 00 12 00 1A 34 08 FF C1 C4 F1 05 10 FF C1 C4 F1 05 18 E6 ED B9 C3 02 20 89 FE BE A4 06 28 8A CA 91 D1 0C 48 9B A5 BD 9B 0A 58 DE 9D 99 F8 08 60 1D 68 FF C1 C4 F1 05 70 00 20 02 2A 9D 01 08 F3 C1 C4 F1 05 10 A2 FF 8C F0 03 18 01 22 8A 01 0A 2A 08 A2 FF 8C F0 03 10 DD F1 92 B7 07 18 A6 01 20 0B 28 AE F9 01 30 F4 C1 C4 F1 05 38 A7 E3 D8 D4 84 80 80 80 01 B8 01 CD B5 01 12 08 08 01 10 00 18 00 20 00 1A 52 0A 50 0A 27 08 00 10 F4 C1 C4 F1 05 18 A7 E3 D8 D4 04 20 00 28 0C 30 00 38 86 01 40 22 4A 0C E5 BE AE E8 BD AF E9 9B 85 E9 BB 91 12 08 0A 06 0A 04 4E 4D 53 4C 12 15 AA 02 12 9A 01 0F 80 01 01 C8 01 00 F0 01 00 F8 01 00 90 02 00 12 04 4A 02 08 00 30 01 2A 15 08 97 A2 C1 F1 05 10 95 A6 F5 E5 0C 18 01 30 01 40 01 48 81 01 2A 10 08 D3 F7 B5 F1 05 10 DD F1 92 B7 07 18 01 30 01 38 00 42 00 48 00
// 00 00 01 0F 08 00 12 00 1A 34 08 FF C1 C4 F1 05 10 FF C1 C4 F1 05 18 E6 ED B9 C3 02 20 89 FE BE A4 06 28 8A CA 91 D1 0C 48 9B A5 BD 9B 0A 58 DE 9D 99 F8 08 60 1D 68 FF C1 C4 F1 05 70 00 20 02 2A 9D 01 08 F3 C1 C4 F1 05 10 A2 FF 8C F0 03 18 01 22 8A 01 0A 2A 08 A2 FF 8C F0 03 10 DD F1 92 B7 07 18 A6 01 20 0B 28 AE F9 01 30 F4 C1 C4 F1 05 38 A7 E3 D8 D4 84 80 80 80 01 B8 01 CD B5 01 12 08 08 01 10 00 18 00 20 00 1A 52 0A 50 0A 27 08 00 10 F4 C1 C4 F1 05 18 A7 E3 D8 D4 04 20 00 28 0C 30 00 38 86 01 40 22 4A 0C E5 BE AE E8 BD AF E9 9B 85 E9 BB 91 12 08 0A 06 0A 04 4E 4D 53 4C 12 15 AA 02 12 9A 01 0F 80 01 01 C8 01 00 F0 01 00 F8 01 00 90 02 00 12 04 4A 02 08 00 30 01 2A 15 08 97 A2 C1 F1 05 10 95 A6 F5 E5 0C 18 01 30 01 40 01 48 81 01 2A 10 08 D3 F7 B5 F1 05 10 DD F1 92 B7 07 18 01 30 01 38 00 42 00 48 00
val
resp
=
readProtoBuf
(
MsgSvc
.
PbGetMsgResp
.
serializer
())
val
resp
=
readProtoBuf
(
MsgSvc
.
PbGetMsgResp
.
serializer
())
...
@@ -276,7 +276,6 @@ internal class MessageSvc {
...
@@ -276,7 +276,6 @@ internal class MessageSvc {
}
}
}
}
@Suppress
(
"FunctionName"
)
inline
fun
ToFriend
(
inline
fun
ToFriend
(
client
:
QQAndroidClient
,
client
:
QQAndroidClient
,
toUin
:
Long
,
toUin
:
Long
,
...
@@ -327,7 +326,6 @@ internal class MessageSvc {
...
@@ -327,7 +326,6 @@ internal class MessageSvc {
}
}
@Suppress
(
"FunctionName"
)
inline
fun
ToGroup
(
inline
fun
ToGroup
(
client
:
QQAndroidClient
,
client
:
QQAndroidClient
,
groupCode
:
Long
,
groupCode
:
Long
,
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.kt
View file @
60b6eab7
...
@@ -55,7 +55,7 @@ internal class OnlinePush {
...
@@ -55,7 +55,7 @@ internal class OnlinePush {
}
}
}
}
@
OptIn
(
ExperimentalStdlibApi
::
class
)
@
UseExperimental
(
ExperimentalStdlibApi
::
class
)
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
,
sequenceId
:
Int
):
Packet
?
{
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
,
sequenceId
:
Int
):
Packet
?
{
// 00 00 02 E4 0A D5 05 0A 4F 08 A2 FF 8C F0 03 10 DD F1 92 B7 07 18 52 20 00 28 BC 3D 30 8C 82 AB F1 05 38 D2 80 E0 8C 80 80 80 80 02 4A 21 08 E7 C1 AD B8 02 10 01 18 BA 05 22 09 48 69 6D 31 38 38 6D 6F 65 30 06 38 02 42 05 4D 69 72 61 69 50 01 58 01 60 00 88 01 08 12 06 08 01 10 00 18 00 1A F9 04 0A F6 04 0A 26 08 00 10 87 82 AB F1 05 18 B7 B4 BF 30 20 00 28 0C 30 00 38 86 01 40 22 4A 0C E5 BE AE E8 BD AF E9 9B 85 E9 BB 91 12 E6 03 42 E3 03 12 2A 7B 34 45 31 38 35 38 32 32 2D 30 45 37 42 2D 46 38 30 46 2D 43 35 42 31 2D 33 34 34 38 38 33 37 34 44 33 39 43 7D 2E 6A 70 67 22 00 2A 04 03 00 00 00 32 60 15 36 20 39 36 6B 45 31 41 38 35 32 32 39 64 63 36 39 38 34 37 39 37 37 62 20 20 20 20 20 20 35 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7B 34 45 31 38 35 38 32 32 2D 30 45 37 42 2D 46 38 30 46 2D 43 35 42 31 2D 33 34 34 38 38 33 37 34 44 33 39 43 7D 2E 6A 70 67 31 32 31 32 41 38 C6 BB 8A A9 08 40 FB AE 9E C2 09 48 50 50 41 5A 00 60 01 6A 10 4E 18 58 22 0E 7B F8 0F C5 B1 34 48 83 74 D3 9C 72 59 2F 67 63 68 61 74 70 69 63 5F 6E 65 77 2F 31 30 34 30 34 30 30 32 39 30 2F 36 35 35 30 35 37 31 32 37 2D 32 32 33 33 36 33 38 33 34 32 2D 34 45 31 38 35 38 32 32 30 45 37 42 46 38 30 46 43 35 42 31 33 34 34 38 38 33 37 34 44 33 39 43 2F 31 39 38 3F 74 65 72 6D 3D 32 82 01 57 2F 67 63 68 61 74 70 69 63 5F 6E 65 77 2F 31 30 34 30 34 30 30 32 39 30 2F 36 35 35 30 35 37 31 32 37 2D 32 32 33 33 36 33 38 33 34 32 2D 34 45 31 38 35 38 32 32 30 45 37 42 46 38 30 46 43 35 42 31 33 34 34 38 38 33 37 34 44 33 39 43 2F 30 3F 74 65 72 6D 3D 32 B0 01 4D B8 01 2E C8 01 FF 05 D8 01 4D E0 01 2E FA 01 59 2F 67 63 68 61 74 70 69 63 5F 6E 65 77 2F 31 30 34 30 34 30 30 32 39 30 2F 36 35 35 30 35 37 31 32 37 2D 32 32 33 33 36 33 38 33 34 32 2D 34 45 31 38 35 38 32 32 30 45 37 42 46 38 30 46 43 35 42 31 33 34 34 38 38 33 37 34 44 33 39 43 2F 34 30 30 3F 74 65 72 6D 3D 32 80 02 4D 88 02 2E 12 45 AA 02 42 50 03 60 00 68 00 9A 01 39 08 09 20 BF 50 80 01 01 C8 01 00 F0 01 00 F8 01 00 90 02 00 98 03 00 A0 03 20 B0 03 00 C0 03 00 D0 03 00 E8 03 00 8A 04 04 08 02 08 01 90 04 80 80 80 10 B8 04 00 C0 04 00 12 06 4A 04 08 00 40 01 12 14 82 01 11 0A 09 48 69 6D 31 38 38 6D 6F 65 18 06 20 08 28 03 10 8A CA 9D A1 07 1A 00
// 00 00 02 E4 0A D5 05 0A 4F 08 A2 FF 8C F0 03 10 DD F1 92 B7 07 18 52 20 00 28 BC 3D 30 8C 82 AB F1 05 38 D2 80 E0 8C 80 80 80 80 02 4A 21 08 E7 C1 AD B8 02 10 01 18 BA 05 22 09 48 69 6D 31 38 38 6D 6F 65 30 06 38 02 42 05 4D 69 72 61 69 50 01 58 01 60 00 88 01 08 12 06 08 01 10 00 18 00 1A F9 04 0A F6 04 0A 26 08 00 10 87 82 AB F1 05 18 B7 B4 BF 30 20 00 28 0C 30 00 38 86 01 40 22 4A 0C E5 BE AE E8 BD AF E9 9B 85 E9 BB 91 12 E6 03 42 E3 03 12 2A 7B 34 45 31 38 35 38 32 32 2D 30 45 37 42 2D 46 38 30 46 2D 43 35 42 31 2D 33 34 34 38 38 33 37 34 44 33 39 43 7D 2E 6A 70 67 22 00 2A 04 03 00 00 00 32 60 15 36 20 39 36 6B 45 31 41 38 35 32 32 39 64 63 36 39 38 34 37 39 37 37 62 20 20 20 20 20 20 35 30 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7B 34 45 31 38 35 38 32 32 2D 30 45 37 42 2D 46 38 30 46 2D 43 35 42 31 2D 33 34 34 38 38 33 37 34 44 33 39 43 7D 2E 6A 70 67 31 32 31 32 41 38 C6 BB 8A A9 08 40 FB AE 9E C2 09 48 50 50 41 5A 00 60 01 6A 10 4E 18 58 22 0E 7B F8 0F C5 B1 34 48 83 74 D3 9C 72 59 2F 67 63 68 61 74 70 69 63 5F 6E 65 77 2F 31 30 34 30 34 30 30 32 39 30 2F 36 35 35 30 35 37 31 32 37 2D 32 32 33 33 36 33 38 33 34 32 2D 34 45 31 38 35 38 32 32 30 45 37 42 46 38 30 46 43 35 42 31 33 34 34 38 38 33 37 34 44 33 39 43 2F 31 39 38 3F 74 65 72 6D 3D 32 82 01 57 2F 67 63 68 61 74 70 69 63 5F 6E 65 77 2F 31 30 34 30 34 30 30 32 39 30 2F 36 35 35 30 35 37 31 32 37 2D 32 32 33 33 36 33 38 33 34 32 2D 34 45 31 38 35 38 32 32 30 45 37 42 46 38 30 46 43 35 42 31 33 34 34 38 38 33 37 34 44 33 39 43 2F 30 3F 74 65 72 6D 3D 32 B0 01 4D B8 01 2E C8 01 FF 05 D8 01 4D E0 01 2E FA 01 59 2F 67 63 68 61 74 70 69 63 5F 6E 65 77 2F 31 30 34 30 34 30 30 32 39 30 2F 36 35 35 30 35 37 31 32 37 2D 32 32 33 33 36 33 38 33 34 32 2D 34 45 31 38 35 38 32 32 30 45 37 42 46 38 30 46 43 35 42 31 33 34 34 38 38 33 37 34 44 33 39 43 2F 34 30 30 3F 74 65 72 6D 3D 32 80 02 4D 88 02 2E 12 45 AA 02 42 50 03 60 00 68 00 9A 01 39 08 09 20 BF 50 80 01 01 C8 01 00 F0 01 00 F8 01 00 90 02 00 98 03 00 A0 03 20 B0 03 00 C0 03 00 D0 03 00 E8 03 00 8A 04 04 08 02 08 01 90 04 80 80 80 10 B8 04 00 C0 04 00 12 06 4A 04 08 00 40 01 12 14 82 01 11 0A 09 48 69 6D 31 38 38 6D 6F 65 18 06 20 08 28 03 10 8A CA 9D A1 07 1A 00
if
(!
bot
.
firstLoginSucceed
)
return
null
if
(!
bot
.
firstLoginSucceed
)
return
null
...
@@ -94,7 +94,7 @@ internal class OnlinePush {
...
@@ -94,7 +94,7 @@ internal class OnlinePush {
internal
object
PbPushTransMsg
:
IncomingPacketFactory
<
Packet
>(
"OnlinePush.PbPushTransMsg"
,
"OnlinePush.RespPush"
)
{
internal
object
PbPushTransMsg
:
IncomingPacketFactory
<
Packet
>(
"OnlinePush.PbPushTransMsg"
,
"OnlinePush.RespPush"
)
{
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
@ExperimentalUnsignedTypes
@ExperimentalUnsignedTypes
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
,
sequenceId
:
Int
):
Packet
{
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
,
sequenceId
:
Int
):
Packet
{
val
content
=
this
.
readProtoBuf
(
OnlinePushTrans
.
PbMsgInfo
.
serializer
())
val
content
=
this
.
readProtoBuf
(
OnlinePushTrans
.
PbMsgInfo
.
serializer
())
...
@@ -187,7 +187,7 @@ internal class OnlinePush {
...
@@ -187,7 +187,7 @@ internal class OnlinePush {
//0C 01 B1 89 BE 09 5E 3D 72 A6 00 01 73 68 FC 06 00 00 00 3C
//0C 01 B1 89 BE 09 5E 3D 72 A6 00 01 73 68 FC 06 00 00 00 3C
internal
object
ReqPush
:
IncomingPacketFactory
<
Packet
>(
"OnlinePush.ReqPush"
,
"OnlinePush.RespPush"
)
{
internal
object
ReqPush
:
IncomingPacketFactory
<
Packet
>(
"OnlinePush.ReqPush"
,
"OnlinePush.RespPush"
)
{
@ExperimentalUnsignedTypes
@ExperimentalUnsignedTypes
@
OptIn
(
ExperimentalStdlibApi
::
class
)
@
UseExperimental
(
ExperimentalStdlibApi
::
class
)
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
,
sequenceId
:
Int
):
Packet
{
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
,
sequenceId
:
Int
):
Packet
{
val
reqPushMsg
=
decodeUniPacket
(
OnlinePushPack
.
SvcReqPushMsg
.
serializer
(),
"req"
)
val
reqPushMsg
=
decodeUniPacket
(
OnlinePushPack
.
SvcReqPushMsg
.
serializer
(),
"req"
)
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/WtLogin.kt
View file @
60b6eab7
...
@@ -29,7 +29,7 @@ internal class WtLogin {
...
@@ -29,7 +29,7 @@ internal class WtLogin {
* OicqRequest
* OicqRequest
*/
*/
@Suppress
(
"FunctionName"
)
@Suppress
(
"FunctionName"
)
@
OptIn
(
ExperimentalUnsignedTypes
::
class
,
MiraiInternalAPI
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
,
MiraiInternalAPI
::
class
)
internal
object
Login
:
OutgoingPacketFactory
<
Login
.
LoginPacketResponse
>(
"wtlogin.login"
)
{
internal
object
Login
:
OutgoingPacketFactory
<
Login
.
LoginPacketResponse
>(
"wtlogin.login"
)
{
private
const
val
subAppId
=
537062845L
private
const
val
subAppId
=
537062845L
...
@@ -127,7 +127,7 @@ internal class WtLogin {
...
@@ -127,7 +127,7 @@ internal class WtLogin {
private
const
val
appId
=
16L
private
const
val
appId
=
16L
private
const
val
subAppId
=
537062845L
private
const
val
subAppId
=
537062845L
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
operator
fun
invoke
(
operator
fun
invoke
(
client
:
QQAndroidClient
client
:
QQAndroidClient
):
OutgoingPacket
=
buildLoginOutgoingPacket
(
client
,
bodyType
=
2
)
{
sequenceId
->
):
OutgoingPacket
=
buildLoginOutgoingPacket
(
client
,
bodyType
=
2
)
{
sequenceId
->
...
@@ -309,7 +309,7 @@ internal class WtLogin {
...
@@ -309,7 +309,7 @@ internal class WtLogin {
}
}
@InternalAPI
@InternalAPI
@
OptIn
(
MiraiDebugAPI
::
class
)
@
UseExperimental
(
MiraiDebugAPI
::
class
)
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
LoginPacketResponse
{
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
LoginPacketResponse
{
discardExact
(
2
)
// subCommand
discardExact
(
2
)
// subCommand
...
@@ -368,7 +368,7 @@ internal class WtLogin {
...
@@ -368,7 +368,7 @@ internal class WtLogin {
}
}
@InternalAPI
@InternalAPI
@
OptIn
(
MiraiDebugAPI
::
class
)
@
UseExperimental
(
MiraiDebugAPI
::
class
)
private
fun
onSolveLoginCaptcha
(
tlvMap
:
TlvMap
,
bot
:
QQAndroidBot
):
LoginPacketResponse
.
Captcha
{
private
fun
onSolveLoginCaptcha
(
tlvMap
:
TlvMap
,
bot
:
QQAndroidBot
):
LoginPacketResponse
.
Captcha
{
/*
/*
java.lang.IllegalStateException: UNKNOWN CAPTCHA QUESTION:
java.lang.IllegalStateException: UNKNOWN CAPTCHA QUESTION:
...
@@ -404,7 +404,7 @@ internal class WtLogin {
...
@@ -404,7 +404,7 @@ internal class WtLogin {
error
(
"UNKNOWN CAPTCHA, tlvMap="
+
tlvMap
.
_miraiContentToString
())
error
(
"UNKNOWN CAPTCHA, tlvMap="
+
tlvMap
.
_miraiContentToString
())
}
}
@
OptIn
(
MiraiDebugAPI
::
class
)
@
UseExperimental
(
MiraiDebugAPI
::
class
)
private
fun
onLoginSuccess
(
tlvMap
:
TlvMap
,
bot
:
QQAndroidBot
):
LoginPacketResponse
.
Success
{
private
fun
onLoginSuccess
(
tlvMap
:
TlvMap
,
bot
:
QQAndroidBot
):
LoginPacketResponse
.
Success
{
val
client
=
bot
.
client
val
client
=
bot
.
client
//println("TLV KEYS: " + tlvMap.keys.joinToString { it.contentToString() })
//println("TLV KEYS: " + tlvMap.keys.joinToString { it.contentToString() })
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/inline.kt
View file @
60b6eab7
...
@@ -21,7 +21,7 @@ import kotlin.jvm.JvmName
...
@@ -21,7 +21,7 @@ import kotlin.jvm.JvmName
/**
/**
* Inline the block
* Inline the block
*/
*/
@
OptIn
(
ExperimentalContracts
::
class
)
@
UseExperimental
(
ExperimentalContracts
::
class
)
@PublishedApi
@PublishedApi
internal
inline
fun
<
R
>
inline
(
block
:
()
->
R
):
R
{
internal
inline
fun
<
R
>
inline
(
block
:
()
->
R
):
R
{
contract
{
contract
{
...
...
mirai-core-qqandroid/src/commonTest/kotlin/test/printing.kt
View file @
60b6eab7
...
@@ -35,7 +35,7 @@ inline fun ByteArray.debugPrintThis(name: String): ByteArray {
...
@@ -35,7 +35,7 @@ inline fun ByteArray.debugPrintThis(name: String): ByteArray {
return
this
return
this
}
}
@
OptIn
(
ExperimentalContracts
::
class
,
MiraiInternalAPI
::
class
)
@
UseExperimental
(
ExperimentalContracts
::
class
,
MiraiInternalAPI
::
class
)
inline
fun
<
R
>
Input
.
debugIfFail
(
name
:
String
=
""
,
onFail
:
(
ByteArray
)
->
ByteReadPacket
=
{
it
.
toReadPacket
()
},
block
:
ByteReadPacket
.()
->
R
):
R
{
inline
fun
<
R
>
Input
.
debugIfFail
(
name
:
String
=
""
,
onFail
:
(
ByteArray
)
->
ByteReadPacket
=
{
it
.
toReadPacket
()
},
block
:
ByteReadPacket
.()
->
R
):
R
{
contract
{
contract
{
...
...
mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroid.kt
View file @
60b6eab7
...
@@ -23,7 +23,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
...
@@ -23,7 +23,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
* QQ for Android
* QQ for Android
*/
*/
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
actual
object
QQAndroid
:
BotFactory
{
actual
object
QQAndroid
:
BotFactory
{
/**
/**
...
...
mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
View file @
60b6eab7
...
@@ -15,11 +15,11 @@ import net.mamoe.mirai.utils.Context
...
@@ -15,11 +15,11 @@ import net.mamoe.mirai.utils.Context
import
net.mamoe.mirai.utils.ContextImpl
import
net.mamoe.mirai.utils.ContextImpl
import
net.mamoe.mirai.utils.MiraiInternalAPI
import
net.mamoe.mirai.utils.MiraiInternalAPI
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
@Suppress
(
"FunctionName"
)
@Suppress
(
"FunctionName"
)
internal
fun
QQAndroidBot
(
account
:
BotAccount
,
configuration
:
BotConfiguration
):
QQAndroidBot
=
QQAndroidBot
(
ContextImpl
(),
account
,
configuration
)
internal
fun
QQAndroidBot
(
account
:
BotAccount
,
configuration
:
BotConfiguration
):
QQAndroidBot
=
QQAndroidBot
(
ContextImpl
(),
account
,
configuration
)
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
internal
actual
class
QQAndroidBot
actual
constructor
(
internal
actual
class
QQAndroidBot
actual
constructor
(
context
:
Context
,
context
:
Context
,
account
:
BotAccount
,
account
:
BotAccount
,
...
...
mirai-core-qqandroid/src/jvmTest/kotlin/test/ProtoBufDataClassGenerator.kt
View file @
60b6eab7
...
@@ -161,7 +161,7 @@ data class PBFieldInfo(
...
@@ -161,7 +161,7 @@ data class PBFieldInfo(
}
}
}
}
@
OptIn
(
ExperimentalUnsignedTypes
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
fun
String
.
generateProtoBufDataClass
():
GeneratedClass
{
fun
String
.
generateProtoBufDataClass
():
GeneratedClass
{
if
(
this
.
indexOf
(
"extends"
)
==
-
1
)
{
if
(
this
.
indexOf
(
"extends"
)
==
-
1
)
{
val
javaClassname
=
substringBetween
(
"class"
,
"{"
)
val
javaClassname
=
substringBetween
(
"class"
,
"{"
)
...
@@ -367,7 +367,7 @@ fun String.getNumericalValue(): Int? {
...
@@ -367,7 +367,7 @@ fun String.getNumericalValue(): Int? {
return
this
.
filter
{
it
in
'0'
..
'9'
}.
toDoubleOrNull
()
?.
toInt
()
return
this
.
filter
{
it
in
'0'
..
'9'
}.
toDoubleOrNull
()
?.
toInt
()
}
}
@
OptIn
(
MiraiDebugAPI
::
class
)
@
UseExperimental
(
MiraiDebugAPI
::
class
)
fun
ProtoType
.
mapToKotlinType
():
String
{
fun
ProtoType
.
mapToKotlinType
():
String
{
return
when
(
this
)
{
return
when
(
this
)
{
ProtoType
.
VAR_INT
->
"Int"
ProtoType
.
VAR_INT
->
"Int"
...
...
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/Bot.kt
View file @
60b6eab7
...
@@ -24,9 +24,7 @@ import net.mamoe.mirai.utils.*
...
@@ -24,9 +24,7 @@ import net.mamoe.mirai.utils.*
* @see kotlinx.coroutines.isActive 判断 [Bot] 是否正常运行中. (在线, 且没有被 [close])
* @see kotlinx.coroutines.isActive 判断 [Bot] 是否正常运行中. (在线, 且没有被 [close])
*/
*/
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@OptIn
(
@UseExperimental
(
MiraiInternalAPI
::
class
,
LowLevelAPI
::
class
,
MiraiExperimentalAPI
::
class
,
JavaHappyAPI
::
class
)
MiraiInternalAPI
::
class
,
LowLevelAPI
::
class
,
MiraiExperimentalAPI
::
class
,
JavaHappyAPI
::
class
)
actual
abstract
class
Bot
actual
constructor
()
:
CoroutineScope
,
LowLevelBotAPIAccessor
,
BotJavaHappyAPI
()
{
actual
abstract
class
Bot
actual
constructor
()
:
CoroutineScope
,
LowLevelBotAPIAccessor
,
BotJavaHappyAPI
()
{
actual
companion
object
{
actual
companion
object
{
/**
/**
...
@@ -236,6 +234,6 @@ actual abstract class Bot actual constructor() : CoroutineScope, LowLevelBotAPIA
...
@@ -236,6 +234,6 @@ actual abstract class Bot actual constructor() : CoroutineScope, LowLevelBotAPIA
*/
*/
actual
abstract
fun
close
(
cause
:
Throwable
?)
actual
abstract
fun
close
(
cause
:
Throwable
?)
@
OptIn
(
LowLevelAPI
::
class
,
MiraiExperimentalAPI
::
class
)
@
UseExperimental
(
LowLevelAPI
::
class
,
MiraiExperimentalAPI
::
class
)
actual
final
override
fun
toString
():
String
=
"Bot(${uin})"
actual
final
override
fun
toString
():
String
=
"Bot(${uin})"
}
}
\ No newline at end of file
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/BotJavaHappyAPI.kt
View file @
60b6eab7
...
@@ -132,7 +132,7 @@ actual abstract class BotJavaHappyAPI actual constructor() {
...
@@ -132,7 +132,7 @@ actual abstract class BotJavaHappyAPI actual constructor() {
message
:
String
?
=
null
,
message
:
String
?
=
null
,
remark
:
String
?
=
null
remark
:
String
?
=
null
):
AddFriendResult
{
):
AddFriendResult
{
@
OptIn
(
MiraiExperimentalAPI
::
class
)
@
UseExperimental
(
MiraiExperimentalAPI
::
class
)
return
runBlocking
{
addFriend
(
id
,
message
,
remark
)
}
return
runBlocking
{
addFriend
(
id
,
message
,
remark
)
}
}
}
...
@@ -170,7 +170,7 @@ actual abstract class BotJavaHappyAPI actual constructor() {
...
@@ -170,7 +170,7 @@ actual abstract class BotJavaHappyAPI actual constructor() {
}
}
// !! 不要 crossinline, 会编译失败
// !! 不要 crossinline, 会编译失败
@
OptIn
(
ExperimentalCoroutinesApi
::
class
)
@
UseExperimental
(
ExperimentalCoroutinesApi
::
class
)
internal
fun
<
R
,
C
:
CoroutineScope
>
C
.
future
(
block
:
suspend
C
.()
->
R
):
Future
<
R
>
{
internal
fun
<
R
,
C
:
CoroutineScope
>
C
.
future
(
block
:
suspend
C
.()
->
R
):
Future
<
R
>
{
val
future
=
object
:
Future
<
R
>
{
val
future
=
object
:
Future
<
R
>
{
val
value
:
CompletableDeferred
<
R
>
=
CompletableDeferred
()
val
value
:
CompletableDeferred
<
R
>
=
CompletableDeferred
()
...
@@ -215,7 +215,7 @@ internal fun <R, C : CoroutineScope> C.future(block: suspend C.() -> R): Future<
...
@@ -215,7 +215,7 @@ internal fun <R, C : CoroutineScope> C.future(block: suspend C.() -> R): Future<
}
}
launch
{
launch
{
@
OptIn
(
ExperimentalCoroutinesApi
::
class
)
@
UseExperimental
(
ExperimentalCoroutinesApi
::
class
)
future
.
value
.
completeWith
(
kotlin
.
runCatching
{
block
()
})
future
.
value
.
completeWith
(
kotlin
.
runCatching
{
block
()
})
}
}
...
...
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Contact.kt
View file @
60b6eab7
...
@@ -33,7 +33,7 @@ import net.mamoe.mirai.utils.WeakRefProperty
...
@@ -33,7 +33,7 @@ import net.mamoe.mirai.utils.WeakRefProperty
* @author Him188moe
* @author Him188moe
*/
*/
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@
OptIn
(
MiraiInternalAPI
::
class
,
JavaHappyAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
,
JavaHappyAPI
::
class
)
actual
abstract
class
Contact
:
CoroutineScope
,
ContactJavaHappyAPI
()
{
actual
abstract
class
Contact
:
CoroutineScope
,
ContactJavaHappyAPI
()
{
/**
/**
* 这个联系人所属 [Bot].
* 这个联系人所属 [Bot].
...
...
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Member.kt
View file @
60b6eab7
...
@@ -21,7 +21,7 @@ import net.mamoe.mirai.utils.WeakRefProperty
...
@@ -21,7 +21,7 @@ import net.mamoe.mirai.utils.WeakRefProperty
* 群成员.
* 群成员.
*/
*/
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@
OptIn
(
MiraiInternalAPI
::
class
,
JavaHappyAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
,
JavaHappyAPI
::
class
)
actual
abstract
class
Member
:
MemberJavaHappyAPI
()
{
actual
abstract
class
Member
:
MemberJavaHappyAPI
()
{
/**
/**
* 所在的群.
* 所在的群.
...
...
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/message/MessagePacket.kt
View file @
60b6eab7
...
@@ -16,7 +16,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
...
@@ -16,7 +16,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
/**
/**
* 平台相关扩展
* 平台相关扩展
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
actual
abstract
class
MessagePacket
<
TSender
:
QQ
,
TSubject
:
Contact
>
actual
constructor
()
:
MessagePacketBase
<
TSender
,
TSubject
>()
{
actual
abstract
class
MessagePacket
<
TSender
:
QQ
,
TSubject
:
Contact
>
actual
constructor
()
:
MessagePacketBase
<
TSender
,
TSubject
>()
{
// suspend inline fun uploadImage(image: Bitmap): Image = subject.uploadImage(image)
// suspend inline fun uploadImage(image: Bitmap): Image = subject.uploadImage(image)
//suspend inline fun uploadImage(image: URL): Image = subject.uploadImage(image)
//suspend inline fun uploadImage(image: URL): Image = subject.uploadImage(image)
...
...
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/message/MessageReceipt.kt
View file @
60b6eab7
...
@@ -28,7 +28,7 @@ import net.mamoe.mirai.utils.unsafeWeakRef
...
@@ -28,7 +28,7 @@ import net.mamoe.mirai.utils.unsafeWeakRef
* @see MessageReceipt.sourceTime 源时间
* @see MessageReceipt.sourceTime 源时间
*/
*/
@Suppress
(
"FunctionName"
)
@Suppress
(
"FunctionName"
)
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
actual
open
class
MessageReceipt
<
C
:
Contact
>
actual
constructor
(
actual
open
class
MessageReceipt
<
C
:
Contact
>
actual
constructor
(
actual
val
source
:
MessageSource
,
actual
val
source
:
MessageSource
,
target
:
C
,
target
:
C
,
...
@@ -94,7 +94,7 @@ actual open class MessageReceipt<C : Contact> actual constructor(
...
@@ -94,7 +94,7 @@ actual open class MessageReceipt<C : Contact> actual constructor(
*/
*/
actual
open
suspend
fun
quote
():
QuoteReplyToSend
{
actual
open
suspend
fun
quote
():
QuoteReplyToSend
{
this
.
source
.
ensureSequenceIdAvailable
()
this
.
source
.
ensureSequenceIdAvailable
()
@
OptIn
(
LowLevelAPI
::
class
)
@
UseExperimental
(
LowLevelAPI
::
class
)
return
_unsafeQuote
()
return
_unsafeQuote
()
}
}
...
...
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/SystemDeviceInfo.kt
View file @
60b6eab7
...
@@ -23,7 +23,7 @@ import java.io.File
...
@@ -23,7 +23,7 @@ import java.io.File
/**
/**
* 加载一个设备信息. 若文件不存在或为空则随机并创建一个设备信息保存.
* 加载一个设备信息. 若文件不存在或为空则随机并创建一个设备信息保存.
*/
*/
@
OptIn
(
UnstableDefault
::
class
)
@
UseExperimental
(
UnstableDefault
::
class
)
fun
File
.
loadAsDeviceInfo
(
context
:
Context
):
DeviceInfo
{
fun
File
.
loadAsDeviceInfo
(
context
:
Context
):
DeviceInfo
{
if
(!
this
.
exists
()
||
this
.
length
()
==
0L
)
{
if
(!
this
.
exists
()
||
this
.
length
()
==
0L
)
{
return
SystemDeviceInfo
(
context
).
also
{
return
SystemDeviceInfo
(
context
).
also
{
...
...
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/io/PlatformSocket.kt
View file @
60b6eab7
...
@@ -80,7 +80,7 @@ actual class PlatformSocket : Closeable {
...
@@ -80,7 +80,7 @@ actual class PlatformSocket : Closeable {
}
}
}
}
@
OptIn
(
ExperimentalIoApi
::
class
)
@
UseExperimental
(
ExperimentalIoApi
::
class
)
actual
suspend
fun
connect
(
serverHost
:
String
,
serverPort
:
Int
)
{
actual
suspend
fun
connect
(
serverHost
:
String
,
serverPort
:
Int
)
{
withContext
(
Dispatchers
.
IO
)
{
withContext
(
Dispatchers
.
IO
)
{
socket
=
Socket
(
serverHost
,
serverPort
)
socket
=
Socket
(
serverHost
,
serverPort
)
...
...
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/platformAndroid.kt
View file @
60b6eab7
...
@@ -26,7 +26,7 @@ import java.util.zip.Inflater
...
@@ -26,7 +26,7 @@ import java.util.zip.Inflater
/**
/**
* Ktor HttpClient. 不同平台使用不同引擎.
* Ktor HttpClient. 不同平台使用不同引擎.
*/
*/
@
OptIn
(
KtorExperimentalAPI
::
class
)
@
UseExperimental
(
KtorExperimentalAPI
::
class
)
actual
val
Http
:
HttpClient
actual
val
Http
:
HttpClient
get
()
=
HttpClient
(
CIO
)
get
()
=
HttpClient
(
CIO
)
...
@@ -76,7 +76,7 @@ private inline fun InputStream.readInSequence(block: (Int) -> Unit) {
...
@@ -76,7 +76,7 @@ private inline fun InputStream.readInSequence(block: (Int) -> Unit) {
}
}
}
}
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
actual
fun
ByteArray
.
unzip
(
offset
:
Int
,
length
:
Int
):
ByteArray
{
actual
fun
ByteArray
.
unzip
(
offset
:
Int
,
length
:
Int
):
ByteArray
{
this
.
checkOffsetAndLength
(
offset
,
length
)
this
.
checkOffsetAndLength
(
offset
,
length
)
if
(
length
==
0
)
return
ByteArray
(
0
)
if
(
length
==
0
)
return
ByteArray
(
0
)
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt
View file @
60b6eab7
...
@@ -41,7 +41,7 @@ import kotlin.jvm.JvmSynthetic
...
@@ -41,7 +41,7 @@ import kotlin.jvm.JvmSynthetic
* @see kotlinx.coroutines.isActive 判断 [Bot] 是否正常运行中. (在线, 且没有被 [close])
* @see kotlinx.coroutines.isActive 判断 [Bot] 是否正常运行中. (在线, 且没有被 [close])
*/
*/
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@
OptIn
(
MiraiInternalAPI
::
class
,
LowLevelAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
,
LowLevelAPI
::
class
)
expect
abstract
class
Bot
()
:
CoroutineScope
,
LowLevelBotAPIAccessor
{
expect
abstract
class
Bot
()
:
CoroutineScope
,
LowLevelBotAPIAccessor
{
companion
object
{
companion
object
{
/**
/**
...
@@ -241,7 +241,7 @@ expect abstract class Bot() : CoroutineScope, LowLevelBotAPIAccessor {
...
@@ -241,7 +241,7 @@ expect abstract class Bot() : CoroutineScope, LowLevelBotAPIAccessor {
*/
*/
abstract
fun
close
(
cause
:
Throwable
?
=
null
)
abstract
fun
close
(
cause
:
Throwable
?
=
null
)
@
OptIn
(
LowLevelAPI
::
class
,
MiraiExperimentalAPI
::
class
)
@
UseExperimental
(
LowLevelAPI
::
class
,
MiraiExperimentalAPI
::
class
)
final
override
fun
toString
():
String
final
override
fun
toString
():
String
}
}
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt
View file @
60b6eab7
...
@@ -52,5 +52,5 @@ data class BotAccount(
...
@@ -52,5 +52,5 @@ data class BotAccount(
@MiraiInternalAPI
@MiraiInternalAPI
@Retention
(
AnnotationRetention
.
SOURCE
)
@Retention
(
AnnotationRetention
.
SOURCE
)
@Target
(
CLASS
,
TYPEALIAS
,
FUNCTION
,
PROPERTY
,
FIELD
,
CONSTRUCTOR
)
@Target
(
CLASS
,
TYPEALIAS
,
FUNCTION
,
PROPERTY
,
FIELD
,
CONSTRUCTOR
)
@
RequiresOptIn
(
level
=
RequiresOptIn
.
Level
.
WARNING
)
@
Experimental
(
level
=
Experimental
.
Level
.
WARNING
)
annotation
class
RawAccountIdUse
annotation
class
RawAccountIdUse
\ No newline at end of file
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt
View file @
60b6eab7
...
@@ -27,7 +27,7 @@ import kotlin.coroutines.CoroutineContext
...
@@ -27,7 +27,7 @@ import kotlin.coroutines.CoroutineContext
/*
/*
* 泛型 N 不需要向外(接口)暴露.
* 泛型 N 不需要向外(接口)暴露.
*/
*/
@
OptIn
(
MiraiExperimentalAPI
::
class
)
@
UseExperimental
(
MiraiExperimentalAPI
::
class
)
@MiraiInternalAPI
@MiraiInternalAPI
abstract
class
BotImpl
<
N
:
BotNetworkHandler
>
constructor
(
abstract
class
BotImpl
<
N
:
BotNetworkHandler
>
constructor
(
context
:
Context
,
context
:
Context
,
...
@@ -43,7 +43,7 @@ abstract class BotImpl<N : BotNetworkHandler> constructor(
...
@@ -43,7 +43,7 @@ abstract class BotImpl<N : BotNetworkHandler> constructor(
@Suppress
(
"CanBePrimaryConstructorProperty"
)
// for logger
@Suppress
(
"CanBePrimaryConstructorProperty"
)
// for logger
final
override
val
account
:
BotAccount
=
account
final
override
val
account
:
BotAccount
=
account
@
OptIn
(
RawAccountIdUse
::
class
)
@
UseExperimental
(
RawAccountIdUse
::
class
)
override
val
uin
:
Long
override
val
uin
:
Long
get
()
=
account
.
id
get
()
=
account
.
id
final
override
val
logger
:
MiraiLogger
by
lazy
{
configuration
.
botLoggerSupplier
(
this
)
}
final
override
val
logger
:
MiraiLogger
by
lazy
{
configuration
.
botLoggerSupplier
(
this
)
}
...
@@ -172,7 +172,7 @@ abstract class BotImpl<N : BotNetworkHandler> constructor(
...
@@ -172,7 +172,7 @@ abstract class BotImpl<N : BotNetworkHandler> constructor(
// endregion
// endregion
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
override
fun
close
(
cause
:
Throwable
?)
{
override
fun
close
(
cause
:
Throwable
?)
{
if
(!
this
.
botJob
.
isActive
)
{
if
(!
this
.
botJob
.
isActive
)
{
// already cancelled
// already cancelled
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Contact.kt
View file @
60b6eab7
...
@@ -36,7 +36,7 @@ import kotlin.jvm.JvmSynthetic
...
@@ -36,7 +36,7 @@ import kotlin.jvm.JvmSynthetic
*
*
* @author Him188moe
* @author Him188moe
*/
// 不要删除多平台结构 !!! kotlin bug
*/
// 不要删除多平台结构 !!! kotlin bug
@
OptIn
(
MiraiInternalAPI
::
class
,
JavaHappyAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
,
JavaHappyAPI
::
class
)
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
expect
abstract
class
Contact
()
:
CoroutineScope
,
ContactJavaHappyAPI
{
expect
abstract
class
Contact
()
:
CoroutineScope
,
ContactJavaHappyAPI
{
/**
/**
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/ContactList.kt
View file @
60b6eab7
...
@@ -19,7 +19,7 @@ import net.mamoe.mirai.utils.*
...
@@ -19,7 +19,7 @@ import net.mamoe.mirai.utils.*
*
*
* @see ContactList.asSequence
* @see ContactList.asSequence
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
@Suppress
(
"unused"
)
@Suppress
(
"unused"
)
class
ContactList
<
C
:
Contact
>(
@MiraiInternalAPI
val
delegate
:
LockFreeLinkedList
<
C
>)
{
class
ContactList
<
C
:
Contact
>(
@MiraiInternalAPI
val
delegate
:
LockFreeLinkedList
<
C
>)
{
/**
/**
...
@@ -79,7 +79,7 @@ fun <E : Contact> ContactList<E>.toList(): List<E> = toMutableList()
...
@@ -79,7 +79,7 @@ fun <E : Contact> ContactList<E>.toList(): List<E> = toMutableList()
/**
/**
* Collect all the elements into a [MutableList].
* Collect all the elements into a [MutableList].
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
fun
<
E
:
Contact
>
ContactList
<
E
>.
toMutableList
():
MutableList
<
E
>
=
this
.
delegate
.
toMutableList
()
fun
<
E
:
Contact
>
ContactList
<
E
>.
toMutableList
():
MutableList
<
E
>
=
this
.
delegate
.
toMutableList
()
/**
/**
...
@@ -90,7 +90,7 @@ fun <E : Contact> ContactList<E>.toSet(): Set<E> = toMutableSet()
...
@@ -90,7 +90,7 @@ fun <E : Contact> ContactList<E>.toSet(): Set<E> = toMutableSet()
/**
/**
* Collect all the elements into a [MutableSet].
* Collect all the elements into a [MutableSet].
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
fun
<
E
:
Contact
>
ContactList
<
E
>.
toMutableSet
():
MutableSet
<
E
>
=
this
.
delegate
.
toMutableSet
()
fun
<
E
:
Contact
>
ContactList
<
E
>.
toMutableSet
():
MutableSet
<
E
>
=
this
.
delegate
.
toMutableSet
()
/**
/**
...
@@ -98,7 +98,7 @@ fun <E : Contact> ContactList<E>.toMutableSet(): MutableSet<E> = this.delegate.t
...
@@ -98,7 +98,7 @@ fun <E : Contact> ContactList<E>.toMutableSet(): MutableSet<E> = this.delegate.t
*
*
* Note that the sequence is dynamic, that is, elements are yielded atomically only when it is required
* Note that the sequence is dynamic, that is, elements are yielded atomically only when it is required
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
fun
<
E
:
Contact
>
ContactList
<
E
>.
asSequence
():
Sequence
<
E
>
{
fun
<
E
:
Contact
>
ContactList
<
E
>.
asSequence
():
Sequence
<
E
>
{
return
this
.
delegate
.
asSequence
()
return
this
.
delegate
.
asSequence
()
}
}
\ No newline at end of file
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Member.kt
View file @
60b6eab7
...
@@ -25,7 +25,7 @@ import kotlin.time.ExperimentalTime
...
@@ -25,7 +25,7 @@ import kotlin.time.ExperimentalTime
* 群成员.
* 群成员.
*/
// 不要删除多平台结构, kotlin bug
*/
// 不要删除多平台结构, kotlin bug
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@
OptIn
(
MiraiInternalAPI
::
class
,
JavaHappyAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
,
JavaHappyAPI
::
class
)
expect
abstract
class
Member
()
:
MemberJavaHappyAPI
{
expect
abstract
class
Member
()
:
MemberJavaHappyAPI
{
/**
/**
* 所在的群.
* 所在的群.
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/MemberPermission.kt
View file @
60b6eab7
...
@@ -82,7 +82,7 @@ expect class PermissionDeniedException : IllegalStateException {
...
@@ -82,7 +82,7 @@ expect class PermissionDeniedException : IllegalStateException {
*
*
* @throws PermissionDeniedException
* @throws PermissionDeniedException
*/
*/
@
OptIn
(
MiraiExperimentalAPI
::
class
)
@
UseExperimental
(
MiraiExperimentalAPI
::
class
)
inline
fun
Group
.
checkBotPermission
(
inline
fun
Group
.
checkBotPermission
(
required
:
MemberPermission
,
required
:
MemberPermission
,
lazyMessage
:
()
->
String
=
{
lazyMessage
:
()
->
String
=
{
...
@@ -99,7 +99,7 @@ inline fun Group.checkBotPermission(
...
@@ -99,7 +99,7 @@ inline fun Group.checkBotPermission(
*
*
* @throws PermissionDeniedException
* @throws PermissionDeniedException
*/
*/
@
OptIn
(
MiraiExperimentalAPI
::
class
)
@
UseExperimental
(
MiraiExperimentalAPI
::
class
)
inline
fun
Group
.
checkBotPermissionOperator
(
inline
fun
Group
.
checkBotPermissionOperator
(
lazyMessage
:
()
->
String
=
{
lazyMessage
:
()
->
String
=
{
"Permission denied: required ${MemberPermission.ADMINISTRATOR} or ${MemberPermission.OWNER}, got actual $botPermission for $bot in group $id"
"Permission denied: required ${MemberPermission.ADMINISTRATOR} or ${MemberPermission.OWNER}, got actual $botPermission for $bot in group $id"
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/Event.kt
View file @
60b6eab7
...
@@ -66,7 +66,7 @@ abstract class AbstractCancellableEvent : Event, CancellableEvent {
...
@@ -66,7 +66,7 @@ abstract class AbstractCancellableEvent : Event, CancellableEvent {
/**
/**
* 广播一个事件的唯一途径.
* 广播一个事件的唯一途径.
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
suspend
fun
<
E
:
Event
>
E
.
broadcast
():
E
=
apply
{
suspend
fun
<
E
:
Event
>
E
.
broadcast
():
E
=
apply
{
if
(
this
is
BroadcastControllable
&&
!
this
.
shouldBroadcast
)
{
if
(
this
is
BroadcastControllable
&&
!
this
.
shouldBroadcast
)
{
return
@
apply
return
@
apply
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/BotEvents.kt
View file @
60b6eab7
...
@@ -143,7 +143,7 @@ sealed class MessageRecallEvent : BotEvent {
...
@@ -143,7 +143,7 @@ sealed class MessageRecallEvent : BotEvent {
)
:
MessageRecallEvent
(),
GroupOperableEvent
,
Packet
)
:
MessageRecallEvent
(),
GroupOperableEvent
,
Packet
}
}
@
OptIn
(
MiraiExperimentalAPI
::
class
)
@
UseExperimental
(
MiraiExperimentalAPI
::
class
)
val
MessageRecallEvent
.
GroupRecall
.
author
:
Member
val
MessageRecallEvent
.
GroupRecall
.
author
:
Member
get
()
=
if
(
authorId
==
bot
.
uin
)
group
.
botAsMember
else
group
[
authorId
]
get
()
=
if
(
authorId
==
bot
.
uin
)
group
.
botAsMember
else
group
[
authorId
]
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/types.kt
View file @
60b6eab7
...
@@ -73,7 +73,7 @@ val GroupOperableEvent.isByBot: Boolean get() = operator == null
...
@@ -73,7 +73,7 @@ val GroupOperableEvent.isByBot: Boolean get() = operator == null
* 当操作人为 [Member] 时获取这个 [Member],
* 当操作人为 [Member] 时获取这个 [Member],
* 当操作人为 [Bot] 时获取 [Group.botAsMember]
* 当操作人为 [Bot] 时获取 [Group.botAsMember]
*/
*/
@
OptIn
(
MiraiExperimentalAPI
::
class
)
@
UseExperimental
(
MiraiExperimentalAPI
::
class
)
val
GroupOperableEvent
.
operatorOrBot
:
Member
val
GroupOperableEvent
.
operatorOrBot
:
Member
get
()
=
this
.
operator
?:
this
.
group
.
botAsMember
get
()
=
this
.
operator
?:
this
.
group
.
botAsMember
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/internal/InternalEventListeners.kt
View file @
60b6eab7
...
@@ -36,7 +36,7 @@ internal fun <E : Event> CoroutineScope.Handler(
...
@@ -36,7 +36,7 @@ internal fun <E : Event> CoroutineScope.Handler(
coroutineContext
:
CoroutineContext
,
coroutineContext
:
CoroutineContext
,
handler
:
suspend
(
E
)
->
ListeningStatus
handler
:
suspend
(
E
)
->
ListeningStatus
):
Handler
<
E
>
{
):
Handler
<
E
>
{
@
OptIn
(
ExperimentalCoroutinesApi
::
class
)
// don't remove
@
UseExperimental
(
ExperimentalCoroutinesApi
::
class
)
// don't remove
val
context
=
this
.
newCoroutineContext
(
coroutineContext
)
val
context
=
this
.
newCoroutineContext
(
coroutineContext
)
return
Handler
(
context
[
Job
],
context
,
handler
)
return
Handler
(
context
[
Job
],
context
,
handler
)
}
}
...
@@ -50,7 +50,7 @@ internal class Handler<in E : Event>
...
@@ -50,7 +50,7 @@ internal class Handler<in E : Event>
@PublishedApi
internal
constructor
(
parentJob
:
Job
?,
private
val
subscriberContext
:
CoroutineContext
,
@JvmField
val
handler
:
suspend
(
E
)
->
ListeningStatus
)
:
@PublishedApi
internal
constructor
(
parentJob
:
Job
?,
private
val
subscriberContext
:
CoroutineContext
,
@JvmField
val
handler
:
suspend
(
E
)
->
ListeningStatus
)
:
Listener
<
E
>,
CompletableJob
by
Job
(
parentJob
)
{
Listener
<
E
>,
CompletableJob
by
Job
(
parentJob
)
{
@
OptIn
(
MiraiDebugAPI
::
class
)
@
UseExperimental
(
MiraiDebugAPI
::
class
)
override
suspend
fun
onEvent
(
event
:
E
):
ListeningStatus
{
override
suspend
fun
onEvent
(
event
:
E
):
ListeningStatus
{
if
(
isCompleted
||
isCancelled
)
return
ListeningStatus
.
STOPPED
if
(
isCompleted
||
isCancelled
)
return
ListeningStatus
.
STOPPED
if
(!
isActive
)
return
ListeningStatus
.
LISTENING
if
(!
isActive
)
return
ListeningStatus
.
LISTENING
...
@@ -155,7 +155,7 @@ internal suspend inline fun Event.broadcastInternal() = coroutineScope {
...
@@ -155,7 +155,7 @@ internal suspend inline fun Event.broadcastInternal() = coroutineScope {
}
}
}
}
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
private
fun
<
E
:
Event
>
CoroutineScope
.
callAndRemoveIfRequired
(
event
:
E
,
listeners
:
EventListeners
<
E
>)
{
private
fun
<
E
:
Event
>
CoroutineScope
.
callAndRemoveIfRequired
(
event
:
E
,
listeners
:
EventListeners
<
E
>)
{
// atomic foreach
// atomic foreach
listeners
.
forEachNode
{
node
->
listeners
.
forEachNode
{
node
->
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscribeMessages.kt
View file @
60b6eab7
...
@@ -33,7 +33,7 @@ import kotlin.coroutines.EmptyCoroutineContext
...
@@ -33,7 +33,7 @@ import kotlin.coroutines.EmptyCoroutineContext
*
*
* @see CoroutineScope.incoming
* @see CoroutineScope.incoming
*/
*/
@
OptIn
(
ExperimentalContracts
::
class
)
@
UseExperimental
(
ExperimentalContracts
::
class
)
inline
fun
<
R
>
CoroutineScope
.
subscribeMessages
(
inline
fun
<
R
>
CoroutineScope
.
subscribeMessages
(
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
crossinline
listeners
:
MessageSubscribersBuilder
<
MessagePacket
<
*
,
*
>>.()
->
R
crossinline
listeners
:
MessageSubscribersBuilder
<
MessagePacket
<
*
,
*
>>.()
->
R
...
@@ -58,7 +58,7 @@ inline fun <R> CoroutineScope.subscribeMessages(
...
@@ -58,7 +58,7 @@ inline fun <R> CoroutineScope.subscribeMessages(
*
*
* @see CoroutineScope.incoming
* @see CoroutineScope.incoming
*/
*/
@
OptIn
(
ExperimentalContracts
::
class
)
@
UseExperimental
(
ExperimentalContracts
::
class
)
inline
fun
<
R
>
CoroutineScope
.
subscribeGroupMessages
(
inline
fun
<
R
>
CoroutineScope
.
subscribeGroupMessages
(
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
crossinline
listeners
:
MessageSubscribersBuilder
<
GroupMessage
>.()
->
R
crossinline
listeners
:
MessageSubscribersBuilder
<
GroupMessage
>.()
->
R
...
@@ -78,7 +78,7 @@ inline fun <R> CoroutineScope.subscribeGroupMessages(
...
@@ -78,7 +78,7 @@ inline fun <R> CoroutineScope.subscribeGroupMessages(
*
*
* @see CoroutineScope.incoming
* @see CoroutineScope.incoming
*/
*/
@
OptIn
(
ExperimentalContracts
::
class
)
@
UseExperimental
(
ExperimentalContracts
::
class
)
inline
fun
<
R
>
CoroutineScope
.
subscribeFriendMessages
(
inline
fun
<
R
>
CoroutineScope
.
subscribeFriendMessages
(
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
crossinline
listeners
:
MessageSubscribersBuilder
<
FriendMessage
>.()
->
R
crossinline
listeners
:
MessageSubscribersBuilder
<
FriendMessage
>.()
->
R
...
@@ -98,7 +98,7 @@ inline fun <R> CoroutineScope.subscribeFriendMessages(
...
@@ -98,7 +98,7 @@ inline fun <R> CoroutineScope.subscribeFriendMessages(
*
*
* @see CoroutineScope.incoming
* @see CoroutineScope.incoming
*/
*/
@
OptIn
(
ExperimentalContracts
::
class
)
@
UseExperimental
(
ExperimentalContracts
::
class
)
inline
fun
<
R
>
Bot
.
subscribeMessages
(
inline
fun
<
R
>
Bot
.
subscribeMessages
(
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
crossinline
listeners
:
MessageSubscribersBuilder
<
MessagePacket
<
*
,
*
>>.()
->
R
crossinline
listeners
:
MessageSubscribersBuilder
<
MessagePacket
<
*
,
*
>>.()
->
R
...
@@ -120,7 +120,7 @@ inline fun <R> Bot.subscribeMessages(
...
@@ -120,7 +120,7 @@ inline fun <R> Bot.subscribeMessages(
*
*
* @see CoroutineScope.incoming
* @see CoroutineScope.incoming
*/
*/
@
OptIn
(
ExperimentalContracts
::
class
)
@
UseExperimental
(
ExperimentalContracts
::
class
)
inline
fun
<
R
>
Bot
.
subscribeGroupMessages
(
inline
fun
<
R
>
Bot
.
subscribeGroupMessages
(
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
crossinline
listeners
:
MessageSubscribersBuilder
<
GroupMessage
>.()
->
R
crossinline
listeners
:
MessageSubscribersBuilder
<
GroupMessage
>.()
->
R
...
@@ -140,7 +140,7 @@ inline fun <R> Bot.subscribeGroupMessages(
...
@@ -140,7 +140,7 @@ inline fun <R> Bot.subscribeGroupMessages(
*
*
* @see CoroutineScope.incoming
* @see CoroutineScope.incoming
*/
*/
@
OptIn
(
ExperimentalContracts
::
class
)
@
UseExperimental
(
ExperimentalContracts
::
class
)
inline
fun
<
R
>
Bot
.
subscribeFriendMessages
(
inline
fun
<
R
>
Bot
.
subscribeFriendMessages
(
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
crossinline
listeners
:
MessageSubscribersBuilder
<
FriendMessage
>.()
->
R
crossinline
listeners
:
MessageSubscribersBuilder
<
FriendMessage
>.()
->
R
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscriber.kt
View file @
60b6eab7
...
@@ -118,7 +118,7 @@ interface Listener<in E : Event> : CompletableJob {
...
@@ -118,7 +118,7 @@ interface Listener<in E : Event> : CompletableJob {
*
@
see
subscribeGroupMessages
监听群消息
DSL
*
@
see
subscribeGroupMessages
监听群消息
DSL
*
@
see
subscribeFriendMessages
监听好友消息
DSL
*
@
see
subscribeFriendMessages
监听好友消息
DSL
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
inline
fun
<
reified
E
:
Event
>
CoroutineScope
.
subscribe
(
inline
fun
<
reified
E
:
Event
>
CoroutineScope
.
subscribe
(
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
noinline
handler
:
suspend
E
.(
E
)
->
ListeningStatus
noinline
handler
:
suspend
E
.(
E
)
->
ListeningStatus
...
@@ -136,7 +136,7 @@ inline fun <reified E : Event> CoroutineScope.subscribe(
...
@@ -136,7 +136,7 @@ inline fun <reified E : Event> CoroutineScope.subscribe(
*
*
* @see subscribe 获取更多说明
* @see subscribe 获取更多说明
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
,
ExperimentalContracts
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
,
ExperimentalContracts
::
class
)
inline
fun
<
reified
E
:
Event
>
CoroutineScope
.
subscribeAlways
(
inline
fun
<
reified
E
:
Event
>
CoroutineScope
.
subscribeAlways
(
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
noinline
listener
:
suspend
E
.(
E
)
->
Unit
noinline
listener
:
suspend
E
.(
E
)
->
Unit
...
@@ -158,7 +158,7 @@ inline fun <reified E : Event> CoroutineScope.subscribeAlways(
...
@@ -158,7 +158,7 @@ inline fun <reified E : Event> CoroutineScope.subscribeAlways(
*
*
* @see subscribe 获取更多说明
* @see subscribe 获取更多说明
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
inline
fun
<
reified
E
:
Event
>
CoroutineScope
.
subscribeOnce
(
inline
fun
<
reified
E
:
Event
>
CoroutineScope
.
subscribeOnce
(
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
noinline
listener
:
suspend
E
.(
E
)
->
Unit
noinline
listener
:
suspend
E
.(
E
)
->
Unit
...
@@ -184,7 +184,7 @@ inline fun <reified E : Event> CoroutineScope.subscribeOnce(
...
@@ -184,7 +184,7 @@ inline fun <reified E : Event> CoroutineScope.subscribeOnce(
* @see subscribe 获取更多说明
* @see subscribe 获取更多说明
*/
*/
@JvmName
(
"subscribeAlwaysForBot"
)
@JvmName
(
"subscribeAlwaysForBot"
)
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
inline
fun
<
reified
E
:
BotEvent
>
Bot
.
subscribe
(
inline
fun
<
reified
E
:
BotEvent
>
Bot
.
subscribe
(
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
noinline
handler
:
suspend
E
.(
E
)
->
ListeningStatus
noinline
handler
:
suspend
E
.(
E
)
->
ListeningStatus
...
@@ -204,7 +204,7 @@ inline fun <reified E : BotEvent> Bot.subscribe(
...
@@ -204,7 +204,7 @@ inline fun <reified E : BotEvent> Bot.subscribe(
* @see subscribe 获取更多说明
* @see subscribe 获取更多说明
*/
*/
@JvmName
(
"subscribeAlwaysForBot1"
)
@JvmName
(
"subscribeAlwaysForBot1"
)
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
inline
fun
<
reified
E
:
BotEvent
>
Bot
.
subscribeAlways
(
inline
fun
<
reified
E
:
BotEvent
>
Bot
.
subscribeAlways
(
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
noinline
listener
:
suspend
E
.(
E
)
->
Unit
noinline
listener
:
suspend
E
.(
E
)
->
Unit
...
@@ -224,7 +224,7 @@ inline fun <reified E : BotEvent> Bot.subscribeAlways(
...
@@ -224,7 +224,7 @@ inline fun <reified E : BotEvent> Bot.subscribeAlways(
* @see subscribe 获取更多说明
* @see subscribe 获取更多说明
*/
*/
@JvmName
(
"subscribeOnceForBot2"
)
@JvmName
(
"subscribeOnceForBot2"
)
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
inline
fun
<
reified
E
:
BotEvent
>
Bot
.
subscribeOnce
(
inline
fun
<
reified
E
:
BotEvent
>
Bot
.
subscribeOnce
(
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
noinline
listener
:
suspend
E
.(
E
)
->
Unit
noinline
listener
:
suspend
E
.(
E
)
->
Unit
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/javaHappy.kt
View file @
60b6eab7
...
@@ -15,7 +15,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
...
@@ -15,7 +15,7 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
* 表明这个 API 是为了让 Java 使用者调用更方便.
* 表明这个 API 是为了让 Java 使用者调用更方便.
*/
*/
@MiraiInternalAPI
@MiraiInternalAPI
@
RequiresOptIn
(
level
=
RequiresOptIn
.
Level
.
ERROR
)
@
Experimental
(
level
=
Experimental
.
Level
.
ERROR
)
@Target
(
AnnotationTarget
.
PROPERTY
,
AnnotationTarget
.
FUNCTION
,
AnnotationTarget
.
TYPE
,
AnnotationTarget
.
CLASS
)
@Target
(
AnnotationTarget
.
PROPERTY
,
AnnotationTarget
.
FUNCTION
,
AnnotationTarget
.
TYPE
,
AnnotationTarget
.
CLASS
)
annotation
class
JavaHappyAPI
annotation
class
JavaHappyAPI
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/lowLevelApi.kt
View file @
60b6eab7
...
@@ -25,7 +25,7 @@ import net.mamoe.mirai.utils.WeakRef
...
@@ -25,7 +25,7 @@ import net.mamoe.mirai.utils.WeakRef
* 使用低级的 API 无法带来任何安全和便捷保障.
* 使用低级的 API 无法带来任何安全和便捷保障.
* 仅在某些使用结构化 API 可能影响性能的情况下使用这些低级 API.
* 仅在某些使用结构化 API 可能影响性能的情况下使用这些低级 API.
*/
*/
@
RequiresOptIn
@
Experimental
@Retention
(
AnnotationRetention
.
BINARY
)
@Retention
(
AnnotationRetention
.
BINARY
)
@Target
(
AnnotationTarget
.
CLASS
,
AnnotationTarget
.
TYPE
,
AnnotationTarget
.
FUNCTION
,
AnnotationTarget
.
PROPERTY
)
@Target
(
AnnotationTarget
.
CLASS
,
AnnotationTarget
.
TYPE
,
AnnotationTarget
.
FUNCTION
,
AnnotationTarget
.
PROPERTY
)
annotation
class
LowLevelAPI
annotation
class
LowLevelAPI
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/MessagePacket.kt
View file @
60b6eab7
...
@@ -33,7 +33,7 @@ import kotlin.jvm.JvmName
...
@@ -33,7 +33,7 @@ import kotlin.jvm.JvmName
* 一条从服务器接收到的消息事件.
* 一条从服务器接收到的消息事件.
* 请查看各平台的 `actual` 实现的说明.
* 请查看各平台的 `actual` 实现的说明.
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
expect
abstract
class
MessagePacket
<
TSender
:
QQ
,
TSubject
:
Contact
>()
:
MessagePacketBase
<
TSender
,
TSubject
>
expect
abstract
class
MessagePacket
<
TSender
:
QQ
,
TSubject
:
Contact
>()
:
MessagePacketBase
<
TSender
,
TSubject
>
/**
/**
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/At.kt
View file @
60b6eab7
...
@@ -28,7 +28,6 @@ import kotlin.jvm.JvmStatic
...
@@ -28,7 +28,6 @@ import kotlin.jvm.JvmStatic
* @see AtAll 全体成员
* @see AtAll 全体成员
*/
*/
class
At
class
At
@Suppress
(
"MemberVisibilityCanBePrivate"
)
private
constructor
(
val
target
:
Long
,
val
display
:
String
)
:
Message
,
MessageContent
{
private
constructor
(
val
target
:
Long
,
val
display
:
String
)
:
Message
,
MessageContent
{
/**
/**
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt
View file @
60b6eab7
...
@@ -76,7 +76,7 @@ interface OnlineImage : Image {
...
@@ -76,7 +76,7 @@ interface OnlineImage : Image {
* 查询原图下载链接.
* 查询原图下载链接.
*/
*/
suspend
fun
Image
.
queryUrl
():
String
{
suspend
fun
Image
.
queryUrl
():
String
{
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
return
when
(
this
)
{
return
when
(
this
)
{
is
OnlineImage
->
this
.
originUrl
is
OnlineImage
->
this
.
originUrl
else
->
BotImpl
.
instances
.
peekFirst
().
get
()
?.
queryImageUrl
(
this
)
else
->
BotImpl
.
instances
.
peekFirst
().
get
()
?.
queryImageUrl
(
this
)
...
@@ -102,7 +102,7 @@ interface OfflineImage : Image
...
@@ -102,7 +102,7 @@ interface OfflineImage : Image
* 原图下载链接. 包含域名
* 原图下载链接. 包含域名
*/
*/
suspend
fun
OfflineImage
.
queryOriginUrl
():
String
{
suspend
fun
OfflineImage
.
queryOriginUrl
():
String
{
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
return
BotImpl
.
instances
.
peekFirst
().
get
()
?.
queryImageUrl
(
this
)
?:
error
(
"No Bot available to query image url"
)
return
BotImpl
.
instances
.
peekFirst
().
get
()
?.
queryImageUrl
(
this
)
?:
error
(
"No Bot available to query image url"
)
}
}
...
@@ -115,7 +115,7 @@ suspend fun OfflineImage.queryOriginUrl(): String {
...
@@ -115,7 +115,7 @@ suspend fun OfflineImage.queryOriginUrl(): String {
* 群图片
* 群图片
*/
*/
// CustomFace
// CustomFace
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
sealed
class
GroupImage
:
AbstractImage
()
{
sealed
class
GroupImage
:
AbstractImage
()
{
abstract
val
filepath
:
String
abstract
val
filepath
:
String
abstract
val
fileId
:
Int
abstract
val
fileId
:
Int
...
@@ -184,7 +184,7 @@ abstract class OnlineGroupImage : GroupImage(), OnlineImage
...
@@ -184,7 +184,7 @@ abstract class OnlineGroupImage : GroupImage(), OnlineImage
/**
/**
* 好友图片
* 好友图片
*/
// NotOnlineImage
*/
// NotOnlineImage
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
sealed
class
FriendImage
:
AbstractImage
()
{
sealed
class
FriendImage
:
AbstractImage
()
{
abstract
val
resourceId
:
String
abstract
val
resourceId
:
String
abstract
val
md5
:
ByteArray
abstract
val
md5
:
ByteArray
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/QuoteReply.kt
View file @
60b6eab7
...
@@ -39,7 +39,7 @@ open class QuoteReply
...
@@ -39,7 +39,7 @@ open class QuoteReply
* 用于发送的引用回复.
* 用于发送的引用回复.
* 总是使用 [quote] 来构造实例.
* 总是使用 [quote] 来构造实例.
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
sealed
class
QuoteReplyToSend
sealed
class
QuoteReplyToSend
@MiraiInternalAPI
constructor
(
source
:
MessageSource
)
:
QuoteReply
(
source
)
{
@MiraiInternalAPI
constructor
(
source
:
MessageSource
)
:
QuoteReply
(
source
)
{
class
ToGroup
(
source
:
MessageSource
,
val
sender
:
QQ
)
:
QuoteReplyToSend
(
source
)
{
class
ToGroup
(
source
:
MessageSource
,
val
sender
:
QQ
)
:
QuoteReplyToSend
(
source
)
{
...
@@ -53,7 +53,7 @@ sealed class QuoteReplyToSend
...
@@ -53,7 +53,7 @@ sealed class QuoteReplyToSend
* 引用这条消息.
* 引用这条消息.
* @see sender 消息发送人.
* @see sender 消息发送人.
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
fun
MessageChain
.
quote
(
sender
:
QQ
?):
QuoteReplyToSend
{
fun
MessageChain
.
quote
(
sender
:
QQ
?):
QuoteReplyToSend
{
this
.
firstOrNull
<
MessageSource
>()
?.
let
{
this
.
firstOrNull
<
MessageSource
>()
?.
let
{
return
it
.
quote
(
sender
)
return
it
.
quote
(
sender
)
...
@@ -65,7 +65,7 @@ fun MessageChain.quote(sender: QQ?): QuoteReplyToSend {
...
@@ -65,7 +65,7 @@ fun MessageChain.quote(sender: QQ?): QuoteReplyToSend {
* 引用这条消息.
* 引用这条消息.
* @see from 消息来源. 若是好友发送
* @see from 消息来源. 若是好友发送
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
fun
MessageSource
.
quote
(
from
:
QQ
?):
QuoteReplyToSend
{
fun
MessageSource
.
quote
(
from
:
QQ
?):
QuoteReplyToSend
{
return
if
(
this
.
groupId
!=
0L
)
{
return
if
(
this
.
groupId
!=
0L
)
{
check
(
from
is
Member
)
{
"sender must be Member to quote a GroupMessage"
}
check
(
from
is
Member
)
{
"sender must be Member to quote a GroupMessage"
}
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/network/BotNetworkHandler.kt
View file @
60b6eab7
...
@@ -101,7 +101,7 @@ abstract class BotNetworkHandler : CoroutineScope {
...
@@ -101,7 +101,7 @@ abstract class BotNetworkHandler : CoroutineScope {
}
}
}
}
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
suspend
fun
BotNetworkHandler
.
closeAndJoin
(
cause
:
Throwable
?
=
null
)
{
suspend
fun
BotNetworkHandler
.
closeAndJoin
(
cause
:
Throwable
?
=
null
)
{
this
.
close
(
cause
)
this
.
close
(
cause
)
this
.
supervisor
.
join
()
this
.
supervisor
.
join
()
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/DeviceInfo.kt
View file @
60b6eab7
...
@@ -120,7 +120,7 @@ class DeviceInfoData(
...
@@ -120,7 +120,7 @@ class DeviceInfoData(
@Transient
@Transient
override
lateinit
var
context
:
Context
override
lateinit
var
context
:
Context
@
OptIn
(
ExperimentalUnsignedTypes
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
override
val
ipAddress
:
ByteArray
override
val
ipAddress
:
ByteArray
get
()
=
localIpAddress
().
split
(
"."
).
map
{
it
.
toUByte
().
toByte
()
}.
takeIf
{
it
.
size
==
4
}
?.
toByteArray
()
?:
byteArrayOf
()
get
()
=
localIpAddress
().
split
(
"."
).
map
{
it
.
toUByte
().
toByte
()
}.
takeIf
{
it
.
size
==
4
}
?.
toByteArray
()
?:
byteArrayOf
()
override
val
androidId
:
ByteArray
get
()
=
display
override
val
androidId
:
ByteArray
get
()
=
display
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/annotataions.kt
View file @
60b6eab7
...
@@ -18,7 +18,7 @@ import kotlin.annotation.AnnotationTarget.*
...
@@ -18,7 +18,7 @@ import kotlin.annotation.AnnotationTarget.*
* 非常不建议在发行版本中使用这些 API.
* 非常不建议在发行版本中使用这些 API.
*/
*/
@Retention
(
AnnotationRetention
.
BINARY
)
@Retention
(
AnnotationRetention
.
BINARY
)
@
RequiresOptIn
(
level
=
RequiresOptIn
.
Level
.
ERROR
)
@
Experimental
(
level
=
Experimental
.
Level
.
ERROR
)
@Target
(
@Target
(
CLASS
,
TYPEALIAS
,
FUNCTION
,
PROPERTY
,
FIELD
,
CONSTRUCTOR
,
CLASS
,
TYPEALIAS
,
FUNCTION
,
PROPERTY
,
FIELD
,
CONSTRUCTOR
,
CLASS
,
CLASS
,
...
@@ -36,7 +36,7 @@ annotation class MiraiInternalAPI(
...
@@ -36,7 +36,7 @@ annotation class MiraiInternalAPI(
* 不建议在发行版本中使用这些 API.
* 不建议在发行版本中使用这些 API.
*/
*/
@Retention
(
AnnotationRetention
.
BINARY
)
@Retention
(
AnnotationRetention
.
BINARY
)
@
RequiresOptIn
(
level
=
RequiresOptIn
.
Level
.
WARNING
)
@
Experimental
(
level
=
Experimental
.
Level
.
WARNING
)
@Target
(
CLASS
,
TYPEALIAS
,
FUNCTION
,
PROPERTY
,
FIELD
,
CONSTRUCTOR
)
@Target
(
CLASS
,
TYPEALIAS
,
FUNCTION
,
PROPERTY
,
FIELD
,
CONSTRUCTOR
)
annotation
class
MiraiExperimentalAPI
(
annotation
class
MiraiExperimentalAPI
(
val
message
:
String
=
""
val
message
:
String
=
""
...
@@ -49,7 +49,7 @@ annotation class MiraiExperimentalAPI(
...
@@ -49,7 +49,7 @@ annotation class MiraiExperimentalAPI(
* 非常不建议在发行版本中使用这些 API.
* 非常不建议在发行版本中使用这些 API.
*/
*/
@Retention
(
AnnotationRetention
.
BINARY
)
@Retention
(
AnnotationRetention
.
BINARY
)
@
RequiresOptIn
(
level
=
RequiresOptIn
.
Level
.
WARNING
)
@
Experimental
(
level
=
Experimental
.
Level
.
WARNING
)
@Target
(
CLASS
,
TYPEALIAS
,
FUNCTION
,
PROPERTY
,
FIELD
,
CONSTRUCTOR
)
@Target
(
CLASS
,
TYPEALIAS
,
FUNCTION
,
PROPERTY
,
FIELD
,
CONSTRUCTOR
)
annotation
class
MiraiDebugAPI
(
annotation
class
MiraiDebugAPI
(
val
message
:
String
=
""
val
message
:
String
=
""
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/channels.kt
View file @
60b6eab7
...
@@ -32,7 +32,7 @@ import kotlin.jvm.JvmName
...
@@ -32,7 +32,7 @@ import kotlin.jvm.JvmName
*/
*/
@InternalSerializationApi
@InternalSerializationApi
suspend
fun
ByteReadChannel
.
copyTo
(
dst
:
OutputStream
)
{
suspend
fun
ByteReadChannel
.
copyTo
(
dst
:
OutputStream
)
{
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
ByteArrayPool
.
useInstance
{
buffer
->
ByteArrayPool
.
useInstance
{
buffer
->
var
size
:
Int
var
size
:
Int
while
(
this
.
readAvailable
(
buffer
).
also
{
size
=
it
}
>
0
)
{
while
(
this
.
readAvailable
(
buffer
).
also
{
size
=
it
}
>
0
)
{
...
@@ -45,7 +45,7 @@ suspend fun ByteReadChannel.copyTo(dst: OutputStream) {
...
@@ -45,7 +45,7 @@ suspend fun ByteReadChannel.copyTo(dst: OutputStream) {
* 从接收者管道读取所有数据并写入 [dst]. 不会关闭 [dst]
* 从接收者管道读取所有数据并写入 [dst]. 不会关闭 [dst]
*/
*/
suspend
fun
ByteReadChannel
.
copyTo
(
dst
:
Output
)
{
suspend
fun
ByteReadChannel
.
copyTo
(
dst
:
Output
)
{
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
ByteArrayPool
.
useInstance
{
buffer
->
ByteArrayPool
.
useInstance
{
buffer
->
var
size
:
Int
var
size
:
Int
while
(
this
.
readAvailable
(
buffer
).
also
{
size
=
it
}
>
0
)
{
while
(
this
.
readAvailable
(
buffer
).
also
{
size
=
it
}
>
0
)
{
...
@@ -78,7 +78,7 @@ suspend fun ByteReadChannel.copyTo(dst: kotlinx.coroutines.io.ByteWriteChannel)
...
@@ -78,7 +78,7 @@ suspend fun ByteReadChannel.copyTo(dst: kotlinx.coroutines.io.ByteWriteChannel)
@InternalSerializationApi
@InternalSerializationApi
suspend
fun
ByteReadChannel
.
copyAndClose
(
dst
:
OutputStream
)
{
suspend
fun
ByteReadChannel
.
copyAndClose
(
dst
:
OutputStream
)
{
try
{
try
{
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
ByteArrayPool
.
useInstance
{
buffer
->
ByteArrayPool
.
useInstance
{
buffer
->
var
size
:
Int
var
size
:
Int
while
(
this
.
readAvailable
(
buffer
).
also
{
size
=
it
}
>
0
)
{
while
(
this
.
readAvailable
(
buffer
).
also
{
size
=
it
}
>
0
)
{
...
@@ -95,7 +95,7 @@ suspend fun ByteReadChannel.copyAndClose(dst: OutputStream) {
...
@@ -95,7 +95,7 @@ suspend fun ByteReadChannel.copyAndClose(dst: OutputStream) {
*/
*/
suspend
fun
ByteReadChannel
.
copyAndClose
(
dst
:
Output
)
{
suspend
fun
ByteReadChannel
.
copyAndClose
(
dst
:
Output
)
{
try
{
try
{
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
ByteArrayPool
.
useInstance
{
buffer
->
ByteArrayPool
.
useInstance
{
buffer
->
var
size
:
Int
var
size
:
Int
while
(
this
.
readAvailable
(
buffer
).
also
{
size
=
it
}
>
0
)
{
while
(
this
.
readAvailable
(
buffer
).
also
{
size
=
it
}
>
0
)
{
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/byteArrays.kt
View file @
60b6eab7
...
@@ -30,7 +30,7 @@ import kotlin.jvm.JvmSynthetic
...
@@ -30,7 +30,7 @@ import kotlin.jvm.JvmSynthetic
@JvmOverloads
@JvmOverloads
@Suppress
(
"DuplicatedCode"
)
// false positive. foreach is not common to UByteArray and ByteArray
@Suppress
(
"DuplicatedCode"
)
// false positive. foreach is not common to UByteArray and ByteArray
@
OptIn
(
ExperimentalUnsignedTypes
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
fun
List
<
Byte
>.
toUHexString
(
separator
:
String
=
" "
,
offset
:
Int
=
0
,
length
:
Int
=
this
.
size
-
offset
):
String
{
fun
List
<
Byte
>.
toUHexString
(
separator
:
String
=
" "
,
offset
:
Int
=
0
,
length
:
Int
=
this
.
size
-
offset
):
String
{
require
(
offset
>=
0
)
{
"offset shouldn't be negative: $offset"
}
require
(
offset
>=
0
)
{
"offset shouldn't be negative: $offset"
}
require
(
length
>=
0
)
{
"length shouldn't be negative: $length"
}
require
(
length
>=
0
)
{
"length shouldn't be negative: $length"
}
...
@@ -54,7 +54,7 @@ fun List<Byte>.toUHexString(separator: String = " ", offset: Int = 0, length: In
...
@@ -54,7 +54,7 @@ fun List<Byte>.toUHexString(separator: String = " ", offset: Int = 0, length: In
@JvmOverloads
@JvmOverloads
@Suppress
(
"DuplicatedCode"
)
// false positive. foreach is not common to UByteArray and ByteArray
@Suppress
(
"DuplicatedCode"
)
// false positive. foreach is not common to UByteArray and ByteArray
@
OptIn
(
ExperimentalUnsignedTypes
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
fun
ByteArray
.
toUHexString
(
separator
:
String
=
" "
,
offset
:
Int
=
0
,
length
:
Int
=
this
.
size
-
offset
):
String
{
fun
ByteArray
.
toUHexString
(
separator
:
String
=
" "
,
offset
:
Int
=
0
,
length
:
Int
=
this
.
size
-
offset
):
String
{
this
.
checkOffsetAndLength
(
offset
,
length
)
this
.
checkOffsetAndLength
(
offset
,
length
)
if
(
length
==
0
)
{
if
(
length
==
0
)
{
...
@@ -99,7 +99,7 @@ inline fun ByteArray.encodeToString(charset: Charset = Charsets.UTF_8): String =
...
@@ -99,7 +99,7 @@ inline fun ByteArray.encodeToString(charset: Charset = Charsets.UTF_8): String =
inline
fun
ByteArray
.
toReadPacket
(
offset
:
Int
=
0
,
length
:
Int
=
this
.
size
-
offset
)
=
inline
fun
ByteArray
.
toReadPacket
(
offset
:
Int
=
0
,
length
:
Int
=
this
.
size
-
offset
)
=
ByteReadPacket
(
this
,
offset
=
offset
,
length
=
length
)
ByteReadPacket
(
this
,
offset
=
offset
,
length
=
length
)
@
OptIn
(
ExperimentalContracts
::
class
)
@
UseExperimental
(
ExperimentalContracts
::
class
)
inline
fun
<
R
>
ByteArray
.
read
(
t
:
ByteReadPacket
.()
->
R
):
R
{
inline
fun
<
R
>
ByteArray
.
read
(
t
:
ByteReadPacket
.()
->
R
):
R
{
contract
{
contract
{
callsInPlace
(
t
,
InvocationKind
.
EXACTLY_ONCE
)
callsInPlace
(
t
,
InvocationKind
.
EXACTLY_ONCE
)
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/chunked.kt
View file @
60b6eab7
...
@@ -51,7 +51,7 @@ class ChunkedInput(
...
@@ -51,7 +51,7 @@ class ChunkedInput(
*
*
* 若 [ByteReadPacket.remaining] 小于 [sizePerPacket], 将会返回唯一元素 [this] 的 [Sequence]
* 若 [ByteReadPacket.remaining] 小于 [sizePerPacket], 将会返回唯一元素 [this] 的 [Sequence]
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
fun
ByteReadPacket
.
chunkedFlow
(
sizePerPacket
:
Int
):
Flow
<
ChunkedInput
>
{
fun
ByteReadPacket
.
chunkedFlow
(
sizePerPacket
:
Int
):
Flow
<
ChunkedInput
>
{
ByteArrayPool
.
checkBufferSize
(
sizePerPacket
)
ByteArrayPool
.
checkBufferSize
(
sizePerPacket
)
if
(
this
.
remaining
<=
sizePerPacket
.
toLong
())
{
if
(
this
.
remaining
<=
sizePerPacket
.
toLong
())
{
...
@@ -76,7 +76,7 @@ fun ByteReadPacket.chunkedFlow(sizePerPacket: Int): Flow<ChunkedInput> {
...
@@ -76,7 +76,7 @@ fun ByteReadPacket.chunkedFlow(sizePerPacket: Int): Flow<ChunkedInput> {
* 对于一个 1000 长度的 [ByteReadChannel] 和参数 [sizePerPacket] = 300, 将会产生含四个元素的 [Sequence],
* 对于一个 1000 长度的 [ByteReadChannel] 和参数 [sizePerPacket] = 300, 将会产生含四个元素的 [Sequence],
* 其长度分别为: 300, 300, 300, 100.
* 其长度分别为: 300, 300, 300, 100.
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
fun
ByteReadChannel
.
chunkedFlow
(
sizePerPacket
:
Int
):
Flow
<
ChunkedInput
>
{
fun
ByteReadChannel
.
chunkedFlow
(
sizePerPacket
:
Int
):
Flow
<
ChunkedInput
>
{
ByteArrayPool
.
checkBufferSize
(
sizePerPacket
)
ByteArrayPool
.
checkBufferSize
(
sizePerPacket
)
if
(
this
.
isClosedForRead
)
{
if
(
this
.
isClosedForRead
)
{
...
@@ -100,7 +100,7 @@ fun ByteReadChannel.chunkedFlow(sizePerPacket: Int): Flow<ChunkedInput> {
...
@@ -100,7 +100,7 @@ fun ByteReadChannel.chunkedFlow(sizePerPacket: Int): Flow<ChunkedInput> {
* 对于一个 1000 长度的 [Input] 和参数 [sizePerPacket] = 300, 将会产生含四个元素的 [Sequence],
* 对于一个 1000 长度的 [Input] 和参数 [sizePerPacket] = 300, 将会产生含四个元素的 [Sequence],
* 其长度分别为: 300, 300, 300, 100.
* 其长度分别为: 300, 300, 300, 100.
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
,
ExperimentalCoroutinesApi
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
,
ExperimentalCoroutinesApi
::
class
)
internal
fun
Input
.
chunkedFlow
(
sizePerPacket
:
Int
):
Flow
<
ChunkedInput
>
{
internal
fun
Input
.
chunkedFlow
(
sizePerPacket
:
Int
):
Flow
<
ChunkedInput
>
{
ByteArrayPool
.
checkBufferSize
(
sizePerPacket
)
ByteArrayPool
.
checkBufferSize
(
sizePerPacket
)
...
@@ -127,7 +127,7 @@ internal fun Input.chunkedFlow(sizePerPacket: Int): Flow<ChunkedInput> {
...
@@ -127,7 +127,7 @@ internal fun Input.chunkedFlow(sizePerPacket: Int): Flow<ChunkedInput> {
*
*
* 若 [ByteReadPacket.remaining] 小于 [sizePerPacket], 将会返回唯一元素 [this] 的 [Sequence]
* 若 [ByteReadPacket.remaining] 小于 [sizePerPacket], 将会返回唯一元素 [this] 的 [Sequence]
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
,
ExperimentalCoroutinesApi
::
class
,
InternalSerializationApi
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
,
ExperimentalCoroutinesApi
::
class
,
InternalSerializationApi
::
class
)
internal
fun
InputStream
.
chunkedFlow
(
sizePerPacket
:
Int
):
Flow
<
ChunkedInput
>
{
internal
fun
InputStream
.
chunkedFlow
(
sizePerPacket
:
Int
):
Flow
<
ChunkedInput
>
{
ByteArrayPool
.
checkBufferSize
(
sizePerPacket
)
ByteArrayPool
.
checkBufferSize
(
sizePerPacket
)
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/input.kt
View file @
60b6eab7
...
@@ -18,7 +18,6 @@ import io.ktor.utils.io.charsets.Charsets
...
@@ -18,7 +18,6 @@ import io.ktor.utils.io.charsets.Charsets
import
io.ktor.utils.io.core.*
import
io.ktor.utils.io.core.*
import
io.ktor.utils.io.pool.useInstance
import
io.ktor.utils.io.pool.useInstance
import
kotlinx.io.OutputStream
import
kotlinx.io.OutputStream
import
kotlinx.serialization.InternalSerializationApi
import
net.mamoe.mirai.utils.MiraiDebugAPI
import
net.mamoe.mirai.utils.MiraiDebugAPI
import
net.mamoe.mirai.utils.MiraiInternalAPI
import
net.mamoe.mirai.utils.MiraiInternalAPI
import
kotlin.contracts.ExperimentalContracts
import
kotlin.contracts.ExperimentalContracts
...
@@ -28,8 +27,7 @@ import kotlin.jvm.JvmMultifileClass
...
@@ -28,8 +27,7 @@ import kotlin.jvm.JvmMultifileClass
import
kotlin.jvm.JvmName
import
kotlin.jvm.JvmName
import
kotlin.jvm.JvmSynthetic
import
kotlin.jvm.JvmSynthetic
@InternalSerializationApi
@UseExperimental
(
MiraiInternalAPI
::
class
)
@OptIn
(
MiraiInternalAPI
::
class
)
fun
ByteReadPacket
.
copyTo
(
outputStream
:
OutputStream
)
{
fun
ByteReadPacket
.
copyTo
(
outputStream
:
OutputStream
)
{
ByteArrayPool
.
useInstance
{
ByteArrayPool
.
useInstance
{
while
(
this
.
isNotEmpty
)
{
while
(
this
.
isNotEmpty
)
{
...
@@ -52,7 +50,7 @@ inline fun ByteReadPacket.readPacketExact(
...
@@ -52,7 +50,7 @@ inline fun ByteReadPacket.readPacketExact(
n
:
Int
=
remaining
.
toInt
()
//not that safe but adequate
n
:
Int
=
remaining
.
toInt
()
//not that safe but adequate
):
ByteReadPacket
=
this
.
readBytes
(
n
).
toReadPacket
()
):
ByteReadPacket
=
this
.
readBytes
(
n
).
toReadPacket
()
@
OptIn
(
ExperimentalContracts
::
class
)
@
UseExperimental
(
ExperimentalContracts
::
class
)
inline
fun
<
C
:
Closeable
,
R
>
C
.
withUse
(
block
:
C
.()
->
R
):
R
{
inline
fun
<
C
:
Closeable
,
R
>
C
.
withUse
(
block
:
C
.()
->
R
):
R
{
contract
{
contract
{
callsInPlace
(
block
,
InvocationKind
.
EXACTLY_ONCE
)
callsInPlace
(
block
,
InvocationKind
.
EXACTLY_ONCE
)
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/output.kt
View file @
60b6eab7
...
@@ -68,6 +68,6 @@ fun BytePacketBuilder.writeHex(uHex: String) {
...
@@ -68,6 +68,6 @@ fun BytePacketBuilder.writeHex(uHex: String) {
/**
/**
* 会使用 [ByteArrayPool] 缓存
* 会使用 [ByteArrayPool] 缓存
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
inline
fun
BytePacketBuilder
.
encryptAndWrite
(
key
:
ByteArray
,
encoder
:
BytePacketBuilder
.()
->
Unit
)
=
inline
fun
BytePacketBuilder
.
encryptAndWrite
(
key
:
ByteArray
,
encoder
:
BytePacketBuilder
.()
->
Unit
)
=
TEA
.
encrypt
(
BytePacketBuilder
().
apply
(
encoder
).
build
(),
key
)
{
decrypted
->
writeFully
(
decrypted
)
}
TEA
.
encrypt
(
BytePacketBuilder
().
apply
(
encoder
).
build
(),
key
)
{
decrypted
->
writeFully
(
decrypted
)
}
\ No newline at end of file
mirai-core/src/commonTest/kotlin/net.mamoe.mirai.message.data/CombinedMessageTest.kt
View file @
60b6eab7
...
@@ -35,7 +35,7 @@ internal class CombinedMessageTest {
...
@@ -35,7 +35,7 @@ internal class CombinedMessageTest {
private
val
toAdd
=
"1"
.
toMessage
()
private
val
toAdd
=
"1"
.
toMessage
()
@
OptIn
(
ExperimentalTime
::
class
)
@
UseExperimental
(
ExperimentalTime
::
class
)
@Test
@Test
fun
speedTest
()
=
repeat
(
100
)
{
fun
speedTest
()
=
repeat
(
100
)
{
var
count
=
1L
var
count
=
1L
...
@@ -86,7 +86,7 @@ internal class CombinedMessageTest {
...
@@ -86,7 +86,7 @@ internal class CombinedMessageTest {
}
}
}
}
@
OptIn
(
ExperimentalTime
::
class
)
@
UseExperimental
(
ExperimentalTime
::
class
)
@Test
@Test
fun
testFastIteration
()
{
fun
testFastIteration
()
{
println
(
"start!"
)
println
(
"start!"
)
...
...
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/Bot.kt
View file @
60b6eab7
...
@@ -24,9 +24,7 @@ import net.mamoe.mirai.utils.*
...
@@ -24,9 +24,7 @@ import net.mamoe.mirai.utils.*
* @see kotlinx.coroutines.isActive 判断 [Bot] 是否正常运行中. (在线, 且没有被 [close])
* @see kotlinx.coroutines.isActive 判断 [Bot] 是否正常运行中. (在线, 且没有被 [close])
*/
*/
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@OptIn
(
@UseExperimental
(
MiraiInternalAPI
::
class
,
LowLevelAPI
::
class
,
MiraiExperimentalAPI
::
class
,
JavaHappyAPI
::
class
)
MiraiInternalAPI
::
class
,
LowLevelAPI
::
class
,
MiraiExperimentalAPI
::
class
,
JavaHappyAPI
::
class
)
actual
abstract
class
Bot
actual
constructor
()
:
CoroutineScope
,
LowLevelBotAPIAccessor
,
BotJavaHappyAPI
()
{
actual
abstract
class
Bot
actual
constructor
()
:
CoroutineScope
,
LowLevelBotAPIAccessor
,
BotJavaHappyAPI
()
{
actual
companion
object
{
actual
companion
object
{
/**
/**
...
@@ -246,6 +244,6 @@ actual abstract class Bot actual constructor() : CoroutineScope, LowLevelBotAPIA
...
@@ -246,6 +244,6 @@ actual abstract class Bot actual constructor() : CoroutineScope, LowLevelBotAPIA
*/
*/
actual
abstract
fun
close
(
cause
:
Throwable
?)
actual
abstract
fun
close
(
cause
:
Throwable
?)
@
OptIn
(
LowLevelAPI
::
class
,
MiraiExperimentalAPI
::
class
)
@
UseExperimental
(
LowLevelAPI
::
class
,
MiraiExperimentalAPI
::
class
)
actual
final
override
fun
toString
():
String
=
"Bot(${uin})"
actual
final
override
fun
toString
():
String
=
"Bot(${uin})"
}
}
\ No newline at end of file
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/BotJavaHappyAPI.kt
View file @
60b6eab7
...
@@ -132,7 +132,7 @@ actual abstract class BotJavaHappyAPI actual constructor() {
...
@@ -132,7 +132,7 @@ actual abstract class BotJavaHappyAPI actual constructor() {
message
:
String
?
=
null
,
message
:
String
?
=
null
,
remark
:
String
?
=
null
remark
:
String
?
=
null
):
AddFriendResult
{
):
AddFriendResult
{
@
OptIn
(
MiraiExperimentalAPI
::
class
)
@
UseExperimental
(
MiraiExperimentalAPI
::
class
)
return
runBlocking
{
addFriend
(
id
,
message
,
remark
)
}
return
runBlocking
{
addFriend
(
id
,
message
,
remark
)
}
}
}
...
@@ -169,7 +169,7 @@ actual abstract class BotJavaHappyAPI actual constructor() {
...
@@ -169,7 +169,7 @@ actual abstract class BotJavaHappyAPI actual constructor() {
}
}
}
}
@
OptIn
(
ExperimentalCoroutinesApi
::
class
)
@
UseExperimental
(
ExperimentalCoroutinesApi
::
class
)
internal
fun
<
R
,
C
:
CoroutineScope
>
C
.
future
(
block
:
suspend
C
.()
->
R
):
Future
<
R
>
{
internal
fun
<
R
,
C
:
CoroutineScope
>
C
.
future
(
block
:
suspend
C
.()
->
R
):
Future
<
R
>
{
val
future
=
object
:
Future
<
R
>
{
val
future
=
object
:
Future
<
R
>
{
val
value
:
CompletableDeferred
<
R
>
=
CompletableDeferred
()
val
value
:
CompletableDeferred
<
R
>
=
CompletableDeferred
()
...
@@ -214,7 +214,7 @@ internal fun <R, C : CoroutineScope> C.future(block: suspend C.() -> R): Future<
...
@@ -214,7 +214,7 @@ internal fun <R, C : CoroutineScope> C.future(block: suspend C.() -> R): Future<
}
}
launch
{
launch
{
@
OptIn
(
ExperimentalCoroutinesApi
::
class
)
@
UseExperimental
(
ExperimentalCoroutinesApi
::
class
)
future
.
value
.
completeWith
(
kotlin
.
runCatching
{
block
()
})
future
.
value
.
completeWith
(
kotlin
.
runCatching
{
block
()
})
}
}
...
...
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Contact.kt
View file @
60b6eab7
...
@@ -32,7 +32,7 @@ import net.mamoe.mirai.utils.WeakRefProperty
...
@@ -32,7 +32,7 @@ import net.mamoe.mirai.utils.WeakRefProperty
* @author Him188moe
* @author Him188moe
*/
*/
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@
OptIn
(
MiraiInternalAPI
::
class
,
JavaHappyAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
,
JavaHappyAPI
::
class
)
actual
abstract
class
Contact
:
CoroutineScope
,
ContactJavaHappyAPI
()
{
actual
abstract
class
Contact
:
CoroutineScope
,
ContactJavaHappyAPI
()
{
/**
/**
* 这个联系人所属 [Bot].
* 这个联系人所属 [Bot].
...
...
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Member.kt
View file @
60b6eab7
...
@@ -20,7 +20,7 @@ import net.mamoe.mirai.utils.WeakRefProperty
...
@@ -20,7 +20,7 @@ import net.mamoe.mirai.utils.WeakRefProperty
/**
/**
* 群成员.
* 群成员.
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
,
JavaHappyAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
,
JavaHappyAPI
::
class
)
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@Suppress
(
"INAPPLICABLE_JVM_NAME"
)
actual
abstract
class
Member
:
MemberJavaHappyAPI
()
{
actual
abstract
class
Member
:
MemberJavaHappyAPI
()
{
/**
/**
...
...
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/MessagePacket.kt
View file @
60b6eab7
...
@@ -30,7 +30,7 @@ import java.net.URL
...
@@ -30,7 +30,7 @@ import java.net.URL
* 一条从服务器接收到的消息事件.
* 一条从服务器接收到的消息事件.
* JVM 平台相关扩展
* JVM 平台相关扩展
*/
*/
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
actual
abstract
class
MessagePacket
<
TSender
:
QQ
,
TSubject
:
Contact
>
actual
constructor
()
:
MessagePacketBase
<
TSender
,
TSubject
>()
{
actual
abstract
class
MessagePacket
<
TSender
:
QQ
,
TSubject
:
Contact
>
actual
constructor
()
:
MessagePacketBase
<
TSender
,
TSubject
>()
{
// region 上传图片
// region 上传图片
suspend
inline
fun
uploadImage
(
image
:
BufferedImage
):
Image
=
subject
.
uploadImage
(
image
)
suspend
inline
fun
uploadImage
(
image
:
BufferedImage
):
Image
=
subject
.
uploadImage
(
image
)
...
...
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/MessageReceipt.kt
View file @
60b6eab7
...
@@ -28,7 +28,7 @@ import net.mamoe.mirai.utils.unsafeWeakRef
...
@@ -28,7 +28,7 @@ import net.mamoe.mirai.utils.unsafeWeakRef
* @see MessageReceipt.sourceTime 源时间
* @see MessageReceipt.sourceTime 源时间
*/
*/
@Suppress
(
"FunctionName"
)
@Suppress
(
"FunctionName"
)
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
actual
open
class
MessageReceipt
<
C
:
Contact
>
actual
constructor
(
actual
open
class
MessageReceipt
<
C
:
Contact
>
actual
constructor
(
actual
val
source
:
MessageSource
,
actual
val
source
:
MessageSource
,
target
:
C
,
target
:
C
,
...
@@ -94,7 +94,7 @@ actual open class MessageReceipt<C : Contact> actual constructor(
...
@@ -94,7 +94,7 @@ actual open class MessageReceipt<C : Contact> actual constructor(
*/
*/
actual
open
suspend
fun
quote
():
QuoteReplyToSend
{
actual
open
suspend
fun
quote
():
QuoteReplyToSend
{
this
.
source
.
ensureSequenceIdAvailable
()
this
.
source
.
ensureSequenceIdAvailable
()
@
OptIn
(
LowLevelAPI
::
class
)
@
UseExperimental
(
LowLevelAPI
::
class
)
return
_unsafeQuote
()
return
_unsafeQuote
()
}
}
...
...
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/PlatformUtilsJvm.kt
View file @
60b6eab7
...
@@ -57,7 +57,7 @@ actual fun localIpAddress(): String = InetAddress.getLocalHost().hostAddress
...
@@ -57,7 +57,7 @@ actual fun localIpAddress(): String = InetAddress.getLocalHost().hostAddress
actual
val
Http
:
HttpClient
get
()
=
HttpClient
(
CIO
)
actual
val
Http
:
HttpClient
get
()
=
HttpClient
(
CIO
)
@
OptIn
(
MiraiInternalAPI
::
class
)
@
UseExperimental
(
MiraiInternalAPI
::
class
)
actual
fun
ByteArray
.
unzip
(
offset
:
Int
,
length
:
Int
):
ByteArray
{
actual
fun
ByteArray
.
unzip
(
offset
:
Int
,
length
:
Int
):
ByteArray
{
this
.
checkOffsetAndLength
(
offset
,
length
)
this
.
checkOffsetAndLength
(
offset
,
length
)
if
(
length
==
0
)
return
ByteArray
(
0
)
if
(
length
==
0
)
return
ByteArray
(
0
)
...
...
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/SystemDeviceInfo.kt
View file @
60b6eab7
...
@@ -21,7 +21,7 @@ import java.io.File
...
@@ -21,7 +21,7 @@ import java.io.File
/**
/**
* 加载一个设备信息. 若文件不存在或为空则随机并创建一个设备信息保存.
* 加载一个设备信息. 若文件不存在或为空则随机并创建一个设备信息保存.
*/
*/
@
OptIn
(
UnstableDefault
::
class
)
@
UseExperimental
(
UnstableDefault
::
class
)
fun
File
.
loadAsDeviceInfo
(
context
:
Context
=
ContextImpl
()):
DeviceInfo
{
fun
File
.
loadAsDeviceInfo
(
context
:
Context
=
ContextImpl
()):
DeviceInfo
{
if
(!
this
.
exists
()
||
this
.
length
()
==
0L
)
{
if
(!
this
.
exists
()
||
this
.
length
()
==
0L
)
{
return
SystemDeviceInfo
(
context
).
also
{
return
SystemDeviceInfo
(
context
).
also
{
...
@@ -35,7 +35,7 @@ fun File.loadAsDeviceInfo(context: Context = ContextImpl()): DeviceInfo {
...
@@ -35,7 +35,7 @@ fun File.loadAsDeviceInfo(context: Context = ContextImpl()): DeviceInfo {
@Serializable
@Serializable
@
OptIn
(
ExperimentalUnsignedTypes
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
actual
open
class
SystemDeviceInfo
actual
constructor
()
:
DeviceInfo
()
{
actual
open
class
SystemDeviceInfo
actual
constructor
()
:
DeviceInfo
()
{
actual
constructor
(
context
:
Context
)
:
this
()
{
actual
constructor
(
context
:
Context
)
:
this
()
{
this
.
context
=
context
this
.
context
=
context
...
...
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/io/PlatformSocket.kt
View file @
60b6eab7
...
@@ -80,7 +80,7 @@ actual class PlatformSocket : Closeable {
...
@@ -80,7 +80,7 @@ actual class PlatformSocket : Closeable {
}
}
}
}
@
OptIn
(
ExperimentalIoApi
::
class
)
@
UseExperimental
(
ExperimentalIoApi
::
class
)
actual
suspend
fun
connect
(
serverHost
:
String
,
serverPort
:
Int
)
{
actual
suspend
fun
connect
(
serverHost
:
String
,
serverPort
:
Int
)
{
withContext
(
Dispatchers
.
IO
)
{
withContext
(
Dispatchers
.
IO
)
{
socket
=
Socket
(
serverHost
,
serverPort
)
socket
=
Socket
(
serverHost
,
serverPort
)
...
...
mirai-core/src/jvmTest/kotlin/net/mamoe/mirai/utils/LockFreeLinkedListTest.kt
View file @
60b6eab7
...
@@ -142,7 +142,7 @@ internal class LockFreeLinkedListTest {
...
@@ -142,7 +142,7 @@ internal class LockFreeLinkedListTest {
list
.
size
shouldBeEqualTo
0
list
.
size
shouldBeEqualTo
0
}
}
@
OptIn
(
ExperimentalUnsignedTypes
::
class
)
@
UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
@Test
@Test
fun
withInlineClassElements
()
{
fun
withInlineClassElements
()
{
val
list
=
LockFreeLinkedList
<
UInt
>()
val
list
=
LockFreeLinkedList
<
UInt
>()
...
@@ -270,7 +270,7 @@ internal class LockFreeLinkedListTest {
...
@@ -270,7 +270,7 @@ internal class LockFreeLinkedListTest {
*/
*/
}
}
@
OptIn
(
ExperimentalCoroutinesApi
::
class
)
@
UseExperimental
(
ExperimentalCoroutinesApi
::
class
)
@MiraiExperimentalAPI
@MiraiExperimentalAPI
internal
suspend
inline
fun
<
E
:
LockFreeLinkedList
<
*
>>
E
.
concurrentDo
(
numberOfCoroutines
:
Int
,
times
:
Int
,
crossinline
todo
:
E
.()
->
Unit
)
=
internal
suspend
inline
fun
<
E
:
LockFreeLinkedList
<
*
>>
E
.
concurrentDo
(
numberOfCoroutines
:
Int
,
times
:
Int
,
crossinline
todo
:
E
.()
->
Unit
)
=
coroutineScope
{
coroutineScope
{
...
...
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