mirror of
https://github.com/irssi/irssi.git
synced 2025-01-03 14:56:47 -05:00
Updated the bundled scripts to their latest version (#143)
Updated the bundled scripts to their latest version (#143) Removed sb_search.pl which is not contributed into the script archive, I will poke coekie about it.
This commit is contained in:
parent
788f181ecb
commit
a663d2f674
@ -5,13 +5,13 @@ use Irssi;
|
|||||||
use strict;
|
use strict;
|
||||||
use vars qw($VERSION %IRSSI);
|
use vars qw($VERSION %IRSSI);
|
||||||
|
|
||||||
$VERSION = "1.00";
|
$VERSION = "1.10";
|
||||||
%IRSSI = (
|
%IRSSI = (
|
||||||
authors => 'Timo Sirainen',
|
authors => 'Timo Sirainen & Jostein Kjønigsen',
|
||||||
name => 'autoop',
|
name => 'autoop',
|
||||||
description => 'Simple auto-op script',
|
description => 'Simple auto-op script',
|
||||||
license => 'Public Domain',
|
license => 'Public Domain',
|
||||||
changed => 'Sun Mar 10 23:18 EET 2002'
|
changed => 'Fri Nov 24 12:55 GMT+1 2014'
|
||||||
);
|
);
|
||||||
|
|
||||||
my (%opnicks, %temp_opped);
|
my (%opnicks, %temp_opped);
|
||||||
@ -64,7 +64,7 @@ sub autoop {
|
|||||||
|
|
||||||
if (!$temp_opped{$nick} &&
|
if (!$temp_opped{$nick} &&
|
||||||
$server->masks_match($masks, $nick, $host)) {
|
$server->masks_match($masks, $nick, $host)) {
|
||||||
$channel->command("op $nick");
|
$channel->command("/op $nick");
|
||||||
$temp_opped{$nick} = 1;
|
$temp_opped{$nick} = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,3 +89,68 @@ sub event_massjoin {
|
|||||||
|
|
||||||
Irssi::command_bind('autoop', 'cmd_autoop');
|
Irssi::command_bind('autoop', 'cmd_autoop');
|
||||||
Irssi::signal_add_last('massjoin', 'event_massjoin');
|
Irssi::signal_add_last('massjoin', 'event_massjoin');
|
||||||
|
|
||||||
|
sub load_autoops {
|
||||||
|
my($file) = Irssi::get_irssi_dir."/autoop";
|
||||||
|
my($count) = 0;
|
||||||
|
local(*CONF);
|
||||||
|
|
||||||
|
%opnicks = ();
|
||||||
|
open(CONF, "<", "$file") or return;
|
||||||
|
while (my $line = <CONF>) {
|
||||||
|
if ($line !=~ /^\s*$/) {
|
||||||
|
cmd_autoop($line);
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(CONF);
|
||||||
|
|
||||||
|
Irssi::print("Loaded $count channels from $file");
|
||||||
|
}
|
||||||
|
|
||||||
|
# --------[ save_autoops ]------------------------------------------------
|
||||||
|
|
||||||
|
sub save_autoops {
|
||||||
|
my($auto) = @_;
|
||||||
|
my($file) = Irssi::get_irssi_dir."/autoop";
|
||||||
|
my($count) = 0;
|
||||||
|
my($channel) = "";
|
||||||
|
local(*CONF);
|
||||||
|
|
||||||
|
return if $auto;
|
||||||
|
|
||||||
|
open(CONF, ">", "$file");
|
||||||
|
foreach $channel (keys %opnicks) {
|
||||||
|
my $masks = $opnicks{$channel};
|
||||||
|
print CONF "$channel\t$masks\n";
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
close(CONF);
|
||||||
|
|
||||||
|
Irssi::print("Saved $count channels to $file")
|
||||||
|
unless $auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# --------[ sig_setup_reread ]------------------------------------------
|
||||||
|
|
||||||
|
# main setup is reread, so let us do it too
|
||||||
|
sub sig_setup_reread {
|
||||||
|
load_autoops;
|
||||||
|
}
|
||||||
|
|
||||||
|
# --------[ sig_setup_save ]--------------------------------------------
|
||||||
|
|
||||||
|
# main config is saved, and so we should save too
|
||||||
|
sub sig_setup_save {
|
||||||
|
my($mainconf,$auto) = @_;
|
||||||
|
save_autoops($auto);
|
||||||
|
}
|
||||||
|
|
||||||
|
# persistance
|
||||||
|
|
||||||
|
Irssi::signal_add('setup saved', 'sig_setup_save');
|
||||||
|
Irssi::signal_add('setup reread', 'sig_setup_reread');
|
||||||
|
|
||||||
|
# ensure we load persisted values on start
|
||||||
|
load_autoops;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
# automatically rejoin to channel after kicked
|
# automatically rejoin to channel after kick
|
||||||
|
# delayed rejoin: Lam 28.10.2001 (lam@lac.pl)
|
||||||
# /SET autorejoin_channels #channel1 #channel2 ...
|
|
||||||
|
|
||||||
# NOTE: I personally don't like this feature, in most channels I'm in it
|
# NOTE: I personally don't like this feature, in most channels I'm in it
|
||||||
# will just result as ban. You've probably misunderstood the idea of /KICK
|
# will just result as ban. You've probably misunderstood the idea of /KICK
|
||||||
@ -10,43 +9,49 @@ use Irssi;
|
|||||||
use Irssi::Irc;
|
use Irssi::Irc;
|
||||||
use strict;
|
use strict;
|
||||||
use vars qw($VERSION %IRSSI);
|
use vars qw($VERSION %IRSSI);
|
||||||
|
$VERSION = "1.0.0";
|
||||||
$VERSION = "1.00";
|
|
||||||
%IRSSI = (
|
%IRSSI = (
|
||||||
authors => 'Timo Sirainen',
|
authors => "Timo 'cras' Sirainen, Leszek Matok",
|
||||||
name => 'autorejoin',
|
contact => "lam\@lac.pl",
|
||||||
description => 'Automatically rejoin to channel after kicked',
|
name => "autorejoin",
|
||||||
license => 'Public Domain',
|
description => "Automatically rejoin to channel after being kick, after a (short) user-defined delay",
|
||||||
changed => 'Sun Mar 10 23:18 EET 2002'
|
license => "GPLv2",
|
||||||
|
changed => "10.3.2002 14:00"
|
||||||
);
|
);
|
||||||
|
|
||||||
sub channel_rejoin {
|
|
||||||
my ($server, $channel) = @_;
|
|
||||||
|
|
||||||
# check if channel has password
|
# How many seconds to wait before the rejoin?
|
||||||
my $chanrec = $server->channel_find($channel);
|
# TODO: make this a /setting
|
||||||
my $password = $chanrec->{key} if ($chanrec);
|
my $delay = 5;
|
||||||
|
|
||||||
# We have to use send_raw() because the channel record still
|
my @tags;
|
||||||
# exists and irssi won't even try to join to it with command()
|
my $acttag = 0;
|
||||||
$server->send_raw("JOIN $channel $password");
|
|
||||||
|
sub rejoin {
|
||||||
|
my ( $data ) = @_;
|
||||||
|
my ( $tag, $servtag, $channel, $pass ) = split( / +/, $data );
|
||||||
|
|
||||||
|
my $server = Irssi::server_find_tag( $servtag );
|
||||||
|
$server->send_raw( "JOIN $channel $pass" ) if ( $server );
|
||||||
|
Irssi::timeout_remove( $tags[$tag] );
|
||||||
}
|
}
|
||||||
|
|
||||||
sub event_rejoin_kick {
|
sub event_rejoin_kick {
|
||||||
my ($server, $data) = @_;
|
my ( $server, $data ) = @_;
|
||||||
my ($channel, $nick) = split(/ +/, $data);
|
my ( $channel, $nick ) = split( / +/, $data );
|
||||||
|
|
||||||
return if ($server->{nick} ne $nick);
|
return if ( $server->{ nick } ne $nick );
|
||||||
|
|
||||||
# check if we want to autorejoin this channel
|
# check if channel has password
|
||||||
my @chans = split(/[ ,]+/, Irssi::settings_get_str('autorejoin_channels'));
|
my $chanrec = $server->channel_find( $channel );
|
||||||
foreach my $chan (@chans) {
|
my $password = $chanrec->{ key } if ( $chanrec );
|
||||||
if (lc($chan) eq lc($channel)) {
|
my $rejoinchan = $chanrec->{ name } if ( $chanrec );
|
||||||
channel_rejoin($server, $channel);
|
my $servtag = $server->{ tag };
|
||||||
last;
|
|
||||||
}
|
Irssi::print "Rejoining $rejoinchan in $delay seconds.";
|
||||||
}
|
$tags[$acttag] = Irssi::timeout_add( $delay * 1000, "rejoin", "$acttag $servtag $rejoinchan $password" );
|
||||||
|
$acttag++;
|
||||||
|
$acttag = 0 if ( $acttag > 60 );
|
||||||
}
|
}
|
||||||
|
|
||||||
Irssi::settings_add_str('misc', 'autorejoin_channels', '');
|
Irssi::signal_add( 'event kick', 'event_rejoin_kick' );
|
||||||
Irssi::signal_add('event kick', 'event_rejoin_kick');
|
|
||||||
|
@ -40,7 +40,7 @@ use Data::Dumper;
|
|||||||
my %suppress;
|
my %suppress;
|
||||||
|
|
||||||
sub upgrade {
|
sub upgrade {
|
||||||
open BUF, sprintf('>%s/scrollbuffer', get_irssi_dir) or die $!;
|
open BUF, q{>}, sprintf('%s/scrollbuffer', get_irssi_dir) or die $!;
|
||||||
print BUF join("\0", map $_->{server}->{address} . $_->{name}, channels), "\n";
|
print BUF join("\0", map $_->{server}->{address} . $_->{name}, channels), "\n";
|
||||||
for my $window (windows) {
|
for my $window (windows) {
|
||||||
next unless defined $window;
|
next unless defined $window;
|
||||||
@ -66,7 +66,7 @@ sub upgrade {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub restore {
|
sub restore {
|
||||||
open BUF, sprintf('<%s/scrollbuffer', get_irssi_dir) or die $!;
|
open BUF, q{<}, sprintf('%s/scrollbuffer', get_irssi_dir) or die $!;
|
||||||
my @suppress = split /\0/, <BUF>;
|
my @suppress = split /\0/, <BUF>;
|
||||||
if (settings_get_bool 'upgrade_suppress_join') {
|
if (settings_get_bool 'upgrade_suppress_join') {
|
||||||
chomp $suppress[-1];
|
chomp $suppress[-1];
|
||||||
@ -98,14 +98,13 @@ sub restore {
|
|||||||
|
|
||||||
sub suppress {
|
sub suppress {
|
||||||
my ($first, $second) = @_;
|
my ($first, $second) = @_;
|
||||||
return
|
return unless scalar keys %suppress and settings_get_bool 'upgrade_suppress_join';
|
||||||
unless scalar keys %suppress
|
my $key_part = (grep { /^:?[#!+&]/ } split ' ', $second)[0];
|
||||||
and settings_get_bool 'upgrade_suppress_join';
|
$key_part =~ s/^://;
|
||||||
my $key = $first->{address} .
|
my $key = $first->{address} . $key_part;
|
||||||
(grep { (s/^://, /^[#!+&]/) } split ' ', $second)[0];
|
|
||||||
if (exists $suppress{$key} and $suppress{$key}--) {
|
if (exists $suppress{$key} and $suppress{$key}--) {
|
||||||
signal_stop();
|
signal_stop();
|
||||||
delete $suppress{$key} unless $suppress{$key};
|
delete $suppress{$key} unless $suppress{$key};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,18 +1,24 @@
|
|||||||
# /DNS <nick>|<host>|<ip> ...
|
# /DNS <nick>|<host>|<ip> ...
|
||||||
|
# version 2.1.1
|
||||||
|
#
|
||||||
|
# updated the script to fix a bug where the script would let
|
||||||
|
# a trailing whitespace go through (ex: tab completion)
|
||||||
|
# - inch <inch@stmpd.net>
|
||||||
|
|
||||||
use Irssi;
|
|
||||||
use strict;
|
use strict;
|
||||||
use Socket;
|
use Socket;
|
||||||
use POSIX;
|
use POSIX;
|
||||||
|
|
||||||
use vars qw($VERSION %IRSSI);
|
use vars qw($VERSION %IRSSI);
|
||||||
$VERSION = "2.1";
|
$VERSION = "2.1.1";
|
||||||
%IRSSI = (
|
%IRSSI = (
|
||||||
authors => 'Timo Sirainen',
|
authors => "Timo \'cras\' Sirainen",
|
||||||
name => 'dns',
|
contact => "tss\@iki.fi",
|
||||||
description => '/DNS <nick>|<host>|<ip> ...',
|
name => "dns",
|
||||||
license => 'Public Domain',
|
description => "/DNS <nick>|<host>|<ip> ...",
|
||||||
changed => 'Sun Mar 10 23:23 EET 2002'
|
license => "Public Domain",
|
||||||
|
url => "http://irssi.org/",
|
||||||
|
changed => "2002-03-04T22:47+0100"
|
||||||
);
|
);
|
||||||
|
|
||||||
my (%resolve_hosts, %resolve_nicks, %resolve_print); # resolve queues
|
my (%resolve_hosts, %resolve_nicks, %resolve_print); # resolve queues
|
||||||
@ -28,7 +34,7 @@ my $pipe_tag;
|
|||||||
sub cmd_dns {
|
sub cmd_dns {
|
||||||
my ($nicks, $server) = @_;
|
my ($nicks, $server) = @_;
|
||||||
return if !$nicks;
|
return if !$nicks;
|
||||||
|
$nicks =~ s/\s+$//;
|
||||||
# get list of nicks/hosts we want to know
|
# get list of nicks/hosts we want to know
|
||||||
my $tag = !$server ? undef : $server->{tag};
|
my $tag = !$server ? undef : $server->{tag};
|
||||||
my $ask_nicks = "";
|
my $ask_nicks = "";
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
# There's a pretty good explanation of (ircnet) ircd's server kills in
|
# There's a pretty good explanation of (ircnet) ircd's server kills in
|
||||||
# http://www.irc.org/tech_docs/ircnet/kills.html
|
# http://www.irc.org/tech_docs/ircnet/kills.html
|
||||||
|
|
||||||
|
use strict;
|
||||||
use Irssi;
|
use Irssi;
|
||||||
use vars qw($VERSION %IRSSI);
|
use vars qw($VERSION %IRSSI);
|
||||||
|
|
||||||
@ -47,13 +48,13 @@ sub msg_quit {
|
|||||||
my @printargs = ();
|
my @printargs = ();
|
||||||
if ($killmsg =~ /([^ ]*) != (.*)/) {
|
if ($killmsg =~ /([^ ]*) != (.*)/) {
|
||||||
# 1 != 2
|
# 1 != 2
|
||||||
my $server1 = $1, $server2 = $2;
|
my $server1 = $1, my $server2 = $2;
|
||||||
|
|
||||||
$server1 =~ s/([^\[]*)\[([^\]]*)\]/\1/;
|
$server1 =~ s/([^\[]*)\[([^\]]*)\]/\1/;
|
||||||
$msg .= "$2 != $server2";
|
$msg .= "$2 != $server2";
|
||||||
} elsif ($killmsg =~ /([^ ]*) <- (.*)/) {
|
} elsif ($killmsg =~ /([^ ]*) <- (.*)/) {
|
||||||
# 1 <- 2
|
# 1 <- 2
|
||||||
my $server1 = $1, $server2 = $2;
|
my $server1 = $1, my $server2 = $2;
|
||||||
|
|
||||||
if ($server1 =~ /^\(/) {
|
if ($server1 =~ /^\(/) {
|
||||||
# (addr1)server1 <- (add2)server2
|
# (addr1)server1 <- (add2)server2
|
||||||
@ -84,9 +85,9 @@ sub msg_quit {
|
|||||||
$msg = $killmsg;
|
$msg = $killmsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@list = $server->nicks_get_same($nick);
|
my @list = $server->nicks_get_same($nick);
|
||||||
while (@list) {
|
while (@list) {
|
||||||
$channel = $list[0];
|
my $channel = $list[0];
|
||||||
shift @list;
|
shift @list;
|
||||||
# skip nick record
|
# skip nick record
|
||||||
shift @list;
|
shift @list;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
use strict;
|
||||||
|
use vars qw($VERSION %IRSSI);
|
||||||
$VERSION = "2.92";
|
$VERSION = "2.92";
|
||||||
%IRSSI = (
|
%IRSSI = (
|
||||||
authors => "Timo Sirainen, Matti Hiljanen, Joost Vunderink, Bart Matthaei",
|
authors => "Timo Sirainen, Matti Hiljanen, Joost Vunderink, Bart Matthaei",
|
||||||
@ -114,7 +116,7 @@ sub mbox_count {
|
|||||||
$last_mtime = $mtime;
|
$last_mtime = $mtime;
|
||||||
|
|
||||||
my $f = gensym;
|
my $f = gensym;
|
||||||
return 0 if (!open($f, $mailfile));
|
return 0 if (!open($f, "<", $mailfile));
|
||||||
|
|
||||||
# count new mails only
|
# count new mails only
|
||||||
my $internal_removed = 0;
|
my $internal_removed = 0;
|
||||||
|
@ -113,7 +113,7 @@ sub mlock_check_mode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($modecmd ne "") {
|
if ($modecmd ne "") {
|
||||||
$channel->{server}->command("mode $channame $modecmd$extracmd");
|
$channel->{server}->command("/mode $channame $modecmd$extracmd");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ sub cmd_quit {
|
|||||||
my ($data, $server, $channel) = @_;
|
my ($data, $server, $channel) = @_;
|
||||||
return if ($data ne "");
|
return if ($data ne "");
|
||||||
|
|
||||||
open (f, $quitfile) || return;
|
open (f, "<", $quitfile) || return;
|
||||||
my $lines = 0; while(<f>) { $lines++; };
|
my $lines = 0; while(<f>) { $lines++; };
|
||||||
|
|
||||||
my $line = int(rand($lines))+1;
|
my $line = int(rand($lines))+1;
|
||||||
@ -38,7 +38,7 @@ sub cmd_quit {
|
|||||||
close(f);
|
close(f);
|
||||||
|
|
||||||
foreach my $server (Irssi::servers) {
|
foreach my $server (Irssi::servers) {
|
||||||
$server->command("disconnect ".$server->{tag}." $quitmsg");
|
$server->command("/disconnect ".$server->{tag}." $quitmsg");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,159 +0,0 @@
|
|||||||
# sb_search.pl - search in your scrollback, scroll to a match
|
|
||||||
# Do /HELP SCROLLBACK for help
|
|
||||||
|
|
||||||
# Copyright (C) 2008 Wouter Coekaerts <wouter@coekaerts.be>, Emanuele Giaquinta <exg@irssi.org>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# 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, write to the Free Software
|
|
||||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use Irssi;
|
|
||||||
use Irssi::TextUI;
|
|
||||||
use vars qw($VERSION %IRSSI);
|
|
||||||
|
|
||||||
$VERSION = '1.1';
|
|
||||||
%IRSSI = (
|
|
||||||
authors => 'Wouter Coekaerts, Emanuele Giaquinta',
|
|
||||||
contact => 'wouter@coekaerts.be, exg@irssi.org',
|
|
||||||
name => 'sb_search',
|
|
||||||
description => 'search in your scrollback, scroll to a match',
|
|
||||||
license => 'GPLv2 or later',
|
|
||||||
url => 'http://wouter.coekaerts.be/irssi/',
|
|
||||||
changed => '$LastChangedDate$',
|
|
||||||
);
|
|
||||||
|
|
||||||
sub cmd_help {
|
|
||||||
my ($args, $server, $witem) = @_;
|
|
||||||
if ($args =~ /^scrollback( search)? *$/i) {
|
|
||||||
Irssi::print ( <<SCRIPTHELP_EOF
|
|
||||||
|
|
||||||
SCROLLBACK SEARCH [-level <level>] [-regexp] [-case] [-word] [-forward] [-all] [<pattern>]
|
|
||||||
|
|
||||||
SEARCH: Search for text in the scrollback buffer.
|
|
||||||
|
|
||||||
-regexp: The given text pattern is a regular expression.
|
|
||||||
-case: Performs a case-sensitive matching.
|
|
||||||
-word: The text must match full words.
|
|
||||||
-forward: Search forwards (default is backwards).
|
|
||||||
-all: Search in all windows.
|
|
||||||
|
|
||||||
Without arguments, the last search is repeated.
|
|
||||||
SCRIPTHELP_EOF
|
|
||||||
,MSGLEVEL_CLIENTCRAP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
my $regex;
|
|
||||||
my $all;
|
|
||||||
my $level;
|
|
||||||
|
|
||||||
sub cmd_sb_search {
|
|
||||||
my ($args, $server, $witem) = @_;
|
|
||||||
|
|
||||||
### handle options
|
|
||||||
|
|
||||||
my ($options, $pattern) = Irssi::command_parse_options('scrollback search', $args);
|
|
||||||
|
|
||||||
my $forward = defined(delete $options->{forward});
|
|
||||||
|
|
||||||
if (!%$options && !$pattern) {
|
|
||||||
return if !$regex && !defined $level;
|
|
||||||
} else {
|
|
||||||
$all = defined($options->{all});
|
|
||||||
$level = MSGLEVEL_ALL;
|
|
||||||
undef $regex;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (defined($options->{level})) {
|
|
||||||
$level = $options->{level};
|
|
||||||
$level =~ y/,/ /;
|
|
||||||
$level = Irssi::combine_level(0, $level);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($pattern) {
|
|
||||||
my $flags = defined($options->{case}) ? '' : '(?i)';
|
|
||||||
my $b = defined($options->{word}) ? '\b' : '';
|
|
||||||
if (defined($options->{regexp})) {
|
|
||||||
local $@;
|
|
||||||
eval {
|
|
||||||
$regex = qr/$flags$b$pattern$b/;
|
|
||||||
};
|
|
||||||
if ($@) {
|
|
||||||
my ($err) = $@ =~ /^(.*)/;
|
|
||||||
$err =~ s/\sat .* line \d+\.$//;
|
|
||||||
print CLIENTERROR $err;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$regex = qr/$flags$b\Q$pattern\E$b/;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
### determine window(s) to search in
|
|
||||||
|
|
||||||
my $current_win = ref $witem ? $witem->window() : Irssi::active_win();
|
|
||||||
|
|
||||||
my @windows;
|
|
||||||
if ($all) {
|
|
||||||
# cycle backward or forwards over all windows starting from current
|
|
||||||
# for example, searching backward through 5 windows, with window 3 active: search order is 3,2,1,5,4
|
|
||||||
# if we're searching forward: 3,4,5,1,2
|
|
||||||
my $order = $forward ? 1 : -1;
|
|
||||||
@windows = sort {$order * ($a->{refnum} cmp $b->{refnum})} Irssi::windows();
|
|
||||||
my @before_windows = grep {($_->{refnum} cmp $current_win->{refnum}) == $order} @windows;
|
|
||||||
my @after_windows = grep {($_->{refnum} cmp $current_win->{refnum}) == -$order} @windows;
|
|
||||||
@windows = ($current_win, @before_windows, @after_windows);
|
|
||||||
} else {
|
|
||||||
@windows = ($current_win);
|
|
||||||
}
|
|
||||||
|
|
||||||
### do the search
|
|
||||||
|
|
||||||
foreach my $win (@windows) {
|
|
||||||
my $view = $win->view;
|
|
||||||
|
|
||||||
## determine line to start from
|
|
||||||
my $line;
|
|
||||||
if ($all && $win != $current_win) {
|
|
||||||
if ($forward) { # first line
|
|
||||||
$line = $view->get_lines;
|
|
||||||
} else { # last line
|
|
||||||
$line = $view->{startline};
|
|
||||||
while ($line->next) {
|
|
||||||
$line = $line->next
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else { # line after or before first visible line
|
|
||||||
$line = $forward ? $view->{startline}->next : $view->{startline}->prev;
|
|
||||||
}
|
|
||||||
|
|
||||||
## loop over the lines
|
|
||||||
while (defined $line) {
|
|
||||||
my $line_level = $line->{info}{level};
|
|
||||||
if ($line_level & $level && $line->get_text(0) =~ $regex) {
|
|
||||||
$view->scroll_line($line);
|
|
||||||
if ($all) {
|
|
||||||
Irssi::command('window goto ' . $win->{refnum});
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$line = $forward ? $line->next : $line->prev;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Irssi::command_bind('scrollback search', \&cmd_sb_search);
|
|
||||||
Irssi::command_bind_last('help', \&cmd_help);
|
|
||||||
Irssi::command_set_options('scrollback search', '-level regexp case word forward all');
|
|
@ -1,4 +1,6 @@
|
|||||||
|
use strict;
|
||||||
use Irssi 20040119.2359 ();
|
use Irssi 20040119.2359 ();
|
||||||
|
use vars qw($VERSION %IRSSI);
|
||||||
$VERSION = "1.19";
|
$VERSION = "1.19";
|
||||||
%IRSSI = (
|
%IRSSI = (
|
||||||
authors => 'David Leadbeater, Timo Sirainen, Georg Lukas',
|
authors => 'David Leadbeater, Timo Sirainen, Georg Lukas',
|
||||||
@ -29,7 +31,6 @@ $VERSION = "1.19";
|
|||||||
# sb_uc_space = " ";
|
# sb_uc_space = " ";
|
||||||
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use Irssi::TextUI;
|
use Irssi::TextUI;
|
||||||
|
|
||||||
my ($ircops, $ops, $halfops, $voices, $normal, $total);
|
my ($ircops, $ops, $halfops, $voices, $normal, $total);
|
||||||
|
Loading…
Reference in New Issue
Block a user