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

View File

@ -1132,7 +1132,7 @@ faction *get_or_create_monsters(void)
if (!f) { if (!f) {
const race *rc = rc_get_or_create("dragon"); const race *rc = rc_get_or_create("dragon");
const char *email = config_get("monster.email"); 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); renumber_faction(f, MONSTER_ID);
faction_setname(f, "Monster"); faction_setname(f, "Monster");
fset(f, FFL_NPC | FFL_NOIDLEOUT); fset(f, FFL_NPC | FFL_NOIDLEOUT);

View File

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