aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Feist <shabble@metavore.org>2011-07-16 03:57:28 +0000
committerTom Feist <shabble@metavore.org>2011-07-16 03:57:28 +0000
commitadffe12768b78f2b69305a5532c883576d9756c0 (patch)
tree31df409aa0ddfa3c9ade63bc6305a2d8e31ac6af
parentadded getchan to demonstrate how to retrieve, alter and restore a format stri... (diff)
downloadirssi-scripts-adffe12768b78f2b69305a5532c883576d9756c0.tar.gz
irssi-scripts-adffe12768b78f2b69305a5532c883576d9756c0.zip
updated to add PM support, and build filenames more betterly
Diffstat (limited to '')
-rw-r--r--longify/longify-urls.pl21
1 files changed, 13 insertions, 8 deletions
diff --git a/longify/longify-urls.pl b/longify/longify-urls.pl
index 8b2691f..38e8ba8 100644
--- a/longify/longify-urls.pl
+++ b/longify/longify-urls.pl
@@ -87,6 +87,7 @@ use Data::Dumper;
use IrssiX::Async qw(fork_off);
use LWP::UserAgent;
use URI;
+use File::Spec;
our $VERSION = '0.1';
our %IRSSI = (
@@ -106,7 +107,16 @@ my $domains;
sub sig_public_message {
- my ($server, $msg, @rest) = @_;
+ _handle_messages(@_);
+}
+
+sub sig_private_message {
+ _handle_messages(@_);
+}
+
+sub _handle_messages {
+
+ my $msg = $_[1];
if ($flushing_message) { # don't interrupt it a second time.
delete $pending_msg_params->{$flushing_message};
@@ -129,12 +139,6 @@ sub sig_public_message {
Irssi::signal_stop;
}
-sub sig_private_message {
- my ($server, $msg, $nick, $addr, $target) = @_;
-
-}
-
-
sub expand_url {
my ($url) = @_;
fork_off $url, \&expand_url_request, \&expand_url_callback;
@@ -235,7 +239,8 @@ sub match_uri {
}
sub cmd_reload {
- my $filename = shift || Irssi::get_irssi_dir . '/longify-urls.list';
+ my $filename = shift
+ || File::Spec->catfile(Irssi::get_irssi_dir, 'longify-urls.list');
$domains = {};
open my $fh, '<', $filename
or die "Couldn't open file containing shorteners list $filename: $!";