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
9694ba0c
Commit
9694ba0c
authored
Jan 03, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `fixToUHex`
parent
bd74907f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
9 deletions
+19
-9
mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/action/GroupImage.kt
...net.mamoe.mirai.timpc/network/packet/action/GroupImage.kt
+1
-1
mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/action/GroupPacket.kt
...et.mamoe.mirai.timpc/network/packet/action/GroupPacket.kt
+1
-1
mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/action/HttpAPIAccessor.kt
...amoe.mirai.timpc/network/packet/action/HttpAPIAccessor.kt
+13
-6
mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/event/MemberMute.kt
.../net.mamoe.mirai.timpc/network/packet/event/MemberMute.kt
+3
-0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/TypeConversion.kt
...monMain/kotlin/net.mamoe.mirai/utils/io/TypeConversion.kt
+1
-1
No files found.
mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/action/GroupImage.kt
View file @
9694ba0c
...
...
@@ -102,7 +102,7 @@ internal object GroupImagePacket : SessionPacketFactory<GroupImageResponse>() {
@SerialId
(
2
)
val
bot
:
Int
,
@SerialId
(
3
)
val
const1
:
Byte
=
0
,
@SerialId
(
4
)
val
md5
:
ByteArray
,
@SerialId
(
5
)
val
const2
:
Short
=
0
x0
E
2D
,
@SerialId
(
5
)
val
const2
:
Short
=
0
x0
F
2D
,
@SerialId
(
6
)
val
const3
:
ByteArray
=
constValue3
,
@SerialId
(
7
)
val
const4
:
Byte
=
1
,
// 8 is missing
...
...
mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/action/GroupPacket.kt
View file @
9694ba0c
...
...
@@ -103,7 +103,7 @@ internal object GroupPacket : SessionPacketFactory<GroupPacket.GroupPacketRespon
internal
interface
GroupPacketResponse
:
Packet
@NoLog
//
@NoLog
internal
object
MessageResponse
:
Packet
,
GroupPacketResponse
{
override
fun
toString
():
String
=
"GroupPacket.MessageResponse"
}
...
...
mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/action/HttpAPIAccessor.kt
View file @
9694ba0c
...
...
@@ -11,7 +11,11 @@ import io.ktor.http.content.OutgoingContent
import
io.ktor.http.userAgent
import
kotlinx.coroutines.io.ByteWriteChannel
import
kotlinx.io.core.Input
import
kotlinx.io.core.readAvailable
import
kotlinx.io.pool.useInstance
import
net.mamoe.mirai.contact.GroupId
import
net.mamoe.mirai.utils.io.ByteArrayPool
import
net.mamoe.mirai.utils.io.debugPrint
@Suppress
(
"SpellCheckingInspection"
)
...
...
@@ -32,7 +36,7 @@ internal suspend inline fun HttpClient.postImage(
parameters
[
"htcmd"
]
=
htcmd
parameters
[
"uin"
]
=
uin
.
toString
()
if
(
groupId
!=
null
)
parameters
[
"groupcode"
]
=
groupId
.
value
.
to
Long
().
to
String
()
if
(
groupId
!=
null
)
parameters
[
"groupcode"
]
=
groupId
.
value
.
toString
()
parameters
[
"term"
]
=
"pc"
parameters
[
"ver"
]
=
"5603"
...
...
@@ -41,17 +45,20 @@ internal suspend inline fun HttpClient.postImage(
parameters
[
"ukey"
]
=
uKeyHex
userAgent
(
"QQClient"
)
buildString
().
debugPrint
(
"URL"
)
}
body
=
object
:
OutgoingContent
.
WriteChannelContent
()
{
override
val
contentType
:
ContentType
=
ContentType
.
Image
.
PNG
override
val
contentType
:
ContentType
=
ContentType
.
Image
.
Any
override
val
contentLength
:
Long
=
inputSize
override
suspend
fun
writeTo
(
channel
:
ByteWriteChannel
)
{
val
buffer
=
byteArrayOf
(
1
)
repeat
(
contentLength
.
toInt
())
{
imageInput
.
readFully
(
buffer
,
0
,
1
)
channel
.
writeFully
(
buffer
,
0
,
1
)
ByteArrayPool
.
useInstance
{
buffer
:
ByteArray
->
var
size
:
Int
while
(
imageInput
.
readAvailable
(
buffer
).
also
{
size
=
it
}
!=
0
)
{
channel
.
writeFully
(
buffer
,
0
,
size
)
}
}
}
}
...
...
mirai-core-timpc/src/commonMain/kotlin/net.mamoe.mirai.timpc/network/packet/event/MemberMute.kt
View file @
9694ba0c
...
...
@@ -64,6 +64,9 @@ internal object MemberMuteEventPacketParserAndHandler : KnownEventParserAndHandl
}
0
x11u
->
debugPrintIfFail
(
"解析禁言包(0x02DC)时"
){
// 猜测这个失败是撤回??
// 00 0A 00 04 01 00 00 00 00 0C 00 05 00 01 00 01 01 27 0B 60 E7 11 00 33 08 07 20 E7 C1 AD B8 02 5A 29 08 A6 FE C0 A4 0A 1A 19 08 BC 15 10 C1 95 BC F0 05 18 CA CA 8F DE 04 20 00 28 00 30 A6 FE C0 A4 0A 2A 02 08 00 30 00 38 00
// 失败
discardExact
(
15
)
discardExact
(
2
)
val
group
=
bot
.
getGroup
(
readQQ
())
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/io/TypeConversion.kt
View file @
9694ba0c
...
...
@@ -95,7 +95,7 @@ fun Byte.fixToUHex(): String = this.toUByte().fixToUHex()
/**
* 转无符号十六进制表示, 并补充首位 `0`.
*/
fun
UByte
.
fixToUHex
():
String
=
if
(
this
.
toInt
()
in
0
..
9
)
"0${this.toString(16).toUpperCase()}"
else
this
.
toString
(
16
).
toUpperCase
()
fun
UByte
.
fixToUHex
():
String
=
if
(
this
.
toInt
()
in
0
..
15
)
"0${this.toString(16).toUpperCase()}"
else
this
.
toString
(
16
).
toUpperCase
()
/**
* 将无符号 Hex 转为 [ByteArray], 有根据 hex 的 [hashCode] 建立的缓存.
...
...
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