From 5f0fe694730dcbe52862c3a9b84341c3f7bf5e8e Mon Sep 17 00:00:00 2001 From: pdbogen Date: Sat, 13 Aug 2011 04:33:32 +0000 Subject: [PATCH] A command to toggle URL trapping, and tweak the regex used on same. git-svn-id: https://www.cernu.us/~pdbogen/svn/destult2@115 088b83a4-0077-4247-935c-42ec02c2848b --- commands.yaml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/commands.yaml b/commands.yaml index d10a198..4819f72 100644 --- a/commands.yaml +++ b/commands.yaml @@ -4,6 +4,24 @@ DIE: |- exit; } +TRAP: |- + sub { + my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_; + my $str = ""; + for my $s (@{$heap->{ "servers" }}) { + if( $s->{ "ssid" } == $src ) { + if( $s->{ "trapEnabled" } ) { + $s->{ "trapEnabled" } = 0; + $kernel->post( $src, $replypath, "URL trapping now DISABLED. D:", $dest ); + } else { + $s->{ "trapEnabled" } = 1; + $kernel->post( $src, $replypath, "URL trapping now enabled. :)", $dest ); + } + } + } + return; + } + LINK: |- sub { my( $kernel, $heap, $who, $what, $src, $dest, $replypath ) = @_; @@ -1943,7 +1961,7 @@ TITLE: |- my $res = $ua->request( $req ); if( $res->is_success ) { my $content = $res->content; - if( $content =~ /(.*?)<\/title>/si ) { + if( $content =~ /<title[^>]*>(.*?)<\/title>/si ) { use HTML::Entities; my $title = decode_entities( $1 ); $title =~ s/[[:space:]]+/ /gs; -- 2.11.0