From b1715c4e4d2f11ad2970aa57bcbd2014885a6d92 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 28 Apr 2008 00:15:37 +0000 Subject: [PATCH] Assorted away-tpope updates --- perl/away-tpope | 62 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/perl/away-tpope b/perl/away-tpope index a82fb84..7ec9c19 100755 --- a/perl/away-tpope +++ b/perl/away-tpope @@ -203,7 +203,7 @@ sub eval_chat { } sub do_hosts { - my (@check) = ("tobias", "lucille", "lindsay", "buster"); + my (@check) = ("tobias", "lindsay"); my (@uphosts, @livehosts, $host, $hostlist); if(($_[0] || 0) == 1) { $hostlist=$state{'hosts'}; @@ -243,7 +243,7 @@ sub is_alive { eval { local $SIG{ALRM} = sub { die "alarm\n" }; alarm(30); - $ret=!(system(@ssh,shift, 'if pidof xscreensaver >/dev/null && DISPLAY=:0.0 xscreensaver-command -version >/dev/null 2>&1; then if DISPLAY=:0.0 xscreensaver-command -time 2>&1 |egrep "non-blanked|no saver status" >/dev/null; then true; else pid=`ps ax|egrep "[0-9]:[0-9][0-9] ssh gob .*(screen.*RR irc|Chat)"|sed -e "s/^ *//"|cut -d" " -f 1`; [ -f "$HOME/.irc.lock" -o -z "$pid" ] || kill $pid; false; fi; else false; fi') >> 8); + $ret=!(system(@ssh,shift, 'if pidof xscreensaver >/dev/null && DISPLAY=:0.0 xscreensaver-command -version >/dev/null 2>&1; then if DISPLAY=:0.0 xscreensaver-command -time 2>&1 |egrep "non-blanked|no saver status" >/dev/null; then true; else pid=`ps ax|egrep "[0-9]:[0-9][0-9] ssh michael .*(screen.*RR irc|Chat)"|sed -e "s/^ *//"|cut -d" " -f 1`; [ -f "$HOME/.irc.lock" -o -z "$pid" ] || kill $pid; false; fi; else false; fi') >> 8); alarm(0); }; if($@) { @@ -258,10 +258,10 @@ sub do_phone { if(!ping('tobias')) { $phone="unknown"; } else { - my $last_slh=`@ssh tobias cat .blue/last_slh 2>/dev/null`; + my $last_slh=`@ssh tobias cat .blue/last_slh .blue/last_gm 2>/dev/null`; if(!$last_slh) { $phone="unknown"; - } elsif (time-$last_slh < 540) { + } elsif (time-$last_slh < 1140) { $phone="present"; } else { $phone="absent"; @@ -275,7 +275,7 @@ sub do_phone { } sub do_power { - open TMP, "upsc milhouse\@localhost 2>/dev/null|"; + open TMP, "upsc sally\@localhost 2>/dev/null|"; my $ups=''; while() { chomp; @@ -404,38 +404,38 @@ sub custom_activity { sub save { if (defined($state{'activity'})) { - $state{'status'}=$state{'activity'}; + $state{'status'}=$state{'activity'}; } elsif (defined($state{'away'})) { - $state{'status'}=$state{'away'}; - } elsif ($state{'alive'} eq "tobias" || $state{'alive'} eq "lucille") { - $state{'status'}="On desktop"; + $state{'status'}=$state{'away'}; + } elsif ($state{'alive'} eq "tobias") { + $state{'status'}="On desktop"; } elsif ($state{'alive'} eq "lindsay") { - $state{'status'}="On laptop"; - } elsif ($state{'alive'} eq "buster") { - $state{'status'}="In bed"; + $state{'status'}="On laptop"; + #} elsif ($state{'alive'} eq "buster") { + #$state{'status'}="In bed"; } open CONF, '>' . $ENV{'HOME'} . "/.away-tpope" || die $!; foreach my $k (keys %state) { - my $val=$state{$k}; - next unless($val); - $val =~ s/\n/\\n/g; - $val =~ s/"/\\"/g; - print CONF "$k=\"$val\"\n"; + my $val=$state{$k}; + next unless($val); + $val =~ s/\n/\\n/g; + $val =~ s/"/\\"/g; + print CONF "$k=\"$val\"\n"; } close CONF; if(defined($state{'activity'})) { - open TMP, '>' . $ENV{'HOME'} . "/.activity"; - print TMP $state{'activity'}."\n"; - close TMP; + open TMP, '>' . $ENV{'HOME'} . "/.activity"; + print TMP $state{'activity'}."\n"; + close TMP; } else { - unlink($ENV{'HOME'} . "/.activity"); + unlink($ENV{'HOME'} . "/.activity"); } if(defined($state{'away'})) { - open TMP, '>' . $ENV{'HOME'} . "/.away"; - print TMP $state{'away'}."\n"; - close TMP; + open TMP, '>' . $ENV{'HOME'} . "/.away"; + print TMP $state{'away'}."\n"; + close TMP; } else { - unlink($ENV{'HOME'} . "/.away"); + unlink($ENV{'HOME'} . "/.away"); } open TMP, '>' . $ENV{'HOME'} . "/.status"; print TMP $state{'status'}."\n"; @@ -449,12 +449,12 @@ sub load { undef $state{'customout'}; undef $state{'internalout'}; while(my $line=) { - $line =~ s/\\n/\n/g; - $line =~ s/\\"/"/g; - $line =~ s/"$//; - $line =~ s/^([^=]*)="?//; - chomp $line; - $state{$1}=$line; + $line =~ s/\\n/\n/g; + $line =~ s/\\"/"/g; + $line =~ s/"$//; + $line =~ s/^([^=]*)="?//; + chomp $line; + $state{$1}=$line; } close CONF; } -- 2.30.2