diff options
| author | Alexander Færøy | 2014-05-31 13:10:46 +0200 |
|---|---|---|
| committer | Alexander Færøy | 2014-05-31 13:10:46 +0200 |
| commit | 2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1 (patch) | |
| tree | 1c5e6d817c88e67b46e216a50e0aef5428bf63df /scripts/seti.pl | |
| parent | 2d080422d79d1fd49d6c5528593ccaaff9bfc583 (diff) | |
| download | scripts.irssi.org-2d0759e6ca5767b48bcc85bf38c2c43d5f0b63b1.tar.bz2 | |
Import scripts from scripts.irssi.org
Diffstat (limited to 'scripts/seti.pl')
| -rw-r--r-- | scripts/seti.pl | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/scripts/seti.pl b/scripts/seti.pl new file mode 100644 index 0000000..01678ac --- /dev/null +++ b/scripts/seti.pl @@ -0,0 +1,50 @@ +# This is not a well written script, but it works. I hope. + +use Irssi; +use vars qw($VERSION %IRSSI); + +$VERSION = '0.1'; +%IRSSI = ( + authors => 'optical', + contact => 'optical@linux.nu', + name => 'SETI@home info', + description => 'Tell ppl how far you\'ve gotten with you SETI\@home workunit.', + license => 'GPL', + url => 'http://optical.kapitalet.org/seti/', + changed => 'Sat Jul 13 12:03:42 CEST 2002', + commands => '/seti <#channel>|<nick>', + note => 'Make sure you set the seti_state_sah with /set' +); + +sub seti_info { + + $WHERES_SETI_STATE_SAH = Irssi::settings_get_str('seti_state_sah'); + + my ($data, $server, $witem) = @_; + $args =~ s/\s+$//; + + open(INFO, "$WHERES_SETI_STATE_SAH"); + for($tmp = 0; $tmp < 5; $tmp++) { + $line = <INFO>; + } + close(INFO); + $proc = substr($line, 7, 4)/100; + my $output = "progress of this SETI@home workunit: $proc%"; + + if($data) + { + $server->command("MSG $data $output"); + } + elsif($witem && ($witem->{type} == "QUERY" || + $witem->{type} == "CHANNEL")) + { + $witem->command("MSG ".$witem->{name}." $output"); + } + else + { + Irssi::print("$output"); + } +} + +Irssi::command_bind('seti', 'seti_info'); +Irssi::settings_add_str('misc', 'seti_state_sah', '~/setiathome-3.03.i386-pc-linux-gnu-gnulibc2.1/state.sah'); |
