From f78c4b66deda932c33923272bda116142edc027c Mon Sep 17 00:00:00 2001 From: pdbogen Date: Wed, 12 Nov 2008 21:59:09 +0000 Subject: [PATCH] Be more diligent about finding a shortened URL form for TITLE. git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@79 088b83a4-0077-4247-935c-42ec02c2848b --- commands.yaml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/commands.yaml b/commands.yaml index f877c2e..b481c34 100644 --- a/commands.yaml +++ b/commands.yaml @@ -1730,8 +1730,15 @@ TITLE: |- return; } - use WWW::Shorten::TinyURL; - + use WWW::Shorten::SnipURL; + my $short = makeashorterlink( $what ); + if( !$short ) { + use WWW::Shorten::TinyURL; + } + $short = makeashorterlink( $what ); + if( !$short ) { + $short = $what; + } use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->timeout(5); @@ -1745,9 +1752,12 @@ TITLE: |- my $title = decode_entities( $1 ); $title =~ s/[[:space:]]+/ /gs; $title =~ s/(^[[:space:]]*)|([[:space:]]*$)//gs; - $kernel->post( $src, $replypath, BOLD . makeashorterlink( $what ) . NORMAL . " ($title)", $dest ); + $kernel->post( $src, $replypath, BOLD . $short . NORMAL . " ($title)", $dest ); } else { - $kernel->post( $src, $replypath, BOLD . makeashorterlink( $what ) . NORMAL, $dest ); + my $resp = BOLD; + $resp .= $short; + $resp .= NORMAL; + $kernel->post( $src, $replypath, $resp, $dest ); } } } -- 2.11.0