mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
Updated from scripts.irssi.org
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2939 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
6374e96621
commit
8ae4516a2a
@ -1,15 +1,18 @@
|
|||||||
use Irssi 20020101.0250 ();
|
use Irssi 20020101.0250 ();
|
||||||
$VERSION = "1.14";
|
$VERSION = "1.16";
|
||||||
%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',
|
||||||
name => 'usercount',
|
name => 'usercount',
|
||||||
description => 'Adds a usercount for a channel as a status bar item',
|
description => 'Adds a usercount for a channel as a statusbar item',
|
||||||
license => 'GNU GPLv2 or later',
|
license => 'GNU GPLv2 or later',
|
||||||
url => 'http://irssi.dgl.yi.org/',
|
url => 'http://irssi.dgl.yi.org/',
|
||||||
);
|
);
|
||||||
|
|
||||||
# Add usercount = { }; to your statusbar config
|
# Once you have loaded this script run the following command:
|
||||||
|
# /statusbar window add usercount
|
||||||
|
# You can also add -alignment left|right option
|
||||||
|
|
||||||
# /set usercount_show_zero on or off to show users when 0 users of that type
|
# /set usercount_show_zero on or off to show users when 0 users of that type
|
||||||
# /set usercount_show_ircops (default off)
|
# /set usercount_show_ircops (default off)
|
||||||
# /set usercount_show_halfops (default on)
|
# /set usercount_show_halfops (default on)
|
||||||
@ -35,7 +38,8 @@ sub usercount {
|
|||||||
my ($item, $get_size_only) = @_;
|
my ($item, $get_size_only) = @_;
|
||||||
my $wi = !Irssi::active_win() ? undef : Irssi::active_win()->{active};
|
my $wi = !Irssi::active_win() ? undef : Irssi::active_win()->{active};
|
||||||
|
|
||||||
if(!$wi || $wi->{type} ne "CHANNEL") { # only works on channels
|
if(!ref $wi || $wi->{type} ne "CHANNEL") { # only works on channels
|
||||||
|
return unless ref $item;
|
||||||
$item->{min_size} = $item->{max_size} = 0;
|
$item->{min_size} = $item->{max_size} = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -49,12 +53,18 @@ sub usercount {
|
|||||||
my $format = $theme->format_expand("{sb_usercount}");
|
my $format = $theme->format_expand("{sb_usercount}");
|
||||||
if ($format) {
|
if ($format) {
|
||||||
# use theme-specific look
|
# use theme-specific look
|
||||||
my $ircopstr = $theme->format_expand("{sb_uc_ircops $ircops}", Irssi::EXPAND_FLAG_IGNORE_EMPTY);
|
my $ircopstr = $theme->format_expand("{sb_uc_ircops $ircops}",
|
||||||
my $opstr = $theme->format_expand("{sb_uc_ops $ops}", Irssi::EXPAND_FLAG_IGNORE_EMPTY);
|
Irssi::EXPAND_FLAG_IGNORE_EMPTY);
|
||||||
my $halfopstr = $theme->format_expand("{sb_uc_halfops $halfops}", Irssi::EXPAND_FLAG_IGNORE_EMPTY);
|
my $opstr = $theme->format_expand("{sb_uc_ops $ops}",
|
||||||
my $voicestr = $theme->format_expand("{sb_uc_voices $voices}", Irssi::EXPAND_FLAG_IGNORE_EMPTY);
|
Irssi::EXPAND_FLAG_IGNORE_EMPTY);
|
||||||
my $normalstr = $theme->format_expand("{sb_uc_normal $normal}", Irssi::EXPAND_FLAG_IGNORE_EMPTY);
|
my $halfopstr = $theme->format_expand("{sb_uc_halfops $halfops}",
|
||||||
my $space = $theme->format_expand('{sb_uc_space}', Irssi::EXPAND_FLAG_IGNORE_EMPTY);
|
Irssi::EXPAND_FLAG_IGNORE_EMPTY);
|
||||||
|
my $voicestr = $theme->format_expand("{sb_uc_voices $voices}",
|
||||||
|
Irssi::EXPAND_FLAG_IGNORE_EMPTY);
|
||||||
|
my $normalstr = $theme->format_expand("{sb_uc_normal $normal}",
|
||||||
|
Irssi::EXPAND_FLAG_IGNORE_EMPTY);
|
||||||
|
my $space = $theme->format_expand('{sb_uc_space}',
|
||||||
|
Irssi::EXPAND_FLAG_IGNORE_EMPTY);
|
||||||
$space = " " unless $space;
|
$space = " " unless $space;
|
||||||
|
|
||||||
my $str = "";
|
my $str = "";
|
||||||
@ -125,7 +135,9 @@ sub refresh {
|
|||||||
|
|
||||||
sub refresh_check {
|
sub refresh_check {
|
||||||
my $channel = shift;
|
my $channel = shift;
|
||||||
my $wi = Irssi::active_win()->{active};
|
my $wi = ref Irssi::active_win() ? Irssi::active_win()->{active} : 0;
|
||||||
|
|
||||||
|
return unless ref $wi && ref $channel;
|
||||||
return if $wi->{name} ne $channel->{name};
|
return if $wi->{name} ne $channel->{name};
|
||||||
return if $wi->{server}->{tag} ne $channel->{server}->{tag};
|
return if $wi->{server}->{tag} ne $channel->{server}->{tag};
|
||||||
|
|
||||||
@ -144,9 +156,9 @@ sub refresh_recalc {
|
|||||||
$recalc = 1;
|
$recalc = 1;
|
||||||
$timeout_tag = 0;
|
$timeout_tag = 0;
|
||||||
|
|
||||||
Irssi::settings_add_bool('misc', 'usercount_show_zero', 1);
|
Irssi::settings_add_bool('usercount', 'usercount_show_zero', 1);
|
||||||
Irssi::settings_add_bool('misc', 'usercount_show_ircops', 0);
|
Irssi::settings_add_bool('usercount', 'usercount_show_ircops', 0);
|
||||||
Irssi::settings_add_bool('misc', 'usercount_show_halfops', 1);
|
Irssi::settings_add_bool('usercount', 'usercount_show_halfops', 1);
|
||||||
|
|
||||||
Irssi::statusbar_item_register('usercount', undef, 'usercount');
|
Irssi::statusbar_item_register('usercount', undef, 'usercount');
|
||||||
Irssi::statusbars_recreate_items();
|
Irssi::statusbars_recreate_items();
|
||||||
|
Loading…
Reference in New Issue
Block a user