aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-02-14 22:06:57 +0100
committerTeddy Wing2018-02-14 22:06:57 +0100
commitb8f971b65d1e3abc7a5734844f94367dfec3e67d (patch)
treeb6b5bf53c869c86f166e677bee7a087ddf41bafe
parentbf7216f3e55c357d1428f74a19fb34635452842c (diff)
downloadirssi-dimpid-b8f971b65d1e3abc7a5734844f94367dfec3e67d.tar.bz2
Get rid of theme, use colour escape codes instead
After doing some research it seemed like it was going to be way too complicated to do this with a theme. I was able to print the message, but would need to include the whole rest of the line, including timestamp, nick, etc. in order to make the line look like it was a normal message. Too much work for not enough gain. That's not to say it isn't possible. Here's the one script I found that appeared to be doing this: https://github.com/irssi/scripts.irssi.org/blob/d62bb05a34ffd6d8d0f719c551d8e454880ef8e1/scripts/nm2.pl Crazy talented stuff. Since we really just want to turn the message text grey, use a simple `signal_continue` and colourise the text with escape codes.
-rw-r--r--dimpid.pl10
1 files changed, 2 insertions, 8 deletions
diff --git a/dimpid.pl b/dimpid.pl
index 1c04b34..ca32c6d 100644
--- a/dimpid.pl
+++ b/dimpid.pl
@@ -12,16 +12,10 @@ our %IRSSI = {
};
-use Data::Dumper;
-
-Irssi::theme_register(['dimpid', '%5$0%n']);
-
Irssi::signal_add('message public', sub {
- my ($server, $text, $nick, $address, $target) = @_;
-
- Irssi::print(Dumper($target), MSGLEVEL_CLIENTCRAP);
+ my ($server, $text, $nick, @rest) = @_;
if ($nick eq 'test-3kj469y5h') {
- $server->printformat($target, MSGLEVEL_PUBLIC, 'dimpid', $text);
+ Irssi::signal_continue($server, "\x{03}14" . $text . "\x{03}", $nick, @rest);
}
});