From: rettenbe Date: Fri, 12 Sep 2008 08:57:18 +0000 (+0000) Subject: bugfix: mailqueue can handle diffrent input messages X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ff4fde84612a93eeb000aa725e34d65616cdcffe;p=gosa.git bugfix: mailqueue can handle diffrent input messages git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12441 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/client/events/mailqueue.pm b/gosa-si/client/events/mailqueue.pm index 76c92e2f6..866b5eae6 100644 --- a/gosa-si/client/events/mailqueue.pm +++ b/gosa-si/client/events/mailqueue.pm @@ -42,6 +42,7 @@ use strict; use warnings; use GOSA::GosaSupportDaemon; use Data::Dumper; +use MIME::Base64; BEGIN {} @@ -158,7 +159,7 @@ sub mailqueue_query { $act_result->{'recipient'} = $info_l[2] =~ /([\w.-]+@[\w.-]+)/ ? $1 : 'unknown' ; $act_result->{'msg_status'} = $info_l[1] =~ /^([\s\S]*)$/ ? $1 : 'unknown' ; - # If a query tag exists, perform the selection + # If all query tags exists, perform the selection my $query_positiv = 0; if (defined $q_tag && defined $q_operator && defined $q_value) { @@ -218,7 +219,17 @@ sub mailqueue_query { } } } - } + + # If no query tag exists, return all mails in mailqueue + } elsif ((not defined $q_tag) && (not defined $q_operator) && (not defined $q_value)) { + $query_positiv++; + + # If query tags are not complete return error message + } elsif ((not defined $q_tag) || (not defined $q_operator) || (not defined $q_value)) { + $error++; + $error_string = "'mailqueue_query'-msg is not complete, some query tags (q_tag, q_operator, q_value) are missing"; + &main::daemon_log("$session_id WARNING: $error_string", 3); + } # If query was successful, add resutls to answer if ($query_positiv) { @@ -650,15 +661,14 @@ sub mailqueue_header { } # parsing information + my $msg_header; if (not $error) { my $cmd = "postcat -q $msg_id"; &main::daemon_log("DEBUG: run '$cmd'", 7); my $result = qx($cmd); - foreach (split(/\n/, $result)) { - if ($_ =~ /^To: ([\S]+)/) { $recipient = $1; } - if ($_ =~ /^From: ([\S]+)/) { $sender = $1; } - if ($_ =~ /^Subject: ([\s\S]+)/) { $subject = $1; } - } + + my @header_l = split(/\n\n/, $result); + $msg_header = $header_l[0]; } # create outgoing msg @@ -676,9 +686,8 @@ sub mailqueue_header { # add mail infos to outgoing msg } else { - &add_content2xml_hash($out_hash, "recipient", $recipient); - &add_content2xml_hash($out_hash, "sender", $sender); - &add_content2xml_hash($out_hash, "subject", $subject); + #&add_content2xml_hash($out_hash, "msg_header", &decode_base64($msg_header)); + &add_content2xml_hash($out_hash, "msg_header", $msg_header); $out_msg = &main::create_xml_string($out_hash); } diff --git a/gosa-si/tests/client.php b/gosa-si/tests/client.php index 81cfbc383..15fe84513 100755 --- a/gosa-si/tests/client.php +++ b/gosa-si/tests/client.php @@ -184,8 +184,8 @@ for($count = 1; $count <= $zahl; $count++) #echo sabber | mail -s test horst@woauchimmer.de # Querying the mailqueue at - #$data = "
gosa_mailqueue_query
GOSA 00:01:6c:9d:aa:16
"; - $data = "
gosa_mailqueue_query
GOSA 00:01:6c:9d:b9:fa recipient eq rett
"; + #$data = "
gosa_mailqueue_query
GOSA 00:01:6c:9d:b9:fa
"; + $data = "
gosa_mailqueue_query
GOSA 00:01:6c:9d:b9:fa recipient eq retta
"; # Multiple xml tags msg_id are allowed #$data = "
gosa_mailqueue_hold
GOSA 00:01:6c:9d:b9:fa 99C8ABEF23
";