Moduled project

This commit is contained in:
Him188moe 2019-09-08 14:49:05 +08:00
parent 3ad2b4d606
commit b33e8757e5
9 changed files with 96 additions and 13 deletions

37
mirai-api/pom.xml Normal file
View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.mamoe</groupId>
<artifactId>mirai</artifactId>
<version>1.0</version>
</parent>
<artifactId>mirai-api</artifactId>
<version>1.0</version>
<dependencies>
</dependencies>
<build>
<resources>
<resource>
<directory>/src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
<plugins>
</plugins>
</build>
</project>

37
mirai-console/pom.xml Normal file
View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.mamoe</groupId>
<artifactId>mirai</artifactId>
<version>1.0</version>
</parent>
<artifactId>mirai-console</artifactId>
<version>1.0</version>
<dependencies>
</dependencies>
<build>
<resources>
<resource>
<directory>/src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
<plugins>
</plugins>
</build>
</project>

View File

@ -178,13 +178,7 @@ public class MiraiServer {
getLogger().info("Initializing [Robot]s");
try {
getAvailableRobot();
} catch (ExecutionException | InterruptedException e) {
e.printStackTrace();
}
/*
this.qqs.keySet().stream().map(key -> this.qqs.getSection(key)).forEach(section -> {
getLogger().info("Initializing [Robot] " + section.getString("account"));
try {
@ -205,7 +199,7 @@ public class MiraiServer {
getLogger().error("Could not load QQ robots config!");
System.exit(1);
}
});*/
});
}

View File

@ -36,7 +36,6 @@ public final class Robot implements Closeable {
public static final List<Robot> instances = Collections.synchronizedList(new LinkedList<>());
public final int id = _id.getAndAdd(1);
private static final AtomicInteger _id = new AtomicInteger(0);
public final RobotAccount account;
@ -118,5 +117,12 @@ public final class Robot implements Closeable {
this.contacts.qqs.clear();
}
public void addFriend(long qq) {
}
/* PRIVATE */
private static final AtomicInteger _id = new AtomicInteger(0);
}

View File

@ -11,8 +11,7 @@ import net.mamoe.mirai.message.defaults.PlainText
* @param robot Owner [Robot]
* @author Him188moe
*/
abstract class Contact(val robot: Robot, val number: Long) {
abstract class Contact internal constructor(val robot: Robot, val number: Long) {
/**
* Async
*/

View File

@ -15,7 +15,7 @@ import java.util.*
* 可发送的或从服务器接收的消息.
* 采用这样的消息模式是因为 QQ 的消息多元化, 一条消息中可包含 [纯文本][PlainText], [图片][Image] .
*
* Kotlin, 使用 [Message] 与使用 [String] 几乎没有什么用法上的区别.
* Kotlin, 使用 [Message] 与使用 [String] 几乎没有什么用法上的区别, 除了
*
* @author Him188moe
* @see Contact.sendMessage

View File

@ -508,7 +508,10 @@ class RobotNetworkHandler(private val robot: Robot) : Closeable {
//GroupMessageEvent(this.robot, robot.contacts.getGroupByNumber(packet.groupNumber), robot.contacts.getQQ(packet.qq), packet.message)
}
is UnknownServerEventPacket,
is UnknownServerEventPacket -> {
//todo
}
is ServerSendFriendMessageResponsePacket,
is ServerSendGroupMessageResponsePacket -> {
//ignored
@ -546,6 +549,10 @@ class RobotNetworkHandler(private val robot: Robot) : Closeable {
}
fun addFriend(qqNumber: Long): Unit {
}
override fun close() {
}

View File

@ -62,8 +62,9 @@ abstract class ServerPacket(val input: DataInputStream) : Packet {
return ServerLoginResponseSuccessPacket.Encrypted(stream).apply { this.idHex = idHex }
}
println(bytes.size)
return ServerLoginResponseFailedPacket(when (bytes.size) {
63, 319, 135, 351 -> LoginState.WRONG_PASSWORD
63, 319, 135, 351 -> LoginState.WRONG_PASSWORD//这四个其中一个也是被冻结
//135 -> LoginState.RETYPE_PASSWORD
279 -> LoginState.BLOCKED
263 -> LoginState.UNKNOWN_QQ_NUMBER

View File

@ -13,6 +13,8 @@
<module>mirai-core</module>
<module>mirai-native</module>
<module>mirai-ui</module>
<module>mirai-console</module>
<module>mirai-api</module>
</modules>
<repositories>