aboutsummaryrefslogtreecommitdiffstats
path: root/tinyurl-tabcomplete
diff options
context:
space:
mode:
authorTom Feist <shabble@cowu.be>2010-09-16 15:25:01 +0000
committerTom Feist <shabble@cowu.be>2010-09-16 15:25:01 +0000
commit15fc0c2cc4635f7a04e31d054ef34abbd3e63073 (patch)
tree531ef5d1a6ebc58efa05c6a227edda517d379888 /tinyurl-tabcomplete
parentmodified it to use DaringFireball liberal uri match rather than re::common to... (diff)
downloadirssi-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.pl6
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;
}
}