Don't allow null ignore/unignore. Show ignore list in the case of ignore, usage for...
authorpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Tue, 14 Oct 2008 18:26:46 +0000 (18:26 +0000)
committerpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Tue, 14 Oct 2008 18:26:46 +0000 (18:26 +0000)
git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@66 088b83a4-0077-4247-935c-42ec02c2848b

commands.yaml

index 2b76f19..1059a4a 100644 (file)
@@ -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 <name>", $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: |-