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
e6a554ae
Commit
e6a554ae
authored
Jan 23, 2020
by
jiahua.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Android Protocol - Rebuild Image Protocol
parent
4c085039
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
25 deletions
+38
-25
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
-1
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/groupimage/GroupImageRequest.kt
...work/protocol/packet/chat/groupimage/GroupImageRequest.kt
+2
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/Cmd0x352Packet.kt
...roid/network/protocol/packet/chat/image/Cmd0x352Packet.kt
+4
-4
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/ImageDownPacket.kt
...oid/network/protocol/packet/chat/image/ImageDownPacket.kt
+2
-2
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/ImageRequest.kt
...ndroid/network/protocol/packet/chat/image/ImageRequest.kt
+27
-16
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/ImageUpPacket.kt
...droid/network/protocol/packet/chat/image/ImageUpPacket.kt
+2
-2
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/ChatType.kt
View file @
e6a554ae
...
@@ -9,7 +9,7 @@ enum class ChatType(val internalID: Int) {
...
@@ -9,7 +9,7 @@ enum class ChatType(val internalID: Int) {
CONTACT
(
1006
),
CONTACT
(
1006
),
//
未知,推测为"组
"
//
推测为"群
"
TROOP
(
1
),
TROOP
(
1
),
TROOP_HCTOPIC
(
1026
),
TROOP_HCTOPIC
(
1026
),
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/groupimage/GroupImageRequest.kt
0 → 100644
View file @
e6a554ae
package
net.mamoe.mirai.qqandroid.network.protocol.packet.chat.groupimage
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/Cmd0x3
25
Packet.kt
→
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/Cmd0x3
52
Packet.kt
View file @
e6a554ae
...
@@ -4,7 +4,7 @@ import kotlinx.serialization.SerialId
...
@@ -4,7 +4,7 @@ import kotlinx.serialization.SerialId
import
kotlinx.serialization.Serializable
import
kotlinx.serialization.Serializable
@Serializable
@Serializable
internal
class
Cmd0x3
25
Packet
(
internal
class
Cmd0x3
52
Packet
(
@SerialId
(
1
)
val
subCommand
:
Int
,
//2是GetImgUrlReq 1是UploadImgReq
@SerialId
(
1
)
val
subCommand
:
Int
,
//2是GetImgUrlReq 1是UploadImgReq
@SerialId
(
2
)
val
uploadImgReq
:
UploadImgReq
?
=
null
,
// optional
@SerialId
(
2
)
val
uploadImgReq
:
UploadImgReq
?
=
null
,
// optional
@SerialId
(
3
)
val
getImgUrlReq
:
GetImgUrlReq
?
=
null
,
// optional
@SerialId
(
3
)
val
getImgUrlReq
:
GetImgUrlReq
?
=
null
,
// optional
...
@@ -12,9 +12,9 @@ internal class Cmd0x325Packet(
...
@@ -12,9 +12,9 @@ internal class Cmd0x325Packet(
@SerialId
(
10
)
val
networkType
:
Int
=
5
// 数据网络=5
@SerialId
(
10
)
val
networkType
:
Int
=
5
// 数据网络=5
)
{
)
{
companion
object
{
companion
object
{
fun
createByImageRequest
(
req
:
ImgReq
,
networkType
:
Int
=
5
):
Cmd0x3
25
Packet
{
fun
createByImageRequest
(
req
:
ImgReq
,
networkType
:
Int
=
5
):
Cmd0x3
52
Packet
{
if
(
req
is
UploadImgReq
)
if
(
req
is
UploadImgReq
)
return
Cmd0x3
25
Packet
(
return
Cmd0x3
52
Packet
(
1
,
1
,
req
,
req
,
null
,
null
,
...
@@ -22,7 +22,7 @@ internal class Cmd0x325Packet(
...
@@ -22,7 +22,7 @@ internal class Cmd0x325Packet(
networkType
networkType
)
)
if
(
req
is
GetImgUrlReq
)
if
(
req
is
GetImgUrlReq
)
return
Cmd0x3
25
Packet
(
return
Cmd0x3
52
Packet
(
2
,
2
,
null
,
null
,
req
,
req
,
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/ImageDownPacket.kt
View file @
e6a554ae
...
@@ -19,8 +19,8 @@ internal object ImageDownPacket : PacketFactory<ImageDownPacket.ImageDownPacketR
...
@@ -19,8 +19,8 @@ internal object ImageDownPacket : PacketFactory<ImageDownPacket.ImageDownPacketR
operator
fun
invoke
(
client
:
QQAndroidClient
,
req
:
GetImgUrlReq
):
OutgoingPacket
{
operator
fun
invoke
(
client
:
QQAndroidClient
,
req
:
GetImgUrlReq
):
OutgoingPacket
{
return
buildOutgingPacket
(
client
,
this
.
_commandName
,
this
.
_commandName
,
client
.
wLoginSigInfo
.
d2Key
)
{
return
buildOutgingPacket
(
client
,
this
.
_commandName
,
this
.
_commandName
,
client
.
wLoginSigInfo
.
d2Key
)
{
ProtoBuf
.
dump
(
ProtoBuf
.
dump
(
Cmd0x3
25
Packet
.
serializer
(),
Cmd0x3
52
Packet
.
serializer
(),
Cmd0x3
25
Packet
.
createByImageRequest
(
req
)
Cmd0x3
52
Packet
.
createByImageRequest
(
req
)
)
)
}
}
}
}
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/ImageRequest.kt
View file @
e6a554ae
...
@@ -2,35 +2,46 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image
...
@@ -2,35 +2,46 @@ package net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image
import
kotlinx.serialization.SerialId
import
kotlinx.serialization.SerialId
import
kotlinx.serialization.Serializable
import
kotlinx.serialization.Serializable
import
net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
import
net.mamoe.mirai.utils.currentTimeSeconds
import
net.mamoe.mirai.utils.currentTimeSeconds
interface
ImgReq
interface
ImgReq
@Serializable
@Serializable
internal
class
UploadImgReq
(
internal
class
UploadImgReq
(
@SerialId
(
1
)
val
srcU
ni
:
Int
,
@SerialId
(
1
)
val
srcU
in
:
Int
,
@SerialId
(
2
)
val
dstU
ni
:
Int
,
@SerialId
(
2
)
val
dstU
in
:
Int
,
@SerialId
(
3
)
val
fileId
:
Int
,
@SerialId
(
3
)
val
fileId
:
Int
=
0
,
//从0开始的自增数?貌似有一个连接就要自增1, 但是又会重置回0
@SerialId
(
4
)
val
fileMd5
:
ByteArray
,
@SerialId
(
4
)
val
fileMd5
:
String
,
@SerialId
(
5
)
val
fileSize
:
Int
,
@SerialId
(
5
)
val
fileSize
:
Int
,
@SerialId
(
6
)
val
fileName
:
String
,
@SerialId
(
6
)
val
fileName
:
String
,
//默认为md5+".jpg"
@SerialId
(
7
)
val
srcTerm
:
Int
,
@SerialId
(
7
)
val
srcTerm
:
Int
=
5
,
@SerialId
(
8
)
val
platformType
:
Int
,
@SerialId
(
8
)
val
platformType
:
Int
=
9
,
@SerialId
(
9
)
val
innerIP
:
Int
=
0
,
@SerialId
(
9
)
val
innerIP
:
Int
=
0
,
@SerialId
(
10
)
val
addressBook
:
Int
=
0
,
//chatType == 1006为1 我觉得发0没问题
@SerialId
(
10
)
val
addressBook
:
Int
=
0
,
//chatType == 1006为1 我觉得发0没问题
@SerialId
(
11
)
val
retry
:
Int
,
@SerialId
(
11
)
val
retry
:
Int
=
0
,
//default
@SerialId
(
12
)
val
buType
:
Int
,
@SerialId
(
12
)
val
buType
:
Int
,
//1或96 不确定
@SerialId
(
13
)
val
imgOriginal
:
Int
,
//是否为原图
@SerialId
(
13
)
val
imgOriginal
:
Int
,
//是否为原图
@SerialId
(
14
)
val
imgWidth
:
Int
,
@SerialId
(
14
)
val
imgWidth
:
Int
,
@SerialId
(
15
)
val
imgHeight
:
Int
,
@SerialId
(
15
)
val
imgHeight
:
Int
,
@SerialId
(
16
)
val
imgType
:
Int
,
@SerialId
(
16
)
val
imgType
:
Int
=
1000
,
/**
* ImgType:
* JPG: 1000
* PNG: 1001
* WEBP: 1002
* BMP: 1005
* GIG: 2000
* APNG: 2001
* SHARPP: 1004
* */
@SerialId
(
17
)
val
buildVer
:
String
=
"8.2.0.1296"
,
//版本号
@SerialId
(
17
)
val
buildVer
:
String
=
"8.2.0.1296"
,
//版本号
@SerialId
(
18
)
val
fileIndex
:
ByteArray
,
@SerialId
(
18
)
val
fileIndex
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
//default
@SerialId
(
19
)
val
fileStoreDays
:
Int
,
@SerialId
(
19
)
val
fileStoreDays
:
Int
=
0
,
//default
@SerialId
(
20
)
val
stepFlag
:
Int
,
@SerialId
(
20
)
val
stepFlag
:
Int
=
0
,
//default
@SerialId
(
21
)
val
rejectTryFast
:
Int
,
//bool
@SerialId
(
21
)
val
rejectTryFast
:
Int
=
0
,
//bool
@SerialId
(
22
)
val
srvUpload
:
Int
,
@SerialId
(
22
)
val
srvUpload
:
Int
=
1
,
//typeHotPic[1/2/3]
@SerialId
(
23
)
val
transferUrl
:
ByteArray
@SerialId
(
23
)
val
transferUrl
:
ByteArray
=
EMPTY_BYTE_ARRAY
//rawDownloadUrl, 如果没有就是EMPTY_BYTE_ARRAY
)
:
ImgReq
)
:
ImgReq
@Serializable
@Serializable
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/ImageUpPacket.kt
View file @
e6a554ae
...
@@ -19,8 +19,8 @@ internal object ImageUpPacket : PacketFactory<ImageUpPacket.ImageUpPacketRespons
...
@@ -19,8 +19,8 @@ internal object ImageUpPacket : PacketFactory<ImageUpPacket.ImageUpPacketRespons
operator
fun
invoke
(
client
:
QQAndroidClient
,
req
:
UploadImgReq
):
OutgoingPacket
{
operator
fun
invoke
(
client
:
QQAndroidClient
,
req
:
UploadImgReq
):
OutgoingPacket
{
return
buildOutgingPacket
(
client
,
this
.
_commandName
,
this
.
_commandName
,
client
.
wLoginSigInfo
.
d2Key
)
{
return
buildOutgingPacket
(
client
,
this
.
_commandName
,
this
.
_commandName
,
client
.
wLoginSigInfo
.
d2Key
)
{
ProtoBuf
.
dump
(
ProtoBuf
.
dump
(
Cmd0x3
25
Packet
.
serializer
(),
Cmd0x3
52
Packet
.
serializer
(),
Cmd0x3
25
Packet
.
createByImageRequest
(
req
)
Cmd0x3
52
Packet
.
createByImageRequest
(
req
)
)
)
}
}
}
}
...
...
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