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
8df1cfff
Commit
8df1cfff
authored
Feb 04, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup
parent
f2f2de06
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
51 deletions
+15
-51
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
...ommonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
+4
-4
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt
.../mirai/qqandroid/network/protocol/packet/PacketFactory.kt
+2
-2
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt
.../net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt
+2
-3
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/LoginPacket.kt
...ai/qqandroid/network/protocol/packet/login/LoginPacket.kt
+5
-9
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/TransEmpPacket.kt
...qqandroid/network/protocol/packet/login/TransEmpPacket.kt
+0
-31
mirai-core-qqandroid/src/jvmTest/kotlin/androidPacketTests/clientToServer.kt
...d/src/jvmTest/kotlin/androidPacketTests/clientToServer.kt
+1
-1
mirai-demos/mirai-demo-gentleman/src/main/kotlin/demo/gentleman/Main.kt
...rai-demo-gentleman/src/main/kotlin/demo/gentleman/Main.kt
+1
-1
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt
View file @
8df1cfff
...
@@ -86,18 +86,18 @@ internal class MemberImpl(
...
@@ -86,18 +86,18 @@ internal class MemberImpl(
}
else
if
(
myPermission
==
MemberPermission
.
MEMBER
)
{
}
else
if
(
myPermission
==
MemberPermission
.
MEMBER
)
{
return
false
return
false
}
}
try
{
return
try
{
bot
.
network
.
run
{
bot
.
network
.
run
{
val
response
=
TroopManagement
.
Mute
(
TroopManagement
.
Mute
(
client
=
bot
.
client
,
client
=
bot
.
client
,
groupCode
=
group
.
id
,
groupCode
=
group
.
id
,
memberUin
=
this
@MemberImpl
.
id
,
memberUin
=
this
@MemberImpl
.
id
,
timeInSecond
=
durationSeconds
timeInSecond
=
durationSeconds
).
sendAndExpect
<
TroopManagement
.
Mute
.
Response
>()
).
sendAndExpect
<
TroopManagement
.
Mute
.
Response
>()
}
}
return
true
true
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
return
false
false
}
}
}
}
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/PacketFactory.kt
View file @
8df1cfff
...
@@ -360,7 +360,7 @@ internal object KnownPacketFactories {
...
@@ -360,7 +360,7 @@ internal object KnownPacketFactories {
}
}
@UseExperimental
(
ExperimentalContracts
::
class
)
@UseExperimental
(
ExperimentalContracts
::
class
)
internal
inline
fun
<
I
:
IoBuffer
,
R
>
I
.
withUse
(
block
:
I
.()
->
R
):
R
{
internal
inline
fun
<
R
>
IoBuffer
.
withUse
(
block
:
IoBuffer
.()
->
R
):
R
{
contract
{
contract
{
callsInPlace
(
block
,
kotlin
.
contracts
.
InvocationKind
.
EXACTLY_ONCE
)
callsInPlace
(
block
,
kotlin
.
contracts
.
InvocationKind
.
EXACTLY_ONCE
)
}
}
...
@@ -372,7 +372,7 @@ internal inline fun <I : IoBuffer, R> I.withUse(block: I.() -> R): R {
...
@@ -372,7 +372,7 @@ internal inline fun <I : IoBuffer, R> I.withUse(block: I.() -> R): R {
}
}
@UseExperimental
(
ExperimentalContracts
::
class
)
@UseExperimental
(
ExperimentalContracts
::
class
)
internal
inline
fun
<
I
:
ByteReadPacket
,
R
>
I
.
withUse
(
block
:
I
.()
->
R
):
R
{
internal
inline
fun
<
R
>
ByteReadPacket
.
withUse
(
block
:
ByteReadPacket
.()
->
R
):
R
{
contract
{
contract
{
callsInPlace
(
block
,
kotlin
.
contracts
.
InvocationKind
.
EXACTLY_ONCE
)
callsInPlace
(
block
,
kotlin
.
contracts
.
InvocationKind
.
EXACTLY_ONCE
)
}
}
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/Tlv.kt
View file @
8df1cfff
...
@@ -146,8 +146,7 @@ fun BytePacketBuilder.t116(
...
@@ -146,8 +146,7 @@ fun BytePacketBuilder.t116(
fun
BytePacketBuilder
.
t100
(
fun
BytePacketBuilder
.
t100
(
appId
:
Long
=
16
,
appId
:
Long
=
16
,
subAppId
:
Long
=
537062845
,
subAppId
:
Long
=
537062845
,
appClientVersion
:
Int
,
appClientVersion
:
Int
sigMap
:
Int
)
{
)
{
writeShort
(
0
x100
)
writeShort
(
0
x100
)
writeShortLVPacket
{
writeShortLVPacket
{
...
@@ -156,7 +155,7 @@ fun BytePacketBuilder.t100(
...
@@ -156,7 +155,7 @@ fun BytePacketBuilder.t100(
writeInt
(
appId
.
toInt
())
writeInt
(
appId
.
toInt
())
writeInt
(
subAppId
.
toInt
())
writeInt
(
subAppId
.
toInt
())
writeInt
(
appClientVersion
)
writeInt
(
appClientVersion
)
writeInt
(
34869472
)
// 34869472?
writeInt
(
34869472
)
//
sigMap,
34869472?
}
shouldEqualsTo
22
}
shouldEqualsTo
22
}
}
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/LoginPacket.kt
View file @
8df1cfff
...
@@ -72,8 +72,7 @@ internal object LoginPacket : OutgoingPacketFactory<LoginPacket.LoginPacketRespo
...
@@ -72,8 +72,7 @@ internal object LoginPacket : OutgoingPacketFactory<LoginPacket.LoginPacketRespo
@UseExperimental
(
MiraiInternalAPI
::
class
)
@UseExperimental
(
MiraiInternalAPI
::
class
)
operator
fun
invoke
(
operator
fun
invoke
(
client
:
QQAndroidClient
,
client
:
QQAndroidClient
,
t402
:
ByteArray
,
t402
:
ByteArray
t403
:
ByteArray
):
OutgoingPacket
=
buildLoginOutgoingPacket
(
client
,
bodyType
=
2
)
{
sequenceId
->
):
OutgoingPacket
=
buildLoginOutgoingPacket
(
client
,
bodyType
=
2
)
{
sequenceId
->
writeSsoPacket
(
client
,
subAppId
,
commandName
,
sequenceId
=
sequenceId
)
{
writeSsoPacket
(
client
,
subAppId
,
commandName
,
sequenceId
=
sequenceId
)
{
writeOicqRequestPacket
(
client
,
EncryptMethodECDH7
(
client
.
ecdh
),
0
x0810
)
{
writeOicqRequestPacket
(
client
,
EncryptMethodECDH7
(
client
.
ecdh
),
0
x0810
)
{
...
@@ -96,10 +95,7 @@ internal object LoginPacket : OutgoingPacketFactory<LoginPacket.LoginPacketRespo
...
@@ -96,10 +95,7 @@ internal object LoginPacket : OutgoingPacketFactory<LoginPacket.LoginPacketRespo
private
const
val
subAppId
=
537062845L
private
const
val
subAppId
=
537062845L
@UseExperimental
(
MiraiInternalAPI
::
class
)
@UseExperimental
(
MiraiInternalAPI
::
class
)
operator
fun
invoke
(
operator
fun
invoke
(
client
:
QQAndroidClient
,
client
:
QQAndroidClient
t174
:
ByteArray
,
t402
:
ByteArray
,
phoneNumber
:
String
):
OutgoingPacket
=
buildLoginOutgoingPacket
(
client
,
bodyType
=
2
)
{
sequenceId
->
):
OutgoingPacket
=
buildLoginOutgoingPacket
(
client
,
bodyType
=
2
)
{
sequenceId
->
writeSsoPacket
(
client
,
subAppId
,
commandName
,
sequenceId
=
sequenceId
,
unknownHex
=
"01 00 00 00 00 00 00 00 00 00 01 00"
)
{
writeSsoPacket
(
client
,
subAppId
,
commandName
,
sequenceId
=
sequenceId
,
unknownHex
=
"01 00 00 00 00 00 00 00 00 00 01 00"
)
{
writeOicqRequestPacket
(
client
,
EncryptMethodECDH7
(
client
.
ecdh
),
0
x0810
)
{
writeOicqRequestPacket
(
client
,
EncryptMethodECDH7
(
client
.
ecdh
),
0
x0810
)
{
...
@@ -163,7 +159,7 @@ internal object LoginPacket : OutgoingPacketFactory<LoginPacket.LoginPacketRespo
...
@@ -163,7 +159,7 @@ internal object LoginPacket : OutgoingPacketFactory<LoginPacket.LoginPacketRespo
if (ConfigManager.get_loginWithPicSt()) appIdList = longArrayOf(1600000226L)
if (ConfigManager.get_loginWithPicSt()) appIdList = longArrayOf(1600000226L)
*/
*/
t116
(
client
.
miscBitMap
,
client
.
subSigMap
)
t116
(
client
.
miscBitMap
,
client
.
subSigMap
)
t100
(
appId
,
subAppId
,
client
.
appClientVersion
,
client
.
mainSigMap
or
0
xC0
)
t100
(
appId
,
subAppId
,
client
.
appClientVersion
)
t107
(
0
)
t107
(
0
)
// t108(byteArrayOf())
// t108(byteArrayOf())
...
@@ -310,7 +306,7 @@ internal object LoginPacket : OutgoingPacketFactory<LoginPacket.LoginPacketRespo
...
@@ -310,7 +306,7 @@ internal object LoginPacket : OutgoingPacketFactory<LoginPacket.LoginPacketRespo
@UseExperimental
(
MiraiDebugAPI
::
class
)
@UseExperimental
(
MiraiDebugAPI
::
class
)
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
LoginPacketResponse
{
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
LoginPacketResponse
{
val
subCommand
=
readUShort
().
toInt
()
discardExact
(
2
)
// subCommand
// println("subCommand=$subCommand")
// println("subCommand=$subCommand")
val
type
=
readUByte
()
val
type
=
readUByte
()
// println("type=$type")
// println("type=$type")
...
@@ -703,7 +699,7 @@ internal object LoginPacket : OutgoingPacketFactory<LoginPacket.LoginPacketRespo
...
@@ -703,7 +699,7 @@ internal object LoginPacket : OutgoingPacketFactory<LoginPacket.LoginPacketRespo
private
fun
QQAndroidClient
.
analysisTlv149
(
t149
:
ByteArray
):
LoginPacketResponse
.
Error
{
private
fun
QQAndroidClient
.
analysisTlv149
(
t149
:
ByteArray
):
LoginPacketResponse
.
Error
{
return
t149
.
read
{
return
t149
.
read
{
val
type
:
Short
=
readShort
()
discardExact
(
2
)
//type
val
title
:
String
=
readUShortLVString
()
val
title
:
String
=
readUShortLVString
()
val
content
:
String
=
readUShortLVString
()
val
content
:
String
=
readUShortLVString
()
val
otherInfo
:
String
=
readUShortLVString
()
val
otherInfo
:
String
=
readUShortLVString
()
...
...
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/TransEmpPacket.kt
deleted
100644 → 0
View file @
f2f2de06
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.QQAndroidClient
import
net.mamoe.mirai.qqandroid.network.protocol.packet.*
internal
object
TransEmpPacket
:
OutgoingPacketFactory
<
TransEmpPacket
.
Response
>(
"wtlogin.trans_emp"
)
{
private
const
val
appId
=
16L
private
const
val
subAppId
=
537062845L
@Suppress
(
"FunctionName"
)
fun
SubCommand1
(
client
:
QQAndroidClient
):
OutgoingPacket
=
buildLoginOutgoingPacket
(
client
,
bodyType
=
2
)
{
writeOicqRequestPacket
(
client
,
EncryptMethodECDH135
(
client
.
ecdh
),
TODO
())
{
// oicq.wlogin_sdk.request.trans_emp_1#packTransEmpBody
}
}
object
Response
:
Packet
override
suspend
fun
ByteReadPacket
.
decode
(
bot
:
QQAndroidBot
):
Response
{
TODO
(
"not implemented"
)
}
}
\ No newline at end of file
mirai-core-qqandroid/src/jvmTest/kotlin/androidPacketTests/clientToServer.kt
View file @
8df1cfff
...
@@ -175,7 +175,7 @@ fun ByteReadPacket.analysisOneFullPacket(): ByteReadPacket = debugIfFail("Failed
...
@@ -175,7 +175,7 @@ fun ByteReadPacket.analysisOneFullPacket(): ByteReadPacket = debugIfFail("Failed
readShort
().
toInt
().
takeIf
{
it
!=
8001
}
?.
let
{
readShort
().
toInt
().
takeIf
{
it
!=
8001
}
?.
let
{
println
(
"这个包不是 oicqRequest"
)
println
(
"这个包不是 oicqRequest"
)
return
@
debugIfFail
this
return
@
debugIfFail
this
println
(
" got new protocolVersion=$it"
)
//
println(" got new protocolVersion=$it")
}
}
val
commandId
=
readUShort
().
toInt
()
val
commandId
=
readUShort
().
toInt
()
println
(
" commandId=0x${commandId.toShort().toUHexString()}"
)
println
(
" commandId=0x${commandId.toShort().toUHexString()}"
)
...
...
mirai-demos/mirai-demo-gentleman/src/main/kotlin/demo/gentleman/Main.kt
View file @
8df1cfff
...
@@ -76,7 +76,7 @@ suspend fun main() {
...
@@ -76,7 +76,7 @@ suspend fun main() {
startsWith
(
"profile"
,
removePrefix
=
true
)
{
startsWith
(
"profile"
,
removePrefix
=
true
)
{
val
account
=
it
.
trim
()
val
account
=
it
.
trim
()
if
(
account
.
isNotEmpty
())
{
if
(
account
.
isNotEmpty
())
{
account
.
toLong
().
qq
(
)
bot
.
getFriend
(
account
.
toLong
()
)
}
else
{
}
else
{
sender
sender
}.
queryProfile
().
toString
().
reply
()
}.
queryProfile
().
toString
().
reply
()
...
...
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