From 6f6601bf89ad1d5dc65757989fe0ebb3b3feba27 Mon Sep 17 00:00:00 2001 From: pdbogen Date: Wed, 12 Sep 2007 21:55:22 +0000 Subject: [PATCH] Fixed option handling for servers and automatic URL catching git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@28 088b83a4-0077-4247-935c-42ec02c2848b --- irc.pl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/irc.pl b/irc.pl index 0d117c8..a175adf 100644 --- a/irc.pl +++ b/irc.pl @@ -32,9 +32,12 @@ sub new { $self->{ "nick" } = "Destult"; $self->{ "port" } = 6667; $self->{ "password" } = ""; - while( shift ) { + $self->{ "trap" } = 0; + while( $_ = shift ) { + print( "IRC : Parsing Option '$_'\n" ); my( $name, $value ) = split( /=/, $_, 2 ); if( exists( $self->{ $name } ) ) { + print( "IRC : Setting $name to $value\n" ); $self->{ $name } = $value; } } @@ -172,6 +175,11 @@ sub on_public { # Strip color $msg =~ s/(\x3)[0-9]{0,2}//g; $msg =~ s/\x02//g; + if( $msg =~ m!(http://[^[:space:]]+)!i && $self->{ "trap" } == 1 ) { + print( "IRC : URL Trapped: '$1' from $who\n" ); + my $url = $1; + $kernel->post( "core", "cmd", $who, "TINYURL $url", $self->{ "ssid" }, $dest->[0], "send_public_to" ); + } $cmd = ( split( / /, $msg, 2 ) )[0]; $kernel->post( "core", "seen", $who, $msg, $self->{ "ssid" }, $who, "send_private" ); if( $cmd =~ /^[~].*/ ) { -- 2.11.0