Change storage format for the last OLR download date in users.data to ensure

that the file will remain portable between the x86 and x86_64 versions.
This commit is contained in:
Andrew Leary 2017-01-28 07:45:44 -05:00
parent 11575f11c6
commit 48f64baecc
4 changed files with 21 additions and 14 deletions

View File

@ -1,3 +1,12 @@
v1.0.6.14 28-Jan-2017 - Andrew Leary
1. Changed the storage format for the last OLR download
date to ensure that the users.data would remain portable
between the x86 and x86_64 versions. It should also now
properly reset the extension back to 0 with each new day.
2. Fixed a minor bug in the New User Registration function.
v1.0.6.13 15-Jan-2017 - Andrew Leary v1.0.6.13 15-Jan-2017 - Andrew Leary
1. Fixed mbfido using LFs instead of CRs in Notify messages. 1. Fixed mbfido using LFs instead of CRs in Notify messages.

View File

@ -151,7 +151,7 @@ struct userrec {
char Password[Max_passlen+1];/* Plain password */ char Password[Max_passlen+1];/* Plain password */
int Charset; /* Character set */ int Charset; /* Character set */
int OLRext; /* OLR extension counter */ int OLRext; /* OLR extension counter */
time_t OLRlast; /* OLR last download */ char OLRlast[12]; /* OLR last download date */
}; };

View File

@ -105,7 +105,7 @@ int newuser(void)
/* Set default editor */ /* Set default editor */
if (strlen(CFG.externaleditor)) if (strlen(CFG.externaleditor))
exitinfo.MsgEditor = EXTEDIT; usrconfig.MsgEditor = EXTEDIT;
else else
usrconfig.MsgEditor = FSEDIT; usrconfig.MsgEditor = FSEDIT;

View File

@ -594,7 +594,7 @@ void OLR_SyncTags()
/* /*
* If the user has no .olrtagsfile yet, we silently create * If the user has no .olrtagsfile yet, we silently create
* a new one. The user will not be notified of new areas * a new one. The user will not be notified of new areas
* of coarse. * of course.
*/ */
Syslog('m', "Creating %s", Tagname); Syslog('m', "Creating %s", Tagname);
if ((fp = fopen(Tagname, "w")) != NULL) { if ((fp = fopen(Tagname, "w")) != NULL) {
@ -1160,9 +1160,9 @@ char *Extensions[] = {
*/ */
void OLR_DownBW() void OLR_DownBW()
{ {
struct tm *tp, *tq; struct tm *tp;
time_t Now, Last; time_t Now;
char Pktname[32], *Work, *Temp, *cwd = NULL, *p; char Pktname[32], *Work, *Temp, Temp2[12], *cwd = NULL, *p;
int Area = 0; int Area = 0;
int RetVal = FALSE, rc = 0; int RetVal = FALSE, rc = 0;
FILE *fp, *tf, *mf, *af; FILE *fp, *tf, *mf, *af;
@ -1191,17 +1191,15 @@ void OLR_DownBW()
Temp = calloc(PATH_MAX, sizeof(char)); Temp = calloc(PATH_MAX, sizeof(char));
Now = time(NULL); Now = time(NULL);
Last = exitinfo.OLRlast;
tp = localtime(&Now); tp = localtime(&Now);
tq = localtime(&Last);
/* Zero all fields except the dates */ /* Build today's date for comparison to last download date */
tq->tm_sec = tq->tm_min = tq->tm_hour = tq->tm_wday = tq->tm_yday = tq->tm_isdst = 0;
tp->tm_sec = tp->tm_min = tp->tm_hour = tp->tm_wday = tp->tm_yday = tp->tm_isdst = 0; snprintf(Temp2, 12, "%02d-%02d-%04d", tp->tm_mday, tp->tm_mon +1, tp->tm_year +1900);
if ((mktime(tp)) != (mktime(tq))) { /* Last download wasn't today */
if (strcmp(Temp2,exitinfo.OLRlast)) { /* Last download wasn't today */
exitinfo.OLRext = 0; exitinfo.OLRext = 0;
} }
tp = localtime(&Now);
Syslog('+', "Preparing Blue Wave packet"); Syslog('+', "Preparing Blue Wave packet");
snprintf(Pktname, 32, "%s%s%d", CFG.bbsid , Extensions[tp->tm_wday], exitinfo.OLRext); snprintf(Pktname, 32, "%s%s%d", CFG.bbsid , Extensions[tp->tm_wday], exitinfo.OLRext);
Syslog('m', "Packet name %s", Pktname); Syslog('m', "Packet name %s", Pktname);
@ -1429,7 +1427,7 @@ void OLR_DownBW()
exitinfo.OLRext++; exitinfo.OLRext++;
if (exitinfo.OLRext > 9) if (exitinfo.OLRext > 9)
exitinfo.OLRext = 0; /* After 9, go back to 0 */ exitinfo.OLRext = 0; /* After 9, go back to 0 */
exitinfo.OLRlast = Now; /* Save the last download date/time */ snprintf(exitinfo.OLRlast, 12, "%s", Temp2); /* Save the last download date/time */
WriteExitinfo(); WriteExitinfo();
} }