From 864fab96c3b2a205989cefe017921c11fbd5c165 Mon Sep 17 00:00:00 2001 From: etienne Date: Mon, 20 Oct 2003 13:34:19 +0000 Subject: 2 corrections : - certains messages pré-formatés à envoyer, extraits des expressions régulieres, étaient tronqués - lorsqu'un client était relancé avec modifications de des bindings, les bindings initiaux étaient conservés. --- src/ivymon | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ivymon b/src/ivymon index 650dec6..e34450c 100755 --- a/src/ivymon +++ b/src/ivymon @@ -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); -- cgit v1.1