cscvs to tla changeset 29
[onak.git] / onak-mail.pl
index 0f108f45e48f3fa1d7f980990724d843e399818b..0e3c2b5b46ba359eb778452339143e21543a160a 100755 (executable)
 use strict;
 use IPC::Open3;
 
+my %config;
+
+#
+# readconfig
+#
+# Reads in our config file. Ignores any command it doesn't understand rather
+# than having to list all the ones that are of no interest to us.
+#
+sub readconfig {
+
+       open(CONFIG, "/home/noodles/projects/onak/onak.conf") or
+               die "Can't read config file: $!";
+       
+       while (<CONFIG>) {
+               if (/^#/ or /^$/) {
+                       # Ignore; comment line.
+               } elsif (/^this_site (.*)/) {
+                       $config{'thissite'} = $1;
+               } elsif (/^maintainer_email (.*)/) {
+                       $config{'adminemail'} = $1;
+               } elsif (/^mail_delivery_client (.*)/) {
+                       $config{'mta'} = $1;
+               } elsif (/^syncsite (.*)/) {
+                       push @{$config{'syncsites'}}, $1;
+               }
+       }
+
+       close(CONFIG);
+
+       return;
+}
+
 #
 # submitupdate
 #
@@ -22,7 +54,8 @@ sub submitupdate {
        my @data = @_;
        my (@errors, @mergedata);
 
-       open3(\*MERGEIN, \*MERGEOUT, \*MERGEERR, "/home/noodles/onak-0.0.3/onak", "add");
+       open3(\*MERGEIN, \*MERGEOUT, \*MERGEERR,
+               "/home/noodles/onak-0.0.3/onak", "add");
 
        print MERGEIN @data;
        close MERGEIN;
@@ -40,6 +73,7 @@ my ($inheader, %syncsites, $subject, $from, $replyto, @body, @syncmail);
 
 $inheader = 1;
 $subject = "";
+&readconfig;
 
 while (<>) {
        if ($inheader) {