When identifying as another user, track *that* username in the identified array and...
authorpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Wed, 17 Feb 2010 14:55:13 +0000 (14:55 +0000)
committerpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Wed, 17 Feb 2010 14:55:13 +0000 (14:55 +0000)
git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@108 088b83a4-0077-4247-935c-42ec02c2848b

commands.yaml
core.pl

index f04ecdd..68cbf15 100644 (file)
@@ -235,7 +235,7 @@ IDENTIFY: |-
   
     if( exists( $heap->{ 'users' }->{ uc( $whom ) } ) ) {
       if( $heap->{ 'users' }->{ uc( $whom ) } eq md5_hex( $password ) ) {
-       $heap->{ 'identified' }->{ $src.uc( $who ) } = 1;
+       $heap->{ 'identified' }->{ $src.uc( $who ) } = uc( $whom );
        $kernel->post( $src, $replypath, "Hello, $who.", $dest );
       } else {
         $kernel->post( $src, $replypath, "Authentication failed.", $dest );
@@ -411,7 +411,7 @@ PARSE: |-
 
     if( exists( $heap->{ 'factoidAccess' }->{ uc( $factoid ) } ) &&
       ( !exists( $heap->{ 'identified' }->{ $src.uc( $who ) } ) ||
-        accessLevel( $kernel, $heap, uc( $who ), $src ) < $heap->{ 'factoidAccess' }->{ uc( $factoid ) } ) ) {
+        accessLevel( $kernel, $heap, $heap->{ 'identified' }->{ $src.uc( $who ) }, $src ) < $heap->{ 'factoidAccess' }->{ uc( $factoid ) } ) ) {
       $kernel->post( $src, $replypath, "$who: An access level of ".$heap->{ 'factoidAccess' }->{ uc( $factoid ) }." is required for the factoid '$factoid'", $dest );
       return;
     }
diff --git a/core.pl b/core.pl
index 36f4004..8fa1fa6 100644 (file)
--- a/core.pl
+++ b/core.pl
@@ -42,7 +42,7 @@ sub seen {
        if( exists( $heap->{ 'memo' } ) &&
            exists( $heap->{ 'memo' }->{ uc( $who ) } ) ) {
            if( exists( $heap->{ 'identified' }->{ $src.uc( $who ) } ) ) {
-                       $kernel->yield( "cmd", $who, "CHECKMEMO", $src, $who, "send_private", $trusted );
+                       $kernel->yield( "cmd", $who, "CHECKMEMO", $src, $heap->{ 'identified' }->{ $src.uc( $who ) }, "send_private", $trusted );
                } else {
                        $kernel->yield( "cmd", $who, "COUNTMEMO", $src, $who, "send_private", $trusted );
                }
@@ -180,7 +180,7 @@ sub cmd {
                }
                if( !exists $heap->{ 'cmdaccess' }->{ uc( $cmd ) } || (
                        exists $heap->{ 'identified' }->{ $src.uc( $who ) } &&
-                       accessLevel( $kernel, $heap, uc( $who ), $src ) >= $heap->{ 'cmdaccess' }->{ uc( $cmd ) } ) ) {
+                       accessLevel( $kernel, $heap, $heap->{ 'identified' }->{ $src.uc( $who ) }, $src ) >= $heap->{ 'cmdaccess' }->{ uc( $cmd ) } ) ) {
                        &{ $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, trusted => $trusted } );