remove noreply email, monster report.

This commit is contained in:
Enno Rehling 2017-09-18 21:43:52 +02:00
parent d8c063ae50
commit 5e204083b8
3 changed files with 14 additions and 11 deletions

View File

@ -18,8 +18,9 @@ local function file_exists(name)
if f~=nil then io.close(f) return true else return false end
end
local function assert_file(filename)
assert_equal(true, file_exists(filename))
local function assert_file(filename, exists)
if exists == nil then exists = true end
assert_equal(exists, file_exists(filename))
os.remove(filename)
end
@ -30,9 +31,9 @@ function test_process_turn()
assert_equal(0, write_reports())
assert_equal(0, eressea.write_game("test.dat"))
assert_file("data/test.dat")
assert_file("reports/" .. get_turn() .. "-ii.nr")
assert_file("reports/" .. get_turn() .. "-ii.cr")
assert_file("reports/" .. get_turn() .. "-ii.txt")
assert_file("reports/" .. get_turn() .. "-ii.nr", false)
assert_file("reports/" .. get_turn() .. "-ii.cr", false)
assert_file("reports/" .. get_turn() .. "-ii.txt", false)
assert_file("reports/" .. get_turn() .. "-777.nr")
assert_file("reports/" .. get_turn() .. "-777.cr")
assert_file("reports/" .. get_turn() .. "-777.txt")

View File

@ -1132,7 +1132,7 @@ faction *get_or_create_monsters(void)
if (!f) {
const race *rc = rc_get_or_create("dragon");
const char *email = config_get("monster.email");
f = addfaction(email ? email : "noreply@eressea.de", NULL, rc, default_locale, 0);
f = addfaction(email ? email : NULL, NULL, rc, default_locale, 0);
renumber_faction(f, MONSTER_ID);
faction_setname(f, "Monster");
fset(f, FFL_NPC | FFL_NOIDLEOUT);

View File

@ -1616,11 +1616,13 @@ int reports(void)
}
for (f = factions; f; f = f->next) {
int error = write_reports(f, ltime);
if (error)
retval = error;
if (mailit)
write_script(mailit, f);
if (f->email && !fval(f, FFL_NPC)) {
int error = write_reports(f, ltime);
if (error)
retval = error;
if (mailit)
write_script(mailit, f);
}
}
if (mailit)
fclose(mailit);