/[smecontribs]/rpms/smeserver-mailstats/contribs7/smeserver-mailstats-0.6.19.patch
ViewVC logotype

Contents of /rpms/smeserver-mailstats/contribs7/smeserver-mailstats-0.6.19.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download)
Fri Feb 15 18:37:14 2008 UTC (16 years, 3 months ago) by slords
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
Import on branch contribs7 of package smeserver-mailstats-0.0.3-1.el4.sme.src.rpm

1 diff -Nur -x '*.orig' -x '*.rej' smeserver-mailstats-0.0.2/root/usr/bin/spamfilter-stats-7.pl mezzanine_patched_smeserver-mailstats-0.0.2/root/usr/bin/spamfilter-stats-7.pl
2 --- smeserver-mailstats-0.0.2/root/usr/bin/spamfilter-stats-7.pl 2007-10-11 17:25:50.000000000 -0400
3 +++ mezzanine_patched_smeserver-mailstats-0.0.2/root/usr/bin/spamfilter-stats-7.pl 2007-10-11 17:25:24.000000000 -0400
4 @@ -76,6 +76,8 @@
5 # - sort out domains when more that one email address in recipient field
6 # 0.6.16 - cb - fix date range bug (http://bugs.contribs.org/show_bug.cgi?id=3366)
7 # 0.6.17 - cb - avoid numerous re-openings of config db
8 +# 0.6.18 - cb - tidy up options configuration section
9 +# 0.6.19 - cb - rename parse_args => analysis_period, and simplify
10 #
11 # TODO
12 # ----
13 @@ -121,16 +123,19 @@
14 use Switch;
15
16 my $hostname = hostname();
17 +my $cdb = esmith::ConfigDB->open_ro or die "Couldn't open ConfigDB : $!\n";
18
19 #Configuration section
20 -my %opt = ();
21 +my %opt = (
22 + version => '0.6.19', # please update at each change.
23 + debug => 0, # guess what ?
24 + sendmail => '/usr/sbin/sendmail', # Path to sendmail stub
25 + from => 'spamfilter-stats', # Who is the mail from
26 + mail => # mailstats email recipient
27 + $cdb->get('mailstats')->prop('Email') || 'admin',
28 + timezone => `date +%z`,
29 +);
30
31 -$opt{'version'} = '0.6.16'; # please update at each change.
32 -$opt{'debug'} = 0; # guess what ?
33 -$opt{'sendmail'} = '/usr/sbin/sendmail'; # Path to sendmail stub
34 -$opt{'from'} = 'spamfilter-stats'; # Who is the mail from
35 -#$opt{'mail'} = "admin"; - set from db now...
36 -$opt{'timezone'} = `date +%z`;
37 Date_Init("TZ=$opt{'timezone'}");
38
39 my $FetchmailIP = '127.0.0.200'; #Apparent Ip address of fetchmail deliveries
40 @@ -232,7 +237,6 @@
41
42 # store the domain of interest. Every other records are stored in a 'Other' zone
43 my $ddb = esmith::DomainsDB->open_ro or die "Couldn't open DomainsDB : $!\n";
44 -my $cdb = esmith::ConfigDB->open_ro or die "Couldn't open ConfigDB : $!\n";
45
46 foreach my $domain( $ddb->get_all_by_prop( type => "domain" ) ) {
47 $byrcptdomain{ $domain->key }{ 'type' }='local';
48 @@ -253,7 +257,7 @@
49 }
50 }
51
52 -my ( $start, $end ) = parse_arg();
53 +my ( $start, $end ) = analysis_period();
54
55 #
56 # First check current configuration for logging, DNS enable and Max threshold for spamassassin
57 @@ -283,9 +287,6 @@
58 my $db = esmith::ConfigDB->open; my $record = $db->new_record('mailstats', { type => 'report', Status => 'enabled' });
59 $disabled = $false;
60 }
61 -# check mailstats email recipient
62 -my $email = $cdb->get('mailstats')->prop('Email') || 'admin';
63 -$opt{'mail'} = $email;
64
65
66 if ( !$RHSenabled || !$DNSenabled ) {
67 @@ -942,10 +943,10 @@
68 #############################################################################
69
70
71 -########################################
72 -# Process parms #
73 -########################################
74 -sub parse_arg {
75 +################################################
76 +# Determine analysis period (start and end time)
77 +################################################
78 +sub analysis_period {
79 my $startdate = shift;
80 my $enddate = shift;
81
82 @@ -953,30 +954,11 @@
83 my $time = 0;
84
85 my $start = UnixDate( $startdate, "%s" );
86 - my $end = UnixDate( $enddate, "%s" );
87 -
88 - if ( !$start && !$end ) {
89 - $end = time;
90 - $start = $end - $secsinday;
91 - return ( $start, $end );
92 - }
93 -
94 - if ( !$start ) {
95 - $start = $end - $secsinday;
96 - return ( $start, $end );
97 - }
98 -
99 - if ( !$end ) {
100 - $end = $start + $secsinday;
101 - return ( $start, $end );
102 - }
103 -
104 - if ( $start > $end ) {
105 - return ( $end, $start );
106 - }
107 -
108 - return ( $start, $end );
109 + my $end = $enddate ? UnixDate( $enddate, "%s" ) :
110 + $startdate ? $start + $secsinday : time;
111 + $start = $startdate ? $start : $end - $secsinday;
112
113 + return ( $start > $end ) ? ( $end, $start ) : ( $start, $end );
114 }
115
116 sub dbg {

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed