From 26b3ac07c2462e8b9dc424293fd6e7215ab88159 Mon Sep 17 00:00:00 2001 From: Him188 Date: Mon, 7 Oct 2019 12:49:39 +0800 Subject: [PATCH] Unmodifiable IP list --- .../protocol/tim/TIMBotNetworkHandler.kt | 1 + .../mirai/network/protocol/tim/TIMProtocol.kt | 28 +++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/network/protocol/tim/TIMBotNetworkHandler.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/network/protocol/tim/TIMBotNetworkHandler.kt index fe34b13bd..6ecddcc4f 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/network/protocol/tim/TIMBotNetworkHandler.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/network/protocol/tim/TIMBotNetworkHandler.kt @@ -423,6 +423,7 @@ internal class TIMBotNetworkHandler(private val bot: Bot) : BotNetworkHandler { } } + @Suppress("MemberVisibilityCanBePrivate") suspend fun changeOnlineStatus(status: ClientLoginStatus) { socket.sendPacket(ClientChangeOnlineStatusPacket(bot.account.qqNumber, sessionKey, status)) } diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/network/protocol/tim/TIMProtocol.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/network/protocol/tim/TIMProtocol.kt index e86afaddd..6d02ff12f 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/network/protocol/tim/TIMProtocol.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/network/protocol/tim/TIMProtocol.kt @@ -14,23 +14,21 @@ import java.util.stream.Collectors * @author Him188moe */ object TIMProtocol { - val SERVER_IP: List = object : ArrayList() { - init { - //add("183.60.56.29") + val SERVER_IP: List by lazy { + //add("183.60.56.29") + val list = mutableListOf() + arrayOf( + "sz3.tencent.com", + "sz4.tencent.com", + "sz5.tencent.com", + "sz6.tencent.com", + "sz8.tencent.com", + "sz9.tencent.com", + "sz2.tencent.com" + ).forEach { list.add(InetAddress.getByName(it).hostAddress) } - arrayOf( - "sz3.tencent.com", - "sz4.tencent.com", - "sz5.tencent.com", - "sz6.tencent.com", - "sz8.tencent.com", - "sz9.tencent.com", - "sz2.tencent.com" - ).forEach { this.add(InetAddress.getByName(it).hostAddress) } - - } + list.toList() } - get() = Collections.unmodifiableList(field) const val head = "02" const val ver = "37 13"