summaryrefslogtreecommitdiffstats
path: root/scripts/hilite_url.pl
blob: 11c4b0d936039ebb1f7a59f38707ca3048c05515 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Simple script to highlight links in public messages

use strict;
use vars qw($VERSION %IRSSI);

# Dev. info ^_^
$VERSION = "0.1";
%IRSSI = (
	authors     => "Stefan Heinemann",
	contact     => "stefan.heinemann\@codedump.ch",
	name        => "hilite url",
	description => "Simple script that highlights URL",
	license     => "GPL",
	url         => "http://senseless.codedump.ch",
);

sub hilite_url {
	my ($server, $data, $nick, $mask, $target) = @_;

	# Add Colours
	$data =~ s/(https?:\/\/[^\s]+)/\e[4;34m\1\e[00m/g;

	# Let it flow
	Irssi::signal_continue($server, $data, $nick, $mask, $target);
}

# Hook me up
Irssi::signal_add('message public', 'hilite_url');