mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-09 18:00:33 +08:00
Convert DEFAULT_BLACKLIST
to function and initialize the immutable set only once
This commit is contained in:
parent
65a3ffc147
commit
f9da72c136
@ -36,7 +36,7 @@ internal interface PacketLoggingStrategy {
|
|||||||
|
|
||||||
internal class PacketLoggingStrategyImpl(
|
internal class PacketLoggingStrategyImpl(
|
||||||
private val bot: AbstractBot,
|
private val bot: AbstractBot,
|
||||||
private val blacklist: Set<String> = DEFAULT_BLACKLIST,
|
private val blacklist: Set<String> = getDefaultBlacklist(),
|
||||||
) : PacketLoggingStrategy {
|
) : PacketLoggingStrategy {
|
||||||
override fun logSent(logger: MiraiLogger, outgoingPacket: OutgoingPacket) {
|
override fun logSent(logger: MiraiLogger, outgoingPacket: OutgoingPacket) {
|
||||||
if (outgoingPacket.commandName in blacklist) return
|
if (outgoingPacket.commandName in blacklist) return
|
||||||
@ -83,10 +83,13 @@ internal class PacketLoggingStrategyImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val DEFAULT_BLACKLIST: Set<String>
|
fun getDefaultBlacklist(): Set<String> {
|
||||||
get() {
|
|
||||||
if (systemProp("mirai.debug.network.show.verbose.packets", false)) return emptySet()
|
if (systemProp("mirai.debug.network.show.verbose.packets", false)) return emptySet()
|
||||||
return setOf(
|
return DEFAULT_BLACKLIST
|
||||||
|
}
|
||||||
|
|
||||||
|
private val DEFAULT_BLACKLIST: Set<String> by lazy {
|
||||||
|
setOf(
|
||||||
// C2C event sync, too verbose to show.
|
// C2C event sync, too verbose to show.
|
||||||
"MessageSvc.PushNotify",
|
"MessageSvc.PushNotify",
|
||||||
"MessageSvc.PbGetMsg",
|
"MessageSvc.PbGetMsg",
|
||||||
|
Loading…
Reference in New Issue
Block a user