summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-12-28 19:04:02 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-12-28 19:04:02 +0000
commit63e0c10dacb943a3cd91c62933d208b957ef3fae (patch)
tree209efc02c3a665eaf9867957a06c26e748a353ea
parentb5937375ac540326f991183901dde632195a9ac8 (diff)
downloadhacchi-63e0c10dacb943a3cd91c62933d208b957ef3fae.tar.gz
hacchi-63e0c10dacb943a3cd91c62933d208b957ef3fae.tar.xz
Fix
-rwxr-xr-xhacchi.pl13
1 files changed, 7 insertions, 6 deletions
diff --git a/hacchi.pl b/hacchi.pl
index 6839581..60a4091 100755
--- a/hacchi.pl
+++ b/hacchi.pl
@@ -57,24 +57,25 @@ sub irc_public {
my ( $sender, $who, $where, $what ) = @_[ SENDER, ARG0 .. ARG2 ];
my $nick = ( split /!/, $who )[0];
my $channel = $where->[0];
+ my $saneurl = "";
$what =~ s/\s+$//;
if ( my ($url) = $what =~ /^!(?:patchqueue|pq)\s+(.+)/ ) {
my $summary = "";
if (my ( $id ) = ($url =~ qr|^http://dpaste.com/(\d+)(?:/(?:plain(?:/)?)?)?(\s+.*)?$|)) {
- $url = "http://dpaste.com/$id/plain";
+ $saneurl = "http://dpaste.com/$id/plain";
}
elsif (( $id ) = ($url =~ qr|^http://ix.io/(\w+)|)) {
- $url = "http://ix.io/$id";
+ $saneurl = "http://ix.io/$id";
}
elsif (( $id ) = ($url =~ qr|^http://paste.pocoo.org/(?:show\|raw)/(\d+)|)) {
- $url = "http://paste.pocoo.org/raw/$id";
+ $saneurl = "http://paste.pocoo.org/raw/$id";
}
- if ($url) {
+ if ($saneurl) {
my $ua = LWP::UserAgent->new;
- my $response = $ua->get($url);
+ my $response = $ua->get($saneurl);
if ($response->is_success) {
my $subject = "";
my @lines = split(/\n/, $response->decoded_content);
@@ -85,7 +86,7 @@ sub irc_public {
$summary = $subject if $subject;
}
else {
- $irc->yield( privmsg => $channel => ("Got HTTP " . $response->code() . " for $url") );
+ $irc->yield( privmsg => $channel => ("Got HTTP " . $response->code() . " for $saneurl") );
}
}