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
fc1e9cbf
Commit
fc1e9cbf
authored
Jan 23, 2020
by
Him188
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
0e150cdc
e6a554ae
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
209 additions
and
107 deletions
+209
-107
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/ChatType.kt
.../mirai/qqandroid/network/protocol/packet/chat/ChatType.kt
+25
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/MessagePacket.kt
...i/qqandroid/network/protocol/packet/chat/MessagePacket.kt
+2
-0
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
+36
-0
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
+38
-0
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
+67
-0
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
+37
-0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/image/ImagePacket.kt
...ai/qqandroid/network/protocol/packet/image/ImagePacket.kt
+0
-106
mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
.../jvmMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
+2
-1
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/ChatType.kt
0 → 100644
View file @
fc1e9cbf
package
net.mamoe.mirai.qqandroid.network.protocol.packet.chat
/**
* TROOP仍然不知道是什么
*/
enum
class
ChatType
(
val
internalID
:
Int
)
{
FRIEND
(
2
),
//可以为任何数字
CONTACT
(
1006
),
//推测为"群"
TROOP
(
1
),
TROOP_HCTOPIC
(
1026
),
//坦白说
CONFESS_A
(
1033
),
CONFESS_B
(
1034
),
CM_GAME_TEMP
(
1036
),
DISCUSSION
(
3000
),
DEVICE_MSG
(
9501
),
}
\ No newline at end of file
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/MessagePacket.kt
0 → 100644
View file @
fc1e9cbf
package
net.mamoe.mirai.qqandroid.network.protocol.packet.chat
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/groupimage/GroupImageRequest.kt
0 → 100644
View file @
fc1e9cbf
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/Cmd0x352Packet.kt
0 → 100644
View file @
fc1e9cbf
package
net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image
import
kotlinx.serialization.SerialId
import
kotlinx.serialization.Serializable
@Serializable
internal
class
Cmd0x352Packet
(
@SerialId
(
1
)
val
subCommand
:
Int
,
//2是GetImgUrlReq 1是UploadImgReq
@SerialId
(
2
)
val
uploadImgReq
:
UploadImgReq
?
=
null
,
// optional
@SerialId
(
3
)
val
getImgUrlReq
:
GetImgUrlReq
?
=
null
,
// optional
@SerialId
(
4
)
val
deleteImgReq
:
String
?
=
""
,
// optional (没有做也不准备做, 没用)
@SerialId
(
10
)
val
networkType
:
Int
=
5
// 数据网络=5
)
{
companion
object
{
fun
createByImageRequest
(
req
:
ImgReq
,
networkType
:
Int
=
5
):
Cmd0x352Packet
{
if
(
req
is
UploadImgReq
)
return
Cmd0x352Packet
(
1
,
req
,
null
,
null
,
networkType
)
if
(
req
is
GetImgUrlReq
)
return
Cmd0x352Packet
(
2
,
null
,
req
,
null
,
networkType
)
error
(
"Unknown ImgReq"
)
}
}
}
\ No newline at end of file
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/ImageDownPacket.kt
0 → 100644
View file @
fc1e9cbf
package
net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image
import
kotlinx.io.core.ByteReadPacket
import
kotlinx.serialization.protobuf.ProtoBuf
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.network.QQAndroidClient
import
net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket
import
net.mamoe.mirai.qqandroid.network.protocol.packet.PacketFactory
import
net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgingPacket
internal
object
ImageDownPacket
:
PacketFactory
<
ImageDownPacket
.
ImageDownPacketResponse
>()
{
init
{
this
.
_commandName
=
"LongConn.OffPicDown"
}
operator
fun
invoke
(
client
:
QQAndroidClient
,
req
:
GetImgUrlReq
):
OutgoingPacket
{
return
buildOutgingPacket
(
client
,
this
.
_commandName
,
this
.
_commandName
,
client
.
wLoginSigInfo
.
d2Key
)
{
ProtoBuf
.
dump
(
Cmd0x352Packet
.
serializer
(),
Cmd0x352Packet
.
createByImageRequest
(
req
)
)
}
}
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
ImageDownPacketResponse
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
sealed
class
ImageDownPacketResponse
:
Packet
{
object
Success
:
ImageDownPacketResponse
()
}
}
\ No newline at end of file
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/ImageRequest.kt
0 → 100644
View file @
fc1e9cbf
package
net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image
import
kotlinx.serialization.SerialId
import
kotlinx.serialization.Serializable
import
net.mamoe.mirai.qqandroid.network.protocol.packet.EMPTY_BYTE_ARRAY
import
net.mamoe.mirai.utils.currentTimeSeconds
interface
ImgReq
@Serializable
internal
class
UploadImgReq
(
@SerialId
(
1
)
val
srcUin
:
Int
,
@SerialId
(
2
)
val
dstUin
:
Int
,
@SerialId
(
3
)
val
fileId
:
Int
=
0
,
//从0开始的自增数?貌似有一个连接就要自增1, 但是又会重置回0
@SerialId
(
4
)
val
fileMd5
:
String
,
@SerialId
(
5
)
val
fileSize
:
Int
,
@SerialId
(
6
)
val
fileName
:
String
,
//默认为md5+".jpg"
@SerialId
(
7
)
val
srcTerm
:
Int
=
5
,
@SerialId
(
8
)
val
platformType
:
Int
=
9
,
@SerialId
(
9
)
val
innerIP
:
Int
=
0
,
@SerialId
(
10
)
val
addressBook
:
Int
=
0
,
//chatType == 1006为1 我觉得发0没问题
@SerialId
(
11
)
val
retry
:
Int
=
0
,
//default
@SerialId
(
12
)
val
buType
:
Int
,
//1或96 不确定
@SerialId
(
13
)
val
imgOriginal
:
Int
,
//是否为原图
@SerialId
(
14
)
val
imgWidth
:
Int
,
@SerialId
(
15
)
val
imgHeight
:
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
(
18
)
val
fileIndex
:
ByteArray
=
EMPTY_BYTE_ARRAY
,
//default
@SerialId
(
19
)
val
fileStoreDays
:
Int
=
0
,
//default
@SerialId
(
20
)
val
stepFlag
:
Int
=
0
,
//default
@SerialId
(
21
)
val
rejectTryFast
:
Int
=
0
,
//bool
@SerialId
(
22
)
val
srvUpload
:
Int
=
1
,
//typeHotPic[1/2/3]
@SerialId
(
23
)
val
transferUrl
:
ByteArray
=
EMPTY_BYTE_ARRAY
//rawDownloadUrl, 如果没有就是EMPTY_BYTE_ARRAY
)
:
ImgReq
@Serializable
internal
class
GetImgUrlReq
(
@SerialId
(
1
)
val
srcUni
:
Int
,
@SerialId
(
2
)
val
dstUni
:
Int
,
@SerialId
(
3
)
val
fileResID
:
String
,
//UUID
/**
* UUID例子: 没有找到
*/
@SerialId
(
4
)
val
urlFlag
:
Int
=
1
,
//5 unknown, 好像没用
@SerialId
(
6
)
val
urlType
:
Int
=
4
,
@SerialId
(
7
)
val
requestTerm
:
Int
=
5
,
//确定
@SerialId
(
8
)
val
requestPlatformType
:
Int
=
9
,
//确定
@SerialId
(
9
)
val
srcFileType
:
Int
=
1
,
//2=ftn,1=picplatform,255
@SerialId
(
10
)
val
innerIP
:
Int
=
0
,
//确定
@SerialId
(
11
)
val
addressBook
:
Int
=
0
,
//[ChatType.internalID]== 1006为1[为CONTACT时] 我觉得发0没问题
@SerialId
(
12
)
val
buType
:
Int
=
1
,
//确定
@SerialId
(
13
)
val
buildVer
:
String
=
"8.2.0.1296"
,
//版本号
@SerialId
(
14
)
val
timestamp
:
Int
=
currentTimeSeconds
.
toInt
(),
//(pic_up_timestamp)
@SerialId
(
15
)
val
requestTransferType
:
Int
=
1
)
:
ImgReq
\ No newline at end of file
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/chat/image/ImageUpPacket.kt
0 → 100644
View file @
fc1e9cbf
package
net.mamoe.mirai.qqandroid.network.protocol.packet.chat.image
import
kotlinx.io.core.ByteReadPacket
import
kotlinx.serialization.protobuf.ProtoBuf
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.network.QQAndroidClient
import
net.mamoe.mirai.qqandroid.network.protocol.packet.OutgoingPacket
import
net.mamoe.mirai.qqandroid.network.protocol.packet.PacketFactory
import
net.mamoe.mirai.qqandroid.network.protocol.packet.buildOutgingPacket
internal
object
ImageUpPacket
:
PacketFactory
<
ImageUpPacket
.
ImageUpPacketResponse
>()
{
init
{
this
.
_commandName
=
"LongConn.OffPicUp"
}
operator
fun
invoke
(
client
:
QQAndroidClient
,
req
:
UploadImgReq
):
OutgoingPacket
{
return
buildOutgingPacket
(
client
,
this
.
_commandName
,
this
.
_commandName
,
client
.
wLoginSigInfo
.
d2Key
)
{
ProtoBuf
.
dump
(
Cmd0x352Packet
.
serializer
(),
Cmd0x352Packet
.
createByImageRequest
(
req
)
)
}
}
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
ImageUpPacketResponse
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
sealed
class
ImageUpPacketResponse
:
Packet
{
object
Success
:
ImageUpPacketResponse
()
}
}
\ No newline at end of file
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/image/ImagePacket.kt
deleted
100644 → 0
View file @
0e150cdc
package
net.mamoe.mirai.qqandroid.network.protocol.packet.image
import
kotlinx.io.core.ByteReadPacket
import
kotlinx.serialization.SerialId
import
kotlinx.serialization.Serializable
import
net.mamoe.mirai.data.Packet
import
net.mamoe.mirai.qqandroid.QQAndroidBot
import
net.mamoe.mirai.qqandroid.network.protocol.packet.PacketFactory
import
net.mamoe.mirai.utils.currentTimeSeconds
@UseExperimental
(
ExperimentalUnsignedTypes
::
class
)
internal
object
ImagePacket
:
PacketFactory
<
ImagePacket
.
RequestImgUrlResponse
>()
{
init
{
this
.
_commandName
=
"LongConn.OffPicDown"
}
sealed
class
RequestImgUrlResponse
:
Packet
{
object
Success
:
RequestImgUrlResponse
()
}
private
fun
createCmd0x325Packet
(
req
:
ImgReq
,
networkType
:
Int
=
5
):
Cmd0x352Packet
{
if
(
req
is
UploadImgReq
)
return
Cmd0x352Packet
(
1
,
req
,
null
,
null
,
networkType
)
if
(
req
is
GetImgUrlReq
)
return
Cmd0x352Packet
(
2
,
null
,
req
,
null
,
networkType
)
error
(
"Unknown ImgReq"
)
}
@Serializable
internal
class
Cmd0x352Packet
(
@SerialId
(
1
)
val
subCommand
:
Int
,
//2是GetImgUrlReq 1是UploadImgReq
@SerialId
(
2
)
val
uploadImgReq
:
UploadImgReq
?
=
null
,
// optional
@SerialId
(
3
)
val
getImgUrlReq
:
GetImgUrlReq
?
=
null
,
// optional
@SerialId
(
4
)
val
deleteImgReq
:
String
?
=
""
,
// optional (没有做也不准备做, 没用)
@SerialId
(
10
)
val
networkType
:
Int
=
5
// 数据网络=5
)
interface
ImgReq
@Serializable
class
UploadImgReq
(
@SerialId
(
1
)
val
srcUni
:
Int
,
@SerialId
(
2
)
val
dstUni
:
Int
,
@SerialId
(
3
)
val
fileId
:
Int
,
@SerialId
(
4
)
val
fileMd5
:
ByteArray
,
@SerialId
(
5
)
val
fileSize
:
Int
,
@SerialId
(
6
)
val
fileName
:
String
,
@SerialId
(
7
)
val
srcTerm
:
Int
,
@SerialId
(
8
)
val
platformType
:
Int
,
@SerialId
(
9
)
val
innerIP
:
Int
=
0
,
@SerialId
(
10
)
val
addressBook
:
Int
=
0
,
//chatType == 1006为1 我觉得发0没问题
@SerialId
(
11
)
val
retry
:
Int
,
@SerialId
(
12
)
val
buType
:
Int
,
@SerialId
(
13
)
val
imgOriginal
:
Int
,
//是否为原图
@SerialId
(
14
)
val
imgWidth
:
Int
,
@SerialId
(
15
)
val
imgHeight
:
Int
,
@SerialId
(
16
)
val
imgType
:
Int
,
@SerialId
(
17
)
val
buildVer
:
String
=
"8.2.0.1296"
,
//版本号
@SerialId
(
18
)
val
fileIndex
:
ByteArray
,
@SerialId
(
19
)
val
fileStoreDays
:
Int
,
@SerialId
(
20
)
val
stepFlag
:
Int
,
@SerialId
(
21
)
val
rejectTryFast
:
Int
,
//bool
@SerialId
(
22
)
val
srvUpload
:
Int
,
@SerialId
(
23
)
val
transferUrl
:
ByteArray
)
:
ImgReq
@Serializable
class
GetImgUrlReq
(
@SerialId
(
1
)
val
srcUni
:
Int
,
@SerialId
(
2
)
val
dstUni
:
Int
,
@SerialId
(
3
)
val
fileResID
:
String
,
//UUID
/**
* UUID例子:
*/
@SerialId
(
4
)
val
urlFlag
:
Int
=
1
,
//5 unknown, 好像没用
@SerialId
(
6
)
val
urlType
:
Int
=
4
,
@SerialId
(
7
)
val
requestTerm
:
Int
=
5
,
//确定
@SerialId
(
8
)
val
requestPlatformType
:
Int
=
9
,
//确定
@SerialId
(
9
)
val
srcFileType
:
Int
=
1
,
//2=ftn,1=picplatform,255
@SerialId
(
10
)
val
innerIP
:
Int
=
0
,
//确定
@SerialId
(
11
)
val
addressBook
:
Int
=
0
,
//chatType == 1006为1 我觉得发0没问题
/**
* chattype
* 1008时为Troop
* 1 时为?
* 9999时为?
* 1036时为?
* 1006时为?
*/
@SerialId
(
12
)
val
buType
:
Int
=
1
,
//确定
@SerialId
(
13
)
val
buildVer
:
String
=
"8.2.0.1296"
,
//版本号
@SerialId
(
14
)
val
timestamp
:
Int
=
currentTimeSeconds
.
toInt
(),
//(pic_up_timestamp)
@SerialId
(
15
)
val
requestTransferType
:
Int
=
1
)
:
ImgReq
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
RequestImgUrlResponse
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
}
mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.kt
View file @
fc1e9cbf
...
@@ -12,4 +12,5 @@ internal actual class QQAndroidBot actual constructor(
...
@@ -12,4 +12,5 @@ internal actual class QQAndroidBot actual constructor(
context
:
Context
,
context
:
Context
,
account
:
BotAccount
,
account
:
BotAccount
,
configuration
:
BotConfiguration
configuration
:
BotConfiguration
)
:
QQAndroidBotBase
(
context
,
account
,
configuration
)
)
:
QQAndroidBotBase
(
context
,
account
,
configuration
)
\ No newline at end of file
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