summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/intercept.pl9
-rw-r--r--scripts/notes.pl3
-rw-r--r--scripts/notifyquit.pl23
-rw-r--r--scripts/tabcompletenick.pl62
-rw-r--r--scripts/timezones.pl14
5 files changed, 63 insertions, 48 deletions
diff --git a/scripts/intercept.pl b/scripts/intercept.pl
index edb882a..b798950 100644
--- a/scripts/intercept.pl
+++ b/scripts/intercept.pl
@@ -3,10 +3,13 @@
use strict;
use warnings;
use Data::Dumper;
+use Carp qw( croak );
use Irssi;
-our $VERSION = "0.1";
-our %IRSSI = (
+use vars qw($VERSION %IRSSI);
+
+$VERSION = "0.1";
+%IRSSI = (
authors => "Jari Matilainen",
contact => 'vague!#irssi@freenode on irc',
name => "intercept",
@@ -50,7 +53,7 @@ sub load_uberprompt_failed {
print "https://github.com/shabble/irssi-scripts/raw/master/"
. "prompt_info/uberprompt.pl";
- die "Script Load Failed: " . join(" ", @_);
+ croak "Script Load Failed: " . join(" ", @_);
}
sub sig_send_text {
diff --git a/scripts/notes.pl b/scripts/notes.pl
index d1ebae2..364ccf4 100644
--- a/scripts/notes.pl
+++ b/scripts/notes.pl
@@ -23,10 +23,11 @@ use vars qw($VERSION %IRSSI);
$VERSION = '0.31';
%IRSSI = (
authors => 'vague',
- contact => 'vague!#irssi\@freenode',
+ contact => 'vague!#irssi@freenode',
name => 'notes',
description => 'Keeps notes on users and displayes the note in /whois output if the host/nick matches',
license => 'GPL2',
+ changed => "24 Nov 16:00:00 CET 2015",
);
my $notes;
diff --git a/scripts/notifyquit.pl b/scripts/notifyquit.pl
index 087ee57..e2910aa 100644
--- a/scripts/notifyquit.pl
+++ b/scripts/notifyquit.pl
@@ -102,10 +102,14 @@ So, add them on quit/kick/part, and remove them after a tiemout.
use strict;
use warnings;
+use Irssi;
+use Carp qw( croak );
use Data::Dumper;
-our $VERSION = "0.3";
-our %IRSSI = (
+use vars qw($VERSION %IRSSI);
+
+$VERSION = "0.3";
+%IRSSI = (
authors => "Jari Matilainen",
contact => 'vague!#irssi@freenode on irc',
name => "notifyquit",
@@ -113,7 +117,7 @@ our %IRSSI = (
license => "Public Domain",
url => "http://gplus.to/vague",
changed => "24 Nov 16:00:00 CET 2015",
- );
+ );
my $active = 0;
my $permit_pending = 0;
@@ -150,7 +154,7 @@ sub load_uberprompt_failed {
print "https://github.com/shabble/irssi-scripts/raw/master/"
. "prompt_info/uberprompt.pl";
- die "Script Load Failed: " . join(" ", @_);
+ croak "Script Load Failed: " . join(" ", @_);
}
sub extract_nick {
@@ -224,7 +228,7 @@ sub sig_send_text {
win_item => $witem,
};
- Irssi::signal_stop;
+ Irssi::signal_stop();
require_confirmation($text);
}
}
@@ -241,7 +245,7 @@ sub sig_gui_keypress {
# Enter, y, or Y.
if ($char =~ m/^y?$/i) {
$permit_pending = 1;
- Irssi::signal_stop;
+ Irssi::signal_stop();
Irssi::signal_emit('send text',
$pending_input->{text},
$pending_input->{server},
@@ -252,7 +256,7 @@ sub sig_gui_keypress {
} elsif ($char =~ m/^n?$/i or $key == 3 or $key == 7) {
# we support n, N, Ctrl-C, and Ctrl-G for no.
- Irssi::signal_stop;
+ Irssi::signal_stop();
set_prompt('');
$permit_pending = 0;
@@ -260,7 +264,7 @@ sub sig_gui_keypress {
$pending_input = {};
} else {
- Irssi::signal_stop;
+ Irssi::signal_stop();
return;
}
}
@@ -421,14 +425,13 @@ sub app_init {
}
sub cmd_show_exceptions {
-
foreach my $e (@match_exceptions) {
print "Exception: $e";
}
}
sub cmd_show_watchlist {
- Irssi::print Dumper($watchlist);
+ Irssi::print(Dumper($watchlist));
}
sub sig_setup_changed {
diff --git a/scripts/tabcompletenick.pl b/scripts/tabcompletenick.pl
index deca5af..a8c0295 100644
--- a/scripts/tabcompletenick.pl
+++ b/scripts/tabcompletenick.pl
@@ -7,9 +7,13 @@
# from the start again
# - /set completion_keep_publics decides how many nicks to remember
-use Irssi;
+use strict;
+use warnings;
+use Irssi::TextUI;
use Data::Dumper;
+{ package Irssi::Nick; }
+
my $VERSION = '1.0';
my %IRSSI = (
authors => 'vague',
@@ -21,20 +25,20 @@ my %IRSSI = (
changed => "24 Nov 16:00:00 CET 2015",
);
-my $lastspokehash = {};
+my $lastspokehash;
my $expand_next = 0;
Irssi::signal_add_first('gui key pressed', sub {
my ($key) = @_;
- my $prompt = Irssi::parse_special('$L');
- my $pos = Irssi::gui_input_get_pos();
- $server = Irssi::active_server();
- $witem = Irssi::active_win()->{active};
+ return unless exists Irssi::active_win->{active} && Irssi::active_win->{active}->{type} eq "CHANNEL";
- return unless $witem->{type} eq "CHANNEL";
+ my $prompt = Irssi::parse_special('$L');
+ my $pos = Irssi::gui_input_get_pos();
+ my $witem = Irssi::active_win()->{active};
+ my $server = Irssi::active_server();
- my $arr = $lastspokehash{$server->{tag}}->{$witem->{name}};
+ my $arr = $lastspokehash->{$server->{tag}}->{$witem->{name}} || [];
if(!$expand_next) {
return unless $key == 9;
@@ -49,7 +53,7 @@ Irssi::signal_add_first('gui key pressed', sub {
return;
}
- if($expand_next < scalar @{$arr}) {
+ if($expand_next < @$arr) {
$expand_next++;
} else {
$expand_next = 0;
@@ -71,43 +75,44 @@ Irssi::signal_add_first('gui key pressed', sub {
sub expando_lastspoke {
my ($server, $witem) = @_;
- $server = Irssi::active_server();
- $witem = Irssi::active_win()->{active};
+ $server = Irssi::active_server() unless $server;
+ $witem = Irssi::active_win()->{active} unless $witem;
return '' if $expand_next == 0;
return '' unless ref($witem) eq 'Irssi::Irc::Channel';
- my $arr = $lastspokehash{$server->{tag}}->{$witem->{name}};
- return '' unless @{$arr};
- return '' unless $expand_last <= $arr;
- return @{$lastspokehash{$server->{tag}}->{$witem->{name}}}[$expand_next - 1];
+ my $arr = $lastspokehash->{$server->{tag}}->{$witem->{name}};
+ return '' unless @$arr;
+ return '' unless $expand_next <= @$arr;
+
+ return @{$lastspokehash->{$server->{tag}}->{$witem->{name}}}[$expand_next - 1];
}
sub act_public {
- my ($server, $msg, $nick, $address, $witem) = @_;
+ my ($server, $msg, $nick, $address, $target) = @_;
- return if $witem eq '';
+ return if $target eq '';
my $i = 0;
- my $arr = $lastspokehash{$server->{tag}}->{$witem};
- foreach(@{$arr}) {
+ my $arr = $lastspokehash->{$server->{tag}}->{$target};
+ foreach(@$arr) {
if($_ eq $nick) {
- splice @{$arr}, $i, 1;
+ splice @$arr, $i, 1;
last;
}
$i++;
}
- unshift @{$lastspokehash{$server->{tag}}->{$witem}}, $nick;
- splice @{$lastspokehash{$server->{tag}}->{$witem}}, Irssi::settings_get_int('completion_keep_publics');
+ unshift @{$lastspokehash->{$server->{tag}}->{$target}}, $nick;
+ splice @{$lastspokehash->{$server->{tag}}->{$target}}, Irssi::settings_get_int('completion_keep_publics');
}
sub _part {
my ($server, $channel, $nick) = @_;
if(!$channel) {
- foreach my $chan (keys %{$lastspokehash{$server->{tag}}}) {
- my $arr = $lastspokehash{$server->{tag}}->{$chan};
+ foreach my $chan (keys %{$lastspokehash->{$server->{tag}}}) {
+ my $arr = $lastspokehash->{$server->{tag}}->{$chan};
my $i = 0;
foreach(@{$arr}) {
if($_ eq $nick) {
@@ -120,7 +125,7 @@ sub _part {
}
}
else {
- my $arr = $lastspokehash{$server->{tag}}->{$channel};
+ my $arr = $lastspokehash->{$server->{tag}}->{$channel};
my $i = 0;
foreach(@{$arr}) {
if($_ eq $nick) {
@@ -132,8 +137,7 @@ sub _part {
}
}
- delete $lastspokehash{$server->{tag}}->{$channel} unless @{$lastspokehash{$server->{tag}}->{$channel}};
- delete $lastspokehash{$server->{tag}} unless keys %{$lastspokehash{$server->{tag}}};
+ delete $lastspokehash->{$server->{tag}} unless keys %{$lastspokehash->{$server->{tag}}};
}
Irssi::signal_add_first('message quit', sub {
@@ -154,8 +158,8 @@ Irssi::signal_add_first('message kick', sub {
Irssi::signal_add_first('message nick', sub {
my ($server, $newnick, $oldnick, $address) = @_;
- foreach my $chan (keys %{$lastspokehash{$server->{tag}}}) {
- my $arr = $lastspokehash{$server->{tag}}->{$chan};
+ foreach my $chan (keys %{$lastspokehash->{$server->{tag}}}) {
+ my $arr = $lastspokehash->{$server->{tag}}->{$chan};
my $i = 0;
foreach(@{$arr}) {
if($_ eq $oldnick) {
diff --git a/scripts/timezones.pl b/scripts/timezones.pl
index 65e9ebe..0ca0ece 100644
--- a/scripts/timezones.pl
+++ b/scripts/timezones.pl
@@ -8,6 +8,14 @@
# or add it to an existing one with
# /statusbar window add timezones (window is an exaple, see /statusbar and /help statusbar for comprehensive help)
+use strict;
+use warnings;
+use Irssi;
+use DateTime;
+use Carp qw/croak/;
+
+use vars qw($VERSION %IRSSI);
+
$VERSION = "0.2";
%IRSSI = (
authors => "Jari Matilainen",
@@ -19,10 +27,6 @@ $VERSION = "0.2";
changed => "Tue 24 November 16:00:00 CET 2015",
);
-use strict;
-use Irssi::TextUI;
-use DateTime;
-
my $refresh_tag;
sub timezones {
@@ -38,7 +42,7 @@ sub timezones {
my ($nick, $timezone) = split /:/, $_;
my $now;
eval {
- $now = DateTime->now(time_zone => "$timezone") or die $!;
+ $now = DateTime->now(time_zone => "$timezone") or croak $!;
};
if($@) {