Code

update: mailqueue_query at mailqueue.pm accepts a regex as q_value
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 11 Sep 2008 13:39:29 +0000 (13:39 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 11 Sep 2008 13:39:29 +0000 (13:39 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12427 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/client/events/mailqueue.pm
gosa-si/tests/client.php

index 2521be2474f528fc0b37a5134e6cfb350866390e..76c92e2f67d08fa51ed02f675aa2ff61ad258b24 100644 (file)
@@ -170,7 +170,9 @@ sub mailqueue_query {
                         &main::daemon_log("$session_id DEBUG: \n$msg", 9); 
                         $query_positiv++;
                     } else {
-                        if ($act_result->{'msg_id'} eq $q_value) { $query_positiv++; }
+                        if ( &_exec_op($act_result->{'msg_id'}, $q_operator, $q_value) ) { 
+                            $query_positiv++; 
+                        }
                     }
 
                 # Query for message size
@@ -198,7 +200,9 @@ sub mailqueue_query {
                         &main::daemon_log("$session_id DEBUG: \n$msg", 9); 
                         $query_positiv++;
                     } else {
-                        if ($act_result->{'sender'} eq $q_value) { $query_positiv++; }
+                        if ( &_exec_op($act_result->{'sender'}, $q_operator, $q_value)) { 
+                            $query_positiv++; 
+                        }
                     }
 
                 # Query for recipient
@@ -209,7 +213,9 @@ sub mailqueue_query {
                         &main::daemon_log("$session_id DEBUG: \n$msg", 9); 
                         $query_positiv++;
                     } else {
-                        if ($act_result->{'recipient'} eq $q_value) { $query_positiv++; }
+                        if ( &_exec_op($act_result->{'recipient'}, $q_operator, $q_value)) { 
+                            $query_positiv++; 
+                        }
                     }
                 }
             }
@@ -684,7 +690,7 @@ sub _exec_op {
     my $res;
 
     if ($op eq "eq") {
-        $res = $a == $b ? 1 : 0 ;
+        $res = $a =~ /$b/ ? 1 : 0 ;
     } elsif ($op eq "gt") {
         $res = $a > $b ? 1 : 0 ;
     } elsif ($op eq "lt") {
index cb8f190257d358011a958e0ebb7bd5156c9a69c4..81cfbc383ad6d5398c02c64d1fb9773ef9e54e97 100755 (executable)
@@ -185,7 +185,7 @@ for($count = 1; $count <= $zahl; $count++)
 
     # Querying the mailqueue at 
     #$data = "<xml> <header>gosa_mailqueue_query</header> <source>GOSA</source> <target>00:01:6c:9d:aa:16</target> </xml>";
-    $data = "<xml> <header>gosa_mailqueue_query</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <q_tag>arrival_time</q_tag> <q_operator>gt</q_operator> <q_value>20080812120000</q_value> </xml>";
+    $data = "<xml> <header>gosa_mailqueue_query</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <q_tag>recipient</q_tag> <q_operator>eq</q_operator> <q_value>rett</q_value> </xml>";
 
     # Multiple xml tags msg_id are allowed
     #$data = "<xml> <header>gosa_mailqueue_hold</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> <msg_id>99C8ABEF23</msg_id> </xml>";