From: pdbogen Date: Tue, 16 Oct 2007 15:08:28 +0000 (+0000) Subject: Don't cache the result if shortening fails. Also, add a command to flush URLs. X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=154f384457fb5b94535031e5f30fdf9ba07a0c04;p=destult.git Don't cache the result if shortening fails. Also, add a command to flush URLs. git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@31 088b83a4-0077-4247-935c-42ec02c2848b --- diff --git a/cmdaccess.yaml b/cmdaccess.yaml index 9bd997b..a7d80d8 100644 --- a/cmdaccess.yaml +++ b/cmdaccess.yaml @@ -13,3 +13,4 @@ REGISTER: 0 REPLACE: 1 SIEVE: 1 TRANSLATE: 0 +FLUSHURLS: 1 diff --git a/commands.yaml b/commands.yaml index 5d72bbd..77a7e62 100644 --- a/commands.yaml +++ b/commands.yaml @@ -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 ); + }