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
30b6181e
Commit
30b6181e
authored
Mar 04, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #105
parent
095feaf5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
25 deletions
+26
-25
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/WtLogin.kt
.../mirai/qqandroid/network/protocol/packet/login/WtLogin.kt
+26
-25
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/protocol/packet/login/WtLogin.kt
View file @
30b6181e
...
@@ -97,7 +97,13 @@ internal class WtLogin {
...
@@ -97,7 +97,13 @@ internal class WtLogin {
operator
fun
invoke
(
operator
fun
invoke
(
client
:
QQAndroidClient
client
:
QQAndroidClient
):
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
,
EncryptMethodECDH
(
client
.
ecdh
),
0
x0810
)
{
writeOicqRequestPacket
(
client
,
EncryptMethodECDH
(
client
.
ecdh
),
0
x0810
)
{
writeShort
(
8
)
// subCommand
writeShort
(
8
)
// subCommand
writeShort
(
6
)
// count of TLVs, probably ignored by server?TODO
writeShort
(
6
)
// count of TLVs, probably ignored by server?TODO
...
@@ -316,11 +322,14 @@ internal class WtLogin {
...
@@ -316,11 +322,14 @@ internal class WtLogin {
// tlvMap.printTLVMap()
// tlvMap.printTLVMap()
return
when
(
type
.
toInt
())
{
return
when
(
type
.
toInt
())
{
0
->
onLoginSuccess
(
tlvMap
,
bot
)
0
->
onLoginSuccess
(
tlvMap
,
bot
)
1
,
15
->
onErrorMessage
(
tlvMap
)
2
->
onSolveLoginCaptcha
(
tlvMap
,
bot
)
2
->
onSolveLoginCaptcha
(
tlvMap
,
bot
)
160
/*-96*/
->
onUnsafeDeviceLogin
(
tlvMap
)
160
/*-96*/
->
onUnsafeDeviceLogin
(
tlvMap
)
204
/*-52*/
->
onSMSVerifyNeeded
(
tlvMap
,
bot
)
204
/*-52*/
->
onSMSVerifyNeeded
(
tlvMap
,
bot
)
else
->
tlvMap
[
0
x149
]
?.
let
{
analysisTlv149
(
it
)
}
?:
error
(
"unknown login result type: $type, TLVMap = ${tlvMap._miraiContentToString()}"
)
// 1, 15 -> onErrorMessage(tlvMap) ?: error("Cannot find error message")
else
->
{
onErrorMessage
(
tlvMap
)
?:
error
(
"Cannot find error message, unknown login result type: $type, TLVMap = ${tlvMap._miraiContentToString()}"
)
}
}
}
}
}
...
@@ -338,17 +347,24 @@ internal class WtLogin {
...
@@ -338,17 +347,24 @@ internal class WtLogin {
return
LoginPacketResponse
.
UnsafeLogin
(
tlvMap
.
getOrFail
(
0
x204
).
toReadPacket
().
readBytes
().
encodeToString
())
return
LoginPacketResponse
.
UnsafeLogin
(
tlvMap
.
getOrFail
(
0
x204
).
toReadPacket
().
readBytes
().
encodeToString
())
}
}
private
fun
onErrorMessage
(
tlvMap
:
TlvMap
):
LoginPacketResponse
.
Error
{
private
fun
onErrorMessage
(
tlvMap
:
TlvMap
):
LoginPacketResponse
.
Error
?
{
return
tlvMap
[
0
x146
]
?.
toReadPacket
()
?.
run
{
return
tlvMap
[
0
x149
]
?.
read
{
readShort
()
// ver
discardExact
(
2
)
//type
readShort
()
// code
val
title
:
String
=
readUShortLVString
()
val
content
:
String
=
readUShortLVString
()
val
otherInfo
:
String
=
readUShortLVString
()
LoginPacketResponse
.
Error
(
title
,
content
,
otherInfo
)
}
?:
tlvMap
[
0
x146
]
?.
toReadPacket
()
?.
run
{
discardExact
(
2
)
// ver
discardExact
(
2
)
// code
val
title
=
readUShortLVString
()
val
title
=
readUShortLVString
()
val
message
=
readUShortLVString
()
val
message
=
readUShortLVString
()
val
errorInfo
=
readUShortLVString
()
val
errorInfo
=
readUShortLVString
()
LoginPacketResponse
.
Error
(
title
,
message
,
errorInfo
)
LoginPacketResponse
.
Error
(
title
,
message
,
errorInfo
)
}
?:
error
(
"Cannot find error message"
)
}
}
}
@InternalAPI
@InternalAPI
...
@@ -552,7 +568,8 @@ internal class WtLogin {
...
@@ -552,7 +568,8 @@ internal class WtLogin {
imgUrl
=
client
.
reserveUinInfo
?.
imgUrl
?:
byteArrayOf
(),
imgUrl
=
client
.
reserveUinInfo
?.
imgUrl
?:
byteArrayOf
(),
mainDisplayName
=
tlvMap119
[
0
x118
]
?:
error
(
"Cannot find tlv 0x118"
)
mainDisplayName
=
tlvMap119
[
0
x118
]
?:
error
(
"Cannot find tlv 0x118"
)
),
),
appPri
=
tlvMap119
[
0
x11f
]
?.
let
{
it
.
read
{
discardExact
(
4
);
readUInt
().
toLong
()
}
}
?:
4294967295L
,
appPri
=
tlvMap119
[
0
x11f
]
?.
let
{
it
.
read
{
discardExact
(
4
);
readUInt
().
toLong
()
}
}
?:
4294967295L
,
a2ExpiryTime
=
expireTime
,
a2ExpiryTime
=
expireTime
,
loginBitmap
=
0
,
// from asyncContext._login_bitmap
loginBitmap
=
0
,
// from asyncContext._login_bitmap
tgt
=
tlvMap119
.
getOrEmpty
(
0
x10a
),
tgt
=
tlvMap119
.
getOrEmpty
(
0
x10a
),
...
@@ -698,22 +715,6 @@ internal class WtLogin {
...
@@ -698,22 +715,6 @@ internal class WtLogin {
tlv
[
0
x172
]
?.
let
{
rollbackSig
=
it
}
tlv
[
0
x172
]
?.
let
{
rollbackSig
=
it
}
}
}
/**
* 错误消息
*/
private
fun
analysisTlv149
(
t149
:
ByteArray
):
LoginPacketResponse
.
Error
{
return
t149
.
read
{
discardExact
(
2
)
//type
val
title
:
String
=
readUShortLVString
()
val
content
:
String
=
readUShortLVString
()
val
otherInfo
:
String
=
readUShortLVString
()
// do not write class into read{} block. CompilationException!!
LoginPacketResponse
.
Error
(
title
=
title
,
message
=
content
,
errorInfo
=
otherInfo
)
// nice toString
}
}
/**
/**
* server host
* server host
*/
*/
...
...
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