forked from github/server
Per default keinen Report mehr für die Monster (kann per write_report() aus
lua gemacht werden, wenn doch gewünscht).
This commit is contained in:
parent
357dd0ddca
commit
a6cc3216b6
2 changed files with 110 additions and 109 deletions
|
@ -2817,130 +2817,130 @@ init_reports(void)
|
||||||
int
|
int
|
||||||
reports(void)
|
reports(void)
|
||||||
{
|
{
|
||||||
faction *f;
|
faction *f;
|
||||||
FILE *shfp, *BAT;
|
FILE *shfp, *BAT;
|
||||||
time_t ltime = time(NULL);
|
time_t ltime = time(NULL);
|
||||||
const char * str;
|
const char * str;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
nmr_warnings();
|
nmr_warnings();
|
||||||
report_donations();
|
report_donations();
|
||||||
remove_empty_units();
|
remove_empty_units();
|
||||||
|
|
||||||
BAT = openbatch();
|
BAT = openbatch();
|
||||||
for (f = factions; f; f = f->next) {
|
for (f = factions; f; f = f->next) {
|
||||||
int error = write_reports(f, ltime);
|
if (f->no != MONSTER_FACTION) {
|
||||||
if (error) retval = error;
|
int error = write_reports(f, ltime);
|
||||||
|
if (error) retval = error;
|
||||||
|
if (!nosh && f->email && BAT) {
|
||||||
|
sprintf(buf, "%s/%s.sh", reportpath(), factionid(f));
|
||||||
|
shfp = fopen(buf, "w");
|
||||||
|
fprintf(shfp,"#!/bin/sh\n\nPATH=%s\n\n",MailitPath());
|
||||||
|
fprintf(shfp,"if [ $# -ge 1 ]; then\n");
|
||||||
|
fprintf(shfp,"\taddr=$1\n");
|
||||||
|
fprintf(shfp,"else\n");
|
||||||
|
fprintf(shfp,"\taddr=%s\n", f->email);
|
||||||
|
fprintf(shfp,"fi\n\n");
|
||||||
|
|
||||||
|
fprintf(BAT, "\n\ndate;echo %s\n", f->email);
|
||||||
|
|
||||||
if (f->no > 0 && f->email && BAT) {
|
if (f->options & REPORT_ZIP) {
|
||||||
sprintf(buf, "%s/%s.sh", reportpath(), factionid(f));
|
|
||||||
shfp = fopen(buf, "w");
|
|
||||||
fprintf(shfp,"#!/bin/sh\n\nPATH=%s\n\n",MailitPath());
|
|
||||||
fprintf(shfp,"if [ $# -ge 1 ]; then\n");
|
|
||||||
fprintf(shfp,"\taddr=$1\n");
|
|
||||||
fprintf(shfp,"else\n");
|
|
||||||
fprintf(shfp,"\taddr=%s\n", f->email);
|
|
||||||
fprintf(shfp,"fi\n\n");
|
|
||||||
|
|
||||||
fprintf(BAT, "\n\ndate;echo %s\n", f->email);
|
if(f->age == 1) {
|
||||||
|
|
||||||
if (f->no > 0 && f->options & REPORT_ZIP) {
|
|
||||||
|
|
||||||
if(f->age == 1) {
|
|
||||||
#if KEEP_UNZIPPED == 1
|
#if KEEP_UNZIPPED == 1
|
||||||
fprintf(BAT, "ls %d-%s.nr %d-%s.txt %d-%s.cr | zip -j -9 -@ %d-%s.zip\n",
|
fprintf(BAT, "ls %d-%s.nr %d-%s.txt %d-%s.cr | zip -j -9 -@ %d-%s.zip\n",
|
||||||
turn, factionid(f),
|
turn, factionid(f),
|
||||||
turn, factionid(f),
|
turn, factionid(f),
|
||||||
turn, factionid(f),
|
turn, factionid(f),
|
||||||
turn, factionid(f));
|
turn, factionid(f));
|
||||||
#else
|
#else
|
||||||
fprintf(BAT, "ls %d-%s.nr %d-%s.txt %d-%s.cr | zip -m -j -9 -@ %d-%s.zip\n",
|
fprintf(BAT, "ls %d-%s.nr %d-%s.txt %d-%s.cr | zip -m -j -9 -@ %d-%s.zip\n",
|
||||||
turn, factionid(f),
|
turn, factionid(f),
|
||||||
turn, factionid(f),
|
turn, factionid(f),
|
||||||
turn, factionid(f),
|
turn, factionid(f),
|
||||||
turn, factionid(f));
|
turn, factionid(f));
|
||||||
#endif
|
#endif
|
||||||
fprintf(BAT, "zip -j -9 %d-%s.zip ../res/%s/%s/welcome.txt\n",
|
fprintf(BAT, "zip -j -9 %d-%s.zip ../res/%s/%s/welcome.txt\n",
|
||||||
turn, factionid(f), global.welcomepath, locale_name(f->locale));
|
turn, factionid(f), global.welcomepath, locale_name(f->locale));
|
||||||
} else {
|
} else {
|
||||||
#if KEEP_UNZIPPED == 1
|
#if KEEP_UNZIPPED == 1
|
||||||
fprintf(BAT, "ls %d-%s.nr %d-%s.txt %d-%s.cr | zip -j -9 -@ %d-%s.zip\n",
|
fprintf(BAT, "ls %d-%s.nr %d-%s.txt %d-%s.cr | zip -j -9 -@ %d-%s.zip\n",
|
||||||
turn, factionid(f),
|
turn, factionid(f),
|
||||||
turn, factionid(f),
|
turn, factionid(f),
|
||||||
turn, factionid(f),
|
turn, factionid(f),
|
||||||
turn, factionid(f));
|
turn, factionid(f));
|
||||||
#else
|
#else
|
||||||
fprintf(BAT, "ls %d-%s.nr %d-%s.txt %d-%s.cr | zip -m -j -9 -@ %d-%s.zip\n",
|
fprintf(BAT, "ls %d-%s.nr %d-%s.txt %d-%s.cr | zip -m -j -9 -@ %d-%s.zip\n",
|
||||||
turn, factionid(f),
|
turn, factionid(f),
|
||||||
turn, factionid(f),
|
turn, factionid(f),
|
||||||
turn, factionid(f),
|
turn, factionid(f),
|
||||||
turn, factionid(f));
|
turn, factionid(f));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(shfp, "eresseamail.zipped $addr \"%s %s\" \"%d-%s.zip\" "
|
fprintf(shfp, "eresseamail.zipped $addr \"%s %s\" \"%d-%s.zip\" "
|
||||||
"%d-%s.zip\n", global.gamename, gamedate_short(f->locale),
|
"%d-%s.zip\n", global.gamename, gamedate_short(f->locale),
|
||||||
turn, factionid(f),
|
turn, factionid(f),
|
||||||
turn, factionid(f));
|
turn, factionid(f));
|
||||||
|
|
||||||
} else if(f->options & REPORT_BZIP2) {
|
} else if(f->options & REPORT_BZIP2) {
|
||||||
|
|
||||||
if (f->age == 1) {
|
if (f->age == 1) {
|
||||||
fprintf(shfp,
|
fprintf(shfp,
|
||||||
" \\\n\t\"text/plain\" \"Willkommen\" ../res/%s/%s/welcome.txt", global.welcomepath, locale_name(f->locale));
|
" \\\n\t\"text/plain\" \"Willkommen\" ../res/%s/%s/welcome.txt", global.welcomepath, locale_name(f->locale));
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(BAT, "bzip2 -9v `ls %d-%s.nr %d-%s.txt %d-%s.cr`\n",
|
fprintf(BAT, "bzip2 -9v `ls %d-%s.nr %d-%s.txt %d-%s.cr`\n",
|
||||||
turn, factionid(f),
|
turn, factionid(f),
|
||||||
turn, factionid(f),
|
turn, factionid(f),
|
||||||
turn, factionid(f));
|
turn, factionid(f));
|
||||||
|
|
||||||
fprintf(shfp, "eresseamail.bzip2 $addr \"%s %s\"", global.gamename, gamedate_short(f->locale));
|
fprintf(shfp, "eresseamail.bzip2 $addr \"%s %s\"", global.gamename, gamedate_short(f->locale));
|
||||||
|
|
||||||
if (!nonr && f->options & REPORT_NR)
|
if (!nonr && f->options & REPORT_NR)
|
||||||
fprintf(shfp,
|
fprintf(shfp,
|
||||||
" \\\n\t\"application/x-bzip2\" \"Report\" %d-%s.nr.bz2",
|
" \\\n\t\"application/x-bzip2\" \"Report\" %d-%s.nr.bz2",
|
||||||
turn,factionid(f));
|
turn,factionid(f));
|
||||||
|
|
||||||
if (f->options & (1 << O_ZUGVORLAGE))
|
if (f->options & (1 << O_ZUGVORLAGE))
|
||||||
fprintf(shfp,
|
fprintf(shfp,
|
||||||
" \\\n\t\"application/x-bzip2\" \"Zugvorlage\" %d-%s.txt.bz2",
|
" \\\n\t\"application/x-bzip2\" \"Zugvorlage\" %d-%s.txt.bz2",
|
||||||
turn,factionid(f));
|
turn,factionid(f));
|
||||||
|
|
||||||
if (!nocr && (f->options & REPORT_CR || f->age<3))
|
if (!nocr && (f->options & REPORT_CR || f->age<3))
|
||||||
fprintf(shfp,
|
fprintf(shfp,
|
||||||
" \\\n\t\"application/x-bzip2\" \"Computer-Report\" %d-%s.cr.bz2",
|
" \\\n\t\"application/x-bzip2\" \"Computer-Report\" %d-%s.cr.bz2",
|
||||||
turn, factionid(f));
|
turn, factionid(f));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
fprintf(shfp, MAIL " $addr \"%s %s\"", global.gamename, gamedate_short(f->locale));
|
fprintf(shfp, MAIL " $addr \"%s %s\"", global.gamename, gamedate_short(f->locale));
|
||||||
|
|
||||||
if (f->age == 1) {
|
if (f->age == 1) {
|
||||||
fprintf(shfp,
|
fprintf(shfp,
|
||||||
" \\\n\t\"text/plain\" \"Willkommen\" ../res/%s/%s/welcome.txt", global.welcomepath, locale_name(f->locale));
|
" \\\n\t\"text/plain\" \"Willkommen\" ../res/%s/%s/welcome.txt", global.welcomepath, locale_name(f->locale));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nonr && f->options & REPORT_NR)
|
if (!nonr && f->options & REPORT_NR)
|
||||||
fprintf(shfp,
|
fprintf(shfp,
|
||||||
" \\\n\t\"text/plain\" \"Report\" %d-%s.nr",
|
" \\\n\t\"text/plain\" \"Report\" %d-%s.nr",
|
||||||
turn, factionid(f));
|
turn, factionid(f));
|
||||||
|
|
||||||
if (f->options & (1 << O_ZUGVORLAGE))
|
if (f->options & (1 << O_ZUGVORLAGE))
|
||||||
fprintf(shfp,
|
fprintf(shfp,
|
||||||
" \\\n\t\"text/plain\" \"Zugvorlage\" %d-%s.txt",
|
" \\\n\t\"text/plain\" \"Zugvorlage\" %d-%s.txt",
|
||||||
turn, factionid(f));
|
turn, factionid(f));
|
||||||
|
|
||||||
if (!nocr && (f->options & REPORT_CR || f->age<3))
|
if (!nocr && (f->options & REPORT_CR || f->age<3))
|
||||||
fprintf(shfp,
|
fprintf(shfp,
|
||||||
" \\\n\t\"text/x-eressea-cr\" \"Computer-Report\" %d-%s.cr",
|
" \\\n\t\"text/x-eressea-cr\" \"Computer-Report\" %d-%s.cr",
|
||||||
turn, factionid(f));
|
turn, factionid(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(BAT, ". %s.sh %s\n", factionid(f), f->email);
|
fprintf(BAT, ". %s.sh %s\n", factionid(f), f->email);
|
||||||
fclose(shfp);
|
fclose(shfp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
str = get_param(global.parameters, "globalreport");
|
str = get_param(global.parameters, "globalreport");
|
||||||
if (str!=NULL) {
|
if (str!=NULL) {
|
||||||
sprintf(buf, "%s/%s.%u.cr", reportpath(), str, turn);
|
sprintf(buf, "%s/%s.%u.cr", reportpath(), str, turn);
|
||||||
|
|
|
@ -1553,6 +1553,7 @@ readfaction(FILE * F)
|
||||||
log_error(("Invalid email address for faction %s: %s\n", itoa36(f->no), email));
|
log_error(("Invalid email address for faction %s: %s\n", itoa36(f->no), email));
|
||||||
set_email(&f->email, "");
|
set_email(&f->email, "");
|
||||||
}
|
}
|
||||||
|
free(email);
|
||||||
rds(F, &f->passw);
|
rds(F, &f->passw);
|
||||||
if (global.data_version >= OVERRIDE_VERSION) {
|
if (global.data_version >= OVERRIDE_VERSION) {
|
||||||
rds(F, &f->override);
|
rds(F, &f->override);
|
||||||
|
|
Loading…
Reference in a new issue