From 0e668ac3f2b0ebaad0dba5fe4b7121c2c4ac42f0 Mon Sep 17 00:00:00 2001
From: Janne Koschinski <janne@kuschku.de>
Date: Sat, 3 Mar 2018 15:40:03 +0100
Subject: [PATCH] Fixed an issue rendering certain mIRC colors

---
 .../quasseldroid_ng/util/irc/format/IrcFormatDeserializer.kt  | 4 ++--
 .../libquassel/protocol/message/ClientInitSerializer.kt       | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/src/main/java/de/kuschku/quasseldroid_ng/util/irc/format/IrcFormatDeserializer.kt b/app/src/main/java/de/kuschku/quasseldroid_ng/util/irc/format/IrcFormatDeserializer.kt
index be95a8de0..75d3c7c00 100644
--- a/app/src/main/java/de/kuschku/quasseldroid_ng/util/irc/format/IrcFormatDeserializer.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid_ng/util/irc/format/IrcFormatDeserializer.kt
@@ -361,13 +361,13 @@ class IrcFormatDeserializer(private val context: Context) {
   private inner class ColorIrcFormat(val foreground: Byte, val background: Byte) : IrcFormat {
 
     override fun applyTo(editable: SpannableStringBuilder, from: Int, to: Int) {
-      if (foreground.toInt() > 0 && foreground.toInt() < mircColors.size) {
+      if (foreground.toInt() >= 0 && foreground.toInt() < mircColors.size) {
         editable.setSpan(
           IrcForegroundColorSpan(foreground.toInt(), mircColors[foreground.toInt()]), from, to,
           Spanned.SPAN_INCLUSIVE_EXCLUSIVE
         )
       }
-      if (background.toInt() > 0 && background.toInt() < mircColors.size) {
+      if (background.toInt() >= 0 && background.toInt() < mircColors.size) {
         editable.setSpan(
           IrcBackgroundColorSpan(background.toInt(), mircColors[background.toInt()]), from, to,
           Spanned.SPAN_INCLUSIVE_EXCLUSIVE
diff --git a/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientInitSerializer.kt b/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientInitSerializer.kt
index 3023e722c..f82d5819c 100644
--- a/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientInitSerializer.kt
+++ b/lib/src/main/java/de/kuschku/libquassel/protocol/message/ClientInitSerializer.kt
@@ -17,6 +17,6 @@ object ClientInitSerializer : HandshakeMessageSerializer<HandshakeMessage.Client
   override fun deserialize(data: QVariantMap) = HandshakeMessage.ClientInit(
     clientVersion = data["ClientVersion"].value(),
     buildDate = data["ClientDate"].value(),
-    clientFeatures = Flags.Companion.of(data["Features"].value(0))
+    clientFeatures = Flags.of(data["Features"].value(0))
   )
 }
-- 
GitLab