mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-05 23:50:08 +08:00
update
This commit is contained in:
parent
e9b64c83f4
commit
2483dcc49d
@ -1,11 +1,8 @@
|
||||
package net.mamoe.mirai;
|
||||
|
||||
|
||||
import net.mamoe.mirai.event.MiraiEventHook;
|
||||
import net.mamoe.mirai.event.events.server.ServerDisableEvent;
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
public final class MiraiMain {
|
||||
private static MiraiServer server;
|
||||
|
@ -3,7 +3,7 @@ package net.mamoe.mirai.contact
|
||||
/**
|
||||
* A contact is a QQ account or a QQ Group.
|
||||
*
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
abstract class Contact(val number: Int) {
|
||||
|
||||
|
@ -7,6 +7,10 @@ fun Int.asGroup(): Group = Instances.groups.stream().filter { t: Group? -> t?.nu
|
||||
|
||||
fun String.withImage(id: String, type: String) = "{$id}.$type"
|
||||
|
||||
fun String.withAt(qq: Int) = qq.asQQ().at()
|
||||
|
||||
fun String.withAt(qq: QQ) = qq.at()
|
||||
|
||||
object Instances {
|
||||
var qqs = arrayListOf<QQ>()
|
||||
var groups = arrayListOf<Group>()
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.mamoe.mirai.contact
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
class QQ(number: Int) : Contact(number) {
|
||||
init {
|
||||
|
@ -4,7 +4,7 @@ import net.mamoe.mirai.event.events.MiraiEvent
|
||||
import net.mamoe.mirai.network.Robot
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
class RobotLoginEvent(val robot: Robot) : MiraiEvent()
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.*
|
||||
import java.util.stream.Collectors
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
interface Protocol {
|
||||
companion object {
|
||||
|
@ -25,7 +25,7 @@ import java.net.InetSocketAddress
|
||||
/**
|
||||
* [number] is a QQ number.
|
||||
*
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
class Robot(val number: Int, private val password: String) {
|
||||
private var sequence: Int = 0
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.mamoe.mirai.network.packet;
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
public interface Packet {
|
||||
|
||||
|
@ -6,7 +6,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.mamoe.mirai.network.packet;
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
public final class PacketUtil {
|
||||
|
||||
|
@ -11,7 +11,7 @@ import java.net.InetAddress
|
||||
import java.security.MessageDigest
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
@ExperimentalUnsignedTypes
|
||||
abstract class ClientPacket : ByteArrayDataOutputStream(), Packet {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.mamoe.mirai.network.packet.client
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
@ExperimentalUnsignedTypes
|
||||
class ClientSendMessagePacket : ClientPacket() {
|
||||
|
@ -11,7 +11,7 @@ import net.mamoe.mirai.util.hexToBytes
|
||||
/**
|
||||
* Password submission (0836_622)
|
||||
*
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
@PacketId("08 36 31 03")
|
||||
@ExperimentalUnsignedTypes
|
||||
@ -120,7 +120,7 @@ class ClientLoginSucceedConfirmationPacket(
|
||||
}
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
@ExperimentalUnsignedTypes
|
||||
private fun ClientPacket.writePart1(qq: Int, password: String, loginTime: Int, loginIP: String, tgtgtKey: ByteArray, token0825: ByteArray) {
|
||||
|
@ -10,7 +10,7 @@ import net.mamoe.mirai.util.ByteArrayDataOutputStream
|
||||
import net.mamoe.mirai.util.TEACryptor
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
@PacketId("00 BA 31 01")
|
||||
@ExperimentalUnsignedTypes
|
||||
|
@ -13,7 +13,7 @@ import java.io.IOException
|
||||
/**
|
||||
* Server redirection (0825 response)
|
||||
*
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
@ExperimentalUnsignedTypes
|
||||
@PacketId("08 25 31 02")
|
||||
|
@ -10,7 +10,7 @@ import net.mamoe.mirai.util.TEACryptor
|
||||
import java.io.IOException
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
@ExperimentalUnsignedTypes
|
||||
@PacketId("00 58")//todo check
|
||||
|
@ -16,7 +16,7 @@ import java.io.IOException
|
||||
*
|
||||
* @see net.mamoe.mirai.network.packet.server.ServerTouchResponsePacket
|
||||
*
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
@ExperimentalUnsignedTypes
|
||||
@PacketId("08 25 31 01")
|
||||
|
@ -10,7 +10,7 @@ import net.mamoe.mirai.util.toHexString
|
||||
import java.io.DataInputStream
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
abstract class ServerPacket(val input: DataInputStream) : Packet {
|
||||
|
||||
|
@ -4,7 +4,7 @@ import net.mamoe.mirai.network.packet.server.ServerPacket
|
||||
import java.io.DataInputStream
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
class ServerLoginResponseFailedPacket(val state: State, input: DataInputStream) : ServerPacket(input) {
|
||||
enum class State {
|
||||
|
@ -5,7 +5,7 @@ import net.mamoe.mirai.network.packet.server.ServerPacket
|
||||
import java.io.DataInputStream
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
@PacketId("08 36 31 03")
|
||||
class ServerLoginResponseResendPacket(input: DataInputStream, val flag: Flag) : ServerPacket(input) {
|
||||
|
@ -10,8 +10,8 @@ import net.mamoe.mirai.util.hexToShort
|
||||
import java.io.DataInputStream
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author NaturalHG @ Mirai Project
|
||||
* @author Him188moe
|
||||
* @author NaturalHG
|
||||
*/
|
||||
class ServerLoginResponseSuccessPacket(input: DataInputStream, val packetDataLength: Int) : ServerPacket(input) {
|
||||
lateinit var _0828_rec_decr_key: ByteArray//16 bytes|
|
||||
|
@ -4,7 +4,7 @@ import net.mamoe.mirai.network.packet.server.ServerPacket
|
||||
import java.io.DataInputStream
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
class ServerLoginResponseVerificationCodePacket(input: DataInputStream) : ServerPacket(input) {
|
||||
var verifyCodeLength: Int = 0
|
||||
|
@ -8,7 +8,7 @@ import java.io.DataInputStream
|
||||
/**
|
||||
* Dispose_0828
|
||||
*
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
class ServerSessionKeyResponsePacket(inputStream: DataInputStream) : ServerPacket(inputStream) {
|
||||
lateinit var sessionKey: ByteArray
|
||||
@ -39,7 +39,7 @@ class ServerSessionKeyResponsePacket(inputStream: DataInputStream) : ServerPacke
|
||||
/**
|
||||
* Encrypted using []0828_rec_decr_key], decrypting in Robot
|
||||
*
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
class ServerSessionKeyResponsePacketEncrypted(inputStream: DataInputStream) : ServerPacket(inputStream) {
|
||||
override fun decode() {
|
||||
|
@ -11,7 +11,7 @@ import java.io.DataInputStream
|
||||
* @see net.mamoe.mirai.network.packet.client.login.ClientServerRedirectionPacket
|
||||
* @see net.mamoe.mirai.network.packet.client.login.ClientPasswordSubmissionPacket
|
||||
*
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
class ServerTouchResponsePacket(private val type: Type, inputStream: DataInputStream) : ServerPacket(inputStream) {
|
||||
var serverIP: String? = null;
|
||||
|
@ -7,7 +7,7 @@ import java.util.*
|
||||
import java.util.zip.CRC32
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
object Utils {
|
||||
fun toHexString(byteArray: ByteArray, separator: String = " "): String = byteArray.joinToString(separator) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
public class NetworkTest {
|
||||
public static void main(String[] args) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package net.mamoe.mirai.util;
|
||||
|
||||
/**
|
||||
* @author Him188moe @ Mirai Project
|
||||
* @author Him188moe
|
||||
*/
|
||||
public final class TeaEncryption {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user