Don't cache the result if shortening fails. Also, add a command to flush URLs.
authorpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Tue, 16 Oct 2007 15:08:28 +0000 (15:08 +0000)
committerpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Tue, 16 Oct 2007 15:08:28 +0000 (15:08 +0000)
git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@31 088b83a4-0077-4247-935c-42ec02c2848b

cmdaccess.yaml
commands.yaml

index 9bd997b..a7d80d8 100644 (file)
@@ -13,3 +13,4 @@ REGISTER: 0
 REPLACE: 1
 SIEVE: 1
 TRANSLATE: 0
+FLUSHURLS: 1
index 5d72bbd..77a7e62 100644 (file)
@@ -1376,8 +1376,13 @@ TINYURL: |-
       my @arr = @{ $heap->{ 'urls' }->{ uc( $what ) } };
       $kernel->post( $src, $replypath, $arr[2]." [first: ".$arr[0]."/".$arr[1]."]", $dest );
     } else {
-      my $url = makeashorterlink( $what );
+      my $url = makeashorterlink( $what ) or return;
       $heap->{ 'urls' }->{ uc( $what ) } = [ $who, $dest, $url ];
       $kernel->post( $src, $replypath, "$url [$who]", $dest );
     }
   }
+FLUSHURLS: |-
+  sub {
+       $heap->{ 'urls' } = {};
+       $kernel->post( $src, $replypath, "URL cache flushed.", $dest );
+  }