blob: def9440a478e14f1ab3306ac9174fe210ce9123d (
plain) (
blame)
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
29
|
use strict;
use vars qw($VERSION %IRSSI);
use Irssi;
use Regexp::Common qw/URI/;
use WWW::Shorten::TinyURL;
$VERSION = '2.1';
%IRSSI = (
authors => 'Shabble',
contact => 'shabble+irssi /at/ metavore /dot/ org',
name => 'Shorten URLs using Tab',
description => '',
license => 'WTFPL',
);
sub do_complete {
my ($strings, $window, $word, $linestart, $want_space) = @_;
return if $word eq '';
if ($word =~ m/$RE{URI}{HTTP}{-keep}/) {
my $uri = makeashorterlink($1);
push @$strings, $uri if $uri;
$$want_space = 1;
Irssi::signal_stop();
}
}
Irssi::signal_add_first( 'complete word', \&do_complete);
|