projects
/
tpope-extra.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Assorted away-tpope updates
[tpope-extra.git]
/
perl
/
away-tpope
diff --git
a/perl/away-tpope
b/perl/away-tpope
index c5bf12ce6ccc7dab9db02b89f79da044b858058e..7ec9c19f3843b572cd1341d983a7e0911c491879 100755
(executable)
--- a/
perl/away-tpope
+++ b/
perl/away-tpope
@@
-195,9
+195,7
@@
sub do_chat {
}
sub eval_chat {
}
sub eval_chat {
- if(($state{'chat'}||'') eq "jmwaller") {
- internal_out("Work",3*60*60);
- } elsif(($state{'chat'}||'') =~ /^tpope-\d+$/) {
+ if(($state{'chat'}||'') =~ /^(tpope-\d+|jmwaller|arwen|george)$/) {
internal_out("Work",3*60*60);
} elsif(($state{'chat'}||'') eq "accd") {
#internal_out("School",30*60);
internal_out("Work",3*60*60);
} elsif(($state{'chat'}||'') eq "accd") {
#internal_out("School",30*60);
@@
-205,7
+203,7
@@
sub eval_chat {
}
sub do_hosts {
}
sub do_hosts {
- my (@check) = ("tobias", "l
ucille", "lindsay", "buster
");
+ my (@check) = ("tobias", "l
indsay
");
my (@uphosts, @livehosts, $host, $hostlist);
if(($_[0] || 0) == 1) {
$hostlist=$state{'hosts'};
my (@uphosts, @livehosts, $host, $hostlist);
if(($_[0] || 0) == 1) {
$hostlist=$state{'hosts'};
@@
-260,10
+258,10
@@
sub do_phone {
if(!ping('tobias')) {
$phone="unknown";
} else {
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";
if(!$last_slh) {
$phone="unknown";
- } elsif (time-$last_slh <
5
40) {
+ } elsif (time-$last_slh <
11
40) {
$phone="present";
} else {
$phone="absent";
$phone="present";
} else {
$phone="absent";
@@
-277,7
+275,7
@@
sub do_phone {
}
sub do_power {
}
sub do_power {
- open TMP, "upsc
milhouse
\@localhost 2>/dev/null|";
+ open TMP, "upsc
sally
\@localhost 2>/dev/null|";
my $ups='';
while(<TMP>) {
chomp;
my $ups='';
while(<TMP>) {
chomp;
@@
-406,38
+404,38
@@
sub custom_activity {
sub save {
if (defined($state{'activity'})) {
sub save {
if (defined($state{'activity'})) {
- $state{'status'}=$state{'activity'};
+
$state{'status'}=$state{'activity'};
} elsif (defined($state{'away'})) {
} 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") {
} 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) {
}
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'})) {
}
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 {
} else {
- unlink($ENV{'HOME'} . "/.activity");
+
unlink($ENV{'HOME'} . "/.activity");
}
if(defined($state{'away'})) {
}
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 {
} else {
- unlink($ENV{'HOME'} . "/.away");
+
unlink($ENV{'HOME'} . "/.away");
}
open TMP, '>' . $ENV{'HOME'} . "/.status";
print TMP $state{'status'}."\n";
}
open TMP, '>' . $ENV{'HOME'} . "/.status";
print TMP $state{'status'}."\n";
@@
-451,12
+449,12
@@
sub load {
undef $state{'customout'};
undef $state{'internalout'};
while(my $line=<CONF>) {
undef $state{'customout'};
undef $state{'internalout'};
while(my $line=<CONF>) {
- $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;
}
}
close CONF;
}