diff options
author | Tom Feist <shabble@cowu.be> | 2010-09-16 15:25:01 +0000 |
---|---|---|
committer | Tom Feist <shabble@cowu.be> | 2010-09-16 15:25:01 +0000 |
commit | 15fc0c2cc4635f7a04e31d054ef34abbd3e63073 (patch) | |
tree | 531ef5d1a6ebc58efa05c6a227edda517d379888 /tinyurl-tabcomplete | |
parent | modified it to use DaringFireball liberal uri match rather than re::common to... (diff) | |
download | irssi-scripts-15fc0c2cc4635f7a04e31d054ef34abbd3e63073.tar.gz irssi-scripts-15fc0c2cc4635f7a04e31d054ef34abbd3e63073.zip |
fixed bug that tried to complete non-uri strings, and also added a check to see
if its already been shortened to prevent recursive shortening.
Diffstat (limited to 'tinyurl-tabcomplete')
-rw-r--r-- | tinyurl-tabcomplete/complete-tiny-url.pl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tinyurl-tabcomplete/complete-tiny-url.pl b/tinyurl-tabcomplete/complete-tiny-url.pl index e3100e4..ead811c 100644 --- a/tinyurl-tabcomplete/complete-tiny-url.pl +++ b/tinyurl-tabcomplete/complete-tiny-url.pl @@ -16,7 +16,9 @@ $VERSION = '2.1'; sub do_complete { my ($strings, $window, $word, $linestart, $want_space) = @_; return if $word eq ''; - if (defined (my $found_uri = match_uri($word))) { + my $found_uri = match_uri($word); + if (defined $found_uri && $found_uri !~ m/tinyurl\./i) { + print "Going to reduce: $found_uri"; my $uri = makeashorterlink($found_uri); push @$strings, $uri if $uri; $$want_space = 1; @@ -60,7 +62,7 @@ sub match_uri { $uri = 'http://' . $uri if $uri !~ m(http://); return $uri; } else { - return ''; + return undef; } } |