summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/adv_windowlist.pl109
-rw-r--r--scripts/connectcmd.pl40
-rw-r--r--scripts/dau.pl10
-rw-r--r--scripts/fullrain.pl98
-rw-r--r--scripts/kicks.pl235
-rw-r--r--scripts/localize.pl8
-rw-r--r--scripts/mangle.pl26
-rw-r--r--scripts/newsline.pl12
-rwxr-xr-xscripts/nicklist.pl6
-rw-r--r--scripts/ogg123.pl2
-rw-r--r--scripts/pushsafer.pl312
-rw-r--r--scripts/query.pl6
-rw-r--r--scripts/quiz.pl6
-rw-r--r--scripts/quizmaster-fr.pl8
-rw-r--r--scripts/quizmaster.pl8
-rw-r--r--scripts/scroller.pl5
-rw-r--r--scripts/signal_hilight.pl140
-rw-r--r--scripts/sysinfoplus.pl11
-rw-r--r--scripts/topicsed.pl9
19 files changed, 836 insertions, 215 deletions
diff --git a/scripts/adv_windowlist.pl b/scripts/adv_windowlist.pl
index 6285786..d656eef 100644
--- a/scripts/adv_windowlist.pl
+++ b/scripts/adv_windowlist.pl
@@ -1,7 +1,7 @@
use strict;
use warnings;
-our $VERSION = '1.3'; # 463402cffae35e5
+our $VERSION = '1.4'; # b46fded611292cb
our %IRSSI = (
authors => 'Nei',
contact => 'Nei @ anti@conference.jabber.teamidiot.de',
@@ -79,6 +79,9 @@ our %IRSSI = (
# * string : Character to use when shortening long names. The second character
# will be used if two blocks need to be filled.
#
+# /format awl_title <string>
+# * string : Text to display in the title string or title bar
+#
# /format awl_viewer_item_bg <string>
# * string : Format String specifying the viewer's item background colour
#
@@ -398,7 +401,19 @@ sub syncLines {
my ($item, $get_size_only) = @_;
my $text = $actString[0];
- my $pat = defined $text ? '{sb '.ucfirst(setc()).': $*}' : '{sb }';
+ my $title = _get_format(set 'title');
+ if (length $title) {
+ $title =~ s{\\(.)|(.)}{
+ defined $2 ? quotemeta $2
+ : $1 eq 'V' ? '\u'
+ : $1 eq ':' ? quotemeta ':%n'
+ : $1 =~ /^[uUFQE]$/ ? "\\$1"
+ : quotemeta "\\$1"
+ }sge;
+ $title = eval qq{"$title"};
+ $title .= ' ';
+ }
+ my $pat = defined $text ? "{sb $title\$*}" : '{sb }';
$text //= '';
$item->default_handler($get_size_only, $pat, $text, 0);
};
@@ -454,6 +469,12 @@ sub awl {
}
}
+sub _add_map {
+ my ($type, $target, $map) = @_;
+ ($type->{$target}) = sort { length $a <=> length $b || $a cmp $b }
+ $map, exists $type->{$target} ? $type->{$target} : ();
+}
+
sub get_keymap {
my ($textDest, undef, $cont_stripped) = @_;
if ($textDest->{level} == 524288 and $textDest->{target} eq '' and !defined $textDest->{server}) {
@@ -472,32 +493,32 @@ sub get_keymap {
for ($command) {
last unless length $map;
if (/^change_window (\d+)/i) {
- $nummap{$1} = $map;
+ _add_map(\%nummap, $1, $map);
}
- elsif (/^command window goto (\S+)/i) {
+ elsif (/^(?:command window goto|change_window) (\S+)/i) {
my $window = $1;
if ($window !~ /\D/) {
- $nummap{$window} = $map;
+ _add_map(\%nummap, $window, $map);
}
elsif (lc $window eq 'active') {
- $specialmap{_active} = $map;
+ _add_map(\%specialmap, '_active', $map);
}
else {
- $wnmap{$window} = $map;
+ _add_map(\%wnmap, $window, $map);
}
}
elsif (/^(?:active_window|command (ack))/i) {
- $specialmap{_active} = $map;
+ _add_map(\%specialmap, '_active', $map);
$viewer{use_ack} = !!$1;
}
elsif (/^command window last/i) {
- $specialmap{_last} = $map;
+ _add_map(\%specialmap, '_last', $map);
}
elsif (/^(?:upper_window|command window up)/i) {
- $specialmap{_up} = $map;
+ _add_map(\%specialmap, '_up', $map);
}
elsif (/^(?:lower_window|command window down)/i) {
- $specialmap{_down} = $map;
+ _add_map(\%specialmap, '_down', $map);
}
elsif (/^key\s+(\w+)/i) {
$custom_key_map{$1} = $map;
@@ -726,12 +747,16 @@ sub _format_display {
@ret
}
+sub _get_format {
+ Irssi::current_theme->get_format(__PACKAGE__, @_)
+}
+
sub _calculate_items {
my ($wins, $abbrevList) = @_;
- my $display_header = Irssi::current_theme->get_format(__PACKAGE__, set 'display_header');
- my $name_format = Irssi::current_theme->get_format(__PACKAGE__, set 'name_display');
- my $abbrev_chars = as_uni(Irssi::current_theme->get_format(__PACKAGE__, set 'abbrev_chars'));
+ my $display_header = _get_format(set 'display_header');
+ my $name_format = _get_format(set 'name_display');
+ my $abbrev_chars = as_uni(_get_format(set 'abbrev_chars'));
my %displays;
@@ -767,14 +792,14 @@ sub _calculate_items {
$abbrev2 = $abbrev_chars[1];
}
for my $win (@$wins) {
- my $global_hack_alert_tag_header;
+ my $global_tag_header_mode;
next unless ref $win;
my $backup_win = Storable::dclone($win);
delete $backup_win->{active} unless ref $backup_win->{active};
- $global_hack_alert_tag_header =
+ $global_tag_header_mode =
$display_header && ($last_net // '') ne ($backup_win->{active}{server}{tag} // '');
if ($win->{data_level} < abs $S{hide_data}
@@ -796,7 +821,7 @@ sub _calculate_items {
my $number = $win->{refnum};
my ($name, $display, $cdisplay);
- if ($global_hack_alert_tag_header) {
+ if ($global_tag_header_mode) {
$display = $display_header;
$name = as_uni($backup_win->{active}{server}{tag}) // '';
if ($custom_xform) {
@@ -818,7 +843,7 @@ sub _calculate_items {
grep { !/_visible$/ } @display;
}
$display = (grep { length $_ }
- map { $displays{$_} //= Irssi::current_theme->get_format(__PACKAGE__, set $_) }
+ map { $displays{$_} //= _get_format(set $_) }
@display)[0];
$cdisplay = $name_format;
$name = as_uni($win->get_active_name) // '';
@@ -906,7 +931,7 @@ sub _calculate_items {
as_tc($key_ent),
$win);
- if ($global_hack_alert_tag_header) {
+ if ($global_tag_header_mode) {
$last_net = $backup_win->{active}{server}{tag};
redo;
}
@@ -917,9 +942,9 @@ sub _calculate_items {
sub _spread_items {
my $width = [Irssi::windows]->[0]{width} - $sb_base_width - 1;
- my @separator = Irssi::current_theme->get_format(__PACKAGE__, set 'separator');
+ my @separator = _get_format(set 'separator');
if ($S{block} >= 0) {
- my $sep2 = Irssi::current_theme->get_format(__PACKAGE__, set 'separator2');
+ my $sep2 = _get_format(set 'separator2');
push @separator, $sep2 if length $sep2 && $sep2 ne $separator[0];
}
$separator[0] .= '%n';
@@ -929,7 +954,7 @@ sub _spread_items {
my $curLine;
my $curLen = 0;
if ($S{shared_sbar}) {
- $curLen += $S{shared_sbar}[0] + 2 + length setc();
+ $curLen += $S{shared_sbar}[0] + 2;
$width -= $S{shared_sbar}[2];
}
my $mouse_header_check = 0;
@@ -1198,13 +1223,25 @@ sub syncViewer {
});
$viewer{client_env} = 1;
}
- my $separator = Irssi::current_theme->get_format(__PACKAGE__, set 'separator');
+ my $separator = _get_format(set 'separator');
my $sepLen = sb_length($separator);
- my $item_bg = Irssi::current_theme->get_format(__PACKAGE__, set 'viewer_item_bg');
+ my $item_bg = _get_format(set 'viewer_item_bg');
+ my $title = _get_format(set 'title');
+ if (length $title) {
+ $title =~ s{\\(.)|(.)}{
+ defined $2 ? quotemeta $2
+ : $1 eq 'V' ? '\U'
+ : $1 eq ':' ? quotemeta '%N'
+ : $1 =~ /^[uUFQE]$/ ? "\\$1"
+ : quotemeta "\\$1"
+ }sge;
+ $title = eval qq{"$title"};
+ }
$str .= _encode_var(redraw => 1) if delete $viewer{fullRedraw};
$str .= _encode_var(separator => $separator,
seplen => $sepLen,
itembg => $item_bg,
+ title => $title,
mouse => $mouse_coords{refnum},
key2 => \%wnmap_exp,
win => \@win_items);
@@ -1377,9 +1414,9 @@ return sub {
%banned_channels = map { lc1459(to_uni($_)) => undef }
split ' ', Irssi::settings_get_str('banned_channels');
- my @sb_base = split /\177/, sb_format_expand("{sb \177}"), 2;
+ my @sb_base = split /\177/, sb_format_expand("{sbstart}{sb \177}{sbend}"), 2;
$sb_base_width_pre = sb_length($sb_base[0]);
- $sb_base_width_post = sb_length($sb_base[1]);
+ $sb_base_width_post = max 0, sb_length($sb_base[1])-1;
$sb_base_width = $sb_base_width_pre + $sb_base_width_post;
if ($print_text_activity && $S{line_shade}) {
@@ -1602,6 +1639,7 @@ Irssi::signal_register({
set 'separator2' => '',
set 'abbrev_chars' => "~\x{301c}",
set 'viewer_item_bg' => sb_format_expand('{sb_background}'),
+ set 'title' => '\V'.setc().'\:',
]);
}
Irssi::settings_add_bool(setc, set 'prefer_name', 0); #
@@ -1976,13 +2014,17 @@ UNITCHECK
}
sub _header {
- my $str = uc ::setc();
- my $space = int( ((abs $vars{block}) - length $str) / (1 + length $str));
+ my $str = $vars{title} // uc ::setc();
+ my $ccs = qr/%(?:X(?:[1-6][0-9A-Z]|7[A-X])|[0-9BCFGIKMNRUWY_])/i;
+ (my $stripstr = $str) =~ s/($ccs)//g;
+ my $space = int( ((abs $vars{block}) - length $stripstr) / (1 + length $stripstr));
if ($space > 0) {
my $ss = ' ' x $space;
- $str = join $ss, '', (split //, $str), '';
+ my @x = $str =~ /((?:$ccs)*\X(?:(?:$ccs)*$)?)/g;
+ $str = join $ss, '', @x, '';
}
- my $pad = (abs $vars{block}) - length $str;
+ ($stripstr = $str) =~ s/($ccs)//g;
+ my $pad = max 0, (abs $vars{block}) - length $stripstr;
$str = ' ' x ($pad/2) . $str . ' ' x ($pad/2 + $pad%2);
$str
}
@@ -2017,7 +2059,7 @@ UNITCHECK
my $j = 0;
my @new_screen;
my @new_mouse;
- $new_screen[0][0] = _header() . ' ' x $vars{seplen}
+ $new_screen[0][0] = _header() #. ' ' x $vars{seplen}
if $show_title_bar;
unless ($nrows > $ncols) { # line layout
++$j if $show_title_bar;
@@ -2393,6 +2435,11 @@ UNITCHECK
# Changelog
# =========
+# 1.4
+# - fix line wrapping in some themes, reported by justanotherbody
+# - fix named window key detection, reported by madduck
+# - make title (in viewer and shared_sbar) configurable
+#
# 1.3 - workaround for irssi issue #572
# 1.2 - new format to choose abbreviation character
# 1.1 - infinite loop on shortening certain window names reported by Kalan
diff --git a/scripts/connectcmd.pl b/scripts/connectcmd.pl
index b2bbdc2..9b5bf38 100644
--- a/scripts/connectcmd.pl
+++ b/scripts/connectcmd.pl
@@ -1,7 +1,8 @@
use strict;
use Irssi 20020101.0250 ();
+
use vars qw($VERSION %IRSSI);
-$VERSION = "0.1";
+$VERSION = "0.2";
%IRSSI = (
authors => "Ian Peters",
contact => "itp\@ximian.com",
@@ -9,7 +10,7 @@ $VERSION = "0.1";
description => "run arbitrary shell commands while [dis]connecting to a server",
license => "Public Domain",
url => "http://irssi.org/",
- changed => "Sun, 10 Mar 2002 17:08:03 -0500"
+ changed => "2017-03-18"
);
my %preconn_actions;
@@ -17,39 +18,42 @@ my %postconn_actions;
my %disconn_actions;
sub load_actions {
- open ACTIONS, q{<}, "$ENV{HOME}/.irssi/connectcmd_actions";
+ my $fi;
+
+ open $fi, '<', "$ENV{HOME}/.irssi/connectcmd_actions";
- while (<ACTIONS>) {
+ while (<$fi>) {
my @lines = split "\n";
foreach my $line (@lines) {
my ($server, $type, $action) = split ":", $line;
if ($type eq "preconn") {
- $preconn_actions{$server} = $action;
+ $preconn_actions{$server} = $action;
} elsif ($type eq "postconn") {
- $postconn_actions{$server} = $action;
+ $postconn_actions{$server} = $action;
} elsif ($type eq "disconn") {
- $disconn_actions{$server} = $action;
+ $disconn_actions{$server} = $action;
}
}
}
- close ACTIONS;
+ close $fi;
}
sub save_actions {
- open ACTIONS, q{>}, "$ENV{HOME}/.irssi/connectcmd_actions";
+ my $fa;
+ open $fa, q{>}, "$ENV{HOME}/.irssi/connectcmd_actions";
foreach my $server (keys %preconn_actions) {
- print ACTIONS "$server:preconn:$preconn_actions{$server}\n";
+ print $fa "$server:preconn:$preconn_actions{$server}\n";
}
foreach my $server (keys %postconn_actions) {
- print ACTIONS "$server:postconn:$postconn_actions{$server}\n";
+ print $fa "$server:postconn:$postconn_actions{$server}\n";
}
foreach my $server (keys %disconn_actions) {
- print ACTIONS "$server:disconn:$disconn_actions{$server}\n";
+ print $fa "$server:disconn:$disconn_actions{$server}\n";
}
- close ACTIONS;
+ close $fa;
}
sub sig_server_looking {
@@ -78,7 +82,13 @@ sub sig_server_disconnected {
sub cmd_connectcmd {
my ($data, $server, $witem) = @_;
- my ($op, $type, $server, $action) = split " ", $data;
+
+ #my ($op, $type, $server, $action) = split " ", $data;
+ $data =~ m/^(\S*)\s+(\S*)\s+(\S*)\s+(.*)$/;
+ my $op=$1;
+ my $type=$2;
+ my $server=$3;
+ my $action=$4;
$op = lc $op;
@@ -146,7 +156,7 @@ sub cmd_connectcmd {
}
}
-load_actions;
+load_actions();
Irssi::command_bind ('connectcmd', 'cmd_connectcmd');
diff --git a/scripts/dau.pl b/scripts/dau.pl
index 89a6623..ac8c051 100644
--- a/scripts/dau.pl
+++ b/scripts/dau.pl
@@ -1417,7 +1417,7 @@ sub switch_create_files {
} else {
- if (open(FH1, "> $file1")) {
+ if (open(FH1, ">", $file1)) {
print FH1 &fix(<<' END');
# dau.pl - http://dau.pl/
@@ -1451,7 +1451,7 @@ sub switch_create_files {
} else {
- if (open(FH1, "> $file2")) {
+ if (open(FH1, ">", $file2)) {
print FH1 &fix(<<' END');
END
@@ -1479,7 +1479,7 @@ sub switch_create_files {
} else {
- if (open(FH1, "> $file3")) {
+ if (open(FH1, ">", $file3)) {
print FH1 &fix(<<' END');
END
@@ -5736,7 +5736,7 @@ sub time_parse {
################################################################################
sub debug_message {
- open(DEBUG, ">> $ENV{HOME}/.dau/.debug");
+ open(DEBUG, ">>", "$ENV{HOME}/.dau/.debug");
print DEBUG $_[0];
@@ -5746,5 +5746,5 @@ sub debug_message {
#BEGIN {
# use warnings;
#
-# open(STDERR, ">> $ENV{HOME}/.dau/.STDERR");
+# open(STDERR, ">>", $ENV{HOME}/.dau/.STDERR");
#}
diff --git a/scripts/fullrain.pl b/scripts/fullrain.pl
new file mode 100644
index 0000000..bac0a62
--- /dev/null
+++ b/scripts/fullrain.pl
@@ -0,0 +1,98 @@
+# fullrain.pl - Irssi script for colorized fullwidth text
+# Copyright (C) 2017 Kenneth B. Jensen <kenneth@jensen.cf>
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by the Free Software Foundation.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+use strict;
+use warnings;
+use Encode qw(decode);
+use Irssi qw(command_bind active_win);
+
+our $VERSION = '1.0.0';
+our %IRSSI = (
+ authors => 'kjensenxz',
+ contact => 'kenneth@jensen.cf',
+ name => 'fullrain',
+ url => 'http://github.com/kjensenxz',
+ description => 'Prints colorized fullwidth text',
+ license => 'GNU GPLv3',
+
+ # code borrowed from scripts:
+ # 'fullwidth' by prussian <genunrest@gmail.com>
+ # http://github.com/GeneralUnRest/ || Apache 2.0 License
+ # 'rainbow' by Jakub Jankowski <shasta@atn.pl>
+ # http://irssi.atn.pl/ || GNU GPLv2 (or later) License
+);
+# colors
+# 0 white
+# 4 light red
+# 8 yellow
+# 9 light green
+# 11 light cyan
+# 12 light blue
+# 13 light magenta
+my @COLORS = (0, 4, 8, 9, 11, 12, 13);
+
+sub make_fullcolor {
+ my $str = decode('UTF-8', $_[0]);
+ my $newstr = q();
+
+ my $color = 0;
+ my $prev = $color;
+ foreach my $char (split //xms, $str) {
+ if ($char =~ /\s/xms) {
+ $newstr .= q( );
+ }
+ else {
+ my $nchar = ord $char;
+ while (($color = int rand scalar @COLORS) == $prev) {};
+ $prev = $color;
+ $newstr .= "\003" . $COLORS[$prev];
+ # check if char is printing nonwhite ascii
+ if ($nchar > ord ' ' && $nchar <= ord '~') {
+ $newstr .= chr $nchar + 65_248;
+ }
+ else {
+ $newstr .= $char . ' ';
+ }
+ }
+ }
+ return $newstr;
+}
+
+command_bind(rfsay => sub {
+ my $say = make_fullcolor($_[0]);
+ active_win->command("say $say"); #say what you want
+ # but don't play games with my affection
+});
+
+command_bind(rfme => sub {
+ my $say = make_fullcolor($_[0]);
+ active_win->command("/me $say");
+});
+
+command_bind(rftopic => sub {
+ my $say = make_fullcolor($_[0]);
+ active_win->command("/topic $say");
+});
+
+command_bind(rfaway => sub {
+ my $say = make_fullcolor($_[0]);
+ active_win->command("/away $say");
+});
+
+1;
+
+# changelog:
+# 2017/03/28 (1.0.0): initial release
diff --git a/scripts/kicks.pl b/scripts/kicks.pl
index 9df9314..76e87ea 100644
--- a/scripts/kicks.pl
+++ b/scripts/kicks.pl
@@ -4,76 +4,77 @@
# - http://www.penguin-breeder.org/irssi/
#<scriptinfo>
+use strict;
use vars qw($VERSION %IRSSI);
use Irssi 20020120;
-$VERSION = "0.26";
+$VERSION = "0.27";
%IRSSI = (
- authors => "c0ffee",
- contact => "c0ffee\@penguin-breeder.org",
- name => "Various kick and ban commands",
- description => "Enhances /k /kb and /kn with some nice options.",
- license => "Public Domain",
- url => "http://www.penguin-breeder.org/irssi/",
- changed => "Tue Nov 14 23:19:19 CET 2006",
+ authors => "c0ffee",
+ contact => "c0ffee\@penguin-breeder.org",
+ name => "Various kick and ban commands",
+ description => "Enhances /k /kb and /kn with some nice options.",
+ license => "Public Domain",
+ url => "http://www.penguin-breeder.org/irssi/",
+ changed => "2017-03-31",
);
#</scriptinfo>
my %kickreasons = (
- default => ["random kick victim",
- "no",
- "are you stupid?",
- "i don't like you, go away!",
- "oh, fsck off",
- "waste other ppls time, elsewhere",
- "get out and STAY OUT",
- "don't come back",
- "no thanks",
- "on popular demand, you are now leaving the channel",
- "\$N",
- "*void*",
- "/part is the command you're looking for",
- "this is the irssi of borg. your mIRC will be assimilated. resistance is futile.",
- "Autokick! mwahahahah!"
- ],
- none => [""],
- topic => ["\$topic"],
+ default => ["random kick victim",
+ "no",
+ "are you stupid?",
+ "i don't like you, go away!",
+ "oh, fsck off",
+ "waste other ppls time, elsewhere",
+ "get out and STAY OUT",
+ "don't come back",
+ "no thanks",
+ "on popular demand, you are now leaving the channel",
+ "\$N",
+ "*void*",
+ "/part is the command you're looking for",
+ "this is the irssi of borg. your mIRC will be assimilated. resistance is futile.",
+ "Autokick! mwahahahah!"
+ ],
+ none => [""],
+ topic => ["\$topic"],
);
# fine tune the script for different chatnets
-# cmdline_k regular expr that matches a correct cmdline for /k
-# req_chan 0/1 whether the channel is always part of the cmdline
-# num_nicks number of nicks ... (-1 = inf)
-# start_with_dash 0/1 whether the normal cmdline may start with a dash
-# match_chn matches channels
-# match_n match nicks
-# match_reason matches reasons
-# default_reason reason to give as "no reason"
+# cmdline_k regular expr that matches a correct cmdline for /k
+# req_chan 0/1 whether the channel is always part of the cmdline
+# num_nicks number of nicks ... (-1 = inf)
+# start_with_dash 0/1 whether the normal cmdline may start with a dash
+# match_chn matches channels
+# match_n match nicks
+# match_reason matches reasons
+# default_reason reason to give as "no reason"
my %cfg = (
- IRC => {
- cmdline_k => '\s*([!#+&][^\x0\a\n\r ]*)\s+[-\[\]\\\\\`{}\w_|^\'~]+(,[-\[\]\\\\\`{}\w_|^\'~]+)*\s+\S.*',
- req_chan => 0,
- num_nicks => 3, # actually, /k takes more, but
- # normal irc servers only take
- # three in a row
- start_with_dash => 1,
- match_chn => '([!#+&][^\x0\a\n\r ]*)\s',
- match_n => '(?:^|\s+)([-\[\]\\\\\`{}\w_|^\'~]+(?:,[-\[\]\\\\\`{}\w_|^\']+)*)',
- match_reason => '^\s*[!#+&][^\x0\a\n\r ]*\s+[-\[\]\\\\\`{}\w_|^\'~]+(?:,[-\[\]\\\\\`{}\w_|^\'~]+)*\s+(\S.*)$',
- default_reason => '$N'
- },
-
- SILC => {
- cmdline_k => '\s*[^\x0-\x20\*\?,@!]+\s+[^\x0-\x20\*\?,@!]+\s+\S.*',
- req_chan => 1,
- num_nicks => 1,
- start_with_dash => 0,
- match_chn => '\s*([^\x0-\x20\*\?,@!]+)\s+[^\x0-\x20\*\?,@!]+(?:,[^\x0-\x20\*\?,@!]+)*',
- match_n => '\s*(?:[^\x0-\x20\*\?,@!]+\s+)?([^\x0-\x20\*\?,@!]+(?:,[^\x0-\x20\*\?,@!]+)*)',
- match_reason => '\s*[^\x0-\x20\*\?,@!]+\s+[^\x0-\x20\*\?,@!]+(?:,[^\x0-\x20\*\?,@!]+)*\s+(\S.*)',
- default_reason => '$N'
- }
+ IRC => {
+ cmdline_k => '\s*([!#+&][^\x0\a\n\r ]*)\s+[-\[\]\\\\\`{}\w_|^\'~]+(,[-\[\]\\\\\`{}\w_|^\'~]+)*\s+\S.*',
+ req_chan => 0,
+ num_nicks => 3, # actually, /k takes more, but
+ # normal irc servers only take
+ # three in a row
+ start_with_dash => 1,
+ match_chn => '([!#+&][^\x0\a\n\r ]*)\s',
+ match_n => '(?:^|\s+)([-\[\]\\\\\`{}\w_|^\'~]+(?:,[-\[\]\\\\\`{}\w_|^\']+)*)',
+ match_reason => '^\s*[!#+&][^\x0\a\n\r ]*\s+[-\[\]\\\\\`{}\w_|^\'~]+(?:,[-\[\]\\\\\`{}\w_|^\'~]+)*\s+(\S.*)$',
+ default_reason => '$N'
+ },
+
+ SILC => {
+ cmdline_k => '\s*[^\x0-\x20\*\?,@!]+\s+[^\x0-\x20\*\?,@!]+\s+\S.*',
+ req_chan => 1,
+ num_nicks => 1,
+ start_with_dash => 0,
+ match_chn => '\s*([^\x0-\x20\*\?,@!]+)\s+[^\x0-\x20\*\?,@!]+(?:,[^\x0-\x20\*\?,@!]+)*',
+ match_n => '\s*(?:[^\x0-\x20\*\?,@!]+\s+)?([^\x0-\x20\*\?,@!]+(?:,[^\x0-\x20\*\?,@!]+)*)',
+ match_reason => '\s*[^\x0-\x20\*\?,@!]+\s+[^\x0-\x20\*\?,@!]+(?:,[^\x0-\x20\*\?,@!]+)*\s+(\S.*)',
+ default_reason => '$N'
+ }
);
sub initialize {
@@ -83,51 +84,53 @@ sub initialize {
my ($basedir) = $conf_file =~ /^(.*\/).*?/;
if (-f $conf_file) {
- open CONF, $conf_file;
-
- while (<CONF>) {
- $line++;
-
- next if /^\s*#/;
-
- chomp;
- ($key, $reasons) = /^(\S+)\s+(.+)\s*$/ or next;
-
- if ($reasons =~ /\`([^\s]+).*?\`/) {
- $kickreasons{$key} = "$reasons";
- Irssi::print("Added executable $1 as $key...");
- next;
- }
-
- $reasons =~ s/^"(.*)"$/$1/;
- $reasons =~ s/~/$ENV{HOME}/;
- $reasons =~ s/^([^\/])/$basedir$1/;
-
- if (-f $reasons) {
-
- $kickreasons{$key} = [];
-
- open REASON, $reasons;
-
- while (<REASON>) {
- chomp;
- push @{$kickreasons{$key}}, $_;
- }
-
- close REASON;
- Irssi::print("Loaded $reasons as $key...");
- } else {
- Irssi::print("can't parse config line $line...");
- }
- }
- close CONF;
+ open CONF, '<', $conf_file;
+
+ my $line=0;
+
+ while (<CONF>) {
+ $line++;
+
+ next if /^\s*#/;
+
+ chomp;
+ my ($key, $reasons) = /^(\S+)\s+(.+)\s*$/ or next;
+
+ if ($reasons =~ /\`([^\s]+).*?\`/) {
+ $kickreasons{$key} = "$reasons";
+ Irssi::print("Added executable $1 as $key...");
+ next;
+ }
+
+ $reasons =~ s/^"(.*)"$/$1/;
+ $reasons =~ s/~/$ENV{HOME}/;
+ $reasons =~ s/^([^\/])/$basedir$1/;
+
+ if (-f $reasons) {
+
+ $kickreasons{$key} = [];
+
+ open REASON, '<', $reasons;
+
+ while (<REASON>) {
+ chomp;
+ push @{$kickreasons{$key}}, $_;
+ }
+
+ close REASON;
+ Irssi::print("Loaded $reasons as $key...");
+ } else {
+ Irssi::print("can't parse config line $line...");
+ }
+ }
+ close CONF;
} else {
Irssi::print("Could not find configuration file for kicks...");
- Irssi::print("... use /set kicks_configuration <file>");
+ Irssi::print("... use /set kicks_configuration <file>");
}
}
-
+
sub get_a_reason {
my ($topic) = @_;
@@ -147,15 +150,17 @@ sub cmd_realkick {
return if not $server
or not defined $cfg{$server->{chat_type}}
- or not $channel
- or $data =~ /^$cfg{$server->{chat_type}}{cmdline_k}$/;
+ or not $channel
+ or $data =~ /^$cfg{$server->{chat_type}}{cmdline_k}$/;
Irssi::signal_stop();
# let's see whether some options where supplied
- $default = Irssi::settings_get_str("default_kick_options");
+ my $default = Irssi::settings_get_str("default_kick_options");
$data = "$default $data" if not $default =~ /^\s*$/;
- @opts = split /\s+/, $data;
+ my @opts = split /\s+/, $data;
+ my $opt;
+ my $fail=0;
while (($opt) = (shift @opts) =~ /^\s*-(\S+)/) {
@@ -163,18 +168,18 @@ sub cmd_realkick {
$data =~ s/^\s*-$opt\s+//,
$reasons = lc $opt,
- next if defined $kickreasons{lc $opt};
+ next if defined $kickreasons{lc $opt};
last if $cfg{$server->{chat_type}}{start_with_dash};
Irssi::print("Unknown option -$opt");
- $fail = true;
+ $fail = 1;
}
return if $fail;
- $chn = "";
+ my $chn = "";
($chn) = $data =~ /^$cfg{$server->{chat_type}}{match_chn}/;
if ($cfg{$server->{chat_type}}{req_chan} && ($chn eq "")) {
@@ -184,37 +189,39 @@ sub cmd_realkick {
# do we need to add a channel?
if ($chn eq "") {
- Irssi::print("Not joined to any channel"), return
- if $channel->{type} ne "CHANNEL";
+ Irssi::print("Not joined to any channel"), return
+ if $channel->{type} ne "CHANNEL";
$chn = $channel->{name};
- $data = "$chn $data";
+ $data = "$chn $data";
}
# is a reason already supplied?
+ my $reason;
$reason = get_a_reason($reasons)
if not (($reason) = $data =~ /$cfg{$server->{chat_type}}{match_reason}/);
$reason = $cfg{$server->{chat_type}}{default_reason}
if $reason =~ /^\s*$/;
- @nicks = split /,/, ($data =~ /$cfg{$server->{chat_type}}{match_n}/)[0];
- $num_nicks = $cfg{$server->{chat_type}}{num_nicks};
+ my @nicks = split /,/, ($data =~ /$cfg{$server->{chat_type}}{match_n}/)[0];
+ my $num_nicks = $cfg{$server->{chat_type}}{num_nicks};
$num_nicks = @nicks if $num_nicks <= 0;
+ my @commands;
undef @commands;
while (@nicks) {
- $tmp = ($chn ne "" ? "$chn " : "") .
+ my $tmp = ($chn ne "" ? "$chn " : "") .
join ",", (splice @nicks,0,$num_nicks);
- $tmp =~ s/([;\\\$])/\\$1/g;
- push @commands, "$tmp $reason";
+ $tmp =~ s/([;\\\$])/\\$1/g;
+ push @commands, "$tmp $reason";
}
foreach (@commands) {
if ($_ =~ /^$cfg{$server->{chat_type}}{cmdline_k}$/) {
s/\s+$//;
- $channel->command("EVAL $cmd $_")
+ $channel->command("EVAL $cmd $_");
} else {
Irssi::print("BUG: generated invalid $cmd command: $_");
}
@@ -237,7 +244,7 @@ sub cmd_kickban {
Irssi::settings_add_str("misc", "default_kick_options", "");
Irssi::settings_add_str("misc", "kicks_configuration",
- Irssi::get_irssi_dir() . "/kicks.conf");
+ Irssi::get_irssi_dir() . "/kicks.conf");
Irssi::command_bind("kick", "cmd_kick");
Irssi::command_bind("kickban", "cmd_kickban");
diff --git a/scripts/localize.pl b/scripts/localize.pl
index 7aabe9f..b836c92 100644
--- a/scripts/localize.pl
+++ b/scripts/localize.pl
@@ -60,7 +60,7 @@
use strict;
use vars qw($VERSION %IRSSI);
-$VERSION = "2014112501";
+$VERSION = "2017040101";
%IRSSI = (
authors => "Stefan 'tommie' Tomanek",
contact => "stefan\@pico.ruhr.de",
@@ -511,7 +511,7 @@ sub save_cache {
my $filename = Irssi::settings_get_str('localize_cache_filename');
my $data = Dumper(\%cache);
local *F;
- open(F, '>'.$filename);
+ open(F, '>',$filename);
print(F $data);
close(F);
print CLIENTCRAP "%R>>%n localize cache (".scalar(keys(%cache))." entries/".length($data)." bytes) saved to ".$filename;
@@ -522,7 +522,7 @@ sub load_cache {
my $filename = Irssi::settings_get_str('localize_cache_filename');
my (%new_cache, $text);
local *F;
- open F, "<".$filename || return;
+ open F, "<",$filename || return;
$text .= $_ foreach (<F>);
close(F);
eval { %new_cache = %{ eval "$text" }; };
@@ -561,7 +561,7 @@ sub show_map ($$$) {
my $cmd = Irssi::settings_get_str('localize_xplanet_cmd');
my $file = Irssi::settings_get_str('localize_xplanet_temp_file');
local *F;
- open F, '>'.$file;
+ open F, '>',$file;
print F $lat.' '.$long.' "'.$nick.'"';
close F;
system("$cmd -markerf $file &");
diff --git a/scripts/mangle.pl b/scripts/mangle.pl
index 00158a5..acfbcd6 100644
--- a/scripts/mangle.pl
+++ b/scripts/mangle.pl
@@ -7,18 +7,20 @@
use strict;
use locale;
use Irssi 20020324;
+use Irssi::TextUI;
use POSIX;
use Data::Dumper;
use vars qw($VERSION %IRSSI %HELP %channels %translations);
-$VERSION = '2004031701';
+$VERSION = '2017031701';
%IRSSI = (
authors => 'Szymon Sokol',
contact => 'szymon@hell.pl',
name => 'mangle',
description => 'translates your messages into Morse code, rot13 and other sillinesses.',
license => 'GPLv2',
- url => 'http://irssi.org/scripts/', changed => $VERSION,
+ url => 'http://irssi.org/scripts/',
+ changed => $VERSION,
modules => 'Data::Dumper'
);
@@ -192,23 +194,25 @@ sub add_channel ($$) {
sub save_channels {
my $filename = Irssi::settings_get_str('mangle_filename');
- local *F;
- open F, '>'.$filename;
+ my $fo;
+ open $fo, '>',$filename;
my $data = Dumper(\%channels);
- print F $data;
- close F;
+ print $fo $data;
+ close $fo;
print CLIENTCRAP "%R>>%n Mangle channels saved";
}
sub load_channels {
my $filename = Irssi::settings_get_str('mangle_filename');
return unless (-e $filename);
- local *F;
- open F, '<'.$filename;
+ my $fi;
+ open $fi, '<',$filename;
my $text;
- $text .= $_ foreach <F>;
- no strict "vars";
- %channels = %{ eval "$text" };
+ $text .= $_ foreach <$fi>;
+ #no strict "vars";
+ my $VAR1;
+ eval "$text";
+ %channels = %$VAR1;
}
sub mangle_show ($$) {
diff --git a/scripts/newsline.pl b/scripts/newsline.pl
index 0f54eee..b37cfcc 100644
--- a/scripts/newsline.pl
+++ b/scripts/newsline.pl
@@ -3,7 +3,7 @@
use strict;
use vars qw($VERSION %IRSSI);
-$VERSION = '2003021101';
+$VERSION = '2017040101';
%IRSSI = (
authors => 'Stefan \'tommie\' Tomanek',
contact => 'stefan@pico.ruhr.de',
@@ -287,10 +287,10 @@ sub call_openurl ($) {
my ($url) = @_;
no strict "refs";
# check for a loaded openurl
- if (defined %{ "Irssi::Script::openurl::" }) {
- &{ "Irssi::Script::openurl::launch_url" }($url);
+ if (my $code = Irssi::Script::openurl::->can('launch_url')) {
+ $code->($url);
} else {
- print CLIENTCRAP "%R>>%n Please install openurl.pl";
+ print CLIENTCRAP "%R>>%n Please install openurl.pl";
}
use strict "refs";
}
@@ -377,7 +377,7 @@ sub reload_config() {
my $text;
if (-e $filename) {
local *F;
- open F, "<".$filename;
+ open F, "<",$filename;
$text .= $_ foreach (<F>);
close F;
if ($text) {
@@ -402,7 +402,7 @@ sub reload_config() {
sub save_config() {
local *F;
my $filename = Irssi::settings_get_str('newsline_sites_file');
- open(F, ">$filename");
+ open(F, '>',$filename);
my $dumper = Data::Dumper->new([\%sites], ['sites']);
$dumper->Purity(1)->Deepcopy(1);
my $data = $dumper->Dump;
diff --git a/scripts/nicklist.pl b/scripts/nicklist.pl
index 0317ba3..477ee2c 100755
--- a/scripts/nicklist.pl
+++ b/scripts/nicklist.pl
@@ -5,7 +5,7 @@ use strict;
use IO::Handle; # for (auto)flush
use Fcntl; # for sysopen
use vars qw($VERSION %IRSSI);
-$VERSION = '0.4.6';
+$VERSION = '0.4.7';
%IRSSI = (
authors => 'Wouter Coekaerts',
contact => 'coekie@irssi.org',
@@ -13,7 +13,7 @@ $VERSION = '0.4.6';
description => 'draws a nicklist to another terminal, or at the right of your irssi in the same terminal',
license => 'GPLv2',
url => 'http://wouter.coekaerts.be/irssi',
- changed => '29/06/2004'
+ changed => '20/03/2017'
);
sub cmd_help {
@@ -193,7 +193,7 @@ sub screen_size {
unless (defined &TIOCGWINSZ) {
die "Term::ReadKey not found, and ioctl 'workaround' failed. Install the Term::ReadKey perl module to use screen mode.\n";
}
- open(TTY, "+</dev/tty") or die "No tty: $!";
+ open(TTY, "+<","/dev/tty") or die "No tty: $!";
unless (ioctl(TTY, &TIOCGWINSZ, $winsize='')) {
die "Term::ReadKey not found, and ioctl 'workaround' failed ($!). Install the Term::ReadKey perl module to use screen mode.\n";
}
diff --git a/scripts/ogg123.pl b/scripts/ogg123.pl
index 274ebbd..85a6700 100644
--- a/scripts/ogg123.pl
+++ b/scripts/ogg123.pl
@@ -64,7 +64,7 @@ sub cmd_ogg123 {
}
}
- open (f, $ogg123file) || return;
+ open (f,'<', $ogg123file) || return;
while ($ogg123linha=<f>) {
diff --git a/scripts/pushsafer.pl b/scripts/pushsafer.pl
new file mode 100644
index 0000000..584f19c
--- /dev/null
+++ b/scripts/pushsafer.pl
@@ -0,0 +1,312 @@
+use strict;
+use warnings;
+
+use Irssi;
+use vars qw($VERSION %IRSSI %config);
+use LWP::UserAgent;
+use Scalar::Util qw(looks_like_number);
+
+$VERSION = '0.0.1';
+
+%IRSSI = (
+ authors => 'Kevin Siml',
+ contact => 'kevinsiml@googlemail.com',
+ name => 'pushsafer',
+ description => 'Push hilights and private messages when away by the pushsafer.com API',
+ license => 'BSD',
+ url => 'https://www.pushsafer.com',
+ changed => "2017-03-31"
+);
+
+my $pushsafer_ignorefile;
+
+
+sub cmd_help {
+ my $out = <<'HELP_EOF';
+PUSHIGNORE LIST
+PUSHIGNORE ADD <hostmask>
+PUSHIGNORE REMOVE <number>
+
+The mask matches in the format ident@host. Notice that no-ident responses puts
+a tilde in front of the ident.
+
+Examples:
+ Will match foo@test.bar.de but *not* ~foo@test.bar.se.
+ /PUSHIGNORE ADD foo@*.bar.de
+ Use the list-command to show a list of ignores and the number in front
+ combined with remove to delete that mask.
+ /PUSHIGNORE REMOVE 2
+
+For a list of available settings, run:
+ /set pushsafer
+HELP_EOF
+ chomp $out;
+ Irssi::print($out, MSGLEVEL_CLIENTCRAP);
+}
+sub read_settings {
+ $pushsafer_ignorefile = Irssi::settings_get_str('pushsafer_ignorefile');
+}
+
+sub debug {
+ return unless Irssi::settings_get_bool('pushsafer_debug');
+ my $text = shift;
+ my @caller = caller(1);
+ Irssi::print('From '.$caller[3].': '.$text);
+}
+
+sub send_push {
+ my $private_key = Irssi::settings_get_str('pushsafer_key');
+ if (!$private_key) {
+ debug('Missing Pushsafer.com private or alias_key.');
+ return;
+ }
+
+ debug('Sending notification.');
+ my ($channel, $text) = @_;
+ my $resp = LWP::UserAgent->new()->post(
+ 'https://www.pushsafer.com/api', [
+ k => $private_key,
+ m => $text,
+ d => Irssi::settings_get_str('pushsafer_device'),
+ s => Irssi::settings_get_str('pushsafer_sound'),
+ i => Irssi::settings_get_str('pushsafer_icon'),
+ v => Irssi::settings_get_str('pushsafer_vibration'),
+ u => Irssi::settings_get_str('pushsafer_url'),
+ ut => Irssi::settings_get_str('pushsafer_urltitle'),
+ l => Irssi::settings_get_str('pushsafer_time2live'),
+ t => $channel
+ ]
+ );
+
+ if ($resp->is_success) {
+ debug('Notification successfully sent.');
+ }
+ else {
+ debug('Notification not sent: '.$resp->decoded_content);
+ }
+}
+
+sub msg_pub {
+ my ($server, $data, $nick, $address, $target) = @_;
+ my $safeNick = quotemeta($server->{nick});
+
+ if(check_ignore_channels($target)) {
+ return;
+ }
+
+ if(check_ignore($address) || check_away($server)) {
+ return;
+ }
+
+ if ($data =~ /$safeNick/i) {
+ debug('Got pub msg.');
+ send_push($target, $nick.': '.Irssi::strip_codes($data));
+ }
+}
+
+sub msg_print_text {
+ my ($dest, $text, $stripped) = @_;
+ my $server = $dest->{server};
+ my $target = $dest->{target};
+
+ return if (!$server || !($dest->{level} & MSGLEVEL_HILIGHT));
+
+ if(check_ignore_channels($target)) {
+ return;
+ }
+
+ if(check_away($server)) {
+ return;
+ }
+
+ debug('Got nick highlight');
+ $stripped =~ s/^\s+|\s+$//g;
+ send_push($target, $stripped);
+}
+
+sub msg_pri {
+ my ($server, $data, $nick, $address) = @_;
+
+ if(check_ignore($address) || check_away($server)) {
+ return;
+ }
+ debug('Got priv msg.');
+ send_push('Priv, '.$nick, Irssi::strip_codes($data));
+}
+
+sub msg_kick {
+ my ($server, $channel, $nick, $kicker, $address, $reason) = @_;
+
+ if(check_ignore($address) || check_away($server)) {
+ return;
+ }
+
+ if ($nick eq $server->{nick}) {
+ debug('Was kicked.');
+ send_push('Kicked: '.$channel, 'Was kicked by: '.$kicker.'. Reason: '.Irssi::strip_codes($reason));
+ }
+}
+
+sub msg_test {
+ my ($data, $server, $item) = @_;
+ $data =~ s/^([\s]+).*$/$1/;
+ my $orig_debug = Irssi::settings_get_bool('pushsafer_debug');
+ Irssi::settings_set_bool('pushsafer_debug', 1);
+ debug("Sending test message :" . $data);
+ send_push("Test Message", Irssi::strip_codes($data));
+ Irssi::settings_set_bool('pushsafer_debug', $orig_debug);
+}
+
+# check our away status & pushsafer_only_if_away. returns 0 if it's ok to send a message.
+sub check_away {
+ my ($server) = @_;
+ my $msg_only_if_away = Irssi::settings_get_bool('pushsafer_only_if_away');
+ if ($msg_only_if_away && $server->{usermode_away} != '1') {
+ debug("Only sending messages if we're marked as away, and we're not");
+ return 1;
+ }
+ return 0;
+}
+
+sub check_ignore {
+ return 0 unless(Irssi::settings_get_bool('pushsafer_ignore'));
+ my @ignores = read_file();
+ return 0 unless(@ignores);
+ my ($mask) = @_;
+
+ foreach (@ignores) {
+ $_ =~ s/\./\\./g;
+ $_ =~ s/\*/.*?/g;
+ if ($mask =~ m/^$_$/i) {
+ debug('Ignore matches, not pushing.');
+ return 1;
+ }
+ }
+ return 0;
+}
+
+sub check_ignore_channels {
+ my ($target) = @_;
+ my @ignore_channels = split(' ', Irssi::settings_get_str('pushsafer_ignorechannels'));
+ return 0 unless @ignore_channels;
+ if (grep {lc($_) eq lc($target)} @ignore_channels) {
+ debug("$target set as ignored channel.");
+ return 1;
+ }
+ return 0;
+}
+
+sub ignore_handler {
+ my ($data, $server, $item) = @_;
+ $data =~ s/\s+$//g;
+ Irssi::command_runsub('pushignore', $data, $server, $item);
+}
+
+sub ignore_unknown {
+ cmd_help();
+ Irssi::signal_stop(); # Don't print 'no such command' error.
+}
+
+sub ignore_list {
+ my @data = read_file();
+ if (@data) {
+ my $i = 1;
+ my $out;
+ foreach(@data) {
+ $out .= $i++.". $_\n";
+ }
+ chomp $out;
+ Irssi::print($out, MSGLEVEL_CLIENTCRAP);
+ }
+}
+
+sub ignore_add {
+ my ($data, $server, $item) = @_;
+ $data =~ s/^([\s]+).*$/$1/;
+ return Irssi::print("No hostmask given.", MSGLEVEL_CLIENTCRAP) unless($data ne "");
+
+ my @ignores = read_file();
+ push(@ignores, $data);
+ write_file(@ignores);
+ Irssi::print("Successfully added '$data'.", MSGLEVEL_CLIENTCRAP);
+}
+
+sub ignore_remove {
+ my($num, $server, $item) = @_;
+ $num =~ s/^(\d+).*$/$1/;
+ return Irssi::print("List-number is needed when removing", MSGLEVEL_CLIENTCRAP) unless(looks_like_number($num));
+ my @ignores = read_file();
+
+ # Index out of range
+ return Irssi::print("Number was out of range.", MSGLEVEL_CLIENTCRAP) unless(scalar(@ignores) >= $num);
+ delete $ignores[$num-1];
+ write_file(@ignores);
+}
+
+sub write_file {
+ read_settings();
+ my $fp;
+ if (!open($fp, ">", $pushsafer_ignorefile)) {
+ Irssi::print("Error opening ignore file", MSGLEVEL_CLIENTCRAP);
+ return;
+ }
+ print $fp join("\n", @_);
+ close $fp;
+}
+
+sub read_file {
+ read_settings();
+ my $fp;
+ if (-e $pushsafer_ignorefile) {
+ if (!open($fp, "<", $pushsafer_ignorefile)) {
+ Irssi::print("Error opening ignore file", MSGLEVEL_CLIENTCRAP);
+ return;
+ }
+ }
+
+ my @out;
+ while (<$fp>) {
+ chomp;
+ next if $_ eq '';
+ push(@out, $_);
+ }
+ close $fp;
+
+ return @out;
+}
+
+Irssi::settings_add_str($IRSSI{'name'}, 'pushsafer_key', '');
+Irssi::settings_add_bool($IRSSI{'name'}, 'pushsafer_debug', 0);
+Irssi::settings_add_bool($IRSSI{'name'}, 'pushsafer_ignore', 1);
+Irssi::settings_add_bool($IRSSI{'name'}, 'pushsafer_only_if_away', 0);
+Irssi::settings_add_str($IRSSI{'name'}, 'pushsafer_ignorefile', Irssi::get_irssi_dir().'/pushsafer_ignores');
+Irssi::settings_add_str($IRSSI{'name'}, 'pushsafer_ignorechannels', '');
+
+# Check the Pushsafer.com API > https://www.pushsafer.com/en/pushapi for replacing params
+Irssi::settings_add_str($IRSSI{'name'}, 'pushsafer_sound', '21');
+Irssi::settings_add_str($IRSSI{'name'}, 'pushsafer_device', '');
+Irssi::settings_add_str($IRSSI{'name'}, 'pushsafer_icon', '25');
+Irssi::settings_add_str($IRSSI{'name'}, 'pushsafer_vibration', '0');
+Irssi::settings_add_str($IRSSI{'name'}, 'pushsafer_url', '');
+Irssi::settings_add_str($IRSSI{'name'}, 'pushsafer_urltitle', '');
+Irssi::settings_add_str($IRSSI{'name'}, 'pushsafer_time2live', '');
+
+Irssi::command_bind('help pushignore', \&cmd_help);
+Irssi::command_bind('pushignore help', \&cmd_help);
+Irssi::command_bind('pushignore add', \&ignore_add);
+Irssi::command_bind('pushignore remove', \&ignore_remove);
+Irssi::command_bind('pushignore list', \&ignore_list);
+Irssi::command_bind('pushignore', \&ignore_handler);
+Irssi::command_bind('pushtest', \&msg_test);
+Irssi::signal_add_first("default command pushignore", \&ignore_unknown);
+
+
+#Irssi::signal_add_last('message public', 'msg_pub');
+Irssi::signal_add_last('print text', 'msg_print_text');
+Irssi::signal_add_last('message private', 'msg_pri');
+Irssi::signal_add_last('message kick', 'msg_kick');
+
+Irssi::print('%Y>>%n '.$IRSSI{name}.' '.$VERSION.' loaded.');
+if (!Irssi::settings_get_str('pushsafer_key')) {
+ Irssi::print('%Y>>%n '.$IRSSI{name}.' Pushsafer.com private or alias key is not set, set it with /set pushsafer_key YourPrivateOrAliasKey');
+}
diff --git a/scripts/query.pl b/scripts/query.pl
index 1d472ea..9d69aad 100644
--- a/scripts/query.pl
+++ b/scripts/query.pl
@@ -16,7 +16,7 @@ use POSIX;
# ======[ Script Header ]===============================================
use vars qw{$VERSION %IRSSI};
-($VERSION) = '$Revision: 1.24 $' =~ / (\d+\.\d+) /;
+($VERSION) = '$Revision: 1.25 $' =~ / (\d+\.\d+) /;
%IRSSI = (
name => 'query',
authors => 'Peder Stray',
@@ -44,7 +44,7 @@ sub load_defaults {
local *FILE;
%defaults = ();
- open FILE, "< $file";
+ open FILE, '<',$file;
while (<FILE>) {
my($mask,$maxage,$immortal) = split;
$defaults{$mask}{maxage} = $maxage;
@@ -59,7 +59,7 @@ sub save_defaults {
my $file = Irssi::get_irssi_dir."/query";
local *FILE;
- open FILE, "> $file";
+ open FILE, '>', $file;
for (keys %defaults) {
my $d = $defaults{$_};
print FILE join("\t", $_,
diff --git a/scripts/quiz.pl b/scripts/quiz.pl
index 09ae726..46e34d8 100644
--- a/scripts/quiz.pl
+++ b/scripts/quiz.pl
@@ -26,7 +26,7 @@ use strict;
use vars qw($VERSION %IRSSI);
use Irssi 20020217.1542 (); # Version 0.8.1
-$VERSION = "0.7";
+$VERSION = "0.8";
%IRSSI = (
authors => "Simon Huggins",
contact => "huggie-irssi\@earth.li",
@@ -34,7 +34,7 @@ name => "Quiz",
description => "Turns irssi into a quiz bot",
license => "GPLv2",
url => "http://the.earth.li/~huggie/irssi/",
-changed => "Wed Apr 24 01:12:01 BST 2002",
+changed => "2017-04-03",
);
use Irssi::Irc;
@@ -69,7 +69,7 @@ sub load_questions($$) {
return if $game->{'questions'} and not $force;
my $file = Irssi::settings_get_str("quiz_file");
- if (open(QS, "<$file")) {
+ if (open(QS, '<',$file)) {
@{$game->{'questions'}}=<QS>;
close(QS);
Irssi::print("Loaded questions");
diff --git a/scripts/quizmaster-fr.pl b/scripts/quizmaster-fr.pl
index 1f5bd7b..c143a09 100644
--- a/scripts/quizmaster-fr.pl
+++ b/scripts/quizmaster-fr.pl
@@ -3,7 +3,7 @@
use strict;
use vars qw($VERSION %IRSSI);
-$VERSION = '20030208+fr';
+$VERSION = '20170403+fr';
%IRSSI = (
authors => 'Stefan \'tommie\' Tomanek',
contact => 'stefan@pico.ruhr.de',
@@ -60,7 +60,7 @@ sub draw_box ($$$$) {
sub save_quizfile {
local *F;
my $filename = Irssi::settings_get_str("quizmaster_questions_file");
- open(F, ">".$filename);
+ open(F, '>',$filename);
my $dumper = Data::Dumper->new([\%questions], ['quest']);
$dumper->Purity(1)->Deepcopy(1);
my $data = $dumper->Dump;
@@ -75,7 +75,7 @@ sub load_quizfile ($) {
return unless -e $file;
my $text;
local *F;
- open F, $file;
+ open F,'<', $file;
$text .= $_ foreach (<F>);
close F;
return unless "$text";
@@ -85,7 +85,7 @@ sub load_quizfile ($) {
sub import_quizfile ($$) {
my ($name, $file) = @_;
local *F;
- open(F, $file);
+ open(F,'<', $file);
my @data = <F>;
my @questions;
my $quest = {};
diff --git a/scripts/quizmaster.pl b/scripts/quizmaster.pl
index 5aec557..e226075 100644
--- a/scripts/quizmaster.pl
+++ b/scripts/quizmaster.pl
@@ -2,7 +2,7 @@
use strict;
use vars qw($VERSION %IRSSI);
-$VERSION = '20030208';
+$VERSION = '20170403';
%IRSSI = (
authors => 'Stefan \'tommie\' Tomanek',
contact => 'stefan@pico.ruhr.de',
@@ -59,7 +59,7 @@ sub draw_box ($$$$) {
sub save_quizfile {
local *F;
my $filename = Irssi::settings_get_str("quizmaster_questions_file");
- open(F, ">".$filename);
+ open(F, ">",$filename);
my $dumper = Data::Dumper->new([\%questions], ['quest']);
$dumper->Purity(1)->Deepcopy(1);
my $data = $dumper->Dump;
@@ -74,7 +74,7 @@ sub load_quizfile ($) {
return unless -e $file;
my $text;
local *F;
- open F, $file;
+ open F,'<', $file;
$text .= $_ foreach (<F>);
close F;
return unless "$text";
@@ -84,7 +84,7 @@ sub load_quizfile ($) {
sub import_quizfile ($$) {
my ($name, $file) = @_;
local *F;
- open(F, $file);
+ open(F,'<', $file);
my @data = <F>;
my @questions;
my $quest = {};
diff --git a/scripts/scroller.pl b/scripts/scroller.pl
index 5bc4abb..610eed9 100644
--- a/scripts/scroller.pl
+++ b/scripts/scroller.pl
@@ -28,11 +28,12 @@
use Irssi;
+use Irssi::TextUI;
use strict;
use vars qw($VERSION %IRSSI);
-$VERSION="0.01";
+$VERSION="0.02";
%IRSSI = (
authors=> 'Demonen',
contact=> 'demmydemon@gmail.com',
@@ -84,7 +85,7 @@ sub scrollerStart() {
Irssi::settings_add_int('misc', 'scrollerSpeed', 200);
$timeout = Irssi::timeout_add(Irssi::settings_get_int('scrollerSpeed'), 'scrollerTimeout' , undef);
Irssi::statusbar_item_register('scroller', '$0', 'scrollerStatusbar');
- Irssi::command_bind scrollthis => \&scrollthis;
+ #Irssi::command_bind scrollthis => \&scrollthis;
Irssi::signal_add('setup changed', 'scrollerUpdate');
&scrollerUpdate();
}
diff --git a/scripts/signal_hilight.pl b/scripts/signal_hilight.pl
new file mode 100644
index 0000000..30b7efc
--- /dev/null
+++ b/scripts/signal_hilight.pl
@@ -0,0 +1,140 @@
+# signal_hilight.pl - (c) 2017 John Morrissey <jwm@horde.net>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# About
+# =====
+#
+# When you're away, sends highlighted messages to you via Signal.
+#
+#
+# To use
+# ======
+#
+# 1. Install signal-cli (https://github.com/AsamK/signal-cli).
+#
+# 2. Register a new Signal account for this device, or link to an existing
+# one.
+#
+# It's better to create a dedicated Signal account to have this script
+# send messages from. This requires a dedicated phone number to receive
+# the verification code text message for the new Signal account. Google
+# Voice numbers are useful here.
+#
+# Linking gives the host running irssi the same access to the account
+# (such as reading messages, changing account settings, and more) as the
+# Signal app has on your phone or computer.
+#
+# - Register a new account:
+# - signal-cli -u +12128675309 register
+# - Retrieve verification
+# - signal-cli -u +12128675309 verify VERIFICATION-CODE-FROM-SMS
+#
+# - Link to an existing account:
+# - signal-cli link -n $(hostname)
+# - qrencode -o device-link-qrcode.png 'tsdevice:/?uuid=...'
+# - View device-link-qrcode.png.
+# - Scan the QR code with the Signal app
+# (Settings -> Linked Devices -> Link New Device).
+#
+# 3. Load the script and configure:
+# - /script load signal_hilight.pl
+# - /set signal_phonenumber_from +12128675309
+# - /set signal_phonenumber_to +12128675309
+
+use strict;
+use warnings;
+
+use POSIX;
+
+use Irssi;
+
+our $VERSION = '1.0';
+our %IRSSI = (
+ author => 'John Morrissey',
+ contact => 'jwm@horde.net',
+ name => 'signal_hilight',
+ description => 'Send highlighted messages via Signal',
+ licence => 'BSD',
+);
+
+my $IS_AWAY = 0;
+
+sub send_notification {
+ my ($message) = @_;
+
+ my $pid = fork();
+ if ($pid > 0) {
+ Irssi::pidwait_add($pid);
+ } else {
+ eval {
+ my $from = Irssi::settings_get_str('signal_phonenumber_from');
+ my $to = Irssi::settings_get_str('signal_phonenumber_to');
+
+ if ($from && $to &&
+ open(SIGNAL_CLI, '|-', "signal-cli -u $from send $to")) {
+
+ print SIGNAL_CLI "$message";
+ close(SIGNAL_CLI);
+ }
+ };
+ POSIX::_exit(0);
+ }
+}
+
+sub sig_print_text {
+ my ($dest, $text, $stripped) = @_;
+
+ if ($IS_AWAY &&
+ ($dest->{level} & MSGLEVEL_PUBLIC) &&
+ ($dest->{level} & (MSGLEVEL_HILIGHT|MSGLEVEL_MSGS)) &&
+ ($dest->{level} & MSGLEVEL_NOHILIGHT) == 0) {
+
+ send_notification($dest->{target} . ": $stripped");
+ }
+}
+
+sub sig_message_public {
+ my ($server, $msg, $nick, $address, $target) = @_;
+
+ if ($server->{usermode_away}) {
+ $IS_AWAY = 1;
+ } else {
+ $IS_AWAY = 0;
+ }
+}
+
+sub sig_message_private {
+ my ($server, $msg, $nick, $address, $target) = @_;
+
+ if ($server->{usermode_away}) {
+ send_notification("$nick: $msg");
+ }
+}
+
+Irssi::signal_add('print text', \&sig_print_text);
+Irssi::signal_add_last('message public', \&sig_message_public);
+Irssi::signal_add_last('message private', \&sig_message_private);
+
+Irssi::settings_add_str('misc', 'signal_phonenumber_from', '');
+Irssi::settings_add_str('misc', 'signal_phonenumber_to', '');
diff --git a/scripts/sysinfoplus.pl b/scripts/sysinfoplus.pl
index cc82d0d..fc0cff0 100644
--- a/scripts/sysinfoplus.pl
+++ b/scripts/sysinfoplus.pl
@@ -16,8 +16,10 @@
# -Total amount of memory counts (not the used amount, as before)
# Changelog 2.10 -> 2.20: memory/swap info is displayed now (it was broken previously) and code is properly indented
+use strict;
+use vars qw/$VERSION %IRSSI/;
-$VERSION = "2.20";
+$VERSION = "2.21";
%IRSSI = (
authors => "Juerd, Tronic",
contact => "trn\@iki.fi",
@@ -25,7 +27,7 @@ $VERSION = "2.20";
description => "Linux system information (with vPenis and other stuff)",
license => "Public Domain",
url => "http://juerd.nl/irssi/",
- changed => "Mon Nov 04 15:17:30 EET 2002"
+ changed => "2017-04-02"
);
BEGIN{
@@ -37,7 +39,6 @@ BEGIN{
$console = !!$@;
}
-use strict;
# Tronic has no time for maintaining this and Juerd hates braces, so it might be better
# not to expect any new versions ...
@@ -51,7 +52,7 @@ sub sysinfo{
$ret = "Host '@uname[1]', running @uname[0] @uname[2] - ";
- open FOO, '/proc/cpuinfo';
+ open FOO,'<', '/proc/cpuinfo';
while (<FOO>){
/^processor\s*:\s*(\d+)/ ? $ret .= "Cpu$1: "
: /^model name\s*:\s*(\w+[ A-Za-z]*)/ ? do { my $t = $1; $t =~ s/\s+$//; $ret .= "$t " }
@@ -60,7 +61,7 @@ sub sysinfo{
}
close FOO;
$ret =~ s/( ?)$/;$1/;
- open FOO, '/proc/pci';
+ open FOO,'<', '/proc/pci';
while (<FOO>){
/^\s*(?:multimedia )?(.*?)( storage| compatible)? controller/i and push @pci, $1;
}
diff --git a/scripts/topicsed.pl b/scripts/topicsed.pl
index d56ed3d..58d0143 100644
--- a/scripts/topicsed.pl
+++ b/scripts/topicsed.pl
@@ -4,17 +4,18 @@
# Thanks to Mikael Magnusson for the idea and patch to implement a
# preview functionality. ;]
#
-
+use strict;
use Irssi;
-use vars %IRSSI;
+use vars qw/%IRSSI $VERSION/;
+$VERSION="0.1";
%IRSSI = (
authors => "Gabor Nyeki",
contact => "bigmac\@vim.hu",
name => "topicsed",
description => "editing channel topics by regexps",
license => "public domain",
- changed => "Fri Aug 13 19:27:38 CEST 2004"
+ changed => "2017-03-18"
);
@@ -32,7 +33,7 @@ sub topicsed {
return;
}
return if (!$server || !$server->{connected} ||
- !$winit || $winit->{type} != 'CHANNEL');
+ !$winit || $winit->{type} ne 'CHANNEL');
my $topic = $winit->{topic};
my $x = $topic;