From: pdbogen Date: Tue, 14 Oct 2008 18:26:46 +0000 (+0000) Subject: Don't allow null ignore/unignore. Show ignore list in the case of ignore, usage for... X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=43524e740e08bb0f0f915714126c2966c9cc5e5d;p=destult.git Don't allow null ignore/unignore. Show ignore list in the case of ignore, usage for unignore. Generating console message when either are used. git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@66 088b83a4-0077-4247-935c-42ec02c2848b --- diff --git a/commands.yaml b/commands.yaml index 2b76f19..1059a4a 100644 --- a/commands.yaml +++ b/commands.yaml @@ -1034,7 +1034,12 @@ PART: |- IGNORE: |- sub { my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_; - $what =~ s/[[:space:]]+$//; + if( $what =~ /^[[:space:]]*$/ ) { + $kernel->post( $src, $replypath, "The following users are ignored: ".join( ' ', keys(%{ $heap->{ 'ignored' } })), $dest ); + return; + } + $what =~ s/[[:space:]]*$//; + $what =~ s/^[[:space:]]*//; if( exists( $heap->{ 'ignored' }->{ uc( $what ) } ) ) { $kernel->post( $src, $replypath, "'$what' is already ignored.", $dest ); return; @@ -1042,12 +1047,18 @@ IGNORE: |- $heap->{ 'ignored' }->{ uc( $what ) } = $who; $kernel->post( $src, $replypath, "'$what' is now ignored.", $dest ); DumpFile( "ignored.yaml", $heap->{ 'ignored' } ); + print( "IGNORE: $who marks $what ignored\n" ); } UNIGNORE: |- sub { my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_; + if( $what =~ /^[[:space:]]*$/ ) { + $kernel->post( $src, $replypath, "Usage: UNIGNORE ", $dest ); + return; + } $what =~ s/[[:space:]]+$//; + $what =~ s/^[[:space:]]+//; if( exists( $heap->{ 'ignored' }->{ uc( $what ) } ) ) { delete $heap->{ 'ignored' }->{ uc( $what ) }; $kernel->post( $src, $replypath, "'$what' is no longer ignored.", $dest ); @@ -1055,6 +1066,7 @@ UNIGNORE: |- return; } $kernel->post( $src, $replypath, "'$what' is not ignored.", $dest ); + print( "UNIGNORE: $who marks $what unignored\n" ); } REPLACE: |-