From: rettenbe Date: Wed, 30 Apr 2008 13:05:21 +0000 (+0000) Subject: update user messaging X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c2d8e0f9c5346d03821528b36570414a578571e6;p=gosa.git update user messaging git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10748 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/client/events/corefunctions.pm b/gosa-si/client/events/corefunctions.pm index 62f744f07..a6f96e3bc 100644 --- a/gosa-si/client/events/corefunctions.pm +++ b/gosa-si/client/events/corefunctions.pm @@ -6,11 +6,11 @@ my @events = ( "registered", "new_ldap_config", "new_key", - "generate_hw_digest", + "generate_hw_digest", # no implementations "detect_hardware", "confirm_new_key", "ping", - "import_events", + "import_events", # no implementations ); @EXPORT = @events; diff --git a/gosa-si/client/events/gosaTriggered.pm b/gosa-si/client/events/gosaTriggered.pm index a5077f13d..789996d3b 100644 --- a/gosa-si/client/events/gosaTriggered.pm +++ b/gosa-si/client/events/gosaTriggered.pm @@ -8,11 +8,11 @@ my @events = ( "trigger_action_halt", "trigger_action_faireboot", "trigger_action_reboot", - "trigger_action_memcheck", +# "trigger_action_memcheck", # not yet implemented "trigger_action_reinstall", "trigger_action_update", "trigger_action_instant_update", - "trigger_action_sysinfo", +# "trigger_action_sysinfo", # not yet implemented ); @EXPORT = @events; diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index 45d0b2c1e..c5488c320 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -1380,7 +1380,6 @@ sub watch_for_new_messages { # create outgoing messages my $message_to = @{$hit}[3]; - # translate message_to to plain login name my @message_to_l = split(/,/, $message_to); my %receiver_h; @@ -1453,26 +1452,36 @@ sub watch_for_delivery_messages { # reciver is logged in nowhere if (not ref(@$res[0]) eq "ARRAY") { next; } - # receiver is logged in at host - my $receiver_host = @{@{$res}[0]}[0]; - - # fetch key to encrypt msg propperly for usr/host - $sql = "SELECT * FROM $known_clients_tn WHERE (hostname='$receiver_host')"; - &daemon_log("0 DEBUG: $sql", 7); - $res = $known_clients_db->exec_statement($sql); - my $receiver_key = @{@{$res}[0]}[2]; - - my %data = ('subject' => $subject, 'message' => $message, 'usr' => $receiver); - my $out_msg = &build_msg("usr_msg", $server_address, $receiver_host, \%data ); - my $error_state = &send_msg_to_target($out_msg, $receiver_host, $receiver_key, "usr_msg", 0); + my $send_succeed = 0; + foreach my $hit (@$res) { + my $receiver_host = @$hit[0]; + &daemon_log("M DEBUG: user '$receiver' is logged in at host '$receiver_host'", 7); + + # fetch key to encrypt msg propperly for usr/host + my $sql = "SELECT * FROM $known_clients_tn WHERE (hostname='$receiver_host')"; + &daemon_log("0 DEBUG: $sql", 7); + my $res = $known_clients_db->exec_statement($sql); + + # host is already down + if (not ref(@$res[0]) eq "ARRAY") { next; } + + # host is on + my $receiver_key = @{@{$res}[0]}[2]; + my %data = ('subject' => $subject, 'message' => $message, 'usr' => $receiver); + my $out_msg = &build_msg("usr_msg", $server_address, $receiver_host, \%data ); + my $error = &send_msg_to_target($out_msg, $receiver_host, $receiver_key, "usr_msg", 0); + if ($error != 0 ) { + $send_succeed++ ; + } + } - if ($error_state == 0) { - # set outgoing msg at db to deliverd - my $sql = "UPDATE $messaging_tn SET flag='d' WHERE (id='$msg_id' AND direction='out' AND message_to='$receiver')"; - &daemon_log("0 DEBUG: $sql", 7); - my $res = $messaging_db->exec_statement($sql); - } - } + if ($send_succeed) { + # set outgoing msg at db to deliverd + my $sql = "UPDATE $messaging_tn SET flag='d' WHERE (id='$msg_id' AND direction='out' AND message_to='$receiver')"; + &daemon_log("0 DEBUG: $sql", 7); + my $res = $messaging_db->exec_statement($sql); + } + } $kernel->delay_set('watch_for_delivery_messages', $messaging_db_loop_delay); return;