From a43a4a4922b50d40e7b9350775218063b9610c52 Mon Sep 17 00:00:00 2001 From: beepbeat Date: Mon, 1 Jan 2018 02:57:43 +0100 Subject: [PATCH] Reduced the number of screen updates, added support for "AdiIrc" (log syntax is same as mIrc. --- src/Definition.kt | 8 ++---- src/LogHandler.kt | 2 ++ src/Main.kt | 55 +++++++++++++++++++++-------------------- src/WebSocketHandler.kt | 5 ++-- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/Definition.kt b/src/Definition.kt index 39a0962..4a7e5a8 100644 --- a/src/Definition.kt +++ b/src/Definition.kt @@ -29,7 +29,7 @@ class Rescue(client : String, clientSystem : System, language : String, number : - var rats : WatchableMutableList = WatchableMutableList(::updateScreen) + var rats : WatchableMutableList = WatchableMutableList(::noop) var notes : WatchableMutableList = WatchableMutableList(::updateScreen) override fun hashCode(): Int { @@ -46,8 +46,4 @@ enum class Trilean{ TRUE, FALSE, NEUTRAL; } -fun rescueChanged(prop : Any, old : Any, new : Any){ - //println() - //if (old != new) - //updateScreen() -} \ No newline at end of file +fun rescueChanged(prop : Any, old : Any, new : Any) = Unit \ No newline at end of file diff --git a/src/LogHandler.kt b/src/LogHandler.kt index 986d0f0..1c30dda 100644 --- a/src/LogHandler.kt +++ b/src/LogHandler.kt @@ -54,6 +54,8 @@ open class listener : TailerListenerAdapter(){ handleMessage(nick, line) } + fun adiirc(l : String?) = mirc(l) + fun mirc(l : String?){ var line : String = l!!.replace("\t", " ") val nick = line.split(Pattern.compile(" "), 3)[1].replace("<", "").replace(">", "").replace("+", "").replace("%", "").replace("@", "").replace("~", "").replace("&", "") // strip: +%@~& diff --git a/src/Main.kt b/src/Main.kt index 25821df..389c87a 100644 --- a/src/Main.kt +++ b/src/Main.kt @@ -154,7 +154,7 @@ fun updateScreen() { //terminal!!.exitPrivateMode() } -fun Terminal.printString(input : String, x : Int, y : Int, color : Pair = Pair(TextColor.ANSI.WHITE, TextColor.ANSI.BLACK), reversed : Boolean = false){ +fun Terminal.printString(input : String, x : Int, y : Int, color : Pair = Pair(TextColor.ANSI.WHITE, TextColor.ANSI.BLACK), reversed : Boolean = false, noflush : Boolean = false){ @Suppress("NAME_SHADOWING") val color = if (reversed){Pair(color.second, color.first)} else {color} val coords = this.cursorPosition @@ -164,7 +164,7 @@ fun Terminal.printString(input : String, x : Int, y : Int, color : Pair rats.map { it.uuid }.contains(rat) } .forEach { rats.add(Rat(resolveRatName(it), uuid= it)) } + attributes.get("unidentifiedRats").asJsonArray.forEach { rats.add(Rat(it.asString, uuid="-1").setNameCorrectly())} /* @@ -243,7 +244,7 @@ fun parseRescueUpdate(meta: JsonObject, data: JsonArray){ } - updateScreen() + // updateScreen() launch{ delay(255); updateScreen()} }