diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/char/char.c | 20 | ||||
-rw-r--r-- | src/char_sql/char.c | 20 | ||||
-rw-r--r-- | src/ladmin/ladmin.c | 52 | ||||
-rw-r--r-- | src/login/admin.c | 44 | ||||
-rw-r--r-- | src/login/login.c | 64 | ||||
-rw-r--r-- | src/login/login.h | 4 | ||||
-rw-r--r-- | src/login_sql/login.c | 56 | ||||
-rw-r--r-- | src/login_sql/login.h | 4 | ||||
-rw-r--r-- | src/map/chrif.c | 4 | ||||
-rw-r--r-- | src/map/chrif.h | 2 | ||||
-rw-r--r-- | src/map/pc.c | 6 | ||||
-rw-r--r-- | src/txt-converter/login-converter.c | 8 |
12 files changed, 142 insertions, 142 deletions
diff --git a/src/char/char.c b/src/char/char.c index 62ac40338..625becef8 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -108,7 +108,7 @@ struct char_session_data { int account_id, login_id1, login_id2, sex; int found_char[MAX_CHARS]; // ids of chars on this account char email[40]; // e-mail (default: a@a.com) by [Yor] - time_t connect_until_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) + time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) }; #define AUTH_FIFO_SIZE 256 @@ -117,7 +117,7 @@ struct { uint32 ip; int delflag; int sex; - time_t connect_until_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) + time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) } auth_fifo[AUTH_FIFO_SIZE]; int auth_fifo_pos = 0; @@ -2017,7 +2017,7 @@ int parse_fromlogin(int fd) int login_id2 = RFIFOL(fd,10); bool result = RFIFOB(fd,14); const char* email = (const char*)RFIFOP(fd,15); - time_t connect_until = (time_t)RFIFOL(fd,55); + time_t expiration_time = (time_t)RFIFOL(fd,55); // find the session with this account id ARR_FIND( 0, fd_max, i, session[i] && (sd = (struct char_session_data*)session[i]->session_data) && @@ -2033,7 +2033,7 @@ int parse_fromlogin(int fd) memcpy(sd->email, email, 40); if (e_mail_check(sd->email) == 0) strncpy(sd->email, "a@a.com", 40); // default e-mail - sd->connect_until_time = connect_until; + sd->expiration_time = expiration_time; char_auth_ok(i, sd); } } @@ -2051,7 +2051,7 @@ int parse_fromlogin(int fd) memcpy(sd->email, RFIFOP(fd,6), 40); if (e_mail_check(sd->email) == 0) strncpy(sd->email, "a@a.com", 40); // default e-mail - sd->connect_until_time = (time_t)RFIFOL(fd,46); + sd->expiration_time = (time_t)RFIFOL(fd,46); break; } } @@ -2809,7 +2809,7 @@ int parse_frommap(int fd) auth_fifo[auth_fifo_pos].login_id1 = RFIFOL(fd,6); auth_fifo[auth_fifo_pos].login_id2 = RFIFOL(fd,10); auth_fifo[auth_fifo_pos].delflag = 2; - auth_fifo[auth_fifo_pos].connect_until_time = 0; // unlimited/unknown time by default (not display in map-server) + auth_fifo[auth_fifo_pos].expiration_time = 0; // unlimited/unknown time by default (not display in map-server) auth_fifo[auth_fifo_pos].ip = ntohl(RFIFOL(fd,14)); auth_fifo_pos++; WFIFOHEAD(fd,7); @@ -2854,7 +2854,7 @@ int parse_frommap(int fd) WFIFOL(map_fd,4) = RFIFOL(fd,2); //Account ID WFIFOL(map_fd,8) = RFIFOL(fd,6); //Login1 WFIFOL(map_fd,16) = RFIFOL(fd,10); //Login2 - WFIFOL(map_fd,12) = (unsigned long)0; //TODO: connect_until_time, how do I figure it out right now? + WFIFOL(map_fd,12) = (unsigned long)0; //TODO: expiration_time, how do I figure it out right now? memcpy(WFIFOP(map_fd,20), char_data, sizeof(struct mmo_charstatus)); WFIFOSET(map_fd, WFIFOW(map_fd,2)); @@ -3250,7 +3250,7 @@ int parse_char(int fd) CREATE(session[fd]->session_data, struct char_session_data, 1); sd = (struct char_session_data*)session[fd]->session_data; strncpy(sd->email, "no mail", 40); // put here a mail without '@' to refuse deletion if we don't receive the e-mail - sd->connect_until_time = 0; // unknown or unlimited (not displaying on map-server) + sd->expiration_time = 0; // unknown or unlimited (not displaying on map-server) sd->account_id = account_id; sd->login_id1 = login_id1; sd->login_id2 = login_id2; @@ -3392,7 +3392,7 @@ int parse_char(int fd) auth_fifo[auth_fifo_pos].login_id2 = sd->login_id2; auth_fifo[auth_fifo_pos].delflag = 0; auth_fifo[auth_fifo_pos].sex = sd->sex; - auth_fifo[auth_fifo_pos].connect_until_time = sd->connect_until_time; + auth_fifo[auth_fifo_pos].expiration_time = sd->expiration_time; auth_fifo[auth_fifo_pos].ip = session[fd]->client_addr; //Send NEW auth packet [Kevin] @@ -3416,7 +3416,7 @@ int parse_char(int fd) WFIFOL(map_fd,4) = auth_fifo[auth_fifo_pos].account_id; WFIFOL(map_fd,8) = auth_fifo[auth_fifo_pos].login_id1; WFIFOL(map_fd,16) = auth_fifo[auth_fifo_pos].login_id2; - WFIFOL(map_fd,12) = (unsigned long)auth_fifo[auth_fifo_pos].connect_until_time; + WFIFOL(map_fd,12) = (unsigned long)auth_fifo[auth_fifo_pos].expiration_time; memcpy(WFIFOP(map_fd,20), cd, sizeof(struct mmo_charstatus)); WFIFOSET(map_fd, WFIFOW(map_fd,2)); diff --git a/src/char_sql/char.c b/src/char_sql/char.c index 533946546..854dea5f6 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -138,7 +138,7 @@ struct char_session_data { int account_id, login_id1, login_id2, sex; int found_char[MAX_CHARS]; // ids of chars on this account char email[40]; // e-mail (default: a@a.com) by [Yor] - time_t connect_until_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) + time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) }; #define AUTH_FIFO_SIZE 256 @@ -147,7 +147,7 @@ struct { uint32 ip; int delflag; int sex; - time_t connect_until_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) + time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) } auth_fifo[AUTH_FIFO_SIZE]; int auth_fifo_pos = 0; @@ -1718,7 +1718,7 @@ int parse_fromlogin(int fd) int login_id2 = RFIFOL(fd,10); bool result = RFIFOB(fd,14); const char* email = (const char*)RFIFOP(fd,15); - time_t connect_until = (time_t)RFIFOL(fd,55); + time_t expiration_time = (time_t)RFIFOL(fd,55); // find the session with this account id ARR_FIND( 0, fd_max, i, session[i] && (sd = (struct char_session_data*)session[i]->session_data) && @@ -1732,7 +1732,7 @@ int parse_fromlogin(int fd) WFIFOSET(i,3); } else { // success memcpy(sd->email, email, 40); - sd->connect_until_time = connect_until; + sd->expiration_time = expiration_time; char_auth_ok(i, sd); } } @@ -1750,7 +1750,7 @@ int parse_fromlogin(int fd) if( i < fd_max ) { memcpy(sd->email, RFIFOP(fd,6), 40); - sd->connect_until_time = (time_t)RFIFOL(fd,46); + sd->expiration_time = (time_t)RFIFOL(fd,46); } RFIFOSKIP(fd,50); break; @@ -2391,7 +2391,7 @@ int parse_frommap(int fd) auth_fifo[auth_fifo_pos].login_id1 = RFIFOL(fd,6); auth_fifo[auth_fifo_pos].login_id2 = RFIFOL(fd,10); auth_fifo[auth_fifo_pos].delflag = 2; - auth_fifo[auth_fifo_pos].connect_until_time = 0; // unlimited/unknown time by default (not display in map-server) + auth_fifo[auth_fifo_pos].expiration_time = 0; // unlimited/unknown time by default (not display in map-server) auth_fifo[auth_fifo_pos].ip = ntohl(RFIFOL(fd,14)); auth_fifo_pos++; WFIFOHEAD(fd,7); @@ -2436,7 +2436,7 @@ int parse_frommap(int fd) WFIFOL(map_fd,4) = RFIFOL(fd,2); //Account ID WFIFOL(map_fd,8) = RFIFOL(fd,6); //Login1 WFIFOL(map_fd,16) = RFIFOL(fd,10); //Login2 - WFIFOL(map_fd,12) = (unsigned long)0; //TODO: connect_until_time, how do I figure it out right now? + WFIFOL(map_fd,12) = (unsigned long)0; //TODO: expiration_time, how do I figure it out right now? memcpy(WFIFOP(map_fd,20), char_data, sizeof(struct mmo_charstatus)); WFIFOSET(map_fd, WFIFOW(map_fd,2)); @@ -2866,7 +2866,7 @@ int parse_char(int fd) CREATE(session[fd]->session_data, struct char_session_data, 1); sd = (struct char_session_data*)session[fd]->session_data; - sd->connect_until_time = 0; // unknown or unlimited (not displaying on map-server) + sd->expiration_time = 0; // unknown or unlimited (not displaying on map-server) sd->account_id = account_id; sd->login_id1 = login_id1; sd->login_id2 = login_id2; @@ -3014,7 +3014,7 @@ int parse_char(int fd) auth_fifo[auth_fifo_pos].login_id2 = sd->login_id2; auth_fifo[auth_fifo_pos].delflag = 0; auth_fifo[auth_fifo_pos].sex = sd->sex; - auth_fifo[auth_fifo_pos].connect_until_time = sd->connect_until_time; + auth_fifo[auth_fifo_pos].expiration_time = sd->expiration_time; auth_fifo[auth_fifo_pos].ip = session[fd]->client_addr; //Send NEW auth packet [Kevin] @@ -3038,7 +3038,7 @@ int parse_char(int fd) WFIFOL(map_fd,4) = auth_fifo[auth_fifo_pos].account_id; WFIFOL(map_fd,8) = auth_fifo[auth_fifo_pos].login_id1; WFIFOL(map_fd,16) = auth_fifo[auth_fifo_pos].login_id2; - WFIFOL(map_fd,12) = (unsigned long)auth_fifo[auth_fifo_pos].connect_until_time; + WFIFOL(map_fd,12) = (unsigned long)auth_fifo[auth_fifo_pos].expiration_time; memcpy(WFIFOP(map_fd,20), &char_dat, sizeof(struct mmo_charstatus)); WFIFOSET(map_fd, WFIFOW(map_fd,2)); diff --git a/src/ladmin/ladmin.c b/src/ladmin/ladmin.c index 89728be84..c39d03c1c 100644 --- a/src/ladmin/ladmin.c +++ b/src/ladmin/ladmin.c @@ -1419,13 +1419,13 @@ int banaddaccount(char* param) int bansetaccountsub(char* name, char* date, char* time) { int year, month, day, hour, minute, second; - time_t ban_until_time; // # of seconds 1/1/1970 (timestamp): ban time limit of the account (0 = no ban) + time_t unban_time; // # of seconds 1/1/1970 (timestamp): ban time limit of the account (0 = no ban) struct tm *tmtime; WFIFOHEAD(login_fd,30); year = month = day = hour = minute = second = 0; - ban_until_time = 0; - tmtime = localtime(&ban_until_time); // initialize + unban_time = 0; + tmtime = localtime(&unban_time); // initialize if (verify_accountname(name) == 0) { return 102; @@ -1449,7 +1449,7 @@ int bansetaccountsub(char* name, char* date, char* time) } if (atoi(date) == 0) { - ban_until_time = 0; + unban_time = 0; } else { if (year < 70) { year = year + 100; @@ -1526,8 +1526,8 @@ int bansetaccountsub(char* name, char* date, char* time) tmtime->tm_min = minute; tmtime->tm_sec = second; tmtime->tm_isdst = -1; // -1: no winter/summer time modification - ban_until_time = mktime(tmtime); - if (ban_until_time == -1) { + unban_time = mktime(tmtime); + if (unban_time == -1) { if (defaultlanguage == 'F') { ShowMessage("Date incorrecte.\n"); ShowMessage("Entrez une date et une heure svp (format: aaaa/mm/jj hh:mm:ss).\n"); @@ -1551,7 +1551,7 @@ int bansetaccountsub(char* name, char* date, char* time) WFIFOW(login_fd,0) = 0x794a; memcpy(WFIFOP(login_fd,2), name, 24); - WFIFOL(login_fd,26) = (int)ban_until_time; + WFIFOL(login_fd,26) = (int)unban_time; WFIFOSET(login_fd,30); bytes_to_read = 1; @@ -2799,7 +2799,7 @@ int timesetaccount(char* param) { char name[1023], date[1023], time[1023]; int year, month, day, hour, minute, second; - time_t connect_until_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) + time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) struct tm *tmtime; WFIFOHEAD(login_fd,30); @@ -2807,8 +2807,8 @@ int timesetaccount(char* param) memset(date, '\0', sizeof(date)); memset(time, '\0', sizeof(time)); year = month = day = hour = minute = second = 0; - connect_until_time = 0; - tmtime = localtime(&connect_until_time); // initialize + expiration_time = 0; + tmtime = localtime(&expiration_time); // initialize if (sscanf(param, "\"%[^\"]\" %s %[^\r\n]", name, date, time) < 2 && // if date = 0, time can be void sscanf(param, "'%[^']' %s %[^\r\n]", name, date, time) < 2 && // if date = 0, time can be void @@ -2852,7 +2852,7 @@ int timesetaccount(char* param) } if (atoi(date) == 0) { - connect_until_time = 0; + expiration_time = 0; } else { if (year < 70) { year = year + 100; @@ -2929,8 +2929,8 @@ int timesetaccount(char* param) tmtime->tm_min = minute; tmtime->tm_sec = second; tmtime->tm_isdst = -1; // -1: no winter/summer time modification - connect_until_time = mktime(tmtime); - if (connect_until_time == -1) { + expiration_time = mktime(tmtime); + if (expiration_time == -1) { if (defaultlanguage == 'F') { ShowMessage("Date incorrecte.\n"); ShowMessage("Ajoutez 0 ou une date et une heure svp (format: 0 ou aaaa/mm/jj hh:mm:ss).\n"); @@ -2952,7 +2952,7 @@ int timesetaccount(char* param) WFIFOW(login_fd,0) = 0x7948; memcpy(WFIFOP(login_fd,2), name, 24); - WFIFOL(login_fd,26) = (int)connect_until_time; + WFIFOL(login_fd,26) = (int)expiration_time; WFIFOSET(login_fd,30); bytes_to_read = 1; @@ -4014,8 +4014,8 @@ int parse_fromlogin(int fd) return 0; { char userid[24], error_message[20], lastlogin[24], last_ip[16], email[40], memo[255]; - time_t ban_until_time; // # of seconds 1/1/1970 (timestamp): ban time limit of the account (0 = no ban) - time_t connect_until_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) + time_t unban_time; // # of seconds 1/1/1970 (timestamp): ban time limit of the account (0 = no ban) + time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) memcpy(userid, RFIFOP(fd,7), sizeof(userid)); userid[sizeof(userid)-1] = '\0'; memcpy(error_message, RFIFOP(fd,40), sizeof(error_message)); @@ -4026,8 +4026,8 @@ int parse_fromlogin(int fd) last_ip[sizeof(last_ip)-1] = '\0'; memcpy(email, RFIFOP(fd,100), sizeof(email)); email[sizeof(email)-1] = '\0'; - connect_until_time = (time_t)RFIFOL(fd,140); - ban_until_time = (time_t)RFIFOL(fd,144); + expiration_time = (time_t)RFIFOL(fd,140); + unban_time = (time_t)RFIFOL(fd,144); memset(memo, '\0', sizeof(memo)); strncpy(memo, (const char*)RFIFOP(fd,150), RFIFOW(fd,148)); id = RFIFOL(fd,2); @@ -4121,11 +4121,11 @@ int parse_fromlogin(int fd) break; } if (defaultlanguage == 'F') { - if (ban_until_time == 0) { + if (unban_time == 0) { ShowMessage(" Banissement: non banni.\n"); } else { char tmpstr[128]; - strftime(tmpstr, 24, date_format, localtime(&ban_until_time)); + strftime(tmpstr, 24, date_format, localtime(&unban_time)); ShowMessage(" Banissement: jusqu'au %s.\n", tmpstr); } if (RFIFOL(fd,32) > 1) @@ -4133,19 +4133,19 @@ int parse_fromlogin(int fd) else ShowMessage(" Compteur: %d connexion.\n", (int)RFIFOL(fd,32)); ShowMessage(" Dernière connexion le: %s (ip: %s)\n", lastlogin, last_ip); - if (connect_until_time == 0) { + if (expiration_time == 0) { ShowMessage(" Limite de validité: illimité.\n"); } else { char tmpstr[128]; - strftime(tmpstr, 24, date_format, localtime(&connect_until_time)); + strftime(tmpstr, 24, date_format, localtime(&expiration_time)); ShowMessage(" Limite de validité: jusqu'au %s.\n", tmpstr); } } else { - if (ban_until_time == 0) { + if (unban_time == 0) { ShowMessage(" Banishment: not banished.\n"); } else { char tmpstr[128]; - strftime(tmpstr, 24, date_format, localtime(&ban_until_time)); + strftime(tmpstr, 24, date_format, localtime(&unban_time)); ShowMessage(" Banishment: until %s.\n", tmpstr); } if (RFIFOL(fd,32) > 1) @@ -4153,11 +4153,11 @@ int parse_fromlogin(int fd) else ShowMessage(" Count: %d connection.\n", (int)RFIFOL(fd,32)); ShowMessage(" Last connection at: %s (ip: %s)\n", lastlogin, last_ip); - if (connect_until_time == 0) { + if (expiration_time == 0) { ShowMessage(" Validity limit: unlimited.\n"); } else { char tmpstr[128]; - strftime(tmpstr, 24, date_format, localtime(&connect_until_time)); + strftime(tmpstr, 24, date_format, localtime(&expiration_time)); ShowMessage(" Validity limit: until %s.\n", tmpstr); } } diff --git a/src/login/admin.c b/src/login/admin.c index 64f7c1b3c..7115e6f05 100644 --- a/src/login/admin.c +++ b/src/login/admin.c @@ -117,7 +117,7 @@ int parse_admin(int fd) memcpy(WFIFOP(fd,len+5), auth_dat[j].userid, 24); WFIFOB(fd,len+29) = auth_dat[j].sex; WFIFOL(fd,len+30) = auth_dat[j].logincount; - if (auth_dat[j].state == 0 && auth_dat[j].ban_until_time != 0) // if no state and banished + if (auth_dat[j].state == 0 && auth_dat[j].unban_time != 0) // if no state and banished WFIFOL(fd,len+34) = 7; // 6 = Your are Prohibited to log in until %s else WFIFOL(fd,len+34) = auth_dat[j].state; @@ -595,7 +595,7 @@ int parse_admin(int fd) if (i != -1) { memcpy(WFIFOP(fd,6), auth_dat[i].userid, 24); ShowNotice("'ladmin': Change of a validity limit (account: %s, new validity: %d (%s), ip: %s)\n", auth_dat[i].userid, timestamp, (timestamp == 0 ? "unlimited" : tmpstr), ip); - auth_dat[i].connect_until_time = timestamp; + auth_dat[i].expiration_time = timestamp; WFIFOL(fd,2) = auth_dat[i].account_id; mmo_auth_sync(); } else { @@ -628,7 +628,7 @@ int parse_admin(int fd) memcpy(WFIFOP(fd,6), auth_dat[i].userid, 24); WFIFOL(fd,2) = auth_dat[i].account_id; ShowNotice("'ladmin': Change of the final date of a banishment (account: %s, new final date of banishment: %d (%s), ip: %s)\n", auth_dat[i].userid, timestamp, (timestamp == 0 ? "no banishment" : tmpstr), ip); - if (auth_dat[i].ban_until_time != timestamp) { + if (auth_dat[i].unban_time != timestamp) { if (timestamp != 0) { unsigned char buf[16]; WBUFW(buf,0) = 0x2731; @@ -642,7 +642,7 @@ int parse_admin(int fd) auth_fifo[j].login_id1++; // to avoid reconnection error when come back from map-server (char-server will ask again the authentication) */ } - auth_dat[i].ban_until_time = timestamp; + auth_dat[i].unban_time = timestamp; mmo_auth_sync(); } } else { @@ -671,10 +671,10 @@ int parse_admin(int fd) if (i != -1) { WFIFOL(fd,2) = auth_dat[i].account_id; memcpy(WFIFOP(fd,6), auth_dat[i].userid, 24); - if (auth_dat[i].ban_until_time == 0 || auth_dat[i].ban_until_time < time(NULL)) + if (auth_dat[i].unban_time == 0 || auth_dat[i].unban_time < time(NULL)) timestamp = time(NULL); else - timestamp = auth_dat[i].ban_until_time; + timestamp = auth_dat[i].unban_time; tmtime = localtime(×tamp); tmtime->tm_year = tmtime->tm_year + (short)RFIFOW(fd,26); tmtime->tm_mon = tmtime->tm_mon + (short)RFIFOW(fd,28); @@ -688,7 +688,7 @@ int parse_admin(int fd) timestamp = 0; strftime(tmpstr, 24, login_config.date_format, localtime(×tamp)); ShowNotice("'ladmin': Adjustment of a final date of a banishment (account: %s, (%+d y %+d m %+d d %+d h %+d mn %+d s) -> new validity: %d (%s), ip: %s)\n", auth_dat[i].userid, (short)RFIFOW(fd,26), (short)RFIFOW(fd,28), (short)RFIFOW(fd,30), (short)RFIFOW(fd,32), (short)RFIFOW(fd,34), (short)RFIFOW(fd,36), timestamp, (timestamp == 0 ? "no banishment" : tmpstr), ip); - if (auth_dat[i].ban_until_time != timestamp) { + if (auth_dat[i].unban_time != timestamp) { if (timestamp != 0) { unsigned char buf[16]; WBUFW(buf,0) = 0x2731; @@ -704,14 +704,14 @@ int parse_admin(int fd) } */ } - auth_dat[i].ban_until_time = timestamp; + auth_dat[i].unban_time = timestamp; mmo_auth_sync(); } } else { - strftime(tmpstr, 24, login_config.date_format, localtime(&auth_dat[i].ban_until_time)); - ShowNotice("'ladmin': Impossible to adjust the final date of a banishment (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> ???, ip: %s)\n", auth_dat[i].userid, auth_dat[i].ban_until_time, (auth_dat[i].ban_until_time == 0 ? "no banishment" : tmpstr), (short)RFIFOW(fd,26), (short)RFIFOW(fd,28), (short)RFIFOW(fd,30), (short)RFIFOW(fd,32), (short)RFIFOW(fd,34), (short)RFIFOW(fd,36), ip); + strftime(tmpstr, 24, login_config.date_format, localtime(&auth_dat[i].unban_time)); + ShowNotice("'ladmin': Impossible to adjust the final date of a banishment (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> ???, ip: %s)\n", auth_dat[i].userid, auth_dat[i].unban_time, (auth_dat[i].unban_time == 0 ? "no banishment" : tmpstr), (short)RFIFOW(fd,26), (short)RFIFOW(fd,28), (short)RFIFOW(fd,30), (short)RFIFOW(fd,32), (short)RFIFOW(fd,34), (short)RFIFOW(fd,36), ip); } - WFIFOL(fd,30) = (unsigned long)auth_dat[i].ban_until_time; + WFIFOL(fd,30) = (unsigned long)auth_dat[i].unban_time; } else { memcpy(WFIFOP(fd,6), account_name, 24); ShowNotice("'ladmin': Attempt to adjust the final date of a banishment of an unknown account (account: %s, ip: %s)\n", account_name, ip); @@ -775,7 +775,7 @@ int parse_admin(int fd) if (i != -1) { WFIFOL(fd,2) = auth_dat[i].account_id; memcpy(WFIFOP(fd,6), auth_dat[i].userid, 24); - timestamp = auth_dat[i].connect_until_time; + timestamp = auth_dat[i].expiration_time; if (timestamp == 0 || timestamp < time(NULL)) timestamp = time(NULL); tmtime = localtime(×tamp); @@ -787,15 +787,15 @@ int parse_admin(int fd) tmtime->tm_sec = tmtime->tm_sec + (short)RFIFOW(fd,36); timestamp = mktime(tmtime); if (timestamp != -1) { - strftime(tmpstr, 24, login_config.date_format, localtime(&auth_dat[i].connect_until_time)); + strftime(tmpstr, 24, login_config.date_format, localtime(&auth_dat[i].expiration_time)); strftime(tmpstr2, 24, login_config.date_format, localtime(×tamp)); - ShowNotice("'ladmin': Adjustment of a validity limit (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> new validity: %d (%s), ip: %s)\n", auth_dat[i].userid, auth_dat[i].connect_until_time, (auth_dat[i].connect_until_time == 0 ? "unlimited" : tmpstr), (short)RFIFOW(fd,26), (short)RFIFOW(fd,28), (short)RFIFOW(fd,30), (short)RFIFOW(fd,32), (short)RFIFOW(fd,34), (short)RFIFOW(fd,36), timestamp, (timestamp == 0 ? "unlimited" : tmpstr2), ip); - auth_dat[i].connect_until_time = timestamp; + ShowNotice("'ladmin': Adjustment of a validity limit (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> new validity: %d (%s), ip: %s)\n", auth_dat[i].userid, auth_dat[i].expiration_time, (auth_dat[i].expiration_time == 0 ? "unlimited" : tmpstr), (short)RFIFOW(fd,26), (short)RFIFOW(fd,28), (short)RFIFOW(fd,30), (short)RFIFOW(fd,32), (short)RFIFOW(fd,34), (short)RFIFOW(fd,36), timestamp, (timestamp == 0 ? "unlimited" : tmpstr2), ip); + auth_dat[i].expiration_time = timestamp; mmo_auth_sync(); - WFIFOL(fd,30) = (unsigned long)auth_dat[i].connect_until_time; + WFIFOL(fd,30) = (unsigned long)auth_dat[i].expiration_time; } else { - strftime(tmpstr, 24, login_config.date_format, localtime(&auth_dat[i].connect_until_time)); - ShowNotice("'ladmin': Impossible to adjust a validity limit (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> ???, ip: %s)\n", auth_dat[i].userid, auth_dat[i].connect_until_time, (auth_dat[i].connect_until_time == 0 ? "unlimited" : tmpstr), (short)RFIFOW(fd,26), (short)RFIFOW(fd,28), (short)RFIFOW(fd,30), (short)RFIFOW(fd,32), (short)RFIFOW(fd,34), (short)RFIFOW(fd,36), ip); + strftime(tmpstr, 24, login_config.date_format, localtime(&auth_dat[i].expiration_time)); + ShowNotice("'ladmin': Impossible to adjust a validity limit (account: %s, %d (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> ???, ip: %s)\n", auth_dat[i].userid, auth_dat[i].expiration_time, (auth_dat[i].expiration_time == 0 ? "unlimited" : tmpstr), (short)RFIFOW(fd,26), (short)RFIFOW(fd,28), (short)RFIFOW(fd,30), (short)RFIFOW(fd,32), (short)RFIFOW(fd,34), (short)RFIFOW(fd,36), ip); WFIFOL(fd,30) = 0; } } else { @@ -828,8 +828,8 @@ int parse_admin(int fd) memcpy(WFIFOP(fd,60), auth_dat[i].lastlogin, 24); memcpy(WFIFOP(fd,84), auth_dat[i].last_ip, 16); memcpy(WFIFOP(fd,100), auth_dat[i].email, 40); - WFIFOL(fd,140) = (unsigned long)auth_dat[i].connect_until_time; - WFIFOL(fd,144) = (unsigned long)auth_dat[i].ban_until_time; + WFIFOL(fd,140) = (unsigned long)auth_dat[i].expiration_time; + WFIFOL(fd,144) = (unsigned long)auth_dat[i].unban_time; WFIFOW(fd,148) = (uint16)strlen(auth_dat[i].memo); if (auth_dat[i].memo[0]) { memcpy(WFIFOP(fd,150), auth_dat[i].memo, strlen(auth_dat[i].memo)); @@ -863,8 +863,8 @@ int parse_admin(int fd) memcpy(WFIFOP(fd,60), auth_dat[i].lastlogin, 24); memcpy(WFIFOP(fd,84), auth_dat[i].last_ip, 16); memcpy(WFIFOP(fd,100), auth_dat[i].email, 40); - WFIFOL(fd,140) = (unsigned long)auth_dat[i].connect_until_time; - WFIFOL(fd,144) = (unsigned long)auth_dat[i].ban_until_time; + WFIFOL(fd,140) = (unsigned long)auth_dat[i].expiration_time; + WFIFOL(fd,144) = (unsigned long)auth_dat[i].unban_time; WFIFOW(fd,148) = (uint16)strlen(auth_dat[i].memo); if (auth_dat[i].memo[0]) { memcpy(WFIFOP(fd,150), auth_dat[i].memo, strlen(auth_dat[i].memo)); diff --git a/src/login/login.c b/src/login/login.c index 8b5243811..88832634f 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -338,7 +338,7 @@ int mmo_auth_tostr(char* str, struct mmo_account* p) str_p += sprintf(str_p, "%d\t%s\t%s\t%s\t%c\t%d\t%u\t%s\t%s\t%ld\t%s\t%s\t%ld\t", p->account_id, p->userid, p->pass, p->lastlogin, p->sex, p->logincount, p->state, p->email, p->error_message, - (long)p->connect_until_time, p->last_ip, p->memo, (long)p->ban_until_time); + (long)p->expiration_time, p->last_ip, p->memo, (long)p->unban_time); for(i = 0; i < p->account_reg2_num; i++) if (p->account_reg2[i].str[0]) @@ -358,8 +358,8 @@ int mmo_auth_init(void) int logincount, n; uint32 i, j; char line[2048], *p, userid[2048], pass[2048], lastlogin[2048], sex, email[2048], error_message[2048], last_ip[2048], memo[2048]; - long ban_until_time; - long connect_until_time; + long unban_time; + long expiration_time; char str[2048]; char v[2048]; int GM_count = 0; @@ -393,11 +393,11 @@ int mmo_auth_init(void) if (((i = sscanf(line, "%d\t%[^\t]\t%[^\t]\t%[^\t]\t%c\t%d\t%u\t" "%[^\t]\t%[^\t]\t%ld\t%[^\t]\t%[^\t]\t%ld%n", &account_id, userid, pass, lastlogin, &sex, &logincount, &state, - email, error_message, &connect_until_time, last_ip, memo, &ban_until_time, &n)) == 13 && line[n] == '\t') || + email, error_message, &expiration_time, last_ip, memo, &unban_time, &n)) == 13 && line[n] == '\t') || ((i = sscanf(line, "%d\t%[^\t]\t%[^\t]\t%[^\t]\t%c\t%d\t%u\t" "%[^\t]\t%[^\t]\t%ld\t%[^\t]\t%[^\t]%n", &account_id, userid, pass, lastlogin, &sex, &logincount, &state, - email, error_message, &connect_until_time, last_ip, memo, &n)) == 12 && line[n] == '\t')) { + email, error_message, &expiration_time, last_ip, memo, &n)) == 12 && line[n] == '\t')) { n = n + 1; // Some checks @@ -470,11 +470,11 @@ int mmo_auth_init(void) } if (i == 13) - auth_dat[auth_num].ban_until_time = (time_t)ban_until_time; + auth_dat[auth_num].unban_time = (time_t)unban_time; else - auth_dat[auth_num].ban_until_time = 0; + auth_dat[auth_num].unban_time = 0; - auth_dat[auth_num].connect_until_time = (time_t)connect_until_time; + auth_dat[auth_num].expiration_time = (time_t)expiration_time; last_ip[15] = '\0'; remove_control_chars(last_ip); @@ -575,8 +575,8 @@ int mmo_auth_init(void) // Initialization of new data strncpy(auth_dat[auth_num].email, "a@a.com", 40); strncpy(auth_dat[auth_num].error_message, "-", 20); - auth_dat[auth_num].ban_until_time = 0; - auth_dat[auth_num].connect_until_time = 0; + auth_dat[auth_num].unban_time = 0; + auth_dat[auth_num].expiration_time = 0; strncpy(auth_dat[auth_num].last_ip, "-", 16); strncpy(auth_dat[auth_num].memo, "-", 255); @@ -848,7 +848,7 @@ int mmo_auth_new(struct mmo_account* account) static int num_regs = 0; // registration counter unsigned int tick = gettick(); - time_t connect_until = 0; + time_t expiration_time = 0; unsigned int i = auth_num; // check if the account doesn't exist already @@ -889,10 +889,10 @@ int mmo_auth_new(struct mmo_account* account) auth_dat[i].state = 0; safestrncpy(auth_dat[i].email, e_mail_check(account->email) ? account->email : "a@a.com", sizeof(auth_dat[i].email)); safestrncpy(auth_dat[i].error_message, "-", sizeof(auth_dat[i].error_message)); - auth_dat[i].ban_until_time = 0; + auth_dat[i].unban_time = 0; if( login_config.start_limited_time != -1 ) - connect_until = time(NULL) + login_config.start_limited_time; - auth_dat[i].connect_until_time = connect_until; + expiration_time = time(NULL) + login_config.start_limited_time; + auth_dat[i].expiration_time = expiration_time; strncpy(auth_dat[i].last_ip, "-", 16); strncpy(auth_dat[i].memo, "-", 255); auth_dat[i].account_reg2_num = 0; @@ -1013,15 +1013,15 @@ int mmo_auth(struct login_session_data* sd) return 1; // 1 = Incorrect Password } - if( auth_dat[i].connect_until_time != 0 && auth_dat[i].connect_until_time < time(NULL) ) + if( auth_dat[i].expiration_time != 0 && auth_dat[i].expiration_time < time(NULL) ) { ShowNotice("Connection refused (account: %s, pass: %s, expired ID, ip: %s)\n", sd->userid, sd->passwd, ip); return 2; // 2 = This ID is expired } - if( auth_dat[i].ban_until_time != 0 && auth_dat[i].ban_until_time > time(NULL) ) + if( auth_dat[i].unban_time != 0 && auth_dat[i].unban_time > time(NULL) ) { - strftime(tmpstr, 20, login_config.date_format, localtime(&auth_dat[i].ban_until_time)); + strftime(tmpstr, 20, login_config.date_format, localtime(&auth_dat[i].unban_time)); tmpstr[19] = '\0'; ShowNotice("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n", sd->userid, sd->passwd, tmpstr, ip); return 6; // 6 = Your are Prohibited to log in until %s @@ -1050,7 +1050,7 @@ int mmo_auth(struct login_session_data* sd) safestrncpy(auth_dat[i].lastlogin, tmpstr, sizeof(auth_dat[i].lastlogin)); safestrncpy(auth_dat[i].last_ip, ip, sizeof(auth_dat[i].last_ip)); - auth_dat[i].ban_until_time = 0; + auth_dat[i].unban_time = 0; auth_dat[i].logincount++; // Save until for change ip/time of auth is not very useful => limited save for that @@ -1146,7 +1146,7 @@ int parse_fromchar(int fd) node->sex == sex && node->ip == ip_ ) {// found - uint32 connect_until_time; + uint32 expiration_time; char email[40]; unsigned int k; @@ -1160,12 +1160,12 @@ int parse_fromchar(int fd) if( k < auth_num ) { strcpy(email, auth_dat[k].email); - connect_until_time = (uint32)auth_dat[k].connect_until_time; + expiration_time = (uint32)auth_dat[k].expiration_time; } else { memset(email, 0, sizeof(email)); - connect_until_time = 0; + expiration_time = 0; } // send ack @@ -1176,7 +1176,7 @@ int parse_fromchar(int fd) WFIFOL(fd,10) = login_id2; WFIFOB(fd,14) = 0; memcpy(WFIFOP(fd,15), email, 40); - WFIFOL(fd,55) = connect_until_time; + WFIFOL(fd,55) = expiration_time; WFIFOSET(fd,59); } else @@ -1243,7 +1243,7 @@ int parse_fromchar(int fd) if( RFIFOREST(fd) < 6 ) return 0; { - uint32 connect_until_time = 0; + uint32 expiration_time = 0; char email[40] = ""; int account_id = RFIFOL(fd,2); @@ -1255,14 +1255,14 @@ int parse_fromchar(int fd) else { safestrncpy(email, auth_dat[i].email, sizeof(email)); - connect_until_time = (uint32)auth_dat[i].connect_until_time; + expiration_time = (uint32)auth_dat[i].expiration_time; } WFIFOHEAD(fd,50); WFIFOW(fd,0) = 0x2717; WFIFOL(fd,2) = account_id; safestrncpy((char*)WFIFOP(fd,6), email, 40); - WFIFOL(fd,46) = connect_until_time; + WFIFOL(fd,46) = expiration_time; WFIFOSET(fd,50); } break; @@ -1368,10 +1368,10 @@ int parse_fromchar(int fd) { time_t timestamp; struct tm *tmtime; - if (auth_dat[i].ban_until_time == 0 || auth_dat[i].ban_until_time < time(NULL)) + if (auth_dat[i].unban_time == 0 || auth_dat[i].unban_time < time(NULL)) timestamp = time(NULL); else - timestamp = auth_dat[i].ban_until_time; + timestamp = auth_dat[i].unban_time; tmtime = localtime(×tamp); tmtime->tm_year = tmtime->tm_year + year; tmtime->tm_mon = tmtime->tm_mon + month; @@ -1401,7 +1401,7 @@ int parse_fromchar(int fd) if( j < AUTH_FIFO_SIZE ) auth_fifo[j].login_id1++; // to avoid reconnection error when come back from map-server (char-server will ask again the authentication) */ - auth_dat[i].ban_until_time = timestamp; + auth_dat[i].unban_time = timestamp; // Save mmo_auth_sync(); } @@ -1494,11 +1494,11 @@ int parse_fromchar(int fd) if( i == auth_num ) ShowNotice("Char-server '%s': Error of UnBan request (account: %d not found, ip: %s).\n", server[id].name, account_id, ip); else - if( auth_dat[i].ban_until_time == 0 ) + if( auth_dat[i].unban_time == 0 ) ShowNotice("Char-server '%s': Error of UnBan request (account: %d, no change for unban date, ip: %s).\n", server[id].name, account_id, ip); else { - auth_dat[i].ban_until_time = 0; + auth_dat[i].unban_time = 0; ShowNotice("Char-server '%s': UnBan request (account: %d, ip: %s).\n", server[id].name, account_id, ip); } } @@ -1753,8 +1753,8 @@ void login_auth_failed(struct login_session_data* sd, int result) {// 6 = Your are Prohibited to log in until %s char tmpstr[20]; int i = search_account_index(sd->userid); - time_t ban_until_time = ( i >= 0 ) ? auth_dat[i].ban_until_time : 0; - strftime(tmpstr, 20, login_config.date_format, localtime(&ban_until_time)); + time_t unban_time = ( i >= 0 ) ? auth_dat[i].unban_time : 0; + strftime(tmpstr, 20, login_config.date_format, localtime(&unban_time)); safestrncpy((char*)WFIFOP(fd,3), tmpstr, 20); // ban timestamp goes here } WFIFOSET(fd,23); diff --git a/src/login/login.h b/src/login/login.h index 8470578aa..1147d6bb6 100644 --- a/src/login/login.h +++ b/src/login/login.h @@ -82,8 +82,8 @@ struct mmo_account { uint32 state; // packet 0x006a value + 1 (0: compte OK) char email[40]; // e-mail (by default: a@a.com) char error_message[20]; // Message of error code #6 = Your are Prohibited to log in until %s (packet 0x006a) - time_t ban_until_time; // # of seconds 1/1/1970 (timestamp): ban time limit of the account (0 = no ban) - time_t connect_until_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) + time_t unban_time; // # of seconds 1/1/1970 (timestamp): ban time limit of the account (0 = no ban) + time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) char last_ip[16]; // save of last IP of connection char memo[255]; // a memo field int account_reg2_num; diff --git a/src/login_sql/login.c b/src/login_sql/login.c index 5ec3c308d..81733f213 100644 --- a/src/login_sql/login.c +++ b/src/login_sql/login.c @@ -390,7 +390,7 @@ int mmo_auth_new(struct mmo_account* account) unsigned int tick = gettick(); char md5buf[32+1]; - time_t connect_until = 0; + time_t expiration_time = 0; SqlStmt* stmt; int result = 0; @@ -417,12 +417,12 @@ int mmo_auth_new(struct mmo_account* account) return result;// error or incorrect user if( login_config.start_limited_time != -1 ) - connect_until = time(NULL) + login_config.start_limited_time; + expiration_time = time(NULL) + login_config.start_limited_time; // insert new entry into db //TODO: error checking stmt = SqlStmt_Malloc(sql_handle); - SqlStmt_Prepare(stmt, "INSERT INTO `%s` (`%s`, `%s`, `sex`, `email`, `connect_until`) VALUES (?, ?, '%c', 'a@a.com', '%d')", login_db, login_db_userid, login_db_user_pass, account->sex, connect_until); + SqlStmt_Prepare(stmt, "INSERT INTO `%s` (`%s`, `%s`, `sex`, `email`, `expiration_time`) VALUES (?, ?, '%c', 'a@a.com', '%d')", login_db, login_db_userid, login_db_user_pass, account->sex, expiration_time); SqlStmt_BindParam(stmt, 0, SQLDT_STRING, account->userid, strnlen(account->userid, NAME_LENGTH)); if( login_config.use_md5_passwds ) { @@ -452,10 +452,10 @@ int mmo_auth_new(struct mmo_account* account) //----------------------------------------------------- int mmo_auth(struct login_session_data* sd) { - time_t ban_until_time; + time_t unban_time; char esc_userid[NAME_LENGTH*2+1];// escaped username char user_password[256], password[256]; - long connect_until; + long expiration_time; int state; size_t len; char* data; @@ -524,7 +524,7 @@ int mmo_auth(struct login_session_data* sd) // retrieve login entry for the specified username if( SQL_ERROR == Sql_Query(sql_handle, - "SELECT `%s`,`%s`,`lastlogin`,`sex`,`connect_until`,`ban_until`,`state`,`%s` FROM `%s` WHERE `%s`= %s '%s'", + "SELECT `%s`,`%s`,`lastlogin`,`sex`,`expiration_time`,`unban_time`,`state`,`%s` FROM `%s` WHERE `%s`= %s '%s'", login_db_account_id, login_db_user_pass, login_db_level, login_db, login_db_userid, (login_config.case_sensitive ? "BINARY" : ""), esc_userid) ) Sql_ShowDebug(sql_handle); @@ -542,8 +542,8 @@ int mmo_auth(struct login_session_data* sd) Sql_GetData(sql_handle, 1, &data, &len); safestrncpy(password, data, sizeof(password)); Sql_GetData(sql_handle, 2, &data, NULL); safestrncpy(sd->lastlogin, data, sizeof(sd->lastlogin)); Sql_GetData(sql_handle, 3, &data, NULL); sd->sex = *data; - Sql_GetData(sql_handle, 4, &data, NULL); connect_until = atol(data); - Sql_GetData(sql_handle, 5, &data, NULL); ban_until_time = atol(data); + Sql_GetData(sql_handle, 4, &data, NULL); expiration_time = atol(data); + Sql_GetData(sql_handle, 5, &data, NULL); unban_time = atol(data); Sql_GetData(sql_handle, 6, &data, NULL); state = atoi(data); Sql_GetData(sql_handle, 7, &data, NULL); sd->level = atoi(data); if( len > sizeof(password) - 1 ) @@ -565,10 +565,10 @@ int mmo_auth(struct login_session_data* sd) return 1; // 1 = Incorrect Password } - if( connect_until != 0 && connect_until < time(NULL) ) + if( expiration_time != 0 && expiration_time < time(NULL) ) return 2; // 2 = This ID is expired - if( ban_until_time != 0 && ban_until_time > time(NULL) ) + if( unban_time != 0 && unban_time > time(NULL) ) return 6; // 6 = Your are Prohibited to log in until %s if( state ) @@ -583,7 +583,7 @@ int mmo_auth(struct login_session_data* sd) if( sd->sex != 'S' && sd->account_id < START_ACCOUNT_NUM ) ShowWarning("Account %s has account id %d! Account IDs must be over %d to work properly!\n", sd->userid, sd->account_id, START_ACCOUNT_NUM); - if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `lastlogin` = NOW(), `logincount`=`logincount`+1, `last_ip`='%s', `ban_until`='0', `state`='0' WHERE `%s` = '%d'", + if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `lastlogin` = NOW(), `logincount`=`logincount`+1, `last_ip`='%s', `unban_time`='0', `state`='0' WHERE `%s` = '%d'", login_db, ip, login_db_account_id, sd->account_id) ) Sql_ShowDebug(sql_handle); @@ -682,14 +682,14 @@ int parse_fromchar(int fd) node->sex == sex && node->ip == ip_ ) {// found - uint32 connect_until_time; + uint32 expiration_time; char email[40]; // each auth entry can only be used once idb_remove(auth_db, account_id); // retrieve email and account expiration time - if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `email`,`connect_until` FROM `%s` WHERE `%s`='%d'", login_db, login_db_account_id, account_id) ) + if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `email`,`expiration_time` FROM `%s` WHERE `%s`='%d'", login_db, login_db_account_id, account_id) ) Sql_ShowDebug(sql_handle); if( SQL_SUCCESS == Sql_NextRow(sql_handle) ) { @@ -697,7 +697,7 @@ int parse_fromchar(int fd) size_t len = 0; Sql_GetData(sql_handle, 0, &data, &len); safestrncpy(email, data, sizeof(email)); - Sql_GetData(sql_handle, 1, &data, NULL); connect_until_time = (uint32)strtoul(data, NULL, 10); + Sql_GetData(sql_handle, 1, &data, NULL); expiration_time = (uint32)strtoul(data, NULL, 10); if( len > sizeof(email) ) ShowDebug("parse_fromchar:0x2712: email is too long (len=%u,maxlen=%u)\n", len, sizeof(email)); @@ -706,7 +706,7 @@ int parse_fromchar(int fd) else { memset(email, 0, sizeof(email)); - connect_until_time = 0; + expiration_time = 0; } // send ack @@ -717,7 +717,7 @@ int parse_fromchar(int fd) WFIFOL(fd,10) = login_id2; WFIFOB(fd,14) = 0; memcpy(WFIFOP(fd,15), email, 40); - WFIFOL(fd,55) = connect_until_time; + WFIFOL(fd,55) = expiration_time; WFIFOSET(fd,59); } else @@ -759,13 +759,13 @@ int parse_fromchar(int fd) if( RFIFOREST(fd) < 6 ) return 0; { - uint32 connect_until_time = 0; + uint32 expiration_time = 0; char email[40] = ""; int account_id = RFIFOL(fd,2); RFIFOSKIP(fd,6); - if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `email`,`connect_until` FROM `%s` WHERE `%s`='%d'", login_db, login_db_account_id, account_id) ) + if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `email`,`expiration_time` FROM `%s` WHERE `%s`='%d'", login_db, login_db_account_id, account_id) ) Sql_ShowDebug(sql_handle); else if( SQL_SUCCESS == Sql_NextRow(sql_handle) ) { @@ -776,7 +776,7 @@ int parse_fromchar(int fd) safestrncpy(email, data, sizeof(email)); Sql_GetData(sql_handle, 1, &data, NULL); - connect_until_time = (uint32)strtoul(data, NULL, 10); + expiration_time = (uint32)strtoul(data, NULL, 10); Sql_FreeResult(sql_handle); } @@ -785,7 +785,7 @@ int parse_fromchar(int fd) WFIFOW(fd,0) = 0x2717; WFIFOL(fd,2) = account_id; safestrncpy((char*)WFIFOP(fd,6), email, 40); - WFIFOL(fd,46) = connect_until_time; + WFIFOL(fd,46) = expiration_time; WFIFOSET(fd,50); } break; @@ -893,7 +893,7 @@ int parse_fromchar(int fd) int sec = (short)RFIFOW(fd,16); RFIFOSKIP(fd,18); - if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `ban_until` FROM `%s` WHERE `%s` = '%d'", login_db, login_db_account_id, account_id) ) + if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `unban_time` FROM `%s` WHERE `%s` = '%d'", login_db, login_db_account_id, account_id) ) Sql_ShowDebug(sql_handle); else if( SQL_SUCCESS == Sql_NextRow(sql_handle) ) { @@ -928,7 +928,7 @@ int parse_fromchar(int fd) charif_sendallwos(-1, buf, 11); } ShowNotice("Account: %d Banned until: %lu\n", account_id, (unsigned long)timestamp); - if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `ban_until` = '%lu' WHERE `%s` = '%d'", login_db, (unsigned long)timestamp, login_db_account_id, account_id) ) + if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `unban_time` = '%lu' WHERE `%s` = '%d'", login_db, (unsigned long)timestamp, login_db_account_id, account_id) ) Sql_ShowDebug(sql_handle); } } @@ -1019,11 +1019,11 @@ int parse_fromchar(int fd) int account_id = RFIFOL(fd,2); RFIFOSKIP(fd,6); - if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `ban_until` FROM `%s` WHERE `%s` = '%d'", login_db, login_db_account_id, account_id) ) + if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `unban_time` FROM `%s` WHERE `%s` = '%d'", login_db, login_db_account_id, account_id) ) Sql_ShowDebug(sql_handle); else if( Sql_NumRows(sql_handle) > 0 ) {// Found a match - if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `ban_until` = '0' WHERE `%s` = '%d'", login_db, login_db_account_id, account_id) ) + if( SQL_ERROR == Sql_Query(sql_handle, "UPDATE `%s` SET `unban_time` = '0' WHERE `%s` = '%d'", login_db, login_db_account_id, account_id) ) Sql_ShowDebug(sql_handle); } } @@ -1375,18 +1375,18 @@ void login_auth_failed(struct login_session_data* sd, int result) memset(WFIFOP(fd,3), '\0', 20); else {// 6 = Your are Prohibited to log in until %s - if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `ban_until` FROM `%s` WHERE `%s` = %s '%s'", login_db, login_db_userid, (login_config.case_sensitive ? "BINARY" : ""), esc_userid) ) + if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `unban_time` FROM `%s` WHERE `%s` = %s '%s'", login_db, login_db_userid, (login_config.case_sensitive ? "BINARY" : ""), esc_userid) ) Sql_ShowDebug(sql_handle); else if( SQL_SUCCESS == Sql_NextRow(sql_handle) ) { char* data; - time_t ban_until_time; + time_t unban_time; Sql_GetData(sql_handle, 0, &data, NULL); - ban_until_time = (time_t)strtoul(data, NULL, 10); + unban_time = (time_t)strtoul(data, NULL, 10); Sql_FreeResult(sql_handle); - strftime((char*)WFIFOP(fd,3), 20, login_config.date_format, localtime(&ban_until_time)); + strftime((char*)WFIFOP(fd,3), 20, login_config.date_format, localtime(&unban_time)); } } WFIFOSET(fd,23); diff --git a/src/login_sql/login.h b/src/login_sql/login.h index 4cee1c747..d343c0905 100644 --- a/src/login_sql/login.h +++ b/src/login_sql/login.h @@ -82,8 +82,8 @@ struct mmo_account { uint32 state; // packet 0x006a value + 1 (0: compte OK) char email[40]; // e-mail (by default: a@a.com) char error_message[20]; // Message of error code #6 = Your are Prohibited to log in until %s (packet 0x006a) - time_t ban_until_time; // # of seconds 1/1/1970 (timestamp): ban time limit of the account (0 = no ban) - time_t connect_until_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) + time_t unban_time; // # of seconds 1/1/1970 (timestamp): ban time limit of the account (0 = no ban) + time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) char last_ip[16]; // save of last IP of connection char memo[255]; // a memo field int account_reg2_num; diff --git a/src/map/chrif.c b/src/map/chrif.c index e56ae5a56..583c22ad6 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -523,7 +523,7 @@ void chrif_authreq(struct map_session_data *sd) node->char_id == sd->status.char_id && node->login_id1 == sd->login_id1) { //auth ok - if (!pc_authok(sd, node->login_id2, node->connect_until_time, node->char_dat)) + if (!pc_authok(sd, node->login_id2, node->expiration_time, node->char_dat)) chrif_auth_delete(node->account_id, node->char_id, ST_LOGIN); else { //char_dat no longer needed, but player auth is not completed yet. @@ -594,7 +594,7 @@ void chrif_authok(int fd) node->account_id=account_id; node->char_id=char_id; node->login_id1=RFIFOL(fd, 8); - node->connect_until_time=RFIFOL(fd, 12); + node->expiration_time=RFIFOL(fd, 12); node->login_id2=RFIFOL(fd, 16); memcpy(node->char_dat,status,sizeof(struct mmo_charstatus)); node->node_created=gettick(); diff --git a/src/map/chrif.h b/src/map/chrif.h index 05c6a334a..57282dcdb 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -11,7 +11,7 @@ enum sd_state { ST_LOGIN, ST_LOGOUT, ST_MAPCHANGE }; struct auth_node { int account_id, char_id; int login_id1, login_id2, sex, fd; - time_t connect_until_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) + time_t expiration_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) struct map_session_data *sd; //Data from logged on char. struct mmo_charstatus *char_dat; //Data from char server. unsigned int node_created; //timestamp for node timeouts diff --git a/src/map/pc.c b/src/map/pc.c index e9dde09de..acc8af40c 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -724,7 +724,7 @@ int pc_isequip(struct map_session_data *sd,int n) * session id‚É–â‘è–³‚µ * charŽI‚©‚ç‘—‚ç‚ê‚Ä‚«‚½ƒXƒe?ƒ^ƒX‚ðÝ’è *------------------------------------------*/ -bool pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_time, struct mmo_charstatus *st) +bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, struct mmo_charstatus *st) { int i; unsigned long tick = gettick(); @@ -849,9 +849,9 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_ } // message of the limited time of the account - if (connect_until_time != 0) { // don't display if it's unlimited or unknow value + if (expiration_time != 0) { // don't display if it's unlimited or unknow value char tmpstr[1024]; - strftime(tmpstr, sizeof(tmpstr) - 1, msg_txt(501), localtime(&connect_until_time)); // "Your account time limit is: %d-%m-%Y %H:%M:%S." + strftime(tmpstr, sizeof(tmpstr) - 1, msg_txt(501), localtime(&expiration_time)); // "Your account time limit is: %d-%m-%Y %H:%M:%S." clif_wis_message(sd->fd, wisp_server_name, tmpstr, strlen(tmpstr)+1); } diff --git a/src/txt-converter/login-converter.c b/src/txt-converter/login-converter.c index b216ff8d2..edd59d77b 100644 --- a/src/txt-converter/login-converter.c +++ b/src/txt-converter/login-converter.c @@ -92,7 +92,7 @@ int convert_login(void) FILE *fp; int account_id, logincount, user_level, state, n, i; char line[2048], userid[2048], pass[2048], lastlogin[2048], sex, email[2048], error_message[2048], last_ip[2048], memo[2048]; - int ban_until_time, connect_until_time; + int unban_time, expiration_time; char dummy[2048]; mysql_handle = Sql_Malloc(); @@ -117,7 +117,7 @@ int convert_login(void) i = sscanf(line, "%d\t%[^\t]\t%[^\t]\t%[^\t]\t%c\t%d\t%d\t%[^\t]\t%[^\t]\t%d\t%[^\t]\t%[^\t]\t%d\t%[^\r\n]%n", &account_id, userid, pass, lastlogin, &sex, &logincount, &state, - email, error_message, &connect_until_time, last_ip, memo, &ban_until_time, dummy, &n); + email, error_message, &expiration_time, last_ip, memo, &unban_time, dummy, &n); if (i < 13) { ShowWarning("Skipping incompatible data on line %d\n", line_counter); @@ -133,10 +133,10 @@ int convert_login(void) stmt = SqlStmt_Malloc(mysql_handle); if( SQL_ERROR == SqlStmt_Prepare(stmt, "REPLACE INTO `login` " - "(`account_id`, `userid`, `user_pass`, `lastlogin`, `sex`, `logincount`, `email`, `level`, `error_message`, `connect_until`, `last_ip`, `memo`, `ban_until`, `state`) " + "(`account_id`, `userid`, `user_pass`, `lastlogin`, `sex`, `logincount`, `email`, `level`, `error_message`, `expiration_time`, `last_ip`, `memo`, `unban_time`, `state`) " "VALUES " "(%d, ?, ?, '%s', '%c', %d, '%s', %d, '%s', %d, '%s', '%s', %d, %d)", - account_id, lastlogin, sex, logincount, email, user_level, error_message, connect_until_time, last_ip, memo, ban_until_time, state) + account_id, lastlogin, sex, logincount, email, user_level, error_message, expiration_time, last_ip, memo, unban_time, state) || SQL_ERROR == SqlStmt_BindParam(stmt, 0, SQLDT_STRING, userid, strnlen(userid, 255)) || SQL_ERROR == SqlStmt_BindParam(stmt, 1, SQLDT_STRING, pass, strnlen(pass, 32)) || SQL_ERROR == SqlStmt_Execute(stmt) ) |