diff options
| author | 2014-04-24 06:28:42 +0400 | |
|---|---|---|
| committer | 2014-04-24 06:28:42 +0400 | |
| commit | 9e47587396d4bd6f25a7f6eb1892eff084185533 (patch) | |
| tree | e4756c2492b342aabdd7dfcb9b42e5841bf9919c /modules/event.pl | |
| parent | b050ebc6bc0ddb4eebd4afd6fd8b28cb6cafe995 (diff) | |
Fixed the urlcrunch detection rule
Diffstat (limited to 'modules/event.pl')
| -rw-r--r-- | modules/event.pl | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/modules/event.pl b/modules/event.pl index d3e3fa5..4978432 100644 --- a/modules/event.pl +++ b/modules/event.pl @@ -338,15 +338,15 @@ sub on_public $::sc{lc $event->{to}->[0]}{users}{lc $event->{nick}}{msgtime} = time; $::log->logg( $event ); $::db->logg( $event ); -# if ($event->{args}->[0] =~ /(https?:\/\/bitly.com\/\w+)|(https?:\/\/bit.ly\/\w+)|(https?:\/\/j.mp\/\w+)/i) { -# my $reqid = $::async->add( HTTP::Request->new( GET => $1 ) ); -# $::httpRequests{$reqid} = $event; -# my ($response, $id) = $::async->wait_for_next_response( 1 ); -# if (defined($response)) { -# on_httpResponse($conn, $id, $response); -# } -# else { $conn->schedule( 1, sub { checkHTTP($conn); } ); } -# } + if ($event->{args}->[0] =~ /(https?:\/\/bitly.com\/\w+|https?:\/\/bit.ly\/\w+|https?:\/\/j.mp\/\w+)/i) { + my $reqid = $::async->add( HTTP::Request->new( GET => $1 ) ); + $::httpRequests{$reqid} = $event; + my ($response, $id) = $::async->wait_for_next_response( 1 ); + if (defined($response)) { + on_httpResponse($conn, $id, $response); + } + else { $conn->schedule( 1, sub { checkHTTP($conn); } ); } + } $::inspector->inspect( $conn, $event ); $::commander->command( $conn, $event ); } |
