Skip to content

Commit

Permalink
add: protocol value
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Jun 24, 2023
1 parent 19901b2 commit 6497b3b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,7 @@ internal fun TlvMapWriter.t548(

internal fun TlvMapWriter.t544ForToken( // 1348
uin: Long,
protocol: BotConfiguration.MiraiProtocol,
guid: ByteArray,
sdkVersion: String,
subCommandId: Int,
Expand All @@ -984,6 +985,7 @@ internal fun TlvMapWriter.t544ForToken( // 1348
}.use { dataIn ->
service.encryptTlv(EncryptServiceContext(uin, buildTypeSafeMap {
set(EncryptServiceContext.KEY_COMMAND_STR, commandStr)
set(EncryptServiceContext.KEY_BOT_PROTOCOL, protocol)
}), 0x544, dataIn.readBytes())
}.let { result ->
writeFully(result ?: "".toByteArray()) // Empty str means native throws exception
Expand All @@ -993,6 +995,7 @@ internal fun TlvMapWriter.t544ForToken( // 1348

internal fun TlvMapWriter.t544ForVerify( // 1348
uin: Long,
protocol: BotConfiguration.MiraiProtocol,
guid: ByteArray,
sdkVersion: String,
subCommandId: Int,
Expand All @@ -1008,6 +1011,7 @@ internal fun TlvMapWriter.t544ForVerify( // 1348
}.use { dataIn ->
service.encryptTlv(EncryptServiceContext(uin, buildTypeSafeMap {
set(EncryptServiceContext.KEY_COMMAND_STR, commandStr)
set(EncryptServiceContext.KEY_BOT_PROTOCOL, protocol)
}), 0x544, dataIn.readBytes())
}.let { result ->
writeFully(result ?: "".toByteArray()) // Empty str means native throws exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ internal object WtLogin10 : WtLoginExt {
if (client.useAndroid) {
t544ForToken(
uin = client.uin,
protocol = client.bot.configuration.protocol,
guid = client.device.guid,
sdkVersion = client.sdkVersion,
subCommandId = 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ internal object WtLogin15 : WtLoginExt {
if (client.useAndroid) {
t544ForToken(
uin = client.uin,
protocol = client.bot.configuration.protocol,
guid = client.device.guid,
sdkVersion = client.sdkVersion,
subCommandId = 15,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ internal object WtLogin2 : WtLoginExt {
if (client.useAndroid) {
t544ForVerify(
uin = client.uin,
protocol = client.bot.configuration.protocol,
guid = client.device.guid,
sdkVersion = client.sdkVersion,
subCommandId = 2,
Expand Down Expand Up @@ -63,6 +64,7 @@ internal object WtLogin2 : WtLoginExt {
if (client.useAndroid) {
t544ForVerify(
uin = client.uin,
protocol = client.bot.configuration.protocol,
guid = client.device.guid,
sdkVersion = client.sdkVersion,
subCommandId = 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ internal object WtLogin7 : WtLoginExt {
if (client.useAndroid) {
t544ForVerify(
uin = client.uin,
protocol = client.bot.configuration.protocol,
guid = client.device.guid,
sdkVersion = client.sdkVersion,
subCommandId = 7,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ internal object WtLogin9 : WtLoginExt {
if (client.useAndroid) {
t544ForToken(
uin = client.uin,
protocol = client.bot.configuration.protocol,
guid = client.device.guid,
sdkVersion = client.sdkVersion,
subCommandId = 9,
Expand All @@ -147,6 +148,7 @@ internal object WtLogin9 : WtLoginExt {
if (client.usePC) {
t544ForToken(
uin = client.uin,
protocol = client.bot.configuration.protocol,
guid = client.device.guid,
sdkVersion = client.sdkVersion,
subCommandId = 9,
Expand Down Expand Up @@ -211,6 +213,7 @@ internal object WtLogin9 : WtLoginExt {
if (client.usePC) {
t544ForToken(
uin = client.uin,
protocol = client.bot.configuration.protocol,
guid = client.device.guid,
sdkVersion = client.sdkVersion,
subCommandId = 9,
Expand Down

0 comments on commit 6497b3b

Please sign in to comment.