summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-06-26 20:46:27 -0500
committerJesse Luehrs <doy@tozt.net>2009-06-26 20:46:27 -0500
commitd8dbe191247c9ccf30f1c07538a6da526736f9f5 (patch)
treee3dcd0d078ac830b78b1ef65c6ea602a1928faad
parent8b242b5ad8d19185e946af5451520ec828d64b3c (diff)
downloadnet-termcast-d8dbe191247c9ccf30f1c07538a6da526736f9f5.tar.gz
net-termcast-d8dbe191247c9ccf30f1c07538a6da526736f9f5.zip
change in_menu to 'location' which also tracks sessions
-rw-r--r--lib/Net/Termcast.pm13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Net/Termcast.pm b/lib/Net/Termcast.pm
index eb115bb..f5eb8d8 100644
--- a/lib/Net/Termcast.pm
+++ b/lib/Net/Termcast.pm
@@ -29,10 +29,10 @@ has cols => (
default => 80,
);
-has in_menu => (
+has location => (
is => 'rw',
- isa => 'Bool',
- default => 0,
+ isa => 'Str',
+ default => 'menu',
init_arg => undef,
);
@@ -82,7 +82,6 @@ has _sock => (
sub BUILD {
my $self = shift;
- $self->in_menu(1);
$self->_get_menu;
}
@@ -96,10 +95,10 @@ sub select_session {
my $self = shift;
my ($session) = @_;
return unless exists $self->sessions->{$session};
- $self->_sock->send('q', 0) if $self->in_menu;
+ $self->_sock->send('q', 0) unless $self->location eq 'menu';
$self->_sock->send($session, 0);
$self->_get_screen;
- $self->in_menu(0);
+ $self->location($session);
}
# XXX: these two should use color at some point
@@ -123,7 +122,7 @@ sub _get_screen {
sub _get_menu {
my $self = shift;
- return unless $self->in_menu;
+ return unless $self->location eq 'menu';
$self->_get_screen;
$self->_parse_menu;
}