forked from github/server
commit
09cf29a75c
|
@ -1,5 +1,5 @@
|
||||||
[game]
|
[game]
|
||||||
email = eressea-server@kn-bremen.de
|
email = eressea-server@example.com
|
||||||
sender = Eressea Server
|
sender = Eressea Server
|
||||||
name = Eressea
|
name = Eressea
|
||||||
report = reports
|
report = reports
|
||||||
|
|
|
@ -16,7 +16,7 @@ then
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "-Lde" ]
|
if [ "$1" == "-Len" ]
|
||||||
then
|
then
|
||||||
TEMPLATE=report-mail.en.txt
|
TEMPLATE=report-mail.en.txt
|
||||||
shift
|
shift
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
## this script takes a backup of a turn.
|
|
||||||
## usage: backup.sh <turn>
|
|
||||||
|
|
||||||
if [ -z $ERESSEA ]; then
|
if [ -z $ERESSEA ]; then
|
||||||
echo "You have to define the \$ERESSEA environment variable to run $0"
|
echo "You have to define the \$ERESSEA environment variable to run $0"
|
||||||
|
|
|
@ -10,7 +10,7 @@ done
|
||||||
if [ "$FORCE" != "yes" ] ; then
|
if [ "$FORCE" != "yes" ] ; then
|
||||||
BRANCH=$(git status -s -b | head -1 | cut -d\ -f 2 | sed 's/\..*//')
|
BRANCH=$(git status -s -b | head -1 | cut -d\ -f 2 | sed 's/\..*//')
|
||||||
if [ "$BRANCH" != "master" ] ; then
|
if [ "$BRANCH" != "master" ] ; then
|
||||||
echo "you should only install stable versions from the master branch"
|
echo "You should only install stable versions from the master branch. Use -f to override."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
50
s/setup
50
s/setup
|
@ -11,9 +11,9 @@ done
|
||||||
ERESSEA=$(dirname $ROOT)
|
ERESSEA=$(dirname $ROOT)
|
||||||
|
|
||||||
function abort() {
|
function abort() {
|
||||||
echo $1
|
echo $1
|
||||||
[ -z $2 ] && exit -1
|
[ -z $2 ] && exit -1
|
||||||
exit $2 # otherwise
|
exit $2 # otherwise
|
||||||
}
|
}
|
||||||
|
|
||||||
function usage() {
|
function usage() {
|
||||||
|
@ -63,34 +63,36 @@ if [ -d $dir ] ; then
|
||||||
[ $force -eq 1 ] || abort "$dir directory exists. Use -f to force"
|
[ $force -eq 1 ] || abort "$dir directory exists. Use -f to force"
|
||||||
fi
|
fi
|
||||||
mkdir -p $dir
|
mkdir -p $dir
|
||||||
cd $dir || abort "could not chdir to game-$game"
|
cd $dir || abort "could not chdir to $dir"
|
||||||
mkdir -p data reports
|
mkdir -p data reports
|
||||||
|
|
||||||
function ini_sec() {
|
function ini_sec() {
|
||||||
if [ $edit -eq 1 ]; then
|
if [ $edit -eq 1 ]; then
|
||||||
$INIFILE eressea.ini add $1
|
$INIFILE eressea.ini add $1
|
||||||
else
|
else
|
||||||
echo "[$1]" >> eressea.ini
|
echo "[$1]" >> eressea.ini
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function ini_add() {
|
function ini_add() {
|
||||||
if [ $edit -eq 1 ]; then
|
if [ $edit -eq 1 ]; then
|
||||||
$INIFILE eressea.ini add $1:$2 $3
|
$INIFILE eressea.ini add $1:$2 $3
|
||||||
else
|
else
|
||||||
echo "$2 = $3" >> eressea.ini
|
echo "$2 = $3" >> eressea.ini
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function ini_start() {
|
function ini_start() {
|
||||||
if [ -e eressea.ini ]; then
|
if [ -e eressea.ini ]; then
|
||||||
if [ ! -e $INIFILE ] && [ $edit -eq 1 ]; then
|
if [ ! -e $INIFILE ] && [ $edit -eq 1 ]; then
|
||||||
abort "missing editor for eressea.ini. use -n to create new file."
|
abort "missing editor for eressea.ini. use -n to create new file."
|
||||||
fi
|
fi
|
||||||
rm -f eressea.ini
|
rm -f eressea.ini
|
||||||
edit=0
|
edit=0
|
||||||
else
|
else
|
||||||
edit=0
|
edit=0
|
||||||
fi
|
fi
|
||||||
touch eressea.ini
|
touch eressea.ini
|
||||||
}
|
}
|
||||||
|
|
||||||
ini_start
|
ini_start
|
||||||
|
|
|
@ -29,7 +29,7 @@ local function dbupdate()
|
||||||
update_scores()
|
update_scores()
|
||||||
if config.dbname then
|
if config.dbname then
|
||||||
dbname = config.basepath..'/'..config.dbname
|
dbname = config.basepath..'/'..config.dbname
|
||||||
edb = db.open(dbame)
|
edb = db.open(dbname)
|
||||||
if edb~=nil then
|
if edb~=nil then
|
||||||
edb:update_factions()
|
edb:update_factions()
|
||||||
edb:update_scores()
|
edb:update_scores()
|
||||||
|
|
|
@ -1055,8 +1055,8 @@ static void cr_find_address(FILE * F, const faction * uf, selist * addresses)
|
||||||
if (uf != f) {
|
if (uf != f) {
|
||||||
fprintf(F, "PARTEI %d\n", f->no);
|
fprintf(F, "PARTEI %d\n", f->no);
|
||||||
fprintf(F, "\"%s\";Parteiname\n", f->name);
|
fprintf(F, "\"%s\";Parteiname\n", f->name);
|
||||||
if (f->email)
|
if (strcmp(faction_getemail(f), "") != 0)
|
||||||
fprintf(F, "\"%s\";email\n", f->email);
|
fprintf(F, "\"%s\";email\n", faction_getemail(f));
|
||||||
if (f->banner)
|
if (f->banner)
|
||||||
fprintf(F, "\"%s\";banner\n", f->banner);
|
fprintf(F, "\"%s\";banner\n", f->banner);
|
||||||
fprintf(F, "\"%s\";locale\n", locale_name(f->locale));
|
fprintf(F, "\"%s\";locale\n", locale_name(f->locale));
|
||||||
|
@ -1604,7 +1604,7 @@ report_computer(const char *filename, report_context * ctx, const char *bom)
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(F, "\"%s\";Parteiname\n", f->name);
|
fprintf(F, "\"%s\";Parteiname\n", f->name);
|
||||||
fprintf(F, "\"%s\";email\n", f->email);
|
fprintf(F, "\"%s\";email\n", faction_getemail(f));
|
||||||
if (f->banner)
|
if (f->banner)
|
||||||
fprintf(F, "\"%s\";banner\n", f->banner);
|
fprintf(F, "\"%s\";banner\n", f->banner);
|
||||||
print_items(F, f->items, f->locale);
|
print_items(F, f->items, f->locale);
|
||||||
|
|
|
@ -859,7 +859,7 @@ static void select_regions(state * st, int selectmode)
|
||||||
static void loaddata(state *st) {
|
static void loaddata(state *st) {
|
||||||
char datafile[MAX_PATH];
|
char datafile[MAX_PATH];
|
||||||
|
|
||||||
askstring(st->wnd_status->handle, "save as:", datafile, sizeof(datafile));
|
askstring(st->wnd_status->handle, "load from:", datafile, sizeof(datafile));
|
||||||
if (strlen(datafile) > 0) {
|
if (strlen(datafile) > 0) {
|
||||||
readgame(datafile);
|
readgame(datafile);
|
||||||
st->modified = 0;
|
st->modified = 0;
|
||||||
|
|
|
@ -102,7 +102,7 @@ int json_export(stream * out, int flags) {
|
||||||
cJSON *data;
|
cJSON *data;
|
||||||
cJSON_AddItemToObject(json, itoa36(f->no), data = cJSON_CreateObject());
|
cJSON_AddItemToObject(json, itoa36(f->no), data = cJSON_CreateObject());
|
||||||
cJSON_AddStringToObject(data, "name", f->name);
|
cJSON_AddStringToObject(data, "name", f->name);
|
||||||
cJSON_AddStringToObject(data, "email", f->email);
|
cJSON_AddStringToObject(data, "email", faction_getemail(f));
|
||||||
cJSON_AddNumberToObject(data, "score", (double)f->score);
|
cJSON_AddNumberToObject(data, "score", (double)f->score);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,8 +229,11 @@ faction *addfaction(const char *email, const char *password,
|
||||||
faction *f = calloc(sizeof(faction), 1);
|
faction *f = calloc(sizeof(faction), 1);
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
|
||||||
if (set_email(&f->email, email) != 0) {
|
if (check_email(email) == 0) {
|
||||||
log_warning("Invalid email address for faction %s: %s\n", itoa36(f->no), email);
|
faction_setemail(f, email);
|
||||||
|
} else {
|
||||||
|
log_warning("Invalid email address for faction %s: %s\n", itoa36(f->no), email?email:"");
|
||||||
|
faction_setemail(f, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
f->alliance_joindate = turn;
|
f->alliance_joindate = turn;
|
||||||
|
@ -544,6 +547,8 @@ void faction_setemail(faction * self, const char *email)
|
||||||
free(self->email);
|
free(self->email);
|
||||||
if (email)
|
if (email)
|
||||||
self->email = strdup(email);
|
self->email = strdup(email);
|
||||||
|
else
|
||||||
|
self->email = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *faction_getbanner(const faction * self)
|
const char *faction_getbanner(const faction * self)
|
||||||
|
@ -797,7 +802,7 @@ int writepasswd(void)
|
||||||
|
|
||||||
for (f = factions; f; f = f->next) {
|
for (f = factions; f; f = f->next) {
|
||||||
fprintf(F, "%s:%s:%s:%d\n",
|
fprintf(F, "%s:%s:%s:%d\n",
|
||||||
itoa36(f->no), f->email, f->_password, f->subscription);
|
itoa36(f->no), faction_getemail(f), f->_password, f->subscription);
|
||||||
}
|
}
|
||||||
fclose(F);
|
fclose(F);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -225,17 +225,28 @@ static void test_valid_race(CuTest *tc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_set_email(CuTest *tc) {
|
static void test_set_email(CuTest *tc) {
|
||||||
char * email = NULL;
|
faction *f;
|
||||||
|
char email[10];
|
||||||
test_setup();
|
test_setup();
|
||||||
CuAssertIntEquals(tc, 0, set_email(&email, "enno@eressea.de"));
|
CuAssertIntEquals(tc, 0, check_email("enno@eressea.de"));
|
||||||
CuAssertStrEquals(tc, "enno@eressea.de", email);
|
CuAssertIntEquals(tc, 0, check_email("bugs@eressea.de"));
|
||||||
CuAssertIntEquals(tc, 0, set_email(&email, "bugs@eressea.de"));
|
CuAssertIntEquals(tc, -1, check_email("bad@@eressea.de"));
|
||||||
CuAssertStrEquals(tc, "bugs@eressea.de", email);
|
CuAssertIntEquals(tc, -1, check_email("eressea.de"));
|
||||||
CuAssertIntEquals(tc, -1, set_email(&email, "bad@@eressea.de"));
|
CuAssertIntEquals(tc, -1, check_email("eressea@"));
|
||||||
CuAssertIntEquals(tc, -1, set_email(&email, "eressea.de"));
|
CuAssertIntEquals(tc, -1, check_email(""));
|
||||||
CuAssertIntEquals(tc, -1, set_email(&email, "eressea@"));
|
CuAssertIntEquals(tc, -1, check_email(NULL));
|
||||||
CuAssertStrEquals(tc, "bugs@eressea.de", email);
|
f = test_create_faction(0);
|
||||||
free(email);
|
|
||||||
|
sprintf(email, "enno");
|
||||||
|
faction_setemail(f, email);
|
||||||
|
email[0] = 0;
|
||||||
|
CuAssertStrEquals(tc, "enno", f->email);
|
||||||
|
CuAssertStrEquals(tc, "enno", faction_getemail(f));
|
||||||
|
faction_setemail(f, "bugs@eressea.de");
|
||||||
|
CuAssertStrEquals(tc, "bugs@eressea.de", f->email);
|
||||||
|
faction_setemail(f, NULL);
|
||||||
|
CuAssertPtrEquals(tc, 0, f->email);
|
||||||
|
CuAssertStrEquals(tc, "", faction_getemail(f));
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1067,9 +1067,11 @@ faction *read_faction(gamedata * data)
|
||||||
log_debug(" - Lese Partei %s (%s)", f->name, itoa36(f->no));
|
log_debug(" - Lese Partei %s (%s)", f->name, itoa36(f->no));
|
||||||
|
|
||||||
READ_STR(data->store, name, sizeof(name));
|
READ_STR(data->store, name, sizeof(name));
|
||||||
if (set_email(&f->email, name) != 0) {
|
if (check_email(name) == 0) {
|
||||||
|
faction_setemail(f, name);
|
||||||
|
} else {
|
||||||
log_warning("Invalid email address for faction %s: %s", itoa36(f->no), name);
|
log_warning("Invalid email address for faction %s: %s", itoa36(f->no), name);
|
||||||
set_email(&f->email, "");
|
faction_setemail(f, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
read_password(data, f);
|
read_password(data, f);
|
||||||
|
@ -1168,7 +1170,7 @@ void write_faction(gamedata *data, const faction * f)
|
||||||
|
|
||||||
WRITE_STR(data->store, f->name);
|
WRITE_STR(data->store, f->name);
|
||||||
WRITE_STR(data->store, f->banner);
|
WRITE_STR(data->store, f->banner);
|
||||||
WRITE_STR(data->store, f->email);
|
WRITE_STR(data->store, f->email?f->email:"");
|
||||||
write_password(data, f);
|
write_password(data, f);
|
||||||
WRITE_TOK(data->store, locale_name(f->locale));
|
WRITE_TOK(data->store, locale_name(f->locale));
|
||||||
WRITE_INT(data->store, f->lastorders);
|
WRITE_INT(data->store, f->lastorders);
|
||||||
|
|
|
@ -2126,13 +2126,13 @@ int email_cmd(unit * u, struct order *ord)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
faction *f = u->faction;
|
faction *f = u->faction;
|
||||||
if (set_email(&f->email, s) != 0) {
|
if (check_email(s) == 0) {
|
||||||
|
faction_setemail(f, s);
|
||||||
|
ADDMSG(&f->msgs, msg_message("changemail", "value", faction_getemail(f)));
|
||||||
|
} else {
|
||||||
log_error("Invalid email address for faction %s: %s\n", itoa36(f->no), s);
|
log_error("Invalid email address for faction %s: %s\n", itoa36(f->no), s);
|
||||||
ADDMSG(&f->msgs, msg_message("changemail_invalid", "value", s));
|
ADDMSG(&f->msgs, msg_message("changemail_invalid", "value", s));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
ADDMSG(&f->msgs, msg_message("changemail", "value", f->email));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,7 @@ newfaction *read_newfactions(const char *filename)
|
||||||
sz += strlcat(password, itoa36(rng_int()), sizeof(password));
|
sz += strlcat(password, itoa36(rng_int()), sizeof(password));
|
||||||
}
|
}
|
||||||
for (f = factions; f; f = f->next) {
|
for (f = factions; f; f = f->next) {
|
||||||
if (strcmp(f->email, email) == 0 && f->age < MINAGE_MULTI) {
|
if (strcmp(faction_getemail(f), email) == 0 && f->age < MINAGE_MULTI) {
|
||||||
log_warning("email %s already in use by %s", email, factionname(f));
|
log_warning("email %s already in use by %s", email, factionname(f));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,9 @@ newfaction *read_newfactions(const char *filename)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
nf = calloc(sizeof(newfaction), 1);
|
nf = calloc(sizeof(newfaction), 1);
|
||||||
if (set_email(&nf->email, email) != 0) {
|
if (check_email(email) == 0) {
|
||||||
|
nf->email = strdup(email);
|
||||||
|
} else {
|
||||||
log_error("Invalid email address for subscription %s: %s\n", itoa36(subscription), email);
|
log_error("Invalid email address for subscription %s: %s\n", itoa36(subscription), email);
|
||||||
free(nf);
|
free(nf);
|
||||||
continue;
|
continue;
|
||||||
|
@ -619,6 +621,7 @@ int autoseed(newfaction ** players, int nsize, int max_agediff)
|
||||||
while (*nfp) {
|
while (*nfp) {
|
||||||
newfaction *nf = *nfp;
|
newfaction *nf = *nfp;
|
||||||
if (strcmp(nextf->email, nf->email) == 0) {
|
if (strcmp(nextf->email, nf->email) == 0) {
|
||||||
|
log_warning("Duplicate email %s\n", nf->email?nf->email:"");
|
||||||
*nfp = nf->next;
|
*nfp = nf->next;
|
||||||
free_newfaction(nf);
|
free_newfaction(nf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 : NULL, NULL, rc, default_locale, 0);
|
f = addfaction(email, 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);
|
||||||
|
|
|
@ -1753,7 +1753,7 @@ static void list_address(struct stream *out, const faction * uf, selist * seenfa
|
||||||
char buf[8192];
|
char buf[8192];
|
||||||
char label = '-';
|
char label = '-';
|
||||||
|
|
||||||
sprintf(buf, "%s: %s; %s", factionname(f), f->email,
|
sprintf(buf, "%s: %s; %s", factionname(f), faction_getemail(f),
|
||||||
f->banner ? f->banner : "");
|
f->banner ? f->banner : "");
|
||||||
if (uf == f)
|
if (uf == f)
|
||||||
label = '*';
|
label = '*';
|
||||||
|
@ -2078,7 +2078,7 @@ report_plaintext(const char *filename, report_context * ctx,
|
||||||
newline(out);
|
newline(out);
|
||||||
sprintf(buf, "%s, %s/%s (%s)", factionname(f),
|
sprintf(buf, "%s, %s/%s (%s)", factionname(f),
|
||||||
LOC(f->locale, rc_name_s(f->race, NAME_PLURAL)),
|
LOC(f->locale, rc_name_s(f->race, NAME_PLURAL)),
|
||||||
LOC(f->locale, mkname("school", magic_school[f->magiegebiet])), f->email);
|
LOC(f->locale, mkname("school", magic_school[f->magiegebiet])), faction_getemail(f));
|
||||||
centre(out, buf, true);
|
centre(out, buf, true);
|
||||||
if (f_get_alliance(f)) {
|
if (f_get_alliance(f)) {
|
||||||
centre(out, alliancename(f->alliance), true);
|
centre(out, alliancename(f->alliance), true);
|
||||||
|
@ -2088,13 +2088,18 @@ report_plaintext(const char *filename, report_context * ctx,
|
||||||
const char *email;
|
const char *email;
|
||||||
const char *subject;
|
const char *subject;
|
||||||
email = config_get("game.email");
|
email = config_get("game.email");
|
||||||
|
if (!email)
|
||||||
|
log_error("game.email not set");
|
||||||
|
else {
|
||||||
subject = get_mailcmd(f->locale);
|
subject = get_mailcmd(f->locale);
|
||||||
|
|
||||||
m = msg_message("newbie_info_game", "email subject", email, subject);
|
m = msg_message("newbie_info_game", "email subject", email, subject);
|
||||||
if (m) {
|
if (m) {
|
||||||
nr_render(m, f->locale, buf, sizeof(buf), f);
|
nr_render(m, f->locale, buf, sizeof(buf), f);
|
||||||
msg_release(m);
|
msg_release(m);
|
||||||
centre(out, buf, true);
|
centre(out, buf, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ((f->options & want(O_COMPUTER)) == 0) {
|
if ((f->options & want(O_COMPUTER)) == 0) {
|
||||||
const char *s;
|
const char *s;
|
||||||
s = locale_getstring(f->locale, "newbie_info_cr");
|
s = locale_getstring(f->locale, "newbie_info_cr");
|
||||||
|
|
|
@ -1561,7 +1561,11 @@ static void write_script(FILE * F, const faction * f)
|
||||||
report_type *rtype;
|
report_type *rtype;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
fprintf(F, "faction=%s:email=%s:lang=%s", itoa36(f->no), f->email,
|
if (check_email(faction_getemail(f)) != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(F, "faction=%s:email=%s:lang=%s", itoa36(f->no), faction_getemail(f),
|
||||||
locale_name(f->locale));
|
locale_name(f->locale));
|
||||||
if (f->options & (1 << O_BZIP2))
|
if (f->options & (1 << O_BZIP2))
|
||||||
fputs(":compression=bz2", F);
|
fputs(":compression=bz2", F);
|
||||||
|
|
|
@ -144,7 +144,8 @@ static bool db_faction_cb(void *el, void *arg) {
|
||||||
struct cb_data *cb = (struct cb_data *)arg;
|
struct cb_data *cb = (struct cb_data *)arg;
|
||||||
const faction *f = cb->f;
|
const faction *f = cb->f;
|
||||||
|
|
||||||
if (f->no == df->no || strcmp(f->email, df->email) == 0 || strcmp(f->name, df->name) == 0) {
|
/* FIXME comparing name and email is inaccurate ... */
|
||||||
|
if (f->no == df->no || strcmp(faction_getemail(f), df->email?df->email:"") == 0 || strcmp(f->name, df->name) == 0) {
|
||||||
cb->dbf = df;
|
cb->dbf = df;
|
||||||
}
|
}
|
||||||
if (f->subscription == df->uid) {
|
if (f->subscription == df->uid) {
|
||||||
|
@ -172,7 +173,7 @@ int db_update_factions(sqlite3 * db, bool force, int game_id) {
|
||||||
log_warning("faction %s(%d) not found in database, but matches %d\n", itoa36(f->no), f->subscription, dbf->uid);
|
log_warning("faction %s(%d) not found in database, but matches %d\n", itoa36(f->no), f->subscription, dbf->uid);
|
||||||
f->subscription = dbf->uid;
|
f->subscription = dbf->uid;
|
||||||
}
|
}
|
||||||
update = (dbf->no != f->no) || (strcmp(f->email, dbf->email) != 0) || (strcmp(f->name, dbf->name) != 0);
|
update = (dbf->no != f->no) || (strcmp(faction_getemail(f), dbf->email?dbf->email:"") != 0) || (strcmp(f->name, dbf->name) != 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
f->subscription = insert_faction(db, game_id, f);
|
f->subscription = insert_faction(db, game_id, f);
|
||||||
|
|
|
@ -109,17 +109,13 @@ static int spc_email_isvalid(const char *address)
|
||||||
return (count >= 1);
|
return (count >= 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int set_email(char **pemail, const char *newmail)
|
int check_email(const char *newmail)
|
||||||
{
|
{
|
||||||
if (newmail && *newmail) {
|
if (newmail && *newmail) {
|
||||||
if (spc_email_isvalid(newmail) <= 0)
|
if (spc_email_isvalid(newmail) <= 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
} else {
|
||||||
if (*pemail)
|
return -1;
|
||||||
free(*pemail);
|
|
||||||
*pemail = 0;
|
|
||||||
if (newmail) {
|
|
||||||
*pemail = strdup(newmail);
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int set_email(char **pemail, const char *newmail);
|
int check_email(const char *newmail);
|
||||||
|
|
||||||
int *intlist_init(void);
|
int *intlist_init(void);
|
||||||
int *intlist_add(int *i_p, int i);
|
int *intlist_add(int *i_p, int i);
|
||||||
|
|
Loading…
Reference in New Issue