From d7a849845c4bf66a97c4a535e1c7a2323cb28864 Mon Sep 17 00:00:00 2001
From: "Brian S. Stephan" <bss@emptymatter.org>
Date: Thu, 22 Jan 2009 19:39:04 -0600
Subject: [PATCH] hilight the $meta{account} in a tweet with the irssi
 hilight_color. needs a hacky irssi -> mirc lookup table :(

---
 twirssi.pl | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/twirssi.pl b/twirssi.pl
index a1b4bcf..8f6be25 100644
--- a/twirssi.pl
+++ b/twirssi.pl
@@ -34,6 +34,24 @@ my %friends;
 my $last_poll = time - 300;
 my %tweet_cache;
 my %id_map;
+my %irssi_to_mirc_colors = (
+    '%k'    => '01',
+    '%r'    => '05',
+    '%g'    => '03',
+    '%y'    => '07',
+    '%b'    => '02',
+    '%m'    => '06',
+    '%c'    => '10',
+    '%w'    => '15',
+    '%K'    => '14',
+    '%R'    => '04',
+    '%G'    => '09',
+    '%Y'    => '08',
+    '%B'    => '12',
+    '%M'    => '13',
+    '%C'    => '11',
+    '%W'    => '00',
+);
 
 sub cmd_direct {
     my ( $data, $server, $win ) = @_;
@@ -734,7 +752,8 @@ sub monitor_child {
                 $marker                            = ":$marker";
             }
 
-            if ( $_ =~ /\@$meta{account}\W/ ) {
+            my $hilight_color = $irssi_to_mirc_colors{Irssi::settings_get_str("hilight_color")};
+            if ( $_ =~ s/\@($meta{account})\W/\cC$hilight_color\@$1\cO/g ) {
                 $hilight = MSGLEVEL_HILIGHT;
             }
 
-- 
2.39.5