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
3ba1ae4a
Commit
3ba1ae4a
authored
Mar 24, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust visibilities
parent
5dc0475a
Changes
56
Hide whitespace changes
Inline
Side-by-side
Showing
56 changed files
with
197 additions
and
154 deletions
+197
-154
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/GroupImpl.kt
...ain/kotlin/net/mamoe/mirai/qqandroid/contact/GroupImpl.kt
+2
-2
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/MemberImpl.kt
...in/kotlin/net/mamoe/mirai/qqandroid/contact/MemberImpl.kt
+4
-2
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/QQImpl.kt
...onMain/kotlin/net/mamoe/mirai/qqandroid/contact/QQImpl.kt
+12
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/event/PacketReceivedEvent.kt
...in/net/mamoe/mirai/qqandroid/event/PacketReceivedEvent.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/JceStruct.kt
...mmonMain/kotlin/net/mamoe/mirai/qqandroid/io/JceStruct.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/ProtoBuf.kt
...ommonMain/kotlin/net/mamoe/mirai/qqandroid/io/ProtoBuf.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/JceOld.kt
...tlin/net/mamoe/mirai/qqandroid/io/serialization/JceOld.kt
+2
-2
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/ProtoBufWithNullableSupport.kt
...qqandroid/io/serialization/ProtoBufWithNullableSupport.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/README.md
...tlin/net/mamoe/mirai/qqandroid/io/serialization/README.md
+2
-2
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/JceNew.kt
.../net/mamoe/mirai/qqandroid/io/serialization/jce/JceNew.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/common.kt
.../net/mamoe/mirai/qqandroid/io/serialization/jce/common.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/utils.kt
...otlin/net/mamoe/mirai/qqandroid/io/serialization/utils.kt
+13
-13
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/messages.kt
...Main/kotlin/net/mamoe/mirai/qqandroid/message/messages.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/Packet.kt
...onMain/kotlin/net/mamoe/mirai/qqandroid/network/Packet.kt
+11
-5
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
...moe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
+0
-2
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/Ticket.kt
...onMain/kotlin/net/mamoe/mirai/qqandroid/network/Ticket.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/ConfigPush.kt
...e/mirai/qqandroid/network/protocol/data/jce/ConfigPush.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/PushNotifyPack.kt
...rai/qqandroid/network/protocol/data/jce/PushNotifyPack.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/ImageRequest.kt
...rai/qqandroid/network/protocol/data/proto/ImageRequest.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgSvc.kt
...moe/mirai/qqandroid/network/protocol/data/proto/MsgSvc.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
+4
-4
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/IncomingPacketFactory.kt
...qandroid/network/protocol/packet/IncomingPacketFactory.kt
+0
-11
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/MessageMicro.kt
...e/mirai/qqandroid/network/protocol/packet/MessageMicro.kt
+0
-18
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/OutgoingPacketAndroid.kt
...qandroid/network/protocol/packet/OutgoingPacketAndroid.kt
+2
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt
.../mirai/qqandroid/network/protocol/packet/PacketFactory.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt
.../net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt
+54
-50
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/ChatType.kt
.../mirai/qqandroid/network/protocol/packet/chat/ChatType.kt
+1
-4
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/PbMessageSvc.kt
...ai/qqandroid/network/protocol/packet/chat/PbMessageSvc.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/TroopManagement.kt
...qqandroid/network/protocol/packet/chat/TroopManagement.kt
+4
-2
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/ImgStore.kt
.../qqandroid/network/protocol/packet/chat/image/ImgStore.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/LongConn.kt
.../qqandroid/network/protocol/packet/chat/image/LongConn.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.kt
...ndroid/network/protocol/packet/chat/receive/MessageSvc.kt
+5
-2
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/list/FriendList.kt
...irai/qqandroid/network/protocol/packet/list/FriendList.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/Heartbeat.kt
...irai/qqandroid/network/protocol/packet/login/Heartbeat.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/StatSvc.kt
.../mirai/qqandroid/network/protocol/packet/login/StatSvc.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/WtLogin.kt
.../mirai/qqandroid/network/protocol/packet/login/WtLogin.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/GuidSource.kt
...Main/kotlin/net/mamoe/mirai/qqandroid/utils/GuidSource.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/NetworkType.kt
...ain/kotlin/net/mamoe/mirai/qqandroid/utils/NetworkType.kt
+1
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/flags.kt
...ommonMain/kotlin/net/mamoe/mirai/qqandroid/utils/flags.kt
+1
-1
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Group.kt
...e/src/androidMain/kotlin/net/mamoe/mirai/contact/Group.kt
+2
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Group.kt
...re/src/commonMain/kotlin/net.mamoe.mirai/contact/Group.kt
+2
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/AddFriendResult.kt
...commonMain/kotlin/net.mamoe.mirai/data/AddFriendResult.kt
+2
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/FriendInfo.kt
.../src/commonMain/kotlin/net.mamoe.mirai/data/FriendInfo.kt
+3
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/FriendNameRemark.kt
...ommonMain/kotlin/net.mamoe.mirai/data/FriendNameRemark.kt
+4
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupActiveData.kt
...commonMain/kotlin/net.mamoe.mirai/data/GroupActiveData.kt
+2
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupAnnouncement.kt
...mmonMain/kotlin/net.mamoe.mirai/data/GroupAnnouncement.kt
+5
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupInfo.kt
...e/src/commonMain/kotlin/net.mamoe.mirai/data/GroupInfo.kt
+2
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/MemberInfo.kt
.../src/commonMain/kotlin/net.mamoe.mirai/data/MemberInfo.kt
+2
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/OnlineStatus.kt
...rc/commonMain/kotlin/net.mamoe.mirai/data/OnlineStatus.kt
+6
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/PreviousNameList.kt
...ommonMain/kotlin/net.mamoe.mirai/data/PreviousNameList.kt
+4
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/Profile.kt
...ore/src/commonMain/kotlin/net.mamoe.mirai/data/Profile.kt
+3
-0
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/message/MessagePacket.kt
...ommonMain/kotlin/net.mamoe.mirai/message/MessagePacket.kt
+1
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/qqandroid.network/Packet.kt
...onMain/kotlin/net.mamoe.mirai/qqandroid.network/Packet.kt
+14
-0
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Group.kt
...-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Group.kt
+2
-2
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/GroupImpl.kt
View file @
3ba1ae4a
...
...
@@ -7,7 +7,8 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
@
file
:
Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@
file
:
Suppress
(
"INAPPLICABLE_JVM_NAME"
)
@
file
:
OptIn
(
MiraiInternalAPI
::
class
,
LowLevelAPI
::
class
)
package
net.mamoe.mirai.qqandroid.contact
...
...
@@ -47,7 +48,6 @@ internal fun GroupImpl.Companion.checkIsInstance(instance: Group) {
}
@Suppress
(
"PropertyName"
)
@OptIn
(
MiraiInternalAPI
::
class
)
internal
class
GroupImpl
(
bot
:
QQAndroidBot
,
override
val
coroutineContext
:
CoroutineContext
,
override
val
id
:
Long
,
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/MemberImpl.kt
View file @
3ba1ae4a
...
...
@@ -10,6 +10,7 @@
package
net.mamoe.mirai.qqandroid.contact
import
kotlinx.coroutines.launch
import
net.mamoe.mirai.LowLevelAPI
import
net.mamoe.mirai.contact.*
import
net.mamoe.mirai.data.FriendNameRemark
import
net.mamoe.mirai.data.MemberInfo
...
...
@@ -30,9 +31,9 @@ import net.mamoe.mirai.utils.*
import
kotlin.coroutines.CoroutineContext
import
kotlin.jvm.JvmSynthetic
@OptIn
(
LowLevelAPI
::
class
)
@Suppress
(
"MemberVisibilityCanBePrivate"
)
internal
class
MemberImpl
(
internal
class
MemberImpl
constructor
(
val
qq
:
QQImpl
,
// 不要 WeakRef
group
:
GroupImpl
,
override
val
coroutineContext
:
CoroutineContext
,
...
...
@@ -212,6 +213,7 @@ internal class MemberImpl(
}
}
@OptIn
(
LowLevelAPI
::
class
)
internal
class
MemberInfoImpl
(
jceInfo
:
StTroopMemberInfo
,
groupOwnerId
:
Long
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/contact/QQImpl.kt
View file @
3ba1ae4a
/*
* Copyright 2020 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
@
file
:
OptIn
(
MiraiInternalAPI
::
class
,
LowLevelAPI
::
class
)
package
net.mamoe.mirai.qqandroid.contact
import
kotlinx.io.core.Closeable
import
net.mamoe.mirai.LowLevelAPI
import
net.mamoe.mirai.contact.Contact
import
net.mamoe.mirai.contact.QQ
import
net.mamoe.mirai.data.FriendInfo
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/event/PacketReceivedEvent.kt
View file @
3ba1ae4a
...
...
@@ -9,7 +9,7 @@
package
net.mamoe.mirai.qqandroid.event
import
net.mamoe.mirai.
data
.Packet
import
net.mamoe.mirai.
qqandroid.network
.Packet
import
net.mamoe.mirai.event.AbstractCancellableEvent
import
net.mamoe.mirai.event.Event
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/JceStruct.kt
View file @
3ba1ae4a
...
...
@@ -9,4 +9,4 @@
package
net.mamoe.mirai.qqandroid.io
interface
JceStruct
\ No newline at end of file
internal
interface
JceStruct
\ No newline at end of file
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/ProtoBuf.kt
View file @
3ba1ae4a
...
...
@@ -12,4 +12,4 @@ package net.mamoe.mirai.qqandroid.io
/**
* 仅有标示作用
*/
interface
ProtoBuf
inter
nal
inter
face
ProtoBuf
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/JceOld.kt
View file @
3ba1ae4a
...
...
@@ -48,7 +48,7 @@ internal val CharsetGBK = Charset.forName("GBK")
@PublishedApi
internal
val
CharsetUTF8
=
Charset
.
forName
(
"UTF8"
)
enum
class
JceCharset
(
val
kotlinCharset
:
Charset
)
{
internal
enum
class
JceCharset
(
val
kotlinCharset
:
Charset
)
{
GBK
(
Charset
.
forName
(
"GBK"
)),
UTF8
(
Charset
.
forName
(
"UTF8"
))
}
...
...
@@ -60,7 +60,7 @@ internal fun getSerialId(desc: SerialDescriptor, index: Int): Int? = desc.findAn
*/
@Suppress
(
"DEPRECATION_ERROR"
)
@OptIn
(
InternalSerializationApi
::
class
)
class
JceOld
private
constructor
(
private
val
charset
:
JceCharset
,
override
val
context
:
SerialModule
=
EmptyModule
)
:
internal
class
JceOld
private
constructor
(
private
val
charset
:
JceCharset
,
override
val
context
:
SerialModule
=
EmptyModule
)
:
SerialFormat
,
BinaryFormat
{
private
inner
class
ListWriter
(
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/ProtoBufWithNullableSupport.kt
View file @
3ba1ae4a
...
...
@@ -42,7 +42,7 @@ internal fun extractParameters(desc: SerialDescriptor, index: Int, zeroBasedDefa
* 代码复制自 kotlinx.serialization. 修改部分已进行标注 (详见 "MIRAI MODIFY START")
*/
@OptIn
(
InternalSerializationApi
::
class
)
class
ProtoBufWithNullableSupport
(
override
val
context
:
SerialModule
=
EmptyModule
)
:
SerialFormat
,
BinaryFormat
{
internal
class
ProtoBufWithNullableSupport
(
override
val
context
:
SerialModule
=
EmptyModule
)
:
SerialFormat
,
BinaryFormat
{
internal
open
inner
class
ProtobufWriter
(
private
val
encoder
:
ProtobufEncoder
)
:
TaggedEncoder
<
ProtoDesc
>()
{
override
val
context
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/README.md
View file @
3ba1ae4a
...
...
@@ -3,8 +3,8 @@
**序列化支持**
包含:
-
QQ 的 JceStruct 相关的全自动序列化和反序列化:
[
Jce.kt
](
Jce
.kt
)
-
QQ 的 JceStruct 相关的全自动序列化和反序列化:
[
Jce.kt
](
jce/JceNew
.kt
)
-
Protocol Buffers 的 optional 支持:
[
ProtoBufWithNullableSupport.kt
](
ProtoBufWithNullableSupport.kt
)
其中,
ProtoBufWithNullableSupport.kt
的绝大部分源码来自
`kotlinx.serialization`
. 原著权归该项目作者所有.
其中,
`ProtoBufWithNullableSupport`
的绝大部分源码来自
`kotlinx.serialization`
. 原著权归该项目作者所有.
Mirai 所做的修改已经标记上了
`MIRAI MODIFY START`
\ No newline at end of file
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/JceNew.kt
View file @
3ba1ae4a
...
...
@@ -26,7 +26,7 @@ import net.mamoe.mirai.utils.io.toReadPacket
*
* @author Him188
*/
class
Jce
(
internal
class
Jce
(
override
val
context
:
SerialModule
,
val
charset
:
JceCharset
)
:
SerialFormat
,
IOFormat
,
BinaryFormat
{
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/jce/common.kt
View file @
3ba1ae4a
...
...
@@ -19,7 +19,7 @@ import kotlinx.serialization.SerialInfo
*/
@SerialInfo
@Target
(
AnnotationTarget
.
PROPERTY
)
annotation
class
JceId
(
val
id
:
Int
)
internal
annotation
class
JceId
(
val
id
:
Int
)
/**
* 类中元素的 tag
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/io/serialization/utils.kt
View file @
3ba1ae4a
...
...
@@ -31,11 +31,11 @@ import kotlin.jvm.JvmMultifileClass
import
kotlin.jvm.JvmName
fun
<
T
:
JceStruct
>
ByteArray
.
loadAs
(
deserializer
:
DeserializationStrategy
<
T
>,
c
:
JceCharset
=
JceCharset
.
UTF8
):
T
{
internal
fun
<
T
:
JceStruct
>
ByteArray
.
loadAs
(
deserializer
:
DeserializationStrategy
<
T
>,
c
:
JceCharset
=
JceCharset
.
UTF8
):
T
{
return
Jce
.
byCharSet
(
c
).
load
(
deserializer
,
this
.
toReadPacket
())
}
fun
<
T
:
JceStruct
>
BytePacketBuilder
.
writeJceStruct
(
internal
fun
<
T
:
JceStruct
>
BytePacketBuilder
.
writeJceStruct
(
serializer
:
SerializationStrategy
<
T
>,
struct
:
T
,
charset
:
JceCharset
=
JceCharset
.
GBK
...
...
@@ -43,7 +43,7 @@ fun <T : JceStruct> BytePacketBuilder.writeJceStruct(
Jce
.
byCharSet
(
charset
).
dumpTo
(
serializer
,
struct
,
this
)
}
fun
<
T
:
JceStruct
>
ByteReadPacket
.
readJceStruct
(
internal
fun
<
T
:
JceStruct
>
ByteReadPacket
.
readJceStruct
(
serializer
:
DeserializationStrategy
<
T
>,
charset
:
JceCharset
=
JceCharset
.
UTF8
,
length
:
Int
=
this
.
remaining
.
toInt
()
...
...
@@ -55,7 +55,7 @@ fun <T : JceStruct> ByteReadPacket.readJceStruct(
/**
* 先解析为 [RequestPacket], 即 `UniRequest`, 再按版本解析 map, 再找出指定数据并反序列化
*/
fun
<
T
:
JceStruct
>
ByteReadPacket
.
decodeUniPacket
(
deserializer
:
DeserializationStrategy
<
T
>,
name
:
String
?
=
null
):
T
{
internal
fun
<
T
:
JceStruct
>
ByteReadPacket
.
decodeUniPacket
(
deserializer
:
DeserializationStrategy
<
T
>,
name
:
String
?
=
null
):
T
{
return
decodeUniRequestPacketAndDeserialize
(
name
)
{
it
.
read
{
discardExact
(
1
)
...
...
@@ -67,7 +67,7 @@ fun <T : JceStruct> ByteReadPacket.decodeUniPacket(deserializer: Deserialization
/**
* 先解析为 [RequestPacket], 即 `UniRequest`, 再按版本解析 map, 再找出指定数据并反序列化
*/
fun
<
T
:
ProtoBuf
>
ByteReadPacket
.
decodeUniPacket
(
deserializer
:
DeserializationStrategy
<
T
>,
name
:
String
?
=
null
):
T
{
internal
fun
<
T
:
ProtoBuf
>
ByteReadPacket
.
decodeUniPacket
(
deserializer
:
DeserializationStrategy
<
T
>,
name
:
String
?
=
null
):
T
{
return
decodeUniRequestPacketAndDeserialize
(
name
)
{
it
.
read
{
discardExact
(
1
)
...
...
@@ -76,7 +76,7 @@ fun <T : ProtoBuf> ByteReadPacket.decodeUniPacket(deserializer: DeserializationS
}
}
fun
<
R
>
ByteReadPacket
.
decodeUniRequestPacketAndDeserialize
(
name
:
String
?
=
null
,
block
:
(
ByteArray
)
->
R
):
R
{
internal
fun
<
R
>
ByteReadPacket
.
decodeUniRequestPacketAndDeserialize
(
name
:
String
?
=
null
,
block
:
(
ByteArray
)
->
R
):
R
{
val
request
=
this
.
readJceStruct
(
RequestPacket
.
serializer
())
return
block
(
if
(
name
==
null
)
when
(
request
.
iVersion
?.
toInt
()
?:
3
)
{
...
...
@@ -91,31 +91,31 @@ fun <R> ByteReadPacket.decodeUniRequestPacketAndDeserialize(name: String? = null
})
}
fun
<
T
:
JceStruct
>
T
.
toByteArray
(
serializer
:
SerializationStrategy
<
T
>,
c
:
JceCharset
=
JceCharset
.
GBK
):
ByteArray
=
internal
fun
<
T
:
JceStruct
>
T
.
toByteArray
(
serializer
:
SerializationStrategy
<
T
>,
c
:
JceCharset
=
JceCharset
.
GBK
):
ByteArray
=
Jce
.
byCharSet
(
c
).
dump
(
serializer
,
this
)
fun
<
T
:
ProtoBuf
>
BytePacketBuilder
.
writeProtoBuf
(
serializer
:
SerializationStrategy
<
T
>,
v
:
T
)
{
internal
fun
<
T
:
ProtoBuf
>
BytePacketBuilder
.
writeProtoBuf
(
serializer
:
SerializationStrategy
<
T
>,
v
:
T
)
{
this
.
writeFully
(
v
.
toByteArray
(
serializer
))
}
/**
* dump
*/
fun
<
T
:
ProtoBuf
>
T
.
toByteArray
(
serializer
:
SerializationStrategy
<
T
>):
ByteArray
{
internal
fun
<
T
:
ProtoBuf
>
T
.
toByteArray
(
serializer
:
SerializationStrategy
<
T
>):
ByteArray
{
return
ProtoBufWithNullableSupport
.
dump
(
serializer
,
this
)
}
/**
* load
*/
fun
<
T
:
ProtoBuf
>
ByteArray
.
loadAs
(
deserializer
:
DeserializationStrategy
<
T
>):
T
{
internal
fun
<
T
:
ProtoBuf
>
ByteArray
.
loadAs
(
deserializer
:
DeserializationStrategy
<
T
>):
T
{
return
ProtoBufWithNullableSupport
.
load
(
deserializer
,
this
)
}
/**
* load
*/
fun
<
T
:
ProtoBuf
>
ByteReadPacket
.
readProtoBuf
(
internal
fun
<
T
:
ProtoBuf
>
ByteReadPacket
.
readProtoBuf
(
serializer
:
DeserializationStrategy
<
T
>,
length
:
Int
=
this
.
remaining
.
toInt
()
):
T
{
...
...
@@ -125,11 +125,11 @@ fun <T : ProtoBuf> ByteReadPacket.readProtoBuf(
/**
* 构造 [RequestPacket] 的 [RequestPacket.sBuffer]
*/
fun
<
T
:
JceStruct
>
jceRequestSBuffer
(
name
:
String
,
serializer
:
SerializationStrategy
<
T
>,
jceStruct
:
T
):
ByteArray
{
internal
fun
<
T
:
JceStruct
>
jceRequestSBuffer
(
name
:
String
,
serializer
:
SerializationStrategy
<
T
>,
jceStruct
:
T
):
ByteArray
{
return
jceRequestSBuffer
(
name
,
serializer
,
jceStruct
,
JceCharset
.
GBK
)
}
fun
<
T
:
JceStruct
>
jceRequestSBuffer
(
internal
fun
<
T
:
JceStruct
>
jceRequestSBuffer
(
name
:
String
,
serializer
:
SerializationStrategy
<
T
>,
jceStruct
:
T
,
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/messages.kt
View file @
3ba1ae4a
...
...
@@ -93,7 +93,7 @@ _400Height=0x000000EB(235)
pbReserve=<Empty ByteArray>
}
*/
val
FACE_BUF
=
"00 01 00 04 52 CC F5 D0"
.
hexToBytes
()
internal
val
FACE_BUF
=
"00 01 00 04 52 CC F5 D0"
.
hexToBytes
()
internal
fun
Face
.
toJceData
():
ImMsgBody
.
Face
{
return
ImMsgBody
.
Face
(
...
...
mirai-core
/src/commonMain/kotlin/net.mamoe.mirai/data
/Packet.kt
→
mirai-core
-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network
/Packet.kt
View file @
3ba1ae4a
...
...
@@ -7,7 +7,11 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
package
net.mamoe.mirai.data
package
net.mamoe.mirai.qqandroid.network
/*
// moved to `mirai-core`
/**
* 从服务器收到的包解析之后的结构化数据.
...
...
@@ -19,8 +23,9 @@ interface Packet {
*/
interface NoLog
}
*/
object
NoPacket
:
Packet
{
internal
object
NoPacket
:
Packet
{
override
fun
toString
():
String
{
return
"NoPacket"
}
...
...
@@ -29,14 +34,15 @@ object NoPacket : Packet {
/**
* PacketFactory 可以一次解析多个包出来. 它们将会被分别广播.
*/
interface
MultiPacket
<
out
P
:
Packet
>
:
Packet
,
Iterable
<
P
>
inter
nal
inter
face
MultiPacket
<
out
P
:
Packet
>
:
Packet
,
Iterable
<
P
>
open
class
MultiPacketByIterable
<
out
P
:
Packet
>(
internal
val
delegate
:
Iterable
<
P
>)
:
MultiPacket
<
P
>,
internal
open
class
MultiPacketByIterable
<
out
P
:
Packet
>(
internal
val
delegate
:
Iterable
<
P
>)
:
MultiPacket
<
P
>,
Iterable
<
P
>
by
delegate
{
override
fun
toString
():
String
=
"MultiPacketByIterable"
}
open
class
MultiPacketBySequence
<
out
P
:
Packet
>(
internal
val
delegate
:
Sequence
<
P
>)
:
MultiPacket
<
P
>
{
internal
open
class
MultiPacketBySequence
<
out
P
:
Packet
>(
internal
val
delegate
:
Sequence
<
P
>)
:
MultiPacket
<
P
>
{
override
operator
fun
iterator
():
Iterator
<
P
>
=
delegate
.
iterator
()
override
fun
toString
():
String
=
"MultiPacketBySequence"
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
View file @
3ba1ae4a
...
...
@@ -18,8 +18,6 @@ import kotlinx.io.core.ByteReadPacket
import
kotlinx.io.core.Input
import
kotlinx.io.core.buildPacket
import
kotlinx.io.core.use
import
net.mamoe.mirai.data.MultiPacket
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.event.*
import
net.mamoe.mirai.event.events.BotOfflineEvent
import
net.mamoe.mirai.event.events.BotOnlineEvent
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/Ticket.kt
View file @
3ba1ae4a
...
...
@@ -9,7 +9,7 @@
package
net.mamoe.mirai.qqandroid.network
class
Ticket
(
internal
class
Ticket
(
val
id
:
Int
,
val
data
:
ByteArray
,
val
key
:
ByteArray
?,
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/ConfigPush.kt
View file @
3ba1ae4a
...
...
@@ -10,7 +10,7 @@
package
net.mamoe.mirai.qqandroid.network.protocol.data.jce
import
kotlinx.serialization.Serializable
import
net.mamoe.mirai.
data
.Packet
import
net.mamoe.mirai.
qqandroid.network
.Packet
import
net.mamoe.mirai.qqandroid.io.JceStruct
import
net.mamoe.mirai.qqandroid.io.serialization.jce.JceId
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/jce/PushNotifyPack.kt
View file @
3ba1ae4a
...
...
@@ -10,7 +10,7 @@
package
net.mamoe.mirai.qqandroid.network.protocol.data.jce
import
kotlinx.serialization.Serializable
import
net.mamoe.mirai.
data
.Packet
import
net.mamoe.mirai.
qqandroid.network
.Packet
import
net.mamoe.mirai.qqandroid.io.JceStruct
import
net.mamoe.mirai.qqandroid.io.serialization.jce.JceId
import
net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/ImageRequest.kt
View file @
3ba1ae4a
...
...
@@ -14,7 +14,7 @@ import kotlinx.serialization.protobuf.ProtoId
import
net.mamoe.mirai.qqandroid.io.ProtoBuf
import
net.mamoe.mirai.utils.currentTimeSeconds
interface
ImgReq
:
ProtoBuf
inter
nal
inter
face
ImgReq
:
ProtoBuf
// cmd0x352$ReqBody
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/MsgSvc.kt
View file @
3ba1ae4a
...
...
@@ -11,7 +11,7 @@ package net.mamoe.mirai.qqandroid.network.protocol.data.proto
import
kotlinx.serialization.Serializable
import
kotlinx.serialization.protobuf.ProtoId
import
net.mamoe.mirai.
data
.Packet
import
net.mamoe.mirai.
qqandroid.network
.Packet
import
net.mamoe.mirai.qqandroid.io.ProtoBuf
import
net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/EncryptMethod.kt
View file @
3ba1ae4a
...
...
@@ -43,22 +43,22 @@ internal interface EncryptMethodSessionKey : EncryptMethod {
}
}
in
line
class
EncryptMethodSessionKeyLoginState2
(
override
val
sessionKey
:
ByteArray
)
:
in
ternal
class
EncryptMethodSessionKeyLoginState2
(
override
val
sessionKey
:
ByteArray
)
:
EncryptMethodSessionKey
{
override
val
currentLoginState
:
Int
get
()
=
2
}
in
line
class
EncryptMethodSessionKeyLoginState3
(
override
val
sessionKey
:
ByteArray
)
:
in
ternal
class
EncryptMethodSessionKeyLoginState3
(
override
val
sessionKey
:
ByteArray
)
:
EncryptMethodSessionKey
{
override
val
currentLoginState
:
Int
get
()
=
3
}
internal
inline
class
EncryptMethodECDH135
(
override
val
ecdh
:
ECDH
)
:
internal
class
EncryptMethodECDH135
(
override
val
ecdh
:
ECDH
)
:
EncryptMethodECDH
{
override
val
id
:
Int
get
()
=
135
}
internal
inline
class
EncryptMethodECDH7
(
override
val
ecdh
:
ECDH
)
:
internal
class
EncryptMethodECDH7
(
override
val
ecdh
:
ECDH
)
:
EncryptMethodECDH
{
override
val
id
:
Int
get
()
=
7
}
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/IncomingPacketFactory.kt
deleted
100644 → 0
View file @
5dc0475a
/*
* Copyright 2020 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
package
net.mamoe.mirai.qqandroid.network.protocol.packet
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/MessageMicro.kt
deleted
100644 → 0
View file @
5dc0475a
/*
* Copyright 2020 Mamoe Technologies and contributors.
*
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
*
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
package
net.mamoe.mirai.qqandroid.network.protocol.packet
import
kotlinx.serialization.SerializationStrategy
import
net.mamoe.mirai.qqandroid.io.serialization.ProtoBufWithNullableSupport
interface
MessageMicro
fun
<
T
:
MessageMicro
>
T
.
toByteArray
(
serializer
:
SerializationStrategy
<
T
>):
ByteArray
=
ProtoBufWithNullableSupport
.
dump
(
serializer
,
this
)
\ No newline at end of file
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/OutgoingPacketAndroid.kt
View file @
3ba1ae4a
...
...
@@ -34,6 +34,7 @@ internal class OutgoingPacket constructor(
internal
val
KEY_16_ZEROS
=
ByteArray
(
16
)
internal
val
EMPTY_BYTE_ARRAY
=
ByteArray
(
0
)
@Suppress
(
"DuplicatedCode"
)
@OptIn
(
MiraiInternalAPI
::
class
)
internal
inline
fun
OutgoingPacketFactory
<*>.
buildOutgoingUniPacket
(
client
:
QQAndroidClient
,
...
...
@@ -77,6 +78,7 @@ internal inline fun IncomingPacketFactory<*>.buildResponseUniPacket(
sequenceId
:
Int
=
client
.
nextSsoSequenceId
(),
body
:
BytePacketBuilder
.(
sequenceId
:
Int
)
->
Unit
):
OutgoingPacket
{
@Suppress
(
"DuplicatedCode"
)
return
OutgoingPacket
(
name
,
commandName
,
sequenceId
,
buildPacket
{
writeIntLVPacket
(
lengthOffset
=
{
it
+
4
})
{
writeInt
(
0
x0B
)
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt
View file @
3ba1ae4a
...
...
@@ -11,7 +11,7 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet
import
kotlinx.io.core.*
import
kotlinx.io.pool.useInstance
import
net.mamoe.mirai.
data
.Packet
import
net.mamoe.mirai.
qqandroid.network
.Packet
import
net.mamoe.mirai.event.Event
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.network.protocol.packet.chat.PbMessageSvc
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt
View file @
3ba1ae4a
...
...
@@ -7,6 +7,8 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
@
file
:
Suppress
(
"NOTHING_TO_INLINE"
)
package
net.mamoe.mirai.qqandroid.network.protocol.packet
import
kotlinx.io.core.BytePacketBuilder
...
...
@@ -24,9 +26,9 @@ import kotlin.random.Random
/**
* 显式表示一个 [ByteArray] 是一个 tlv 的 body
*/
inline
class
Tlv
(
val
value
:
ByteArray
)
in
ternal
in
line
class
Tlv
(
val
value
:
ByteArray
)
fun
BytePacketBuilder
.
t1
(
uin
:
Long
,
ip
:
ByteArray
)
{
internal
fun
BytePacketBuilder
.
t1
(
uin
:
Long
,
ip
:
ByteArray
)
{
require
(
ip
.
size
==
4
)
{
"ip.size must == 4"
}
writeShort
(
0
x1
)
writeShortLVPacket
{
...
...
@@ -39,7 +41,7 @@ fun BytePacketBuilder.t1(uin: Long, ip: ByteArray) {
}
shouldEqualsTo
20
}
fun
BytePacketBuilder
.
t2
(
captchaCode
:
String
,
captchaToken
:
ByteArray
,
sigVer
:
Short
=
0
)
{
internal
fun
BytePacketBuilder
.
t2
(
captchaCode
:
String
,
captchaToken
:
ByteArray
,
sigVer
:
Short
=
0
)
{
writeShort
(
0
x2
)
writeShortLVPacket
{
writeShort
(
sigVer
)
...
...
@@ -48,7 +50,7 @@ fun BytePacketBuilder.t2(captchaCode: String, captchaToken: ByteArray, sigVer: S
}
}
fun
BytePacketBuilder
.
t8
(
internal
fun
BytePacketBuilder
.
t8
(
localId
:
Int
=
2052
)
{
writeShort
(
0
x8
)
...
...
@@ -59,7 +61,7 @@ fun BytePacketBuilder.t8(
}
}
fun
BytePacketBuilder
.
t18
(
internal
fun
BytePacketBuilder
.
t18
(
appId
:
Long
,
appClientVersion
:
Int
=
0
,
uin
:
Long
,
...
...
@@ -78,7 +80,7 @@ fun BytePacketBuilder.t18(
}
@OptIn
(
MiraiInternalAPI
::
class
)
fun
BytePacketBuilder
.
t106
(
internal
fun
BytePacketBuilder
.
t106
(
appId
:
Long
=
16L
,
subAppId
:
Long
=
537062845L
,
appClientVersion
:
Int
=
0
,
...
...
@@ -136,7 +138,7 @@ fun BytePacketBuilder.t106(
}
}
fun
BytePacketBuilder
.
t116
(
internal
fun
BytePacketBuilder
.
t116
(
miscBitmap
:
Int
,
subSigMap
:
Int
,
appIdList
:
LongArray
=
longArrayOf
(
1600000226L
)
...
...
@@ -154,7 +156,7 @@ fun BytePacketBuilder.t116(
}
fun
BytePacketBuilder
.
t100
(
internal
fun
BytePacketBuilder
.
t100
(
appId
:
Long
=
16
,
subAppId
:
Long
=
537062845
,
appClientVersion
:
Int
...
...
@@ -170,7 +172,7 @@ fun BytePacketBuilder.t100(
}
shouldEqualsTo
22
}
fun
BytePacketBuilder
.
t107
(
internal
fun
BytePacketBuilder
.
t107
(
picType
:
Int
,
const1_always_0
:
Int
=
0
,
const2_always_0
:
Int
=
0
,
...
...
@@ -185,7 +187,7 @@ fun BytePacketBuilder.t107(
}
shouldEqualsTo
6
}
fun
BytePacketBuilder
.
t108
(
internal
fun
BytePacketBuilder
.
t108
(
ksid
:
ByteArray
)
{
require
(
ksid
.
size
==
16
)
{
"ksid should length 16"
}
...
...
@@ -195,7 +197,7 @@ fun BytePacketBuilder.t108(
}
}
fun
BytePacketBuilder
.
t104
(
internal
fun
BytePacketBuilder
.
t104
(
t104Data
:
ByteArray
)
{
writeShort
(
0
x104
)
...
...
@@ -204,7 +206,7 @@ fun BytePacketBuilder.t104(
}
}
fun
BytePacketBuilder
.
t174
(
internal
fun
BytePacketBuilder
.
t174
(
t174Data
:
ByteArray
)
{
writeShort
(
0
x174
)
...
...
@@ -214,7 +216,7 @@ fun BytePacketBuilder.t174(
}
fun
BytePacketBuilder
.
t17a
(
internal
fun
BytePacketBuilder
.
t17a
(
value
:
Int
=
0
)
{
writeShort
(
0
x17a
)
...
...
@@ -223,7 +225,7 @@ fun BytePacketBuilder.t17a(
}
}
fun
BytePacketBuilder
.
t197
(
internal
fun
BytePacketBuilder
.
t197
(
value
:
ByteArray
)
{
writeShort
(
0
x197
)
...
...
@@ -232,7 +234,7 @@ fun BytePacketBuilder.t197(
}
}
fun
BytePacketBuilder
.
t19e
(
internal
fun
BytePacketBuilder
.
t19e
(
value
:
Int
=
0
)
{
writeShort
(
0
x19e
)
...
...
@@ -242,7 +244,7 @@ fun BytePacketBuilder.t19e(
}
}
fun
BytePacketBuilder
.
t17c
(
internal
fun
BytePacketBuilder
.
t17c
(
t17cData
:
ByteArray
)
{
writeShort
(
0
x17c
)
...
...
@@ -252,7 +254,7 @@ fun BytePacketBuilder.t17c(
}
}
fun
BytePacketBuilder
.
t401
(
internal
fun
BytePacketBuilder
.
t401
(
t401Data
:
ByteArray
)
{
writeShort
(
0
x401
)
...
...
@@ -264,7 +266,7 @@ fun BytePacketBuilder.t401(
/**
* @param apkId application.getPackageName().getBytes()
*/
fun
BytePacketBuilder
.
t142
(
internal
fun
BytePacketBuilder
.
t142
(
apkId
:
ByteArray
)
{
writeShort
(
0
x142
)
...
...
@@ -274,7 +276,7 @@ fun BytePacketBuilder.t142(
}
}
fun
BytePacketBuilder
.
t112
(
internal
fun
BytePacketBuilder
.
t112
(
nonNumberUin
:
ByteArray
)
{
writeShort
(
0
x112
)
...
...
@@ -283,7 +285,7 @@ fun BytePacketBuilder.t112(
}
}
fun
BytePacketBuilder
.
t144
(
internal
fun
BytePacketBuilder
.
t144
(
// t109
androidId
:
ByteArray
,
...
...
@@ -324,7 +326,7 @@ fun BytePacketBuilder.t144(
}
@OptIn
(
MiraiInternalAPI
::
class
)
fun
BytePacketBuilder
.
t109
(
internal
fun
BytePacketBuilder
.
t109
(
androidId
:
ByteArray
)
{
writeShort
(
0
x109
)
...
...
@@ -333,7 +335,7 @@ fun BytePacketBuilder.t109(
}
shouldEqualsTo
16
}
fun
BytePacketBuilder
.
t52d
(
internal
fun
BytePacketBuilder
.
t52d
(
androidDevInfo
:
ByteArray
// oicq.wlogin_sdk.tools.util#get_android_dev_info
)
{
writeShort
(
0
x52d
)
...
...
@@ -345,7 +347,7 @@ fun BytePacketBuilder.t52d(
}
}
fun
BytePacketBuilder
.
t124
(
internal
fun
BytePacketBuilder
.
t124
(
osType
:
ByteArray
=
"android"
.
toByteArray
(),
osVersion
:
ByteArray
,
// Build.VERSION.RELEASE.toByteArray()
networkType
:
NetworkType
,
//oicq.wlogin_sdk.tools.util#get_network_type
...
...
@@ -364,7 +366,7 @@ fun BytePacketBuilder.t124(
}
}
fun
BytePacketBuilder
.
t128
(
internal
fun
BytePacketBuilder
.
t128
(
isGuidFromFileNull
:
Boolean
=
false
,
// 保存到文件的 GUID 是否为 null
isGuidAvailable
:
Boolean
=
true
,
// GUID 是否可用(计算/读取成功)
isGuidChanged
:
Boolean
=
false
,
// GUID 是否有变动
...
...
@@ -418,7 +420,7 @@ fun BytePacketBuilder.t128(
}
}
fun
BytePacketBuilder
.
t16e
(
internal
fun
BytePacketBuilder
.
t16e
(
buildModel
:
ByteArray
)
{
writeShort
(
0
x16e
)
...
...
@@ -427,7 +429,7 @@ fun BytePacketBuilder.t16e(
}
}
fun
BytePacketBuilder
.
t145
(
internal
fun
BytePacketBuilder
.
t145
(
guid
:
ByteArray
)
{
writeShort
(
0
x145
)
...
...
@@ -436,7 +438,7 @@ fun BytePacketBuilder.t145(
}
}
fun
BytePacketBuilder
.
t147
(
internal
fun
BytePacketBuilder
.
t147
(
appId
:
Long
,
apkVersionName
:
ByteArray
,
apkSignatureMd5
:
ByteArray
...
...
@@ -449,7 +451,7 @@ fun BytePacketBuilder.t147(
}
}
fun
BytePacketBuilder
.
t166
(
internal
fun
BytePacketBuilder
.
t166
(
imageType
:
Int
)
{
writeShort
(
0
x166
)
...
...
@@ -458,7 +460,7 @@ fun BytePacketBuilder.t166(
}
}
fun
BytePacketBuilder
.
t16a
(
internal
fun
BytePacketBuilder
.
t16a
(
noPicSig
:
ByteArray
// unknown source
)
{
writeShort
(
0
x16a
)
...
...
@@ -467,7 +469,7 @@ fun BytePacketBuilder.t16a(
}
}
fun
BytePacketBuilder
.
t154
(
internal
fun
BytePacketBuilder
.
t154
(
ssoSequenceId
:
Int
// starts from 0
)
{
writeShort
(
0
x154
)
...
...
@@ -476,7 +478,7 @@ fun BytePacketBuilder.t154(
}
}
fun
BytePacketBuilder
.
t141
(
internal
fun
BytePacketBuilder
.
t141
(
simInfo
:
ByteArray
,
networkType
:
NetworkType
,
apn
:
ByteArray
...
...
@@ -490,7 +492,7 @@ fun BytePacketBuilder.t141(
}
}
fun
BytePacketBuilder
.
t511
(
internal
fun
BytePacketBuilder
.
t511
(
domains
:
List
<
String
>
)
{
writeShort
(
0
x511
)
...
...
@@ -517,7 +519,7 @@ fun BytePacketBuilder.t511(
}
}
fun
BytePacketBuilder
.
t172
(
internal
fun
BytePacketBuilder
.
t172
(
rollbackSig
:
ByteArray
// 由服务器发来的 tlv_t172 获得
)
{
writeShort
(
0
x172
)
...
...
@@ -526,7 +528,7 @@ fun BytePacketBuilder.t172(
}
}
fun
BytePacketBuilder
.
t185
()
{
internal
fun
BytePacketBuilder
.
t185
()
{
writeShort
(
0
x185
)
writeShortLVPacket
{
writeByte
(
1
)
...
...
@@ -534,7 +536,7 @@ fun BytePacketBuilder.t185() {
}
}
fun
BytePacketBuilder
.
t400
(
internal
fun
BytePacketBuilder
.
t400
(
g
:
ByteArray
,
// 用于加密这个 tlv
uin
:
Long
,
guid
:
ByteArray
,
...
...
@@ -560,7 +562,7 @@ fun BytePacketBuilder.t400(
}
@OptIn
(
MiraiInternalAPI
::
class
)
fun
BytePacketBuilder
.
t187
(
internal
fun
BytePacketBuilder
.
t187
(
macAddress
:
ByteArray
)
{
writeShort
(
0
x187
)
...
...
@@ -570,7 +572,7 @@ fun BytePacketBuilder.t187(
}
@OptIn
(
MiraiInternalAPI
::
class
)
fun
BytePacketBuilder
.
t188
(
internal
fun
BytePacketBuilder
.
t188
(
androidId
:
ByteArray
)
{
writeShort
(
0
x188
)
...
...
@@ -579,7 +581,7 @@ fun BytePacketBuilder.t188(
}
shouldEqualsTo
16
}
fun
BytePacketBuilder
.
t193
(
internal
fun
BytePacketBuilder
.
t193
(
ticket
:
String
)
{
writeShort
(
0
x193
)
...
...
@@ -588,7 +590,7 @@ fun BytePacketBuilder.t193(
}
}
fun
BytePacketBuilder
.
t194
(
internal
fun
BytePacketBuilder
.
t194
(
imsiMd5
:
ByteArray
)
{
imsiMd5
requireSize
16
...
...
@@ -599,7 +601,7 @@ fun BytePacketBuilder.t194(
}
shouldEqualsTo
16
}
fun
BytePacketBuilder
.
t191
(
internal
fun
BytePacketBuilder
.
t191
(
K
:
Int
=
0
x82
)
{
writeShort
(
0
x191
)
...
...
@@ -608,7 +610,7 @@ fun BytePacketBuilder.t191(
}
}
fun
BytePacketBuilder
.
t201
(
internal
fun
BytePacketBuilder
.
t201
(
L
:
ByteArray
=
byteArrayOf
(),
// unknown
channelId
:
ByteArray
=
byteArrayOf
(),
clientType
:
ByteArray
=
"qq"
.
toByteArray
(),
...
...
@@ -623,7 +625,7 @@ fun BytePacketBuilder.t201(
}
}
fun
BytePacketBuilder
.
t202
(
internal
fun
BytePacketBuilder
.
t202
(
wifiBSSID
:
ByteArray
,
wifiSSID
:
ByteArray
)
{
...
...
@@ -634,7 +636,7 @@ fun BytePacketBuilder.t202(
}
}
fun
BytePacketBuilder
.
t177
(
internal
fun
BytePacketBuilder
.
t177
(
unknown1
:
Long
=
1571193922L
,
unknown2
:
String
=
"6.0.0.2413"
)
{
...
...
@@ -646,7 +648,7 @@ fun BytePacketBuilder.t177(
}
shouldEqualsTo
0
x11
}
fun
BytePacketBuilder
.
t516
(
// 1302
internal
fun
BytePacketBuilder
.
t516
(
// 1302
sourceType
:
Int
=
0
// always 0
)
{
writeShort
(
0
x516
)
...
...
@@ -655,7 +657,7 @@ fun BytePacketBuilder.t516( // 1302
}
shouldEqualsTo
4
}
fun
BytePacketBuilder
.
t521
(
// 1313
internal
fun
BytePacketBuilder
.
t521
(
// 1313
productType
:
Int
=
0
,
// coz setProductType is never used
unknown
:
Short
=
0
// const
)
{
...
...
@@ -666,7 +668,7 @@ fun BytePacketBuilder.t521( // 1313
}
shouldEqualsTo
6
}
fun
BytePacketBuilder
.
t536
(
// 1334
internal
fun
BytePacketBuilder
.
t536
(
// 1334
loginExtraData
:
ByteArray
)
{
writeShort
(
0
x536
)
...
...
@@ -675,7 +677,7 @@ fun BytePacketBuilder.t536( // 1334
}
}
fun
BytePacketBuilder
.
t525
(
internal
fun
BytePacketBuilder
.
t525
(
t536
:
ByteReadPacket
)
{
writeShort
(
0
x525
)
...
...
@@ -685,7 +687,7 @@ fun BytePacketBuilder.t525(
}
}
fun
BytePacketBuilder
.
t318
(
internal
fun
BytePacketBuilder
.
t318
(
tgtQR
:
ByteArray
// unknown
)
{
writeShort
(
0
x318
)
...
...
@@ -694,8 +696,10 @@ fun BytePacketBuilder.t318(
}
}
private
fun
Boolean
.
toByte
():
Byte
=
if
(
this
)
1
else
0
private
fun
Boolean
.
toInt
():
Int
=
if
(
this
)
1
else
0
private
inline
fun
Boolean
.
toByte
():
Byte
=
if
(
this
)
1
else
0
private
inline
fun
Boolean
.
toInt
():
Int
=
if
(
this
)
1
else
0
// noinline: wrong exception stacktrace reported
private
infix
fun
Int
.
shouldEqualsTo
(
int
:
Int
)
=
check
(
this
==
int
)
{
"Required $int, but found $this"
}
private
infix
fun
ByteArray
.
requireSize
(
exactSize
:
Int
)
=
check
(
this
.
size
==
exactSize
)
{
"Required size $exactSize, but found ${this.size}"
}
\ No newline at end of file
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/ChatType.kt
View file @
3ba1ae4a
...
...
@@ -9,10 +9,7 @@
package
net.mamoe.mirai.qqandroid.network.protocol.packet.chat
/**
* TROOP仍然不知道是什么
*/
enum
class
ChatType
(
val
internalID
:
Int
)
{
internal
enum
class
ChatType
(
val
internalID
:
Int
)
{
FRIEND
(
2
),
//可以为任何数字
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/PbMessageSvc.kt
View file @
3ba1ae4a
...
...
@@ -10,7 +10,7 @@
package
net.mamoe.mirai.qqandroid.network.protocol.packet.chat
import
kotlinx.io.core.ByteReadPacket
import
net.mamoe.mirai.
data
.Packet
import
net.mamoe.mirai.
qqandroid.network
.Packet
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.io.serialization.readProtoBuf
import
net.mamoe.mirai.qqandroid.io.serialization.toByteArray
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/TroopManagement.kt
View file @
3ba1ae4a
...
...
@@ -13,9 +13,10 @@ import kotlinx.io.core.ByteReadPacket
import
kotlinx.io.core.buildPacket
import
kotlinx.io.core.readBytes
import
kotlinx.io.core.toByteArray
import
net.mamoe.mirai.LowLevelAPI
import
net.mamoe.mirai.contact.Group
import
net.mamoe.mirai.contact.Member
import
net.mamoe.mirai.
data
.Packet
import
net.mamoe.mirai.
qqandroid.network
.Packet
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.io.serialization.*
import
net.mamoe.mirai.qqandroid.network.QQAndroidClient
...
...
@@ -30,7 +31,8 @@ import net.mamoe.mirai.utils.daysToSeconds
import
net.mamoe.mirai.utils.io.encodeToString
import
net.mamoe.mirai.data.GroupInfo
as
MiraiGroupInfo
internal
inline
class
GroupInfoImpl
(
@OptIn
(
LowLevelAPI
::
class
)
internal
class
GroupInfoImpl
(
internal
val
delegate
:
Oidb0x88d
.
GroupInfo
)
:
MiraiGroupInfo
,
Packet
{
override
val
uin
:
Long
get
()
=
delegate
.
groupUin
?:
error
(
"cannot find groupUin"
)
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/ImgStore.kt
View file @
3ba1ae4a
...
...
@@ -10,7 +10,7 @@
package
net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image
import
kotlinx.io.core.ByteReadPacket
import
net.mamoe.mirai.
data
.Packet
import
net.mamoe.mirai.
qqandroid.network
.Packet
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.io.serialization.readProtoBuf
import
net.mamoe.mirai.qqandroid.io.serialization.writeProtoBuf
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/LongConn.kt
View file @
3ba1ae4a
...
...
@@ -10,10 +10,10 @@
package
net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image
import
kotlinx.io.core.ByteReadPacket
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.io.serialization.readProtoBuf
import
net.mamoe.mirai.qqandroid.io.serialization.writeProtoBuf
import
net.mamoe.mirai.qqandroid.network.Packet
import
net.mamoe.mirai.qqandroid.network.QQAndroidClient
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.Cmd0x352
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.GetImgUrlReq
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/MessageSvc.kt
View file @
3ba1ae4a
...
...
@@ -7,17 +7,20 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
@
file
:
OptIn
(
LowLevelAPI
::
class
)
package
net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive
import
kotlinx.coroutines.FlowPreview
import
kotlinx.coroutines.flow.*
import
kotlinx.io.core.ByteReadPacket
import
kotlinx.io.core.discardExact
import
net.mamoe.mirai.LowLevelAPI
import
net.mamoe.mirai.contact.Group
import
net.mamoe.mirai.contact.MemberPermission
import
net.mamoe.mirai.data.MemberInfo
import
net.mamoe.mirai.
data
.MultiPacketByIterable
import
net.mamoe.mirai.
data
.Packet
import
net.mamoe.mirai.
qqandroid.network
.MultiPacketByIterable
import
net.mamoe.mirai.
qqandroid.network
.Packet
import
net.mamoe.mirai.event.events.BotJoinGroupEvent
import
net.mamoe.mirai.event.events.BotOfflineEvent
import
net.mamoe.mirai.event.events.MemberJoinEvent
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/receive/OnlinePush.kt
View file @
3ba1ae4a
...
...
@@ -13,9 +13,9 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.receive
import
kotlinx.io.core.*
import
net.mamoe.mirai.contact.MemberPermission
import
net.mamoe.mirai.
data
.MultiPacketBySequence
import
net.mamoe.mirai.
data
.NoPacket
import
net.mamoe.mirai.
data
.Packet
import
net.mamoe.mirai.
qqandroid.network
.MultiPacketBySequence
import
net.mamoe.mirai.
qqandroid.network
.NoPacket
import
net.mamoe.mirai.
qqandroid.network
.Packet
import
net.mamoe.mirai.event.Event
import
net.mamoe.mirai.event.events.*
import
net.mamoe.mirai.message.GroupMessage
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/list/FriendList.kt
View file @
3ba1ae4a
...
...
@@ -10,7 +10,7 @@
package
net.mamoe.mirai.qqandroid.network.protocol.packet.list
import
kotlinx.io.core.ByteReadPacket
import
net.mamoe.mirai.
data
.Packet
import
net.mamoe.mirai.
qqandroid.network
.Packet
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.io.serialization.decodeUniPacket
import
net.mamoe.mirai.qqandroid.io.serialization.jceRequestSBuffer
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/Heartbeat.kt
View file @
3ba1ae4a
...
...
@@ -10,8 +10,8 @@
package
net.mamoe.mirai.qqandroid.network.protocol.packet.login
import
kotlinx.io.core.ByteReadPacket
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.network.Packet
import
net.mamoe.mirai.qqandroid.network.QQAndroidClient
import
net.mamoe.mirai.qqandroid.network.protocol.packet.*
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/StatSvc.kt
View file @
3ba1ae4a
...
...
@@ -10,7 +10,7 @@
package
net.mamoe.mirai.qqandroid.network.protocol.packet.login
import
kotlinx.io.core.ByteReadPacket
import
net.mamoe.mirai.
data
.Packet
import
net.mamoe.mirai.
qqandroid.network
.Packet
import
net.mamoe.mirai.event.events.BotOfflineEvent
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.io.serialization.*
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/WtLogin.kt
View file @
3ba1ae4a
...
...
@@ -12,7 +12,7 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.login
import
io.ktor.util.InternalAPI
import
kotlinx.io.core.*
import
net.mamoe.mirai.
data
.Packet
import
net.mamoe.mirai.
qqandroid.network
.Packet
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.network.*
import
net.mamoe.mirai.qqandroid.network.protocol.LoginType
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/GuidSource.kt
View file @
3ba1ae4a
...
...
@@ -25,7 +25,7 @@ import kotlin.jvm.JvmStatic
* 17: 以前没保存但现在生成成功;
*/
@Suppress
(
"NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS"
)
inline
class
GuidSource
private
constructor
(
val
id
:
Long
)
{
// uint actually
in
ternal
in
line
class
GuidSource
private
constructor
(
val
id
:
Long
)
{
// uint actually
companion
object
{
/**
* 初始值
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/NetworkType.kt
View file @
3ba1ae4a
...
...
@@ -12,7 +12,7 @@ package net.mamoe.mirai.qqandroid.utils
/**
* 连接类型
*/
inline
class
NetworkType
(
val
value
:
Int
)
{
in
ternal
in
line
class
NetworkType
(
val
value
:
Int
)
{
companion
object
{
/**
* 移动网络
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/flags.kt
View file @
3ba1ae4a
...
...
@@ -15,7 +15,7 @@ package net.mamoe.mirai.qqandroid.utils
import
kotlin.jvm.JvmMultifileClass
import
kotlin.jvm.JvmName
inline
class
MacOrAndroidIdChangeFlag
(
val
value
:
Long
=
0
)
{
in
ternal
in
line
class
MacOrAndroidIdChangeFlag
(
val
value
:
Long
=
0
)
{
fun
macChanged
():
MacOrAndroidIdChangeFlag
=
MacOrAndroidIdChangeFlag
(
this
.
value
or
0
x1
)
...
...
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/contact/Group.kt
View file @
3ba1ae4a
...
...
@@ -11,6 +11,7 @@ package net.mamoe.mirai.contact
import
kotlinx.coroutines.CoroutineScope
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.LowLevelAPI
import
net.mamoe.mirai.data.MemberInfo
import
net.mamoe.mirai.event.events.*
import
net.mamoe.mirai.event.events.MessageSendEvent.FriendMessageSendEvent
...
...
@@ -117,7 +118,7 @@ actual abstract class Group : Contact(), CoroutineScope {
* 构造一个 [newMember].
* 非特殊情况请不要使用这个函数. 优先使用 [get].
*/
@
Suppress
(
"FunctionName"
)
@
LowLevelAPI
@MiraiExperimentalAPI
(
"dangerous"
)
actual
abstract
fun
newMember
(
memberInfo
:
MemberInfo
):
Member
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact/Group.kt
View file @
3ba1ae4a
...
...
@@ -13,6 +13,7 @@ package net.mamoe.mirai.contact
import
kotlinx.coroutines.CoroutineScope
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.LowLevelAPI
import
net.mamoe.mirai.data.MemberInfo
import
net.mamoe.mirai.event.events.*
import
net.mamoe.mirai.event.events.MessageSendEvent.FriendMessageSendEvent
...
...
@@ -121,8 +122,8 @@ expect abstract class Group() : Contact, CoroutineScope {
* 构造一个 [newMember].
* 非特殊情况请不要使用这个函数. 优先使用 [get].
*/
@LowLevelAPI
@MiraiExperimentalAPI
(
"dangerous"
)
@Suppress
(
"INAPPLICABLE_JVM_NAME"
,
"FunctionName"
)
abstract
fun
newMember
(
memberInfo
:
MemberInfo
):
Member
/**
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/AddFriendResult.kt
View file @
3ba1ae4a
...
...
@@ -13,10 +13,12 @@
package
net.mamoe.mirai.data
import
net.mamoe.mirai.utils.MiraiExperimentalAPI
import
kotlin.jvm.JvmMultifileClass
import
kotlin.jvm.JvmName
@MiraiExperimentalAPI
@Suppress
(
"ClassName"
)
sealed
class
AddFriendResult
{
abstract
class
DONE
internal
constructor
()
:
AddFriendResult
()
{
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/FriendInfo.kt
View file @
3ba1ae4a
...
...
@@ -9,6 +9,9 @@
package
net.mamoe.mirai.data
import
net.mamoe.mirai.LowLevelAPI
@LowLevelAPI
interface
FriendInfo
{
val
uin
:
Long
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/FriendNameRemark.kt
View file @
3ba1ae4a
...
...
@@ -9,7 +9,10 @@
package
net.mamoe.mirai.data
import
net.mamoe.mirai.utils.MiraiExperimentalAPI
/**
* 给好友设置的备注
*/
inline
class
FriendNameRemark
(
val
value
:
String
)
:
Packet
@MiraiExperimentalAPI
inline
class
FriendNameRemark
(
val
value
:
String
)
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupActiveData.kt
View file @
3ba1ae4a
...
...
@@ -3,12 +3,14 @@ package net.mamoe.mirai.data
import
kotlinx.serialization.SerialName
import
kotlinx.serialization.Serializable
import
net.mamoe.mirai.utils.MiraiExperimentalAPI
import
net.mamoe.mirai.utils.SinceMirai
/**
* 群统计信息
*/
@MiraiExperimentalAPI
@SinceMirai
(
"0.28.0"
)
@Serializable
data class
GroupActiveData
(
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupAnnouncement.kt
View file @
3ba1ae4a
...
...
@@ -2,6 +2,7 @@ package net.mamoe.mirai.data
import
kotlinx.serialization.SerialName
import
kotlinx.serialization.Serializable
import
net.mamoe.mirai.utils.MiraiExperimentalAPI
/**
* 群公告数据类
...
...
@@ -10,6 +11,7 @@ import kotlinx.serialization.Serializable
* 发公告时只需要填写text,其他参数可为默认值
*
*/
@MiraiExperimentalAPI
@Serializable
data class
GroupAnnouncementList
(
val
ec
:
Int
,
//状态码 0 是正常的
...
...
@@ -18,6 +20,7 @@ data class GroupAnnouncementList(
val
inst
:
List
<
GroupAnnouncement
>?
=
null
//置顶列表?
)
@MiraiExperimentalAPI
@Serializable
data class
GroupAnnouncement
(
@SerialName
(
"u"
)
val
sender
:
Long
=
0
,
...
...
@@ -30,6 +33,7 @@ data class GroupAnnouncement(
val
fid
:
String
?
=
null
//公告的id
)
@MiraiExperimentalAPI
@Serializable
data class
GroupAnnouncementMsg
(
val
text
:
String
,
...
...
@@ -37,6 +41,7 @@ data class GroupAnnouncementMsg(
val
title
:
String
?
=
null
)
@MiraiExperimentalAPI
@Serializable
data class
GroupAnnouncementSettings
(
@SerialName
(
"is_show_edit_card"
)
val
isShowEditCard
:
Int
=
0
,
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/GroupInfo.kt
View file @
3ba1ae4a
package
net.mamoe.mirai.data
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.LowLevelAPI
/**
* 群资料.
*
* 通过 [Bot._lowLevelQueryGroupInfo] 得到
*/
@LowLevelAPI
interface
GroupInfo
{
/**
* Uin
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/MemberInfo.kt
View file @
3ba1ae4a
...
...
@@ -9,8 +9,10 @@
package
net.mamoe.mirai.data
import
net.mamoe.mirai.LowLevelAPI
import
net.mamoe.mirai.contact.MemberPermission
@LowLevelAPI
interface
MemberInfo
:
FriendInfo
{
val
nameCard
:
String
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/OnlineStatus.kt
View file @
3ba1ae4a
...
...
@@ -7,6 +7,8 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE
*/
@
file
:
Suppress
(
"unused"
)
package
net.mamoe.mirai.data
/**
...
...
@@ -21,14 +23,17 @@ enum class OnlineStatus(val id: Int) {
* 离线
*/
OFFLINE
(
21
),
/**
* 离开
*/
AWAY
(
31
),
/**
* 隐身
*/
INVISIABLE
(
41
),
INVISIBLE
(
41
),
/**
* 忙碌
*/
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/PreviousNameList.kt
View file @
3ba1ae4a
...
...
@@ -9,6 +9,8 @@
package
net.mamoe.mirai.data
import
net.mamoe.mirai.utils.MiraiExperimentalAPI
/**
* 曾用名列表
*
...
...
@@ -16,8 +18,9 @@ package net.mamoe.mirai.data
* - 昵称
* - 共同群内的群名片
*/
@MiraiExperimentalAPI
class
PreviousNameList
(
list
:
List
<
String
>
)
:
Packet
,
List
<
String
>
by
list
{
)
:
List
<
String
>
by
list
{
override
fun
toString
():
String
=
this
.
joinToString
(
prefix
=
"PreviousNameList("
,
postfix
=
")"
,
separator
=
", "
)
}
\ No newline at end of file
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/data/Profile.kt
View file @
3ba1ae4a
...
...
@@ -12,10 +12,12 @@
package
net.mamoe.mirai.data
import
io.ktor.util.date.GMTDate
import
net.mamoe.mirai.utils.MiraiExperimentalAPI
/**
* 个人资料
*/
@MiraiExperimentalAPI
@Suppress
(
"PropertyName"
)
data class
Profile
(
val
qq
:
Long
,
...
...
@@ -54,6 +56,7 @@ data class Profile(
/**
* 性别
*/
@MiraiExperimentalAPI
enum
class
Gender
(
val
value
:
Byte
)
{
SECRET
(
0
),
MALE
(
1
),
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/BotEvents.kt
View file @
3ba1ae4a
...
...
@@ -13,7 +13,6 @@ package net.mamoe.mirai.event.events
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.contact.*
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.event.AbstractCancellableEvent
import
net.mamoe.mirai.event.BroadcastControllable
import
net.mamoe.mirai.event.CancellableEvent
...
...
@@ -21,6 +20,7 @@ import net.mamoe.mirai.event.events.ImageUploadEvent.Failed
import
net.mamoe.mirai.event.events.ImageUploadEvent.Succeed
import
net.mamoe.mirai.message.data.Image
import
net.mamoe.mirai.message.data.MessageChain
import
net.mamoe.mirai.qqandroid.network.Packet
import
net.mamoe.mirai.utils.ExternalImage
import
net.mamoe.mirai.utils.MiraiExperimentalAPI
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/MessagePacket.kt
View file @
3ba1ae4a
...
...
@@ -19,13 +19,13 @@ import net.mamoe.mirai.contact.Contact
import
net.mamoe.mirai.contact.Group
import
net.mamoe.mirai.contact.Member
import
net.mamoe.mirai.contact.QQ
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.event.events.BotEvent
import
net.mamoe.mirai.event.selectMessages
import
net.mamoe.mirai.event.subscribingGet
import
net.mamoe.mirai.event.subscribingGetOrNull
import
net.mamoe.mirai.event.whileSelectMessages
import
net.mamoe.mirai.message.data.*
import
net.mamoe.mirai.qqandroid.network.Packet
import
net.mamoe.mirai.recall
import
net.mamoe.mirai.recallIn
import
net.mamoe.mirai.utils.*
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/qqandroid.network/Packet.kt
0 → 100644
View file @
3ba1ae4a
package
net.mamoe.mirai.qqandroid.network
/**
* 从服务器收到的包解析之后的结构化数据.
* 它是一个数据包工厂的处理的返回值.
*
* **InternalAPI**: 这是内部 API, 它随时都有可能被修改
*/
interface
Packet
{
/**
* 实现这个接口的包将不会被记录到日志中
*/
interface
NoLog
}
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/contact/Group.kt
View file @
3ba1ae4a
...
...
@@ -11,6 +11,7 @@ package net.mamoe.mirai.contact
import
kotlinx.coroutines.CoroutineScope
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.LowLevelAPI
import
net.mamoe.mirai.data.MemberInfo
import
net.mamoe.mirai.event.events.*
import
net.mamoe.mirai.event.events.MessageSendEvent.FriendMessageSendEvent
...
...
@@ -119,8 +120,7 @@ actual abstract class Group : Contact(), CoroutineScope {
* 构造一个 [newMember].
* 非特殊情况请不要使用这个函数. 优先使用 [get].
*/
@JvmName
(
"newMember"
)
@Suppress
(
"INAPPLICABLE_JVM_NAME"
,
"FunctionName"
)
@LowLevelAPI
@MiraiExperimentalAPI
(
"dangerous"
)
actual
abstract
fun
newMember
(
memberInfo
:
MemberInfo
):
Member
...
...
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