Reset OLR extension to 0 for the first BW download of the day.

This commit is contained in:
Andrew Leary 2017-01-19 12:07:15 -05:00
parent 330ca5153f
commit 11575f11c6
4 changed files with 16 additions and 5 deletions

2
configure vendored
View File

@ -2309,7 +2309,7 @@ SUBDIRS="lib mbcico mbfido mbmon mbsebbs mbutils mbnntp mbtask mbsetup unix lang
PACKAGE="mbsebbs" PACKAGE="mbsebbs"
MAJOR="1" MAJOR="1"
MINOR="0" MINOR="0"
REVISION="6.13" REVISION="6.14"
VERSION="$MAJOR.$MINOR.$REVISION" VERSION="$MAJOR.$MINOR.$REVISION"
COPYRIGHT="Copyright (C) 1997-2017 MBSE Development Team, All Rights Reserved" COPYRIGHT="Copyright (C) 1997-2017 MBSE Development Team, All Rights Reserved"
SHORTRIGHT="Copyright (C) 1997-2017 MBSE DevTm" SHORTRIGHT="Copyright (C) 1997-2017 MBSE DevTm"

View File

@ -12,7 +12,7 @@ AC_SUBST(SUBDIRS)
PACKAGE="mbsebbs" PACKAGE="mbsebbs"
MAJOR="1" MAJOR="1"
MINOR="0" MINOR="0"
REVISION="6.13" REVISION="6.14"
VERSION="$MAJOR.$MINOR.$REVISION" VERSION="$MAJOR.$MINOR.$REVISION"
COPYRIGHT="Copyright (C) 1997-2017 MBSE Development Team, All Rights Reserved" COPYRIGHT="Copyright (C) 1997-2017 MBSE Development Team, All Rights Reserved"
SHORTRIGHT="Copyright (C) 1997-2017 MBSE DevTm" SHORTRIGHT="Copyright (C) 1997-2017 MBSE DevTm"

View File

@ -151,6 +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 */
}; };

View File

@ -1160,8 +1160,8 @@ char *Extensions[] = {
*/ */
void OLR_DownBW() void OLR_DownBW()
{ {
struct tm *tp; struct tm *tp, *tq;
time_t Now; time_t Now, Last;
char Pktname[32], *Work, *Temp, *cwd = NULL, *p; char Pktname[32], *Work, *Temp, *cwd = NULL, *p;
int Area = 0; int Area = 0;
int RetVal = FALSE, rc = 0; int RetVal = FALSE, rc = 0;
@ -1191,9 +1191,18 @@ 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);
tq = localtime(&Last);
/* Zero all fields except the dates */
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;
if ((mktime(tp)) != (mktime(tq))) { /* Last download wasn't today */
exitinfo.OLRext = 0;
}
tp = localtime(&Now); 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);
snprintf(Work, PATH_MAX, "%s/%s/tmp", CFG.bbs_usersdir, exitinfo.Name); snprintf(Work, PATH_MAX, "%s/%s/tmp", CFG.bbs_usersdir, exitinfo.Name);
@ -1420,6 +1429,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 */
WriteExitinfo(); WriteExitinfo();
} }