From: rettenbe Date: Tue, 29 Apr 2008 14:29:29 +0000 (+0000) Subject: changed xml-structure for event send_usr_msg X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0298f018a23d8c7c19475ce7ecd0565b041d8e01;p=gosa.git changed xml-structure for event send_usr_msg git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10728 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index 5432c1a8e..45d0b2c1e 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -1382,19 +1382,32 @@ sub watch_for_new_messages { my $message_to = @{$hit}[3]; # translate message_to to plain login name -# TODO implement reciever translation - my @reciever_l = split(/,/, $message_to); + my @message_to_l = split(/,/, $message_to); + my %receiver_h; + foreach my $receiver (@message_to_l) { + if ($receiver =~ /^u_([\s\S]*)$/) { + $receiver_h{$1} = 0; + } elsif ($receiver =~ /^g_([\s\S]*)$/) { +# TODO implement receiver translation + } else { + my $sbjct = &encode_base64(@{$hit}[1]); + my $msg = &encode_base64(@{$hit}[7]); + &daemon_log("M WARNING: unknown receiver '$receiver' for a user-message 'sbjct - msg'", 3); + } + } + my @receiver_l = keys(%receiver_h); + my $message_id = @{$hit}[0]; #add each outgoing msg to messaging_db - my $reciever; - foreach $reciever (@reciever_l) { + my $receiver; + foreach $receiver (@receiver_l) { my $sql_statement = "INSERT INTO $messaging_tn (id, subject, message_from, message_to, flag, direction, delivery_time, message, timestamp) ". "VALUES ('". $message_id."', '". # id @{$hit}[1]."', '". # subject @{$hit}[2]."', '". # message_from - $reciever."', '". # message_to + $receiver."', '". # message_to "none"."', '". # flag "out"."', '". # direction @{$hit}[6]."', '". # delivery_time @@ -1403,7 +1416,7 @@ sub watch_for_new_messages { ")"; &daemon_log("M DEBUG: $sql_statement", 1); my $res = $messaging_db->exec_statement($sql_statement); - &daemon_log("M INFO: message '".@{$hit}[0]."' is prepared for delivery to reciever '$reciever'", 5); + &daemon_log("M INFO: message '".@{$hit}[0]."' is prepared for delivery to receiver '$receiver'", 5); } # set incoming message to flag d=deliverd diff --git a/gosa-si/server/events/gosaTriggered.pm b/gosa-si/server/events/gosaTriggered.pm index 5fbb787cf..371d408f0 100644 --- a/gosa-si/server/events/gosaTriggered.pm +++ b/gosa-si/server/events/gosaTriggered.pm @@ -57,6 +57,16 @@ sub get_events { } sub send_user_msg { + +# msg from gosa +#
gosa_send_user_msg
GOSAGOSA +# 20080429151605 +# andreas.rettenberger +# hallo +# test +# GOSA +#
+ my ($msg, $msg_hash, $session_id) = @_ ; my $header = @{$msg_hash->{'header'}}[0]; my $source = @{$msg_hash->{'source'}}[0]; @@ -65,7 +75,8 @@ sub send_user_msg { #my $subject = &decode_base64(@{$msg_hash->{'subject'}}[0]); my $subject = @{$msg_hash->{'subject'}}[0]; my $from = @{$msg_hash->{'from'}}[0]; - my @to = @{$msg_hash->{'to'}}; + my @users = @{$msg_hash->{'users'}}; + my @groups = @{$msg_hash->{'groups'}}[0]; my $delivery_time = @{$msg_hash->{'delivery_time'}}[0]; #my $message = &decode_base64(@{$msg_hash->{'message'}}[0]); my $message = @{$msg_hash->{'message'}}[0]; @@ -94,12 +105,18 @@ sub send_user_msg { $new_msg_id += 1; } + # highlight user name and group name + @users = map("u_", @users); + my $users_list = join(",", @users); + @groups = map("g_", @groups); + my $groups_list = join(",", @groups); + my $func_dic = {table=>$main::messaging_tn, primkey=>[], id=>$new_msg_id, subject=>$subject, message_from=>$from, - message_to=>join(",",@to), + message_to=>"$users_list,$groups_list", flag=>"n", direction=>"in", delivery_time=>$delivery_time,