+ my $site;
+ my $count;
+ my $i;
+ my @newupdate = submitupdate(@body);
+
+ $count = 0;
+ foreach $i (@{$config{'syncsites'}}) {
+ if (! defined($seenby{$i})) {
+ $count++;
+ }
+ }
+
+ open (LOG, ">>/home/noodles/logs/keyadd.log");
+ print LOG "[".localtime(time)."] Syncing with $count sites.\n";
+ close LOG;
+
+ if ($newupdate[0] eq '') {
+ open (LOG, ">>/home/noodles/logs/keyadd.log");
+ print LOG "[".localtime(time)."] Nothing to sync.\n";
+ close LOG;
+ $count = 0;
+ }
+
+ if ($count > 0) {
+ open(MAIL, "|$config{mta}");
+ print MAIL "From: $config{adminemail}\n";
+ print MAIL "To: ";
+ foreach $i (@{$config{'syncsites'}}) {
+ if (! defined($seenby{$i})) {
+ print MAIL "$i";
+ $count--;
+ if ($count > 0) {
+ print MAIL ", ";
+ }
+ }
+ }
+ print MAIL "\n";
+ print MAIL "Subject: incremental\n";
+ foreach $site (keys %seenby) {
+ print MAIL "X-KeyServer-Sent: $site\n";
+ }
+ print MAIL "X-KeyServer-Sent: $config{thissite}\n";
+ print MAIL "Precedence: list\n";
+ print MAIL "MIME-Version: 1.0\n";
+ print MAIL "Content-Type: application/pgp-keys\n";
+ print MAIL "\n";
+ print @newupdate;
+ close MAIL;
+ }