Only trap URLs if URL trapping is enabled.
authorpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Sat, 13 Aug 2011 04:34:07 +0000 (04:34 +0000)
committerpdbogen <pdbogen@088b83a4-0077-4247-935c-42ec02c2848b>
Sat, 13 Aug 2011 04:34:07 +0000 (04:34 +0000)
git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@117 088b83a4-0077-4247-935c-42ec02c2848b

core.pl

diff --git a/core.pl b/core.pl
index 8fa1fa6..8f34a73 100644 (file)
--- a/core.pl
+++ b/core.pl
@@ -248,7 +248,7 @@ sub advertise {
 # This is called whenever a public message is received, from any source. In the future,
 # this should check for hooks stored on the heap. TODO.
 sub on_public {
-       my( $kernel, $heap, $who, $what, $src, $dest, $replypath, $trusted ) = @_[ KERNEL, HEAP, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5 ];
+       my( $kernel, $heap, $who, $what, $src, $dest, $replypath, $trusted, $trap ) = @_[ KERNEL, HEAP, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6 ];
        my $cmd = ( split( / /, $what, 2 ) )[0];
        # Check for the presence of a command
        if( $cmd =~ /^~.*/ ) {
@@ -256,7 +256,7 @@ sub on_public {
        } else {
                # Handle URLs
                # TODO: Find a new place to put trap config
-               if( $what =~ m!(https?://[^[:space:]]+)!i ) {
+               if( $trap && $what =~ m!(https?://[^[:space:]]+)!i ) {
                        print( "IRC : URL Trapped: '$1' from $who\n" );
                        my $url = $1;
                        $kernel->yield( "cmd", $who, "TITLE $url", $src, $dest, $replypath, $trusted );