]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
Update usercount
authorDavid Leadbeater <redacted>
Sun, 15 Jun 2014 18:08:50 +0000 (19:08 +0100)
committerDavid Leadbeater <redacted>
Sun, 15 Jun 2014 18:08:50 +0000 (19:08 +0100)
_data/scripts.yaml
scripts/usercount.pl

index 7333d10aabada0a600414cfc92aaba5038ae0e37..8e8907554535da6516ca2723882a21df14672545 100644 (file)
   contact: "dgl@dgl.cx, tss@iki.fi, georg@boerde.de"
   description: "Adds a usercount for a channel as a statusbar item"
   filename: "usercount.pl"
-  modified: "2008-05-17 17:39:11"
+  modified: "2014-06-15 19:03:11"
   license: "GNU GPLv2 or later"
   name: "usercount"
   url: "http://irssi.dgl.cx/"
-  version: "1.16"
+  version: "1.19"
 
 - authors: "Jean-Yves Lefort"
   changed: "$Date: 2002/07/04 13:18:02 $"
index dbdb56d45cfbe9235cd8ae485beb8d4a0117c5df..46dc0b46f30dfca6d085cb0bc901e6fdb4814e57 100644 (file)
@@ -1,5 +1,5 @@
-use Irssi 20020101.0250 ();
-$VERSION = "1.16";
+use Irssi 20040119.2359 ();
+$VERSION = "1.19";
 %IRSSI = (
     authors     => 'David Leadbeater, Timo Sirainen, Georg Lukas',
     contact     => 'dgl@dgl.cx, tss@iki.fi, georg@boerde.de',
@@ -7,15 +7,17 @@ $VERSION = "1.16";
     description => 'Adds a usercount for a channel as a statusbar item',
     license     => 'GNU GPLv2 or later',
     url         => 'http://irssi.dgl.cx/',
+    changes     => 'Only show halfops if server supports them',
 );
 
 # 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_ircops (default off)
-# /set usercount_show_halfops (default on)
+# Settings:
+# /toggle usercount_show_zero to show item even when there are no users
+# /toggle usercount_show_ircops (default off)
+# /toggle usercount_show_halfops (default on)
 
 # you can customize the look of this item from theme file:
 #  sb_usercount = "{sb %_$0%_ nicks ($1-)}";
@@ -114,6 +116,7 @@ sub calc_users() {
   }
 
   $total = $ops+$halfops+$voices+$normal;
+  
   if (!Irssi::settings_get_bool('usercount_show_zero')) {
     $ircops = undef if ($ircops == 0);
     $ops = undef if ($ops == 0);
@@ -121,7 +124,14 @@ sub calc_users() {
     $voices = undef if ($voices == 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');
 }
 
git clone https://git.99rst.org/PROJECT