aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2022-05-01 13:08:18 +0000
committerterminaldweller <thabogre@gmail.com>2022-05-01 13:08:18 +0000
commit0e9477a77d08d617612c2a075ce98db6d64d3a8c (patch)
treee6c63e337d1c55366499365218ada07a5703e371
parentjanky fix (diff)
downloadirssi-scripts-0e9477a77d08d617612c2a075ce98db6d64d3a8c.tar.gz
irssi-scripts-0e9477a77d08d617612c2a075ce98db6d64d3a8c.zip
added a modified version of hilite_url
-rw-r--r--hilite-url/hilite_url.pl44
1 files changed, 44 insertions, 0 deletions
diff --git a/hilite-url/hilite_url.pl b/hilite-url/hilite_url.pl
new file mode 100644
index 0000000..29cd312
--- /dev/null
+++ b/hilite-url/hilite_url.pl
@@ -0,0 +1,44 @@
+# Simple script to highlight urls
+# To configure the color, the setting 'url_color' can be set. The format
+# is like the bash colors. So for instance, if you want to have the links to be
+# colored in red, set the color to 31.
+# See this page for more information about colors:
+# https://misc.flogisoft.com/bash/tip_colors_and_formatting
+
+use strict;
+use Irssi;
+use vars qw($VERSION %IRSSI);
+
+# Dev. info ^_^
+$VERSION = "0.2";
+%IRSSI = (
+ authors => "Stefan Heinemann",
+ contact => "stefan.heinemann\@codedump.ch",
+ name => "HiliteUrl",
+ description => "Simple script that highlights links",
+ license => "GPL",
+ url => "http://senseless.codedump.ch",
+);
+
+# All the works
+sub hilite_url {
+ my ($server, $data, $nick, $mask, $target) = @_;
+
+ my $color = Irssi::settings_get_int('url_color');
+
+ $color = sprintf("\e[%sm", $color);
+
+ # Add Colours
+ # $data =~ s/(https?:\/\/[^\s]+)/$color\1\e[00m/g;
+ $data =~ s/(https?:\/\/[^\s]+)/\e[07m\1\e[07m/g;
+
+ # Let it flow
+ Irssi::signal_continue($server, $data, $nick, $mask, $target);
+}
+
+# Hook me up
+Irssi::signal_add('message public', 'hilite_url');
+
+Irssi::settings_add_int(
+ 'hilite_url', 'url_color', "4;34"
+)