diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/ivymon | 35 |
1 files changed, 26 insertions, 9 deletions
@@ -17,7 +17,7 @@ use Tk::CmdLine; use vars qw/$opt_help $opt_b $opt_bus $opt_history @opt_bind @opt_send/; # geometry -my $minW = 1050; +my $minW = 1024; my $minH = 768; my $ivy_port; # undef:=> default value is treated by ivy-perl @@ -779,6 +779,12 @@ sub removeClient { my $host = shift; $host = $hostname if $host eq 'localhost' or $host =~ /^$hostname\./; $connectedClients{$client}->{$host}-- if $connectedClients{$client}->{$host} > 0; + my $num = 0; + for my $host ((keys(%{$connectedClients{$client}}))) { + $num += $connectedClients{$client}->{$host}; + } + print "client=$client num=$num\n"; + delete $clientsBindings{$client} if $num == 0; &manageClient($client, $host); } # end removeClient @@ -829,6 +835,7 @@ sub killClient { $client =~ s/\s.*//; $ivy->sendDieTo($client); + } # end killClient sub selectClient { @@ -1150,19 +1157,34 @@ sub newBinding2 { &addBindingInList($regexp); &addMsgToSend(undef, $msg); -} # end newBinding +} # end newBinding2 +# add a binding in the bindings list and, after some modifications, +# add a new message in the list of messages to send. sub newBinding { my $regexp = shift; return if $regexp eq '(.*)'; + + ### transform regexp ### + # skip ^ and $ characters in regexp $regexp =~ s/^\^//; $regexp =~ s/\$$//; my $msg = $regexp; + # skip parenthesis in regexp + $regexp =~ s/\(//g; + $regexp =~ s/\)//g; + # add global parenthesis + $regexp = "^(".$regexp.")"; + &addBindingInList($regexp); + + ### extract message to send from regexp ### + + # skip expressions between parenthesis + $msg =~ s/=\(.*?\)/= /g; - $msg =~ s/=\(\W.*\)\s/= /g; - $msg =~ s/\(\W.*\)//g; + # duplicate expressions containing the | character my @expr; my $msgsnum = 1; while ($msg =~ /\((.*?\|.*?)\)/g) { @@ -1173,11 +1195,6 @@ sub newBinding { for (my $i=0; $i < $msgsnum; $i++) { push(@msgs, $msg); } - # skip parenthesis in regexp - $regexp =~ s/\(//g; - $regexp =~ s/\)//g; - $regexp = "^(".$regexp.")"; - &addBindingInList($regexp); if ($msgsnum > 1) { for my $expr (@expr) { my (@field) = split(/\|/, $expr); |