summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoretienne2003-10-20 13:34:19 +0000
committeretienne2003-10-20 13:34:19 +0000
commit864fab96c3b2a205989cefe017921c11fbd5c165 (patch)
treee7e6156a151e7c0a4af07281aa292bc75edf2479 /src
parentd0ecbaee989cf4c8004791103ad514999ce1dcfb (diff)
downloadivymon-864fab96c3b2a205989cefe017921c11fbd5c165.zip
ivymon-864fab96c3b2a205989cefe017921c11fbd5c165.tar.gz
ivymon-864fab96c3b2a205989cefe017921c11fbd5c165.tar.bz2
ivymon-864fab96c3b2a205989cefe017921c11fbd5c165.tar.xz
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.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/ivymon35
1 files changed, 26 insertions, 9 deletions
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);