From: pdbogen Date: Wed, 12 Nov 2008 21:59:09 +0000 (+0000) Subject: Be more diligent about finding a shortened URL form for TITLE. X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=f78c4b66deda932c33923272bda116142edc027c;p=destult.git 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 --- 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 ); } } }