irssi-import / bugs.irssi.org

bugs.irssi.org archive
https://github.com/irssi/irssi/issues
0 stars 0 forks source link

loadavg plugin not working properly, 2 bugs #751

Open irssibot opened 14 years ago

irssibot commented 14 years ago

When I tried to use the loadavg plugin on OSX, it failed to autorun and it did not show anything in the statusbar. Versions: OSX=10.6.3, perl=5.8.9, irssi=0.8.14

I tried to send an email to the maintainer (aki@evilbsd.info) but immediately received a bounce.

Regarding the autorun, a fix is mentioned here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=281097 Btw, the plugin did run when I loaded it manually afterwards.

The second problem, not showing up in the statusbar, was because the get() function did not check for 'darwin' as OS-type.

I've fixed both problems (perhaps not optimally) and attached the patch with this message.

irssibot commented 14 years ago

loadavg_osxpatch.diff

--- loadavg.pl  2010-05-03 00:50:15.000000000 +0200
+++ loadavg_mod.pl  2010-05-03 00:48:35.000000000 +0200
@@ -5,6 +5,7 @@
 # /set loadavg_refresh

 use Irssi;
+use Irssi::TextUI;
 use vars qw($VERSION %IRSSI);

 $VERSION="0.4";
@@ -31,7 +32,7 @@
 }

 sub get {
-   if ($^O eq 'freebsd' || $^O eq 'netbsd' || $^O eq 'openbsd' ) {
+   if ($^O eq 'freebsd' || $^O eq 'netbsd' || $^O eq 'openbsd' || $^O eq 'darwin' ) {
        $lavg=`sysctl vm.loadavg|cut -d" " -f3-5`;
    } elsif ($^O eq 'linux') { $lavg=`cat /proc/loadavg|cut -d" " -f1-3`; }
 }