Upgraded ASCII OLR download to discussed ideas
This commit is contained in:
parent
d6675ff4b4
commit
c3af95b799
@ -21,6 +21,11 @@ v0.83.14 23-Feb-2006
|
|||||||
mbsebbs:
|
mbsebbs:
|
||||||
Added Change archiver menu.
|
Added Change archiver menu.
|
||||||
Added crontrol-U0 to display current archiver.
|
Added crontrol-U0 to display current archiver.
|
||||||
|
Changes to OLR ASCII download:
|
||||||
|
- area files are named after area tag if possible, dots are
|
||||||
|
replaced by underscores and extension is .text.
|
||||||
|
- If available each message now has a msgid in the header.
|
||||||
|
- Added a .info file with control information.
|
||||||
|
|
||||||
mbsetup:
|
mbsetup:
|
||||||
Added archiver selection for nodes in node setup.
|
Added archiver selection for nodes in node setup.
|
||||||
|
@ -68,6 +68,7 @@ char *newtear = NULL;
|
|||||||
typedef struct _msg_high {
|
typedef struct _msg_high {
|
||||||
struct _msg_high *next;
|
struct _msg_high *next;
|
||||||
unsigned int Area;
|
unsigned int Area;
|
||||||
|
char Tag[60];
|
||||||
unsigned int LastMsg;
|
unsigned int LastMsg;
|
||||||
unsigned int Personal;
|
unsigned int Personal;
|
||||||
} msg_high;
|
} msg_high;
|
||||||
@ -79,7 +80,7 @@ typedef struct _msg_high {
|
|||||||
*/
|
*/
|
||||||
void AddArc(char *, char *);
|
void AddArc(char *, char *);
|
||||||
void tidy_high(msg_high **);
|
void tidy_high(msg_high **);
|
||||||
void fill_high(msg_high **, unsigned int, unsigned int, unsigned int);
|
void fill_high(msg_high **, unsigned int, char *, unsigned int, unsigned int);
|
||||||
void UpdateLR(msg_high *, FILE *);
|
void UpdateLR(msg_high *, FILE *);
|
||||||
void Add_Kludges(fidoaddr, int, char *);
|
void Add_Kludges(fidoaddr, int, char *);
|
||||||
int OLR_Prescan(void);
|
int OLR_Prescan(void);
|
||||||
@ -91,7 +92,7 @@ void QWK_Fetch(void);
|
|||||||
float IEEToMSBIN(float);
|
float IEEToMSBIN(float);
|
||||||
float MSBINToIEE(float);
|
float MSBINToIEE(float);
|
||||||
char *StripSpaces(char *, int);
|
char *StripSpaces(char *, int);
|
||||||
unsigned int ASCII_PackArea(unsigned int, int);
|
unsigned int ASCII_PackArea(unsigned int, int, char *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -126,13 +127,14 @@ void tidy_high(msg_high **hdp)
|
|||||||
/*
|
/*
|
||||||
* Add an area to the array
|
* Add an area to the array
|
||||||
*/
|
*/
|
||||||
void fill_high(msg_high **hdp, unsigned int Area, unsigned int Last, unsigned int Pers)
|
void fill_high(msg_high **hdp, unsigned int Area, char *tag, unsigned int Last, unsigned int Pers)
|
||||||
{
|
{
|
||||||
msg_high *tmp;
|
msg_high *tmp;
|
||||||
|
|
||||||
tmp = (msg_high *)malloc(sizeof(msg_high));
|
tmp = (msg_high *)malloc(sizeof(msg_high));
|
||||||
tmp->next = *hdp;
|
tmp->next = *hdp;
|
||||||
tmp->Area = Area;
|
tmp->Area = Area;
|
||||||
|
snprintf(tmp->Tag, 51, "%s", tag);
|
||||||
tmp->LastMsg = Last;
|
tmp->LastMsg = Last;
|
||||||
tmp->Personal = Pers;
|
tmp->Personal = Pers;
|
||||||
*hdp = tmp;
|
*hdp = tmp;
|
||||||
@ -1338,7 +1340,7 @@ void OLR_DownBW()
|
|||||||
if (Start < Msg_Highest()) {
|
if (Start < Msg_Highest()) {
|
||||||
Syslog('m', "First %lu, Last %lu, Start %lu", Msg_Lowest(), Msg_Highest(), Start);
|
Syslog('m', "First %lu, Last %lu, Start %lu", Msg_Lowest(), Msg_Highest(), Start);
|
||||||
High = BlueWave_PackArea(Start, Area);
|
High = BlueWave_PackArea(Start, Area);
|
||||||
fill_high(&mhl, Area, High, Personal);
|
fill_high(&mhl, Area, msgs.Tag, High, Personal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Syslog('+', "Area %-20s %5ld (%ld personal)", msgs.QWKname, Current, Personal);
|
Syslog('+', "Area %-20s %5ld (%ld personal)", msgs.QWKname, Current, Personal);
|
||||||
@ -2005,7 +2007,7 @@ void OLR_DownQWK(void)
|
|||||||
if (Start < Msg_Highest()) {
|
if (Start < Msg_Highest()) {
|
||||||
Syslog('m', "First %lu, Last %lu, Start %lu", Msg_Lowest(), Msg_Highest(), Start);
|
Syslog('m', "First %lu, Last %lu, Start %lu", Msg_Lowest(), Msg_Highest(), Start);
|
||||||
High = QWK_PackArea(Start, Area);
|
High = QWK_PackArea(Start, Area);
|
||||||
fill_high(&mhl, Area, High, Personal);
|
fill_high(&mhl, Area, msgs.Tag, High, Personal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Syslog('+', "Area %-20s %5ld (%ld personal)", msgs.QWKname, Current, Personal);
|
Syslog('+', "Area %-20s %5ld (%ld personal)", msgs.QWKname, Current, Personal);
|
||||||
@ -2640,10 +2642,9 @@ void OLR_DownASCII(void)
|
|||||||
{
|
{
|
||||||
struct tm *tp;
|
struct tm *tp;
|
||||||
time_t Now;
|
time_t Now;
|
||||||
char Pktname[32], *Work, *Temp, *cwd = NULL;
|
char Pktname[32], *Work, *Temp, *cwd = NULL, Atag[60], Kinds[12];
|
||||||
int Area = 0;
|
int Area = 0, i, rc = 0;
|
||||||
int rc = 0;
|
FILE *fp = NULL, *tf, *mf, *af, *inf;
|
||||||
FILE *fp = NULL, *tf, *mf, *af;
|
|
||||||
unsigned int Start, High;
|
unsigned int Start, High;
|
||||||
msg_high *tmp, *mhl = NULL;
|
msg_high *tmp, *mhl = NULL;
|
||||||
|
|
||||||
@ -2689,15 +2690,62 @@ void OLR_DownASCII(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snprintf(Atag, 9, CFG.bbsid);
|
||||||
|
tl(Atag);
|
||||||
|
snprintf(Temp, PATH_MAX, "%s/%s/tmp/%s.info", CFG.bbs_usersdir, exitinfo.Name, Atag);
|
||||||
|
if ((inf = fopen(Temp, "a+")) == NULL) {
|
||||||
|
WriteError("$Can't create %s", Temp);
|
||||||
|
fclose(tf);
|
||||||
|
fclose(fp);
|
||||||
|
fclose(mf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Area = 0;
|
Area = 0;
|
||||||
DrawBar(Pktname);
|
DrawBar(Pktname);
|
||||||
fseek(mf, sizeof(msgshdr), SEEK_SET);
|
fseek(mf, sizeof(msgshdr), SEEK_SET);
|
||||||
fseek(tf, 0, SEEK_SET);
|
fseek(tf, 0, SEEK_SET);
|
||||||
|
|
||||||
|
|
||||||
while (fread(&msgs, msgshdr.recsize, 1, mf) == 1) {
|
while (fread(&msgs, msgshdr.recsize, 1, mf) == 1) {
|
||||||
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
||||||
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
||||||
Area++;
|
Area++;
|
||||||
|
|
||||||
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec)) {
|
||||||
|
if (strlen(msgs.Tag))
|
||||||
|
snprintf(Atag, 51, msgs.Tag);
|
||||||
|
else
|
||||||
|
snprintf(Atag, 51, "%d", Area);
|
||||||
|
switch (msgs.Type) {
|
||||||
|
case LOCALMAIL: snprintf(Temp, 81, "Local");
|
||||||
|
break;
|
||||||
|
case NETMAIL: snprintf(Temp, 81, "Net");
|
||||||
|
break;
|
||||||
|
case ECHOMAIL: snprintf(Temp, 81, "Echo");
|
||||||
|
break;
|
||||||
|
case NEWS: snprintf(Temp, 81, "News");
|
||||||
|
break;
|
||||||
|
case LIST: snprintf(Temp, 81, "List");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (msgs.MsgKinds) {
|
||||||
|
case BOTH: snprintf(Kinds, 12, "PvtPub");
|
||||||
|
break;
|
||||||
|
case PRIVATE: snprintf(Kinds, 12, "Pvt");
|
||||||
|
break;
|
||||||
|
case PUBLIC: snprintf(Kinds, 12, "Pub");
|
||||||
|
break;
|
||||||
|
case RONLY: snprintf(Kinds, 12, "RO");
|
||||||
|
break;
|
||||||
|
case FTNMOD: snprintf(Kinds, 12, "FtnMod");
|
||||||
|
break;
|
||||||
|
case USEMOD: snprintf(Kinds, 12, "UseMod");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fprintf(inf, "Area %s,%s,%s,%s,%s\n", Atag, Temp, Kinds, olrtagrec.Tagged ?"S":"U", msgs.Name);
|
||||||
|
}
|
||||||
|
|
||||||
if (olrtagrec.Tagged) {
|
if (olrtagrec.Tagged) {
|
||||||
if (Msg_Open(msgs.Base)) {
|
if (Msg_Open(msgs.Base)) {
|
||||||
Current = Personal = 0;
|
Current = Personal = 0;
|
||||||
@ -2711,8 +2759,17 @@ void OLR_DownASCII(void)
|
|||||||
if (Start > Msg_Highest())
|
if (Start > Msg_Highest())
|
||||||
Start = Msg_Highest();
|
Start = Msg_Highest();
|
||||||
if (Start < Msg_Highest()) {
|
if (Start < Msg_Highest()) {
|
||||||
High = ASCII_PackArea(Start, Area);
|
if (strlen(msgs.Tag))
|
||||||
fill_high(&mhl, Area, High, Personal);
|
snprintf(Atag, 60, "%s_%s", CFG.bbsid, msgs.Tag);
|
||||||
|
else
|
||||||
|
snprintf(Atag, 60, "%s_%d", CFG.bbsid, Area);
|
||||||
|
for (i = 0; i < strlen(Atag); i++) {
|
||||||
|
if (Atag[i] == '.')
|
||||||
|
Atag[i] = '_';
|
||||||
|
Atag[i] = tolower(Atag[i]);
|
||||||
|
}
|
||||||
|
High = ASCII_PackArea(Start, Area, Atag);
|
||||||
|
fill_high(&mhl, Area, Atag, High, Personal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Syslog('+', "Area %-20s %5ld (%ld personal)", msgs.QWKname, Current, Personal);
|
Syslog('+', "Area %-20s %5ld (%ld personal)", msgs.QWKname, Current, Personal);
|
||||||
@ -2720,38 +2777,45 @@ void OLR_DownASCII(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fclose(inf);
|
||||||
|
|
||||||
if (Total) {
|
/*
|
||||||
Enter(1);
|
* In ASCII mode we allways download, even if there are no messages
|
||||||
/* Packing with */
|
* packed. However we do have a .info file for the user.
|
||||||
PUTSTR((char *)Language(446));
|
*/
|
||||||
PUTCHAR(' ');
|
Enter(1);
|
||||||
snprintf(Temp, PATH_MAX, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
/* Packing with */
|
||||||
if ((af = fopen(Temp, "r")) != NULL) {
|
PUTSTR((char *)Language(446));
|
||||||
fread(&archiverhdr, sizeof(archiverhdr), 1, af);
|
PUTCHAR(' ');
|
||||||
while (fread(&archiver, archiverhdr.recsize, 1, af) == 1) {
|
snprintf(Temp, PATH_MAX, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
||||||
if (archiver.available && (!strcmp(archiver.name, exitinfo.Archiver))) {
|
if ((af = fopen(Temp, "r")) != NULL) {
|
||||||
Syslog('+', "Archiver %s", archiver.comment);
|
fread(&archiverhdr, sizeof(archiverhdr), 1, af);
|
||||||
PUTSTR(archiver.comment);
|
while (fread(&archiver, archiverhdr.recsize, 1, af) == 1) {
|
||||||
PUTCHAR(' ');
|
if (archiver.available && (!strcmp(archiver.name, exitinfo.Archiver))) {
|
||||||
cwd = getcwd(cwd, PATH_MAX);
|
Syslog('+', "Archiver %s", archiver.comment);
|
||||||
chdir(Work);
|
PUTSTR(archiver.comment);
|
||||||
alarm_on();
|
PUTCHAR(' ');
|
||||||
|
cwd = getcwd(cwd, PATH_MAX);
|
||||||
|
chdir(Work);
|
||||||
|
alarm_on();
|
||||||
|
|
||||||
for (tmp = mhl; tmp; tmp = tmp->next) {
|
snprintf(Temp, PATH_MAX, "%s.info", CFG.bbsid);
|
||||||
snprintf(Temp, PATH_MAX, "%03d.TXT", tmp->Area);
|
tl(Temp);
|
||||||
AddArc(Temp, Pktname);
|
AddArc(Temp, Pktname);
|
||||||
}
|
|
||||||
chdir(cwd);
|
for (tmp = mhl; tmp; tmp = tmp->next) {
|
||||||
free(cwd);
|
snprintf(Temp, PATH_MAX, "%s.text", tmp->Tag);
|
||||||
cwd = NULL;
|
AddArc(Temp, Pktname);
|
||||||
snprintf(Temp, PATH_MAX, "%s/%s/tmp/%s", CFG.bbs_usersdir, exitinfo.Name, Pktname);
|
|
||||||
rc = DownloadDirect(Temp, FALSE);
|
|
||||||
unlink(Temp);
|
|
||||||
}
|
}
|
||||||
|
chdir(cwd);
|
||||||
|
free(cwd);
|
||||||
|
cwd = NULL;
|
||||||
|
snprintf(Temp, PATH_MAX, "%s/%s/tmp/%s", CFG.bbs_usersdir, exitinfo.Name, Pktname);
|
||||||
|
rc = DownloadDirect(Temp, FALSE);
|
||||||
|
unlink(Temp);
|
||||||
}
|
}
|
||||||
fclose(af);
|
|
||||||
}
|
}
|
||||||
|
fclose(af);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
@ -2780,7 +2844,7 @@ void OLR_DownASCII(void)
|
|||||||
/*
|
/*
|
||||||
* Pack messages in one mail area
|
* Pack messages in one mail area
|
||||||
*/
|
*/
|
||||||
unsigned int ASCII_PackArea(unsigned int ulLast, int Area)
|
unsigned int ASCII_PackArea(unsigned int ulLast, int Area, char *Atag)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *Work, *Temp, *Text, msg[81];
|
char *Work, *Temp, *Text, msg[81];
|
||||||
@ -2795,7 +2859,7 @@ unsigned int ASCII_PackArea(unsigned int ulLast, int Area)
|
|||||||
Work = calloc(PATH_MAX, sizeof(char));
|
Work = calloc(PATH_MAX, sizeof(char));
|
||||||
snprintf(Work, PATH_MAX, "%s/%s/tmp", CFG.bbs_usersdir, exitinfo.Name);
|
snprintf(Work, PATH_MAX, "%s/%s/tmp", CFG.bbs_usersdir, exitinfo.Name);
|
||||||
|
|
||||||
snprintf(Temp, PATH_MAX, "%s/%03d.TXT", Work, Area);
|
snprintf(Temp, PATH_MAX, "%s/%s.text", Work, Atag);
|
||||||
if ((fp = fopen(Temp, "a+")) != NULL) {
|
if ((fp = fopen(Temp, "a+")) != NULL) {
|
||||||
if (Msg_Next(&Number)) {
|
if (Msg_Next(&Number)) {
|
||||||
do {
|
do {
|
||||||
@ -2815,15 +2879,28 @@ unsigned int ASCII_PackArea(unsigned int ulLast, int Area)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Pack) {
|
if (Pack) {
|
||||||
fprintf (fp, "\n==============================================\n Msg. #%d of %d (%s)\n",
|
fprintf (fp, "===============================================================================\n");
|
||||||
|
fprintf (fp, " Msg: #%d of %d (%s)\n",
|
||||||
Number, Msg_Number(), msgs.Name);
|
Number, Msg_Number(), msgs.Name);
|
||||||
tp = localtime(&Msg.Written);
|
tp = localtime(&Msg.Written);
|
||||||
fprintf (fp, " Date: %d %s %d %2d:%02d\n", tp->tm_mday,
|
fprintf (fp, " Date: %d %s %d %2d:%02d\n", tp->tm_mday,
|
||||||
GetMonth(tp->tm_mon + 1), tp->tm_year, tp->tm_hour, tp->tm_min);
|
GetMonth(tp->tm_mon + 1), tp->tm_year, tp->tm_hour, tp->tm_min);
|
||||||
fprintf (fp, " From: %s\n", Msg.From);
|
fprintf (fp, " From: %s\n", Msg.From);
|
||||||
if (Msg.To[0])
|
if (Msg.To[0])
|
||||||
fprintf (fp, " To: %s\n", Msg.To);
|
fprintf (fp, " To: %s\n", Msg.To);
|
||||||
fprintf (fp, "Subject: %s\n----------------------------------------------\n", Msg.Subject);
|
fprintf (fp, " Subj: %s\n", Msg.Subject);
|
||||||
|
/*
|
||||||
|
* If present, add the msgid
|
||||||
|
*/
|
||||||
|
if ((Text = (char *)MsgText_First()) != NULL) {
|
||||||
|
do {
|
||||||
|
if (strncmp(Text, "\001MSGID: ", 8) == 0) {
|
||||||
|
fprintf (fp, "Msgid: %s\n", Text+8);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while ((Text = (char *)MsgText_Next()) != NULL);
|
||||||
|
}
|
||||||
|
fprintf (fp, "-------------------------------------------------------------------------------\n");
|
||||||
Current++;
|
Current++;
|
||||||
Total++;
|
Total++;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user