From 23594275aa0a41597d672f6d4f922cd12dc0963e Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 8 Oct 2012 15:57:40 -0400 Subject: [PATCH] Remove support for mIRC color codes. They tend to produce unwanted effects when an mIRC code is directly followed by a text digit (which is going to happen often in this context, e.g. with git hex commit IDs). the mIRC codes have no end delimiter, so unless the client's recognizer is very carefully crafted it will eat following text. --- irkerhook.py | 14 +++++--------- irkerhook.xml | 3 +-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/irkerhook.py b/irkerhook.py index 17abef8..fa67af6 100755 --- a/irkerhook.py +++ b/irkerhook.py @@ -104,23 +104,19 @@ class GenericExtractor: self.filtercmd = None # Color highlighting is disabled by default. self.color = None - self.bold = self.green = self.blue = "" - self.yellow = self.brown = self.reset = "" + self.bold = self.green = self.blue = self.yellow = "" + self.brown = self.magenta = self.cyan = self.reset = "" def activate_color(self, style): "IRC color codes." - if style == 'mIRC': - self.bold = '\x02' - self.green = '\x033' - self.blue = '\x032' - self.yellow = '\x037' - self.brown = '\x035' - self.reset = '\x0F' if style == 'ANSI': self.bold = '\x1b[1m' self.green = '\x1b[1;32m' self.blue = '\x1b[1;34m' + self.red = '\x1b[1;31m' self.yellow = '\x1b[1;33m' self.brown = '\x1b[33m' + self.magenta = '\x1b[35m' + self.cyan = '\x1b[36m' self.reset = '\x1b[0m' def load_preferences(self, conf): "Load preferences from a file in the repository root." diff --git a/irkerhook.xml b/irkerhook.xml index d097aaa..f031c72 100644 --- a/irkerhook.xml +++ b/irkerhook.xml @@ -119,8 +119,7 @@ variable is "None", no compression will be attempted. color -If "mIRC", highlight notification fields with mIRC color codes. -If "ANSI", highlight notification fields with ANSI color escape sequences. +If "ANSI", highlight notification fields with ANSI color escape sequences. Defaults to "none" (no colors). Note: if you turn this on and notifications stop appearing on your channel, you need to turn off IRC's color filter on that channel. To do this you will need op -- 2.26.2