mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
run syncscripts.sh
sync buf.pl to version 3.00 sync usercount.pl to version 1.20
This commit is contained in:
parent
2847b751e3
commit
60d2364989
@ -1,11 +1,13 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use vars qw($VERSION %IRSSI);
|
use vars qw($VERSION %IRSSI);
|
||||||
|
use Storable;
|
||||||
|
use 5.014000;
|
||||||
|
|
||||||
use Irssi qw(command signal_add signal_add_first active_win
|
use Irssi qw(command signal_add signal_add_first active_win
|
||||||
settings_get_str settings_get_bool channels windows
|
settings_get_str settings_get_bool channels windows
|
||||||
settings_add_str settings_add_bool get_irssi_dir
|
settings_add_str settings_add_bool get_irssi_dir
|
||||||
window_find_refnum signal_stop);
|
window_find_refnum signal_stop);
|
||||||
$VERSION = '2.20';
|
$VERSION = '3.00';
|
||||||
%IRSSI = (
|
%IRSSI = (
|
||||||
authors => 'Juerd',
|
authors => 'Juerd',
|
||||||
contact => 'juerd@juerd.nl',
|
contact => 'juerd@juerd.nl',
|
||||||
@ -13,8 +15,8 @@ $VERSION = '2.20';
|
|||||||
description => 'Saves the buffer for /upgrade, so that no information is lost',
|
description => 'Saves the buffer for /upgrade, so that no information is lost',
|
||||||
license => 'Public Domain',
|
license => 'Public Domain',
|
||||||
url => 'http://juerd.nl/irssi/',
|
url => 'http://juerd.nl/irssi/',
|
||||||
changed => 'Thu Sep 22 01:37 CEST 2016',
|
changed => 'Thu Mar 29 10:00 CEST 2018',
|
||||||
changes => 'Fixed file permissions (leaked everything via filesystem)',
|
changes => 'Fixed file permissions (leaked everything via filesystem), rewritten to use Storable and print to correct levels',
|
||||||
note1 => 'This script HAS TO BE in your scripts/autorun!',
|
note1 => 'This script HAS TO BE in your scripts/autorun!',
|
||||||
note2 => 'Perl support must be static or in startup',
|
note2 => 'Perl support must be static or in startup',
|
||||||
);
|
);
|
||||||
@ -40,12 +42,7 @@ my %suppress;
|
|||||||
sub _filename { sprintf '%s/scrollbuffer', get_irssi_dir }
|
sub _filename { sprintf '%s/scrollbuffer', get_irssi_dir }
|
||||||
|
|
||||||
sub upgrade {
|
sub upgrade {
|
||||||
my $fn = _filename;
|
my $out = { suppress => [ map $_->{server}->{address} . $_->{name}, channels ] };
|
||||||
my $old_umask = umask 0077;
|
|
||||||
open my $fh, q{>}, $fn or die "open $fn: $!";
|
|
||||||
umask $old_umask;
|
|
||||||
|
|
||||||
print $fh join("\0", map $_->{server}->{address} . $_->{name}, channels), "\n";
|
|
||||||
for my $window (windows) {
|
for my $window (windows) {
|
||||||
next unless defined $window;
|
next unless defined $window;
|
||||||
next if $window->{name} eq 'status';
|
next if $window->{name} eq 'status';
|
||||||
@ -53,17 +50,20 @@ sub upgrade {
|
|||||||
my $line = $view->get_lines;
|
my $line = $view->get_lines;
|
||||||
my $lines = 0;
|
my $lines = 0;
|
||||||
my $buf = '';
|
my $buf = '';
|
||||||
if (defined $line){
|
my $output;
|
||||||
|
if (defined $line) {
|
||||||
{
|
{
|
||||||
$buf .= $line->get_text(1) . "\n";
|
push @$output, { level => $line->{info}{level}, data => $line->get_text(1) };
|
||||||
$line = $line->next;
|
$line = $line->next;
|
||||||
$lines++;
|
|
||||||
redo if defined $line;
|
redo if defined $line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf $fh "%s:%s\n%s", $window->{refnum}, $lines, $buf;
|
push @{$out->{windows}}, { refnum => $window->{refnum}, lines => $output };
|
||||||
}
|
}
|
||||||
close $fh;
|
my $old_umask = umask 0077;
|
||||||
|
my $fn = _filename;
|
||||||
|
store($out, $fn) or die "Could not store data to $fn";
|
||||||
|
umask $old_umask;
|
||||||
unlink sprintf("%s/sessionconfig", get_irssi_dir);
|
unlink sprintf("%s/sessionconfig", get_irssi_dir);
|
||||||
command 'layout save';
|
command 'layout save';
|
||||||
command 'save';
|
command 'save';
|
||||||
@ -71,32 +71,29 @@ sub upgrade {
|
|||||||
|
|
||||||
sub restore {
|
sub restore {
|
||||||
my $fn = _filename;
|
my $fn = _filename;
|
||||||
open my $fh, q{<}, $fn or die "open $fn: $!";
|
my $in = retrieve($fn) or die "Could not retrieve data from $fn";
|
||||||
unlink $fn or warn "unlink $fn: $!";
|
unlink $fn or warn "unlink $fn: $!";
|
||||||
|
|
||||||
my @suppress = split /\0/, readline $fh;
|
my @suppress = @{$in->{suppress}};
|
||||||
if (settings_get_bool 'upgrade_suppress_join') {
|
@suppress{@suppress} = (2) x @suppress if (settings_get_bool 'upgrade_suppress_join');
|
||||||
chomp $suppress[-1];
|
|
||||||
@suppress{@suppress} = (2) x @suppress;
|
|
||||||
}
|
|
||||||
active_win->command('^window scroll off');
|
active_win->command('^window scroll off');
|
||||||
while (my $bla = readline $fh){
|
for my $win (@{$in->{windows}}) {
|
||||||
chomp $bla;
|
my $window = window_find_refnum $win->{refnum};
|
||||||
my ($refnum, $lines) = split /:/, $bla;
|
next unless $window;
|
||||||
next unless $lines;
|
my @lines = @{ $win->{lines} || [] };
|
||||||
my $window = window_find_refnum $refnum;
|
next unless @lines;
|
||||||
unless (defined $window){
|
|
||||||
readline $fh for 1..$lines;
|
|
||||||
next;
|
|
||||||
}
|
|
||||||
my $view = $window->view;
|
my $view = $window->view;
|
||||||
$view->remove_all_lines();
|
$view->remove_all_lines();
|
||||||
$view->redraw();
|
$view->redraw();
|
||||||
my $buf = '';
|
for my $line (@lines) {
|
||||||
$buf .= readline $fh for 1..$lines;
|
my $level = $line->{level};
|
||||||
|
my $data = $line->{data};
|
||||||
|
$window->gui_printtext_after($window->last_line_insert, $level, "$data\n");
|
||||||
|
}
|
||||||
my $sep = settings_get_str 'upgrade_separator';
|
my $sep = settings_get_str 'upgrade_separator';
|
||||||
$sep .= "\n" if $sep ne '';
|
$window->gui_printtext_after($window->last_line_insert, MSGLEVEL_CLIENTNOTICE, "\cO$sep\n") if $sep ne '';
|
||||||
$window->gui_printtext_after(undef, MSGLEVEL_CLIENTNOTICE, "$buf\cO$sep");
|
|
||||||
$view->redraw();
|
$view->redraw();
|
||||||
}
|
}
|
||||||
active_win->command('^window scroll on');
|
active_win->command('^window scroll on');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use Irssi 20040119.2359 ();
|
use Irssi 20040119.2359 ();
|
||||||
use vars qw($VERSION %IRSSI);
|
use vars qw($VERSION %IRSSI);
|
||||||
$VERSION = "1.19";
|
$VERSION = "1.20";
|
||||||
%IRSSI = (
|
%IRSSI = (
|
||||||
authors => 'David Leadbeater, Timo Sirainen, Georg Lukas',
|
authors => 'David Leadbeater, Timo Sirainen, Georg Lukas',
|
||||||
contact => 'dgl@dgl.cx, tss@iki.fi, georg@boerde.de',
|
contact => 'dgl@dgl.cx, tss@iki.fi, georg@boerde.de',
|
||||||
@ -128,7 +128,7 @@ sub calc_users() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Server doesn't support halfops?
|
# Server doesn't support halfops?
|
||||||
if($server->isupport("PREFIX") !~ /\%/) {
|
if($server->can('isupport') && $server->isupport("PREFIX") !~ /\%/) {
|
||||||
$halfops = undef;
|
$halfops = undef;
|
||||||
} else {
|
} else {
|
||||||
$halfops = undef unless Irssi::settings_get_bool('usercount_show_halfops');
|
$halfops = undef unless Irssi::settings_get_bool('usercount_show_halfops');
|
||||||
|
Loading…
Reference in New Issue
Block a user