Pass the trusted bit along in the destination hash we give to commands, so that PARSE...
authorpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Tue, 2 Jun 2009 14:18:39 +0000 (14:18 +0000)
committerpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Tue, 2 Jun 2009 14:18:39 +0000 (14:18 +0000)
git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@98 088b83a4-0077-4247-935c-42ec02c2848b

commands.yaml
core.pl

index 4d49136..0c30718 100644 (file)
@@ -410,7 +410,7 @@ PARSE: |-
       $response = $responses[ int( rand( scalar( @responses ) ) ) ].$author;
     } elsif( $response =~ /<alias>(.+)/ ) {
       $response =~ s/<alias>//;
-      $kernel->post( "core", "cmd", $who, "~+".$response, $src, $dest->{ 'dest' }, $replypath );
+      $kernel->post( "core", "cmd", $who, "~+".$response, $src, $dest->{ 'dest' }, $replypath, $dest->{ 'trusted' } );
       return;
     } else {
       my @responses = split( /\|/, $response );
diff --git a/core.pl b/core.pl
index e3c6260..d96d6c0 100644 (file)
--- a/core.pl
+++ b/core.pl
@@ -155,9 +155,9 @@ sub cmd {
            !exists $heap->{ 'identified' }->{ $src.uc( $who ) } &&
            $cmd !~ /identify|register|title/i ) {
                $kernel->post( $src,
-                              $replypath,
+                              "send_private",
                               "$who: Destult is operating in high security mode; all use must be from identified users. Please REGISTER and then IDENTIFY.",
-                              { dest=>$dest, src=>$who, no_throttle=>$no_throttle }
+                              { dest=>$who, src=>$who, no_throttle=>$no_throttle, trusted => $trusted }
                );
                return;
        }
@@ -168,21 +168,21 @@ sub cmd {
                        $kernel->post( $src,
                                       $replypath,
                                       "$who: Use of access-controled commands is not allowed from untrusted sources.",
-                                      { dest=>$dest, src=>$who, no_throttle=>$no_throttle }
+                                      { dest=>$dest, src=>$who, no_throttle=>$no_throttle, trusted => $trusted }
                        );
                        return;
                }
                if( !exists $heap->{ 'cmdaccess' }->{ uc( $cmd ) } || (
                        exists $heap->{ 'identified' }->{ $src.uc( $who ) } &&
                        accessLevel( $kernel, $heap, uc( $who ), $src ) >= $heap->{ 'cmdaccess' }->{ uc( $cmd ) } ) ) {
-                       &{ $heap->{ 'commands' }->{ uc( $cmd ) } }( $kernel, $heap, $who, $subj, $src, { dest => $dest, src=>$who, no_throttle => $no_throttle }, $replypath );
+                       &{ $heap->{ 'commands' }->{ uc( $cmd ) } }( $kernel, $heap, $who, $subj, $src, { dest => $dest, src=>$who, no_throttle => $no_throttle, trusted => $trusted }, $replypath );
                } else {
-                       $kernel->post( $src, $replypath, "$who: An access level of ".$heap->{ 'cmdaccess' }->{ uc( $cmd ) }." is required for '$cmd'", { dest=>$dest, src=>$who, no_throttle=>$no_throttle } );
+                       $kernel->post( $src, $replypath, "$who: An access level of ".$heap->{ 'cmdaccess' }->{ uc( $cmd ) }." is required for '$cmd'", { dest=>$dest, src=>$who, no_throttle=>$no_throttle, trusted => $trusted } );
                }
        } elsif( exists( $heap->{ 'db' }->{ uc( $what ) } ) && !$noparse ) {
-               &{ $heap->{ 'commands' }->{ 'PARSE' } }( $kernel, $heap, $who, $what, $src, { dest => $dest, src=>$who, no_throttle => $no_throttle }, $replypath );
+               &{ $heap->{ 'commands' }->{ 'PARSE' } }( $kernel, $heap, $who, $what, $src, { dest => $dest, src=>$who, no_throttle => $no_throttle, trusted => $trusted }, $replypath );
        } else {
-               $kernel->post( $src, "send_private", "Huh?", { dest => $who, src => $who } );
+               $kernel->post( $src, "send_private", "Huh?", { dest => $who, src => $who, trusted => $trusted } );
        }
 }