|
|
@ -1068,6 +1068,7 @@ K_ITEM *workers_add(PGconn *conn, int64_t userid, char *workername, |
|
|
|
conned = true; |
|
|
|
conned = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bzero(row, sizeof(*row)); |
|
|
|
row->workerid = nextid(conn, "workerid", (int64_t)1, cd, by, code, inet); |
|
|
|
row->workerid = nextid(conn, "workerid", (int64_t)1, cd, by, code, inet); |
|
|
|
if (row->workerid == 0) |
|
|
|
if (row->workerid == 0) |
|
|
|
goto unitem; |
|
|
|
goto unitem; |
|
|
@ -1076,10 +1077,13 @@ K_ITEM *workers_add(PGconn *conn, int64_t userid, char *workername, |
|
|
|
STRNCPY(row->workername, workername); |
|
|
|
STRNCPY(row->workername, workername); |
|
|
|
if (difficultydefault && *difficultydefault) { |
|
|
|
if (difficultydefault && *difficultydefault) { |
|
|
|
diffdef = atoi(difficultydefault); |
|
|
|
diffdef = atoi(difficultydefault); |
|
|
|
if (diffdef < DIFFICULTYDEFAULT_MIN) |
|
|
|
// If out of the range, set it in the range
|
|
|
|
diffdef = DIFFICULTYDEFAULT_MIN; |
|
|
|
if (diffdef != DIFFICULTYDEFAULT_DEF) { |
|
|
|
if (diffdef > DIFFICULTYDEFAULT_MAX) |
|
|
|
if (diffdef < DIFFICULTYDEFAULT_MIN) |
|
|
|
diffdef = DIFFICULTYDEFAULT_MAX; |
|
|
|
diffdef = DIFFICULTYDEFAULT_MIN; |
|
|
|
|
|
|
|
if (diffdef > DIFFICULTYDEFAULT_MAX) |
|
|
|
|
|
|
|
diffdef = DIFFICULTYDEFAULT_MAX; |
|
|
|
|
|
|
|
} |
|
|
|
row->difficultydefault = diffdef; |
|
|
|
row->difficultydefault = diffdef; |
|
|
|
} else |
|
|
|
} else |
|
|
|
row->difficultydefault = DIFFICULTYDEFAULT_DEF; |
|
|
|
row->difficultydefault = DIFFICULTYDEFAULT_DEF; |
|
|
@ -1095,15 +1099,20 @@ K_ITEM *workers_add(PGconn *conn, int64_t userid, char *workername, |
|
|
|
|
|
|
|
|
|
|
|
if (idlenotificationtime && *idlenotificationtime) { |
|
|
|
if (idlenotificationtime && *idlenotificationtime) { |
|
|
|
nottime = atoi(idlenotificationtime); |
|
|
|
nottime = atoi(idlenotificationtime); |
|
|
|
if (nottime < DIFFICULTYDEFAULT_MIN) { |
|
|
|
if (nottime != IDLENOTIFICATIONTIME_DEF) { |
|
|
|
row->idlenotificationenabled[0] = IDLENOTIFICATIONDISABLED[0]; |
|
|
|
// If out of the range, set to default
|
|
|
|
nottime = DIFFICULTYDEFAULT_MIN; |
|
|
|
if (nottime < IDLENOTIFICATIONTIME_MIN || |
|
|
|
} else if (nottime > IDLENOTIFICATIONTIME_MAX) |
|
|
|
nottime > IDLENOTIFICATIONTIME_MAX) |
|
|
|
nottime = row->idlenotificationtime; |
|
|
|
nottime = IDLENOTIFICATIONTIME_DEF; |
|
|
|
|
|
|
|
} |
|
|
|
row->idlenotificationtime = nottime; |
|
|
|
row->idlenotificationtime = nottime; |
|
|
|
} else |
|
|
|
} else |
|
|
|
row->idlenotificationtime = IDLENOTIFICATIONTIME_DEF; |
|
|
|
row->idlenotificationtime = IDLENOTIFICATIONTIME_DEF; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Default is disabled
|
|
|
|
|
|
|
|
if (row->idlenotificationtime == IDLENOTIFICATIONTIME_DEF) |
|
|
|
|
|
|
|
row->idlenotificationenabled[0] = IDLENOTIFICATIONDISABLED[0]; |
|
|
|
|
|
|
|
|
|
|
|
HISTORYDATEINIT(row, cd, by, code, inet); |
|
|
|
HISTORYDATEINIT(row, cd, by, code, inet); |
|
|
|
HISTORYDATETRANSFER(trf_root, row); |
|
|
|
HISTORYDATETRANSFER(trf_root, row); |
|
|
|
|
|
|
|
|
|
|
|