diff options
author | Tom Feist <shabble@metavore.org> | 2010-10-14 20:42:31 +0000 |
---|---|---|
committer | Tom Feist <shabble@metavore.org> | 2010-10-14 20:42:31 +0000 |
commit | 91585163e7f7cd886b2bce4c98dbc3d14b9d3c2e (patch) | |
tree | ad714832c76eb1c72537db47c1a309261d2385ab /url_hilight | |
parent | uberprompt: removed dead code from startup func. (diff) | |
download | irssi-scripts-91585163e7f7cd886b2bce4c98dbc3d14b9d3c2e.tar.gz irssi-scripts-91585163e7f7cd886b2bce4c98dbc3d14b9d3c2e.zip |
misc: tidying up my working dir
Diffstat (limited to 'url_hilight')
-rw-r--r-- | url_hilight/url_hilight.pl | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/url_hilight/url_hilight.pl b/url_hilight/url_hilight.pl new file mode 100644 index 0000000..4efb893 --- /dev/null +++ b/url_hilight/url_hilight.pl @@ -0,0 +1,26 @@ +use strict; +use warnings; +use Irssi; + +our %IRSSI = ( + "author" => 'shabble', + "contact" => 'shabble+irssi@metavore.org, shabble@Freenode/#irssi', + "name" => 'URL Highlighter', + "description" => ' ' + "license" => 'WTFPL: http://sam.zoy.org/wtfpl/' + "version" => '0.1' + ); + +# regex taken from http://daringfireball.net/2010/07/improved_regex_for_matching_urls +my $url_regex = qr((?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))); + +sub handle_gui_print_text { + my ($win, $fg, $bg, $flags, $text, $text_dest) = @_; + if ($text =~ $url_regex) { + print "matched!"; + } +} + + +Irssi::signal_add('gui print text', \&handle_gui_print_text); + |