1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Merge pull request #38 from dgl/scripts

Update usercount to version in scripts git
This commit is contained in:
Alexander Færøy 2014-06-16 02:16:27 +02:00
commit b4a8a3f7e5

View File

@ -1,21 +1,23 @@
use Irssi 20020101.0250 (); use Irssi 20040119.2359 ();
$VERSION = "1.16"; $VERSION = "1.19";
%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 statusbar 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.cx/',
changes => 'Only show halfops if server supports them',
); );
# Once you have loaded this script run the following command: # Once you have loaded this script run the following command:
# /statusbar window add usercount # /statusbar window add usercount
# You can also add -alignment left|right option # You can also add -alignment left|right option
# /set usercount_show_zero on or off to show users when 0 users of that type # Settings:
# /set usercount_show_ircops (default off) # /toggle usercount_show_zero to show item even when there are no users
# /set usercount_show_halfops (default on) # /toggle usercount_show_ircops (default off)
# /toggle usercount_show_halfops (default on)
# you can customize the look of this item from theme file: # you can customize the look of this item from theme file:
# sb_usercount = "{sb %_$0%_ nicks ($1-)}"; # sb_usercount = "{sb %_$0%_ nicks ($1-)}";
@ -114,6 +116,7 @@ sub calc_users() {
} }
$total = $ops+$halfops+$voices+$normal; $total = $ops+$halfops+$voices+$normal;
if (!Irssi::settings_get_bool('usercount_show_zero')) { if (!Irssi::settings_get_bool('usercount_show_zero')) {
$ircops = undef if ($ircops == 0); $ircops = undef if ($ircops == 0);
$ops = undef if ($ops == 0); $ops = undef if ($ops == 0);
@ -121,7 +124,14 @@ sub calc_users() {
$voices = undef if ($voices == 0); $voices = undef if ($voices == 0);
$normal = undef if ($normal == 0); $normal = undef if ($normal == 0);
} }
$halfops = undef unless Irssi::settings_get_bool('usercount_show_halfops');
# Server doesn't support halfops?
if($server->isupport("PREFIX") !~ /\%/) {
$halfops = undef;
} else {
$halfops = undef unless Irssi::settings_get_bool('usercount_show_halfops');
}
$ircops = undef unless Irssi::settings_get_bool('usercount_show_ircops'); $ircops = undef unless Irssi::settings_get_bool('usercount_show_ircops');
} }