Little updates

This commit is contained in:
Him188 2019-10-02 20:51:11 +08:00
parent 39d8406018
commit d50c2746d6
7 changed files with 21 additions and 14 deletions

View File

@ -2,7 +2,10 @@ package net.mamoe.mirai.network.protocol.tim.handler
import kotlinx.coroutines.runBlocking
import net.mamoe.mirai.network.LoginSession
import net.mamoe.mirai.network.protocol.tim.packet.*
import net.mamoe.mirai.network.protocol.tim.packet.ClientAccountInfoRequestPacket
import net.mamoe.mirai.network.protocol.tim.packet.ServerAccountInfoResponsePacket
import net.mamoe.mirai.network.protocol.tim.packet.ServerEventPacket
import net.mamoe.mirai.network.protocol.tim.packet.ServerPacket
import net.mamoe.mirai.network.protocol.tim.packet.action.AddFriendResult
import net.mamoe.mirai.network.protocol.tim.packet.action.ClientAddFriendPacket
import net.mamoe.mirai.network.protocol.tim.packet.action.ClientCanAddFriendPacket
@ -10,6 +13,9 @@ import net.mamoe.mirai.network.protocol.tim.packet.action.ServerCanAddFriendResp
import net.mamoe.mirai.network.protocol.tim.packet.image.ServerTryGetImageIDFailedPacket
import net.mamoe.mirai.network.protocol.tim.packet.image.ServerTryGetImageIDResponsePacket
import net.mamoe.mirai.network.protocol.tim.packet.image.ServerTryGetImageIDSuccessPacket
import net.mamoe.mirai.network.protocol.tim.packet.login.ClientSKeyRefreshmentRequestPacket
import net.mamoe.mirai.network.protocol.tim.packet.login.ClientSKeyRequestPacket
import net.mamoe.mirai.network.protocol.tim.packet.login.ServerSKeyResponsePacket
import net.mamoe.mirai.task.MiraiThreadPool
import net.mamoe.mirai.utils.getGTK
import java.awt.image.BufferedImage

View File

@ -192,9 +192,9 @@ fun UInt.toByteArray(): ByteArray = byteArrayOf(
fun Int.toUHexString(separator: String = " "): String = this.toByteArray().toUHexString(separator)
internal fun md5(str: String): ByteArray = MessageDigest.getInstance("MD5").digest(str.toByteArray())
fun md5(str: String): ByteArray = MessageDigest.getInstance("MD5").digest(str.toByteArray())
internal fun md5(byteArray: ByteArray): ByteArray = MessageDigest.getInstance("MD5").digest(byteArray)
fun md5(byteArray: ByteArray): ByteArray = MessageDigest.getInstance("MD5").digest(byteArray)
@Throws(IOException::class)

View File

@ -3,9 +3,7 @@ package net.mamoe.mirai.network.protocol.tim.packet
/**
* @author Him188moe
*/
interface Packet {
}
interface Packet
object PacketNameFormatter {

View File

@ -1,6 +1,7 @@
package net.mamoe.mirai.network.protocol.tim.packet
package net.mamoe.mirai.network.protocol.tim.packet.login
import net.mamoe.mirai.network.protocol.tim.TIMProtocol
import net.mamoe.mirai.network.protocol.tim.packet.*
import net.mamoe.mirai.utils.TEA
import java.io.DataInputStream

View File

@ -1,6 +1,7 @@
package net.mamoe.mirai.network.protocol.tim.packet
package net.mamoe.mirai.network.protocol.tim.packet.login
import net.mamoe.mirai.network.protocol.tim.TIMProtocol
import net.mamoe.mirai.network.protocol.tim.packet.*
import net.mamoe.mirai.utils.TEA
import net.mamoe.mirai.utils.lazyEncode
import java.io.DataInputStream

View File

@ -1,7 +1,7 @@
package net.mamoe.mirai.network.protocol.tim.packet
package net.mamoe.mirai.network.protocol.tim.packet.login
import net.mamoe.mirai.network.protocol.tim.TIMProtocol
import net.mamoe.mirai.network.protocol.tim.packet.login.ClientPasswordSubmissionPacket
import net.mamoe.mirai.network.protocol.tim.packet.*
import net.mamoe.mirai.utils.ByteArrayDataOutputStream
import net.mamoe.mirai.utils.TEA
import net.mamoe.mirai.utils.hexToBytes

View File

@ -1,6 +1,7 @@
package net.mamoe.mirai.network.protocol.tim.packet
package net.mamoe.mirai.network.protocol.tim.packet.login
import net.mamoe.mirai.network.protocol.tim.TIMProtocol
import net.mamoe.mirai.network.protocol.tim.packet.*
import net.mamoe.mirai.utils.TEA
import net.mamoe.mirai.utils.Tested
import net.mamoe.mirai.utils.hexToBytes
@ -51,11 +52,11 @@ class ClientVerificationCodeSubmitPacket(
private val packetIdLast: Int,
private val qq: Long,
private val token0825: ByteArray,
private val verificationCode: String,
private val captcha: String,
private val verificationToken: ByteArray
) : ClientPacket() {
init {
require(verificationCode.length == 4) { "verificationCode.length must == 4" }
require(captcha.length == 4) { "captcha.length must == 4" }
}
override fun encode() {
@ -75,7 +76,7 @@ class ClientVerificationCodeSubmitPacket(
it.writeHex(TIMProtocol.publicKey)//25
it.writeHex("14 00 05 00 00 00 00 00 04")
it.write(verificationCode.toUpperCase().toByteArray())
it.write(captcha.toUpperCase().toByteArray())
it.writeHex("00 38")
it.write(verificationToken)