Be more diligent about finding a shortened URL form for TITLE.
authorpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Wed, 12 Nov 2008 21:59:09 +0000 (21:59 +0000)
committerpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Wed, 12 Nov 2008 21:59:09 +0000 (21:59 +0000)
git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@79 088b83a4-0077-4247-935c-42ec02c2848b

commands.yaml

index f877c2e..b481c34 100644 (file)
@@ -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 );
       }
     }
   }