From b8f58e9277ed8d3aa94f6c870b8f6ffabd580708 Mon Sep 17 00:00:00 2001 From: rettenbe Date: Thu, 31 Jul 2008 15:15:45 +0000 Subject: [PATCH] clean up several files git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12085 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/gosa-si-server | 4 +- gosa-si/server/events/clMessages.pm | 84 +++++++++++++++----------- gosa-si/server/events/gosaTriggered.pm | 25 ++++++-- gosa-si/server/events/mailqueue_com.pm | 2 - 4 files changed, 69 insertions(+), 46 deletions(-) diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index f44f5f631..48260797f 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -84,7 +84,7 @@ my %repo_dirs=(); our (%cfg_defaults, $log_file, $pid_file, $server_ip, $server_port, $ClientPackages_key, $arp_activ, $gosa_unit_tag, - $GosaPackages_key, $gosa_ip, $gosa_port, $gosa_timeout, + $GosaPackages_key, $gosa_timeout, $foreign_server_string, $server_domain, $ServerPackages_key, $foreign_servers_register_delay, $wake_on_lan_passwd, $job_synchronization, $modified_jobs_loop_delay, $arp_enabled, $arp_interface, @@ -238,8 +238,6 @@ my $max_children = 2; "wol-password" => [\$wake_on_lan_passwd, ""], }, "GOsaPackages" => { - "ip" => [\$gosa_ip, "0.0.0.0"], - "port" => [\$gosa_port, "20082"], "job-queue" => [\$job_queue_file_name, '/var/lib/gosa-si/jobs.db'], "job-queue-loop-delay" => [\$job_queue_loop_delay, 3], "messaging-db-loop-delay" => [\$messaging_db_loop_delay, 3], diff --git a/gosa-si/server/events/clMessages.pm b/gosa-si/server/events/clMessages.pm index 70da956b5..c5dc787c5 100644 --- a/gosa-si/server/events/clMessages.pm +++ b/gosa-si/server/events/clMessages.pm @@ -1,3 +1,10 @@ +## @file +# @brief Implementation of a GOsa-SI event module. +# @details A GOsa-SI event module containing all functions to handle incoming messages from clients. +# @author Andreas Rettenberger +# @date 2008 +# @version 1.0 + package clMessages; use Exporter; @ISA = qw(Exporter); @@ -31,22 +38,27 @@ END {} ### Start ###################################################################### -my $ldap_uri; -my $ldap_base; -my $ldap_admin_dn; -my $ldap_admin_password; - -my %cfg_defaults = ( -"server" => { - "ldap-uri" => [\$ldap_uri, ""], - "ldap-base" => [\$ldap_base, ""], - "ldap-admin-dn" => [\$ldap_admin_dn, ""], - "ldap-admin-password" => [\$ldap_admin_password, ""], - }, -); -&read_configfile($main::cfg_file, %cfg_defaults); - - +# labled for deleting: rettenbe 20080730 +#my $ldap_uri; +#my $ldap_base; +#my $ldap_admin_dn; +#my $ldap_admin_password; +# +#my %cfg_defaults = ( +#"server" => { +# "ldap-uri" => [\$ldap_uri, ""], +# "ldap-base" => [\$ldap_base, ""], +# "ldap-admin-dn" => [\$ldap_admin_dn, ""], +# "ldap-admin-password" => [\$ldap_admin_password, ""], +# }, +#); +#&read_configfile($main::cfg_file, %cfg_defaults); +# + + +## @method get_events() +# @details A brief function returning a list of functions which are exported by importing the module. +# @return List of all provided functions sub get_events { return \@events; } @@ -69,26 +81,26 @@ sub confirm_usr_msg { -sub read_configfile { - my ($cfg_file, %cfg_defaults) = @_; - my $cfg; - - if( defined( $cfg_file) && ( (-s $cfg_file) > 0 )) { - if( -r $cfg_file ) { - $cfg = Config::IniFiles->new( -file => $cfg_file ); - } else { - &main::daemon_log("ERROR: clMessages.pm couldn't read config file!", 1); - } - } else { - $cfg = Config::IniFiles->new() ; - } - foreach my $section (keys %cfg_defaults) { - foreach my $param (keys %{$cfg_defaults{ $section }}) { - my $pinfo = $cfg_defaults{ $section }{ $param }; - ${@$pinfo[0]} = $cfg->val( $section, $param, @$pinfo[1] ); - } - } -} +#sub read_configfile { +# my ($cfg_file, %cfg_defaults) = @_; +# my $cfg; +# +# if( defined( $cfg_file) && ( (-s $cfg_file) > 0 )) { +# if( -r $cfg_file ) { +# $cfg = Config::IniFiles->new( -file => $cfg_file ); +# } else { +# &main::daemon_log("ERROR: clMessages.pm couldn't read config file!", 1); +# } +# } else { +# $cfg = Config::IniFiles->new() ; +# } +# foreach my $section (keys %cfg_defaults) { +# foreach my $param (keys %{$cfg_defaults{ $section }}) { +# my $pinfo = $cfg_defaults{ $section }{ $param }; +# ${@$pinfo[0]} = $cfg->val( $section, $param, @$pinfo[1] ); +# } +# } +#} sub save_fai_log { diff --git a/gosa-si/server/events/gosaTriggered.pm b/gosa-si/server/events/gosaTriggered.pm index 99b5ae93d..dc18c5ccf 100644 --- a/gosa-si/server/events/gosaTriggered.pm +++ b/gosa-si/server/events/gosaTriggered.pm @@ -1,3 +1,10 @@ +## @file +# @details A GOsa-SI event module containing all functions common used by GOsa +# @brief Implementation of a GOsa-SI event module. +# @author Andreas Rettenberger +# @date 2008 +# @version 1.0 + package gosaTriggered; use Exporter; @ISA = qw(Exporter); @@ -57,25 +64,32 @@ END {} ### Start ###################################################################### -#&main::read_configfile($main::cfg_file, %cfg_defaults); - +## @method get_events() +# A brief function returning a list of functions which are exported by importing the module. +# @return List of all provided functions sub get_events { return \@events; } +## @method send_usr_msg($msg, $msg_hash, $session_id) +# This function accepts usr messages from GOsa, split mulitple target messages to mulitiple single target messages and put all messages into messaging_db +# @param msg - STRING - xml message +# @param msg_hash - HASHREF - message information parsed into a hash +# @param session_id - INTEGER - POE session id of the processing of this message +# @return (out_msg) - ARRAY - Array containing the answer message from client sub send_user_msg { my ($msg, $msg_hash, $session_id) = @_ ; my $header = @{$msg_hash->{'header'}}[0]; my $source = @{$msg_hash->{'source'}}[0]; my $target = @{$msg_hash->{'target'}}[0]; - #my $subject = &decode_base64(@{$msg_hash->{'subject'}}[0]); + #my $subject = &decode_base64(@{$msg_hash->{'subject'}}[0]); # just for debugging my $subject = @{$msg_hash->{'subject'}}[0]; my $from = @{$msg_hash->{'from'}}[0]; my @users = exists $msg_hash->{'users'} ? @{$msg_hash->{'users'}} : () ; my @groups = exists $msg_hash->{'groups'} ? @{$msg_hash->{'groups'}} : (); my $delivery_time = @{$msg_hash->{'delivery_time'}}[0]; - #my $message = &decode_base64(@{$msg_hash->{'message'}}[0]); + #my $message = &decode_base64(@{$msg_hash->{'message'}}[0]); # just for debugging my $message = @{$msg_hash->{'message'}}[0]; # keep job queue uptodate if necessary @@ -93,7 +107,7 @@ sub send_user_msg { return &create_xml_string(&create_xml_hash($header, $target, $source, $error_string)); } - # add incoming message to messaging_db + # determine new message id my $new_msg_id = 1; my $new_msg_id_sql = "SELECT MAX(CAST(id AS INTEGER)) FROM $main::messaging_tn"; my $new_msg_id_res = $main::messaging_db->exec_statement($new_msg_id_sql); @@ -107,6 +121,7 @@ sub send_user_msg { @users = map(push(@receiver_l, "u_$_"), @users); @groups = map(push(@receiver_l, "g_$_"), @groups); + # add incoming message to messaging_db my $func_dic = {table=>$main::messaging_tn, primkey=>[], id=>$new_msg_id, diff --git a/gosa-si/server/events/mailqueue_com.pm b/gosa-si/server/events/mailqueue_com.pm index a253111bd..b285b96f1 100644 --- a/gosa-si/server/events/mailqueue_com.pm +++ b/gosa-si/server/events/mailqueue_com.pm @@ -7,9 +7,7 @@ mailqueue_com - Implementation of a GOsa-SI event module. =head1 SYNOPSIS use GOSA::GosaSupportDaemon; - use Time::HiRes qw(usleep); - use MIME::Base64; =head1 DESCRIPTION -- 2.30.2