[Rt-commit] r9349 - rtir/branches/2.3-EXPERIMENTAL/lib/RT

ruz at bestpractical.com ruz at bestpractical.com
Thu Oct 18 22:45:00 EDT 2007


Author: ruz
Date: Thu Oct 18 22:45:00 2007
New Revision: 9349

Modified:
   rtir/branches/2.3-EXPERIMENTAL/lib/RT/IR.pm

Log:
* minor refactoring

Modified: rtir/branches/2.3-EXPERIMENTAL/lib/RT/IR.pm
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/lib/RT/IR.pm	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/lib/RT/IR.pm	Thu Oct 18 22:45:00 2007
@@ -188,19 +188,14 @@
 );
 sub States {
     my %arg = ( Queue => undef, Active => 1, Inactive => 0, @_ );
+
+    my @queues = !$arg{'Queue'} ? ( values %STATES )
+        : ref $arg{'Queue'}? @{ $arg{'Queue'} } : ( $arg{'Queue'} );
     
     my @states;
-    if ( $arg{'Queue'} ) {
-        my @queues = ref $arg{'Queue'}? @{ $arg{'Queue'} }: ($arg{'Queue'});
-        foreach ( @queues ) {
-            push @states, @{ $STATES{ lc $_ }->{'Active'} || [] } if $arg{'Active'};
-            push @states, @{ $STATES{ lc $_ }->{'Inactive'} || [] } if $arg{'Inactive'};
-        }
-    } else {
-        foreach ( values %STATES ) {
-            push @states, @{ $_->{'Active'} || [] } if $arg{'Active'};
-            push @states, @{ $_->{'Inactive'} || [] } if $arg{'Inactive'};
-        }
+    foreach ( @queues ) {
+        push @states, @{ $STATES{ lc $_ }->{'Active'} || [] } if $arg{'Active'};
+        push @states, @{ $STATES{ lc $_ }->{'Inactive'} || [] } if $arg{'Inactive'};
     }
 
     my %seen = ();


More information about the Rt-commit mailing list