This commit is contained in:
Him188moe 2019-08-18 18:57:25 +08:00
parent e9b64c83f4
commit 2483dcc49d
27 changed files with 33 additions and 32 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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>()

View File

@ -1,7 +1,7 @@
package net.mamoe.mirai.contact
/**
* @author Him188moe @ Mirai Project
* @author Him188moe
*/
class QQ(number: Int) : Contact(number) {
init {

View File

@ -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()

View File

@ -5,7 +5,7 @@ import java.util.*
import java.util.stream.Collectors
/**
* @author Him188moe @ Mirai Project
* @author Him188moe
*/
interface Protocol {
companion object {

View File

@ -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

View File

@ -1,7 +1,7 @@
package net.mamoe.mirai.network.packet;
/**
* @author Him188moe @ Mirai Project
* @author Him188moe
*/
public interface Packet {

View File

@ -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)

View File

@ -1,7 +1,7 @@
package net.mamoe.mirai.network.packet;
/**
* @author Him188moe @ Mirai Project
* @author Him188moe
*/
public final class PacketUtil {

View File

@ -11,7 +11,7 @@ import java.net.InetAddress
import java.security.MessageDigest
/**
* @author Him188moe @ Mirai Project
* @author Him188moe
*/
@ExperimentalUnsignedTypes
abstract class ClientPacket : ByteArrayDataOutputStream(), Packet {

View File

@ -1,7 +1,7 @@
package net.mamoe.mirai.network.packet.client
/**
* @author Him188moe @ Mirai Project
* @author Him188moe
*/
@ExperimentalUnsignedTypes
class ClientSendMessagePacket : ClientPacket() {

View File

@ -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) {

View File

@ -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

View File

@ -13,7 +13,7 @@ import java.io.IOException
/**
* Server redirection (0825 response)
*
* @author Him188moe @ Mirai Project
* @author Him188moe
*/
@ExperimentalUnsignedTypes
@PacketId("08 25 31 02")

View File

@ -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

View File

@ -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")

View File

@ -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 {

View File

@ -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 {

View File

@ -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) {

View File

@ -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|

View File

@ -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

View File

@ -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() {

View File

@ -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;

View File

@ -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) {

View File

@ -1,5 +1,5 @@
/**
* @author Him188moe @ Mirai Project
* @author Him188moe
*/
public class NetworkTest {
public static void main(String[] args) {

View File

@ -1,7 +1,7 @@
package net.mamoe.mirai.util;
/**
* @author Him188moe @ Mirai Project
* @author Him188moe
*/
public final class TeaEncryption {