From f0048f64ac14c1ea0d3563ca564621f7007ada28 Mon Sep 17 00:00:00 2001
From: Janne Koschinski <janne@kuschku.de>
Date: Fri, 30 Mar 2018 16:11:41 +0200
Subject: [PATCH] Only serialize old-school mirc colors as codes

---
 .../quasseldroid/util/irc/format/IrcFormatSerializer.kt   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatSerializer.kt b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatSerializer.kt
index e09276bc1..d5645dec0 100644
--- a/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatSerializer.kt
+++ b/app/src/main/java/de/kuschku/quasseldroid/util/irc/format/IrcFormatSerializer.kt
@@ -183,13 +183,13 @@ class IrcFormatSerializer @Inject constructor(private val context: Context) {
 
         val hasForegroundBefore = foreground != null
         val hasBackgroundBefore = background != null
-        val foregroundBeforeCodeValid = foregroundCode != null
-        val backgroundBeforeCodeValid = backgroundCode != null
+        val foregroundBeforeCodeValid = foregroundCode != null && foregroundCode < 16
+        val backgroundBeforeCodeValid = backgroundCode != null && backgroundCode < 16
 
         val hasForegroundAfter = afterForeground != null
         val hasBackgroundAfter = afterBackground != null
-        val foregroundAfterCodeValid = afterForegroundCode != null
-        val backgroundAfterCodeValid = afterBackgroundCode != null
+        val foregroundAfterCodeValid = afterForegroundCode != null && afterForegroundCode < 16
+        val backgroundAfterCodeValid = afterBackgroundCode != null && afterBackgroundCode < 16
 
         if ((!hasBackgroundAfter || backgroundAfterCodeValid) &&
             (!hasForegroundAfter || foregroundAfterCodeValid) &&
-- 
GitLab