From: Michael Brown Date: Wed, 30 Jan 2002 16:54:39 +0000 (+0000) Subject: The group handling functions would have difficulties with group specifications X-Git-Tag: spong-2_7_7~17 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1bf92d17f12652fdcb60966a1a141e8b42027677;p=spong.git The group handling functions would have difficulties with group specifications where a method was specified (i.e. slsgroup:email). Fixed. We also handle the case when you have a spec such as group:email that includes a member such as bob:pager. In this case, since the methods don't match, NO page is sent to bob. Be aware! --- diff --git a/src/spong-message.pl b/src/spong-message.pl index a09f388..15c21d8 100755 --- a/src/spong-message.pl +++ b/src/spong-message.pl @@ -12,7 +12,7 @@ # (2) Added rules based paging (Stephen Johnson Nov 14, 1998) # (3) Added checks against Acks and downtime (Stephen Johnson Mar 17, 1999) # -# $Id: spong-message.pl,v 1.31 2001/06/21 17:05:00 supermathie Exp $ +# $Id: spong-message.pl,v 1.32 2002/01/30 16:54:39 supermathie Exp $ use lib "@@LIBDIR@@"; @@ -705,11 +705,17 @@ sub add_contact { &debug("Adding contact " . (ref($contact) eq 'HASH' ? "hash: " . $contact->{'rcpt'} : ": " . $contact)); if ( ref($contact) eq 'HASH') { -# foreach $rcpt ( split /[, \t]+/, $contact->{'rcpt'} ) { - if ( $HUMANS{ $contact->{'rcpt'} }{'group'} ) { + $contact->{'rcpt'} =~ /^([^:]+)(:(.*))?/; + my($rcpt,$form) = ($1,$3); + if ( $HUMANS{$rcpt}{'group'} ) { + &debug("Found group: $rcpt"); my $groupee; - foreach $groupee ( split /[, \t]+/, - $HUMANS{ $contact->{'rcpt'} }{'group'} ) { + foreach $groupee ( split /[, \t]+/, $HUMANS{ $rcpt }{'group'} ) { + $groupee =~ /^([^:]+)(:(.*))?/; + my($groupee,$gform) = ($1,$3); + (defined $form and defined $gform and $form ne $gform) && next; + if (defined $form) { $groupee="$groupee:$form"; } + elsif (defined $gform) { $groupee="$groupee:$gform"; } my $newent = {'rcpt' => $groupee}; if ( defined $contact->{'delay'} ) { $newent->{'delay'} = $contact->{'delay'}; } @@ -723,13 +729,22 @@ sub add_contact { push @con, $contact; } # } - } elsif ( $HUMANS{$contact}->{'group'} ) { - my $groupee; - foreach $groupee ( split /[, \t]+/, $HUMANS{$contact}->{'group'} ) { - &add_contact(\@con, $groupee); - } } else { - push @con,$contact; + $contact =~ /^([^:]+)(:(.*))?/; + my($rcpt,$form) = ($1,$3); + if ( $HUMANS{$rcpt}->{'group'} ) { + my $groupee; + foreach $groupee ( split /[, \t]+/, $HUMANS{$rcpt}->{'group'} ) { + $groupee =~ /^([^:]+)(:(.*))?/; + my($groupee,$gform) = ($1,$3); + (defined $form and defined $gform and $form ne $gform) && next; + if (defined $form) { $groupee="$groupee:$form"; } + elsif (defined $gform) { $groupee="$groupee:$gform"; } + &add_contact(\@con, $groupee); + } + } else { + push @con,$contact; + } } }