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
359be123
Commit
359be123
authored
Jan 31, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SEND IMAGE SUPPORT
parent
06224aa1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Msg.kt
.../mamoe/mirai/qqandroid/network/protocol/data/proto/Msg.kt
+16
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/MessageQQA.kt
...Main/kotlin/net/mamoe/mirai/qqandroid/utils/MessageQQA.kt
+11
-1
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt
...c/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt
+1
-1
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/data/proto/Msg.kt
View file @
359be123
...
...
@@ -5,6 +5,7 @@ import kotlinx.serialization.Serializable
import
kotlinx.serialization.protobuf.ProtoNumberType
import
kotlinx.serialization.protobuf.ProtoType
import
net.mamoe.mirai.qqandroid.io.ProtoBuf
import
net.mamoe.mirai.qqandroid.io.serialization.toByteArray
import
net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
@Serializable
...
...
@@ -624,7 +625,7 @@ internal class ImMsgBody : ProtoBuf {
internal
class
NotOnlineImage
(
@SerialId
(
1
)
val
filePath
:
String
=
""
,
@SerialId
(
2
)
val
fileLen
:
Int
=
0
,
@SerialId
(
3
)
val
downloadPath
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
3
)
val
downloadPath
:
String
=
""
,
@SerialId
(
4
)
val
oldVerSendFile
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
@SerialId
(
5
)
val
imgType
:
Int
=
0
,
@SerialId
(
6
)
val
previewsImage
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
...
...
@@ -653,6 +654,20 @@ internal class ImMsgBody : ProtoBuf {
@SerialId
(
29
)
val
pbReserve
:
ByteArray
=
EMPTY_BYTE_ARRAY
)
:
ProtoBuf
@Serializable
// 非官方.
internal
data class
PbReserve
(
@SerialId
(
1
)
val
unknown1
:
Int
=
1
,
@SerialId
(
2
)
val
unknown2
:
Int
=
0
,
@SerialId
(
6
)
val
unknown3
:
Int
=
0
,
@SerialId
(
8
)
val
hint
:
String
=
"[动画表情]"
,
@SerialId
(
10
)
val
unknown5
:
Int
=
0
,
@SerialId
(
15
)
val
unknwon6
:
Int
=
5
)
:
ProtoBuf
{
companion
object
{
val
DEFAULT
:
ByteArray
=
PbReserve
().
toByteArray
(
serializer
())
}
}
@Serializable
internal
class
OnlineImage
(
@SerialId
(
1
)
val
guid
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/MessageQQA.kt
View file @
359be123
...
...
@@ -3,6 +3,7 @@ package net.mamoe.mirai.qqandroid.utils
import
net.mamoe.mirai.data.ImageLink
import
net.mamoe.mirai.message.data.*
import
net.mamoe.mirai.qqandroid.network.protocol.data.proto.ImMsgBody
import
net.mamoe.mirai.utils.io.hexToBytes
internal
fun
MessageChain
.
toRichTextElems
():
MutableList
<
ImMsgBody
.
Elem
>
{
...
...
@@ -20,7 +21,16 @@ internal fun MessageChain.toRichTextElems(): MutableList<ImMsgBody.Elem> {
elems
.
add
(
ImMsgBody
.
Elem
(
notOnlineImage
=
ImMsgBody
.
NotOnlineImage
(
filePath
=
it
.
id
.
value
filePath
=
it
.
id
.
value
,
// 错了, 应该是 2B23D705CAD1F2CF3710FE582692FCC4.jpg
fileLen
=
1149
,
// 假的
downloadPath
=
it
.
id
.
value
,
imgType
=
1000
,
// 不确定
picMd5
=
"2B 23 D7 05 CA D1 F2 CF 37 10 FE 58 26 92 FC C4"
.
hexToBytes
(),
picHeight
=
66
,
picWidth
=
66
,
resId
=
it
.
id
.
value
,
bizType
=
5
,
pbReserve
=
ImMsgBody
.
PbReserve
.
DEFAULT
// 可能还可以改变 `[动画表情]`
)
)
)
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/Image.kt
View file @
359be123
...
...
@@ -14,7 +14,7 @@ fun Image(id: String) = Image(ImageId(id))
* 由接收消息时构建, 可直接发送
*
* @param id 这个图片的 [ImageId]
*/
*/
// TODO: 2020/1/31 去掉 Image. 将 Image 改为 interface/class
inline
class
Image
(
inline
val
id
:
ImageId
)
:
Message
{
override
fun
toString
():
String
=
"[${id.value}]"
...
...
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