Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add all non-nei scripts from nei's website
Some are mostly nei or nei variants, but not originally authored by nei If any of the authors doesn't want to have these in scripts.irssi.org, complain and we'll remove it.
- Loading branch information
Showing
15 changed files
with
4,810 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
use strict; | ||
use warnings; | ||
|
||
our $VERSION = "0.5"; | ||
our %IRSSI = ( | ||
authors => 'Jari Matilainen, init[1]@irc.freenode.net', | ||
contact => 'vague@vague.se', | ||
name => 'cmpchans', | ||
description => 'Compare nicks in two channels', | ||
license => 'Public Domain', | ||
url => 'http://vague.se' | ||
); | ||
|
||
use Irssi::TextUI; | ||
use Data::Dumper; | ||
|
||
sub cmd_cmp { | ||
local $/ = " "; | ||
my ($args, $server, $witem) = @_; | ||
my (@channels) = split /\s+/, $args; | ||
|
||
my $server1 = $server; | ||
if ($channels[0] =~ s,(.*?)/,,) { | ||
$server1 = Irssi::server_find_tag($1) || $server; | ||
} | ||
my $chan1 = $server1->channel_find($channels[0]); | ||
if(!$chan1) { | ||
Irssi::active_win()->{active}->print("You have to specify atleast one channel to compare nicks to"); | ||
return; | ||
} | ||
|
||
my @nicks_1; | ||
my @nicks_2; | ||
|
||
@nicks_1 = $chan1->nicks() if(defined $chan1); | ||
|
||
if(not defined $channels[1]) { | ||
@nicks_2 = $witem->nicks(); | ||
} | ||
else { | ||
if ($channels[1] =~ s,(.*?)/,,) { | ||
$server1 = Irssi::server_find_tag($1) || $server; | ||
} | ||
my ($chan2) = $server1->channel_find($channels[1]); | ||
@nicks_2 = $chan2->nicks() if(defined $chan2); | ||
} | ||
|
||
return if(scalar @nicks_1 == 0 || scalar @nicks_2 == 0); | ||
|
||
my %count = (); | ||
my @intersection; | ||
|
||
foreach (@nicks_1, @nicks_2) { $count{$_->{nick}}++; } | ||
foreach my $key (keys %count) { | ||
if($count{$key} > 1) { | ||
push @{\@intersection}, $key; | ||
} | ||
} | ||
|
||
my $common = join(", ", @intersection); | ||
$witem->print("Common nicks: " . $common); | ||
} | ||
|
||
Irssi::command_bind("cmp", \&cmd_cmp); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
use strict; | ||
use Irssi qw(command_bind MSGLEVEL_HILIGHT); | ||
use vars qw($VERSION %IRSSI); | ||
|
||
# Recommended key bindings: alt+pgup, alt+pgdown: | ||
# /bind meta2-5;3~ /scrollback hlprev | ||
# /bind meta2-6;3~ /scrollback hlnext | ||
|
||
$VERSION = '0.02'; | ||
%IRSSI = ( | ||
authors => 'Juerd, Eevee', | ||
contact => '#####@juerd.nl', | ||
name => 'Scroll to hilights', | ||
description => 'Scrolls to previous or next highlight', | ||
license => 'Public Domain', | ||
url => 'http://juerd.nl/site.plp/irssi', | ||
changed => 'Fri Apr 13 05:48 CEST 2012', | ||
inspiration => '@eevee on Twitter: "i really want irssi keybindings that will scroll to the next/previous line containing a highlight. why does this not exist"', | ||
); | ||
|
||
sub _hlscroll{ | ||
my ($direction, $data, $server, $witem) = @_; | ||
$witem or return; | ||
my $window = $witem->window or return; | ||
|
||
my $view = $window->view; | ||
my $line = $view->{buffer}->{cur_line}; | ||
my $delta = $direction eq 'prev' ? -1 : 1; | ||
|
||
my $linesleft = $view->{ypos} - $view->{height} + 1; | ||
my $scrollby = 0; # how many display lines to scroll to the next highlight | ||
|
||
# find the line currently at the bottom of the screen | ||
while (1) { | ||
my $line_height = $view->get_line_cache($line)->{count}; | ||
|
||
if ($linesleft < $line_height) { | ||
# found it! | ||
if ($direction eq 'prev') { | ||
# skip however much of $line is on the screen | ||
$scrollby = $linesleft - $line_height; | ||
} | ||
else { | ||
# skip however much of $line is off the screen | ||
$scrollby = $linesleft; | ||
} | ||
|
||
last; | ||
} | ||
|
||
$linesleft -= $line_height; | ||
|
||
last if not $line->prev; | ||
$line = $line->prev; | ||
} | ||
|
||
while ($line->$direction) { | ||
$line = $line->$direction; | ||
my $line_height = $view->get_line_cache($line)->{count}; | ||
|
||
if ($line->{info}{level} & MSGLEVEL_HILIGHT) { | ||
# this algorithm scrolls to the "border" between lines -- if | ||
# scrolling down, add in the line's entire height so it's entirely | ||
# visible | ||
if ($direction eq 'next') { | ||
$scrollby += $delta * $line_height; | ||
} | ||
|
||
$view->scroll($scrollby); | ||
return; | ||
} | ||
|
||
$scrollby += $delta * $line_height; | ||
} | ||
|
||
if ($direction eq 'next' and not $line->next) { | ||
# scroll all the way to the bottom, after the last highlight | ||
$view->scroll_line($line); | ||
} | ||
}; | ||
|
||
command_bind 'scrollback hlprev' => sub { _hlscroll('prev', @_) }; | ||
command_bind 'scrollback hlnext' => sub { _hlscroll('next', @_) }; |
Oops, something went wrong.