2001-08-17 05:46:24 +00:00
|
|
|
|
/*****************************************************************************
|
|
|
|
|
*
|
2001-11-10 17:14:16 +00:00
|
|
|
|
* $Id$
|
2001-08-17 05:46:24 +00:00
|
|
|
|
* Purpose ...............: Offline Reader
|
|
|
|
|
*
|
|
|
|
|
*****************************************************************************
|
2002-01-07 19:16:03 +00:00
|
|
|
|
* Copyright (C) 1997-2002
|
2001-08-17 05:46:24 +00:00
|
|
|
|
*
|
|
|
|
|
* Michiel Broek FIDO: 2:280/2802
|
|
|
|
|
* Beekmansbos 10
|
|
|
|
|
* 1971 BV IJmuiden
|
|
|
|
|
* the Netherlands
|
|
|
|
|
*
|
|
|
|
|
* This file is part of MBSE BBS.
|
|
|
|
|
*
|
|
|
|
|
* This BBS is free software; you can redistribute it and/or modify it
|
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
|
* Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
|
* later version.
|
|
|
|
|
*
|
|
|
|
|
* MBSE BBS is distributed in the hope that it will be useful, but
|
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with MBSE BBS; see the file COPYING. If not, write to the Free
|
|
|
|
|
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
2002-06-30 12:48:44 +00:00
|
|
|
|
#include "../config.h"
|
2001-08-17 05:46:24 +00:00
|
|
|
|
#include "../lib/libs.h"
|
2002-06-30 12:48:44 +00:00
|
|
|
|
#include "../lib/memwatch.h"
|
2001-08-17 05:46:24 +00:00
|
|
|
|
#include "../lib/structs.h"
|
|
|
|
|
#include "../lib/mbse.h"
|
2002-01-07 19:16:03 +00:00
|
|
|
|
#include "../lib/users.h"
|
2001-08-17 05:46:24 +00:00
|
|
|
|
#include "../lib/records.h"
|
|
|
|
|
#include "../lib/bluewave.h"
|
|
|
|
|
#include "../lib/common.h"
|
|
|
|
|
#include "../lib/clcomm.h"
|
|
|
|
|
#include "../lib/msgtext.h"
|
|
|
|
|
#include "../lib/msg.h"
|
|
|
|
|
#include "mail.h"
|
|
|
|
|
#include "funcs.h"
|
2001-11-10 17:14:16 +00:00
|
|
|
|
#include "input.h"
|
2001-08-17 05:46:24 +00:00
|
|
|
|
#include "language.h"
|
|
|
|
|
#include "file.h"
|
|
|
|
|
#include "filesub.h"
|
|
|
|
|
#include "exitinfo.h"
|
|
|
|
|
#include "timeout.h"
|
|
|
|
|
#include "msgutil.h"
|
|
|
|
|
#include "pop3.h"
|
|
|
|
|
#include "offline.h"
|
2001-11-10 17:14:16 +00:00
|
|
|
|
#include "whoson.h"
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
long Total, TotalPersonal, Current, Personal;
|
|
|
|
|
unsigned long TotalPack;
|
|
|
|
|
unsigned short BarWidth;
|
|
|
|
|
lastread LR;
|
|
|
|
|
static char TempStr[128];
|
|
|
|
|
extern int do_mailout;
|
2002-07-01 19:31:15 +00:00
|
|
|
|
char *newtear = NULL;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _msg_high {
|
|
|
|
|
struct _msg_high *next;
|
|
|
|
|
unsigned long Area;
|
|
|
|
|
unsigned long LastMsg;
|
|
|
|
|
unsigned long Personal;
|
|
|
|
|
} msg_high;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Internal prototypes.
|
|
|
|
|
*/
|
|
|
|
|
void AddArc(char *, char *);
|
|
|
|
|
void tidy_high(msg_high **);
|
|
|
|
|
void fill_high(msg_high **, unsigned long, unsigned long, unsigned long);
|
|
|
|
|
void UpdateLR(msg_high *, FILE *);
|
|
|
|
|
void Add_Kludges(fidoaddr, int, char *);
|
|
|
|
|
int OLR_Prescan(void);
|
|
|
|
|
void DrawBar(char *);
|
|
|
|
|
unsigned long BlueWave_PackArea(unsigned long, long);
|
|
|
|
|
void BlueWave_Fetch(void);
|
|
|
|
|
unsigned long QWK_PackArea(unsigned long, long);
|
|
|
|
|
void QWK_Fetch(void);
|
|
|
|
|
float IEEToMSBIN(float);
|
|
|
|
|
float MSBINToIEE(float);
|
|
|
|
|
char *StripSpaces(char *, int);
|
|
|
|
|
unsigned long ASCII_PackArea(unsigned long, long);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
|
*
|
|
|
|
|
* Global Functions
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AddArc(char *Temp, char *Pktname)
|
|
|
|
|
{
|
2002-07-01 19:31:15 +00:00
|
|
|
|
execute((char *)archiver.marc, Pktname, Temp, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
|
|
|
|
|
unlink(Temp);
|
|
|
|
|
printf(".");
|
|
|
|
|
fflush(stdout);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void tidy_high(msg_high **hdp)
|
|
|
|
|
{
|
2002-07-01 19:31:15 +00:00
|
|
|
|
msg_high *tmp, *old;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
for (tmp = *hdp; tmp; tmp = old) {
|
|
|
|
|
old = tmp->next;
|
|
|
|
|
free(tmp);
|
|
|
|
|
}
|
|
|
|
|
*hdp = NULL;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Add an area to the array
|
|
|
|
|
*/
|
|
|
|
|
void fill_high(msg_high **hdp, unsigned long Area, unsigned long Last, unsigned long Pers)
|
|
|
|
|
{
|
2002-07-01 19:31:15 +00:00
|
|
|
|
msg_high *tmp;
|
|
|
|
|
|
|
|
|
|
tmp = (msg_high *)malloc(sizeof(msg_high));
|
|
|
|
|
tmp->next = *hdp;
|
|
|
|
|
tmp->Area = Area;
|
|
|
|
|
tmp->LastMsg = Last;
|
|
|
|
|
tmp->Personal = Pers;
|
|
|
|
|
*hdp = tmp;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateLR(msg_high *mhl, FILE *mf)
|
|
|
|
|
{
|
2002-07-01 19:31:15 +00:00
|
|
|
|
char *p;
|
|
|
|
|
msg_high *tmp;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(YELLOW, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Updating lastread pointer */
|
|
|
|
|
printf("%s\n", (char *)Language(449));
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(LIGHTMAGENTA, BLACK);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
for (tmp = mhl; tmp; tmp = tmp->next) {
|
|
|
|
|
printf(".");
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
fseek(mf, ((tmp->Area -1) * (msgshdr.recsize + msgshdr.syssize)) + msgshdr.hdrsize, SEEK_SET);
|
|
|
|
|
fread(&msgs, msgshdr.recsize, 1, mf);
|
|
|
|
|
if (Msg_Open(msgs.Base)) {
|
|
|
|
|
if (Msg_Lock(30L)) {
|
|
|
|
|
if (tmp->Personal)
|
|
|
|
|
Syslog('?', "Personal messages to update");
|
|
|
|
|
|
|
|
|
|
LR.UserID = grecno;
|
|
|
|
|
p = xstrcpy(exitinfo.sUserName);
|
|
|
|
|
if (Msg_GetLastRead(&LR) == TRUE) {
|
|
|
|
|
LR.LastReadMsg = tmp->LastMsg;
|
|
|
|
|
if (tmp->LastMsg > LR.HighReadMsg)
|
|
|
|
|
LR.HighReadMsg = tmp->LastMsg;
|
|
|
|
|
if (LR.HighReadMsg > Msg_Highest()) {
|
|
|
|
|
Syslog('?', "Highread was too high");
|
|
|
|
|
LR.HighReadMsg = Msg_Highest();
|
|
|
|
|
}
|
|
|
|
|
LR.UserCRC = StringCRC32(tl(p));
|
|
|
|
|
if (!Msg_SetLastRead(LR))
|
|
|
|
|
WriteError("Error update lastread");
|
|
|
|
|
} else {
|
|
|
|
|
/*
|
|
|
|
|
* Append new lastread pointer
|
|
|
|
|
*/
|
|
|
|
|
LR.UserCRC = StringCRC32(tl(p));
|
|
|
|
|
LR.UserID = grecno;
|
|
|
|
|
LR.LastReadMsg = tmp->LastMsg;
|
|
|
|
|
LR.HighReadMsg = tmp->LastMsg;
|
|
|
|
|
if (!Msg_NewLastRead(LR))
|
|
|
|
|
WriteError("Can't append new lastread");
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-01 19:31:15 +00:00
|
|
|
|
free(p);
|
|
|
|
|
Msg_UnLock();
|
|
|
|
|
}
|
|
|
|
|
Msg_Close();
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-01 19:31:15 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Add message kludges at the start, append the message text and add
|
|
|
|
|
* trailing kludges, tearline and originline.
|
|
|
|
|
*/
|
|
|
|
|
void Add_Kludges(fidoaddr dest, int IsReply, char *fn)
|
|
|
|
|
{
|
2002-07-01 19:31:15 +00:00
|
|
|
|
FILE *tp;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
Add_Headkludges(fido2faddr(dest), IsReply);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
if ((tp = fopen(fn, "r")) != NULL) {
|
|
|
|
|
Msg_Write(tp);
|
|
|
|
|
fclose(tp);
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 21:16:23 +00:00
|
|
|
|
Add_Footkludges(FALSE, newtear, FALSE);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
Msg_AddMsg();
|
2002-07-03 20:01:33 +00:00
|
|
|
|
Msg_UnLock();
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
|
*
|
|
|
|
|
* Offline Configuration
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Tag areas, called from menu.
|
|
|
|
|
*/
|
|
|
|
|
void OLR_TagArea()
|
|
|
|
|
{
|
2002-07-01 19:31:15 +00:00
|
|
|
|
char *Msgname, *Tagname;
|
|
|
|
|
FILE *ma, *tf;
|
|
|
|
|
char *buf;
|
|
|
|
|
long total, Offset, Area;
|
|
|
|
|
int lines, input, ignore = FALSE, maxlines;
|
|
|
|
|
|
|
|
|
|
WhosDoingWhat(OLR);
|
|
|
|
|
|
|
|
|
|
Msgname = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
Tagname = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
buf = calloc(81, sizeof(char));
|
|
|
|
|
|
|
|
|
|
sprintf(Msgname, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
|
|
|
|
sprintf(Tagname, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
|
|
|
|
|
clear();
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(YELLOW, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Tag Offline Reader message areas */
|
|
|
|
|
printf("%s\n", (char *)Language(66));
|
|
|
|
|
|
|
|
|
|
do {
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(WHITE, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Enter the name of the conference, or ? for a list: */
|
|
|
|
|
printf("\n%s", (char *)Language(228));
|
|
|
|
|
colour(CFG.InputColourF, CFG.InputColourB);
|
|
|
|
|
GetstrC(buf, 20);
|
|
|
|
|
|
|
|
|
|
if (buf[0] == '?') {
|
|
|
|
|
maxlines = lines = exitinfo.iScreenLen - 1;
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(LIGHTCYAN, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Conference Area Msgs Description */
|
|
|
|
|
printf("%s\n", (char *)Language(229));
|
|
|
|
|
if ((ma = fopen(Msgname, "r")) != NULL) {
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
|
|
|
|
Area = 0;
|
|
|
|
|
if ((tf = fopen(Tagname, "r")) != NULL) {
|
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, ma) == 1) {
|
|
|
|
|
fseek(ma, msgshdr.syssize, SEEK_CUR);
|
|
|
|
|
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
|
|
|
|
Area++;
|
|
|
|
|
if (Msg_Open(msgs.Base)) {
|
|
|
|
|
total = Msg_Number();
|
|
|
|
|
Msg_Close();
|
|
|
|
|
} else
|
|
|
|
|
total = 0;
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(CYAN, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && (!olrtagrec.Tagged) && strlen(msgs.QWKname)) {
|
|
|
|
|
if ( (lines != 0) || (ignore) ) {
|
|
|
|
|
lines--;
|
|
|
|
|
printf("%-20.20s %-5ld %-5ld %s\n", msgs.QWKname, Area, total, msgs.Name);
|
|
|
|
|
}
|
|
|
|
|
if (lines == 0) {
|
|
|
|
|
fflush(stdin);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(WHITE, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* More (Y/n/=) */
|
|
|
|
|
printf("%s%c\x08", (char *) Language(61),Keystroke(61,0));
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
alarm_on();
|
|
|
|
|
input = toupper(Getone());
|
|
|
|
|
printf("%c\r",input);
|
|
|
|
|
if ((input == Keystroke(61, 0)) || (input == '\r'))
|
|
|
|
|
lines = maxlines;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
if (input == Keystroke(61, 1)) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
if (input == Keystroke(61, 2))
|
|
|
|
|
ignore = TRUE;
|
|
|
|
|
else
|
|
|
|
|
lines = maxlines;
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(CYAN, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-01 19:31:15 +00:00
|
|
|
|
}
|
|
|
|
|
fclose(tf);
|
|
|
|
|
}
|
|
|
|
|
fclose(ma);
|
|
|
|
|
}
|
|
|
|
|
} else if (buf[0] != '\0') {
|
|
|
|
|
if (atoi(buf) != 0) {
|
|
|
|
|
if ((ma = fopen(Msgname, "r")) != NULL) {
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
|
|
|
|
Offset = msgshdr.hdrsize + ((atoi(buf)-1) * (msgshdr.recsize + msgshdr.syssize));
|
|
|
|
|
fseek(ma, Offset, SEEK_SET);
|
|
|
|
|
if (fread(&msgs, msgshdr.recsize, 1, ma) == 1) {
|
|
|
|
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && strlen(msgs.QWKname)) {
|
|
|
|
|
if ((tf = fopen(Tagname, "r+")) != NULL) {
|
|
|
|
|
fseek(tf, (atoi(buf)-1) * sizeof(olrtagrec), SEEK_SET);
|
|
|
|
|
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
|
|
|
|
if (!olrtagrec.Tagged) {
|
|
|
|
|
olrtagrec.Tagged = TRUE;
|
|
|
|
|
fseek(tf, - sizeof(olrtagrec), SEEK_CUR);
|
|
|
|
|
fwrite(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
|
|
|
|
Syslog('+', "OLR Tagged %d %s", atoi(buf), msgs.QWKname);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-01 19:31:15 +00:00
|
|
|
|
fclose(tf);
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-01 19:31:15 +00:00
|
|
|
|
}
|
|
|
|
|
fclose(ma);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if ((ma = fopen(Msgname, "r")) != NULL) {
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
|
|
|
|
Area = 0;
|
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, ma) == 1) {
|
|
|
|
|
fseek(ma, msgshdr.syssize, SEEK_CUR);
|
|
|
|
|
Area++;
|
|
|
|
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && strlen(msgs.QWKname)) {
|
|
|
|
|
if (strcasecmp(msgs.QWKname, buf) == 0) {
|
|
|
|
|
if ((tf = fopen(Tagname, "r+")) != NULL) {
|
|
|
|
|
fseek(tf, (Area-1) * sizeof(olrtagrec), SEEK_SET);
|
|
|
|
|
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
|
|
|
|
if (!olrtagrec.Tagged) {
|
|
|
|
|
olrtagrec.Tagged = TRUE;
|
|
|
|
|
fseek(tf, - sizeof(olrtagrec), SEEK_CUR);
|
|
|
|
|
fwrite(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
|
|
|
|
Syslog('+', "OLR Tagged %d %s", Area, msgs.QWKname);
|
|
|
|
|
}
|
|
|
|
|
fclose(tf);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fclose(ma);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
} while (buf[0] != '\0');
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
free(buf);
|
|
|
|
|
free(Tagname);
|
|
|
|
|
free(Msgname);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Untag areas, called from menu.
|
|
|
|
|
*/
|
|
|
|
|
void OLR_UntagArea()
|
|
|
|
|
{
|
2002-07-01 19:31:15 +00:00
|
|
|
|
char *Msgname, *Tagname, *buf;
|
|
|
|
|
FILE *ma, *tf;
|
|
|
|
|
long total, Offset, Area;
|
|
|
|
|
int lines, input, ignore = FALSE, maxlines;
|
|
|
|
|
|
|
|
|
|
WhosDoingWhat(OLR);
|
|
|
|
|
|
|
|
|
|
Msgname = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
Tagname = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
buf = calloc(81, sizeof(char));
|
|
|
|
|
|
|
|
|
|
sprintf(Msgname, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
|
|
|
|
sprintf(Tagname, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
|
|
|
|
|
clear();
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(YELLOW, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Untag Offline Reader message areas */
|
|
|
|
|
printf("%s\n", (char *)Language(256));
|
|
|
|
|
|
|
|
|
|
do {
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(WHITE, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Enter the name of the conference, or ? for a list: */
|
|
|
|
|
printf("\n%s", (char *)Language(228));
|
|
|
|
|
colour(CFG.InputColourF, CFG.InputColourB);
|
|
|
|
|
GetstrC(buf, 20);
|
|
|
|
|
|
|
|
|
|
if (buf[0] == '?') {
|
|
|
|
|
maxlines = lines = exitinfo.iScreenLen - 1;
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(LIGHTCYAN, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Conference Area Msgs Description */
|
|
|
|
|
printf("%s\n", (char *)Language(229));
|
|
|
|
|
if ((ma = fopen(Msgname, "r")) != NULL) {
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
|
|
|
|
Area = 0;
|
|
|
|
|
if ((tf = fopen(Tagname, "r")) != NULL) {
|
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, ma) == 1) {
|
|
|
|
|
fseek(ma, msgshdr.syssize, SEEK_CUR);
|
|
|
|
|
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
|
|
|
|
Area++;
|
|
|
|
|
if (Msg_Open(msgs.Base)) {
|
|
|
|
|
total = Msg_Number();
|
|
|
|
|
Msg_Close();
|
|
|
|
|
} else
|
|
|
|
|
total = 0;
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(CYAN, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && olrtagrec.Tagged && strlen(msgs.QWKname)) {
|
|
|
|
|
if ( (lines != 0) || (ignore) ) {
|
|
|
|
|
lines--;
|
|
|
|
|
printf("%-20.20s %-5ld %-5ld %s\n", msgs.QWKname, Area, total, msgs.Name);
|
|
|
|
|
}
|
|
|
|
|
if (lines == 0) {
|
|
|
|
|
fflush(stdin);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(WHITE, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* More (Y/n/=) */
|
|
|
|
|
printf("%s%c\x08", (char *) Language(61),Keystroke(61,0));
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
alarm_on();
|
|
|
|
|
input = toupper(Getone());
|
|
|
|
|
printf("%c\r",input);
|
|
|
|
|
if ((input == Keystroke(61, 0)) || (input == '\r'))
|
|
|
|
|
lines = maxlines;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
if (input == Keystroke(61, 1)) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
if (input == Keystroke(61, 2))
|
|
|
|
|
ignore = TRUE;
|
|
|
|
|
else
|
|
|
|
|
lines = maxlines;
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(CYAN, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-01 19:31:15 +00:00
|
|
|
|
}
|
|
|
|
|
fclose(tf);
|
|
|
|
|
}
|
|
|
|
|
fclose(ma);
|
|
|
|
|
}
|
|
|
|
|
} else if (buf[0] != '\0') {
|
|
|
|
|
if (atoi(buf) != 0) {
|
|
|
|
|
if ((ma = fopen(Msgname, "r")) != NULL) {
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
|
|
|
|
Offset = msgshdr.hdrsize + ((atoi(buf)-1) * (msgshdr.recsize + msgshdr.syssize));
|
|
|
|
|
fseek(ma, Offset, SEEK_SET);
|
|
|
|
|
if (fread(&msgs, msgshdr.recsize, 1, ma) == 1) {
|
|
|
|
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && strlen(msgs.QWKname)) {
|
|
|
|
|
if ((tf = fopen(Tagname, "r+")) != NULL) {
|
|
|
|
|
fseek(tf, (atoi(buf)-1) * sizeof(olrtagrec), SEEK_SET);
|
|
|
|
|
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
|
|
|
|
if (olrtagrec.Tagged) {
|
|
|
|
|
if (msgs.OLR_Forced) {
|
|
|
|
|
printf("Area cannot be switched off\n");
|
|
|
|
|
} else {
|
|
|
|
|
olrtagrec.Tagged = FALSE;
|
|
|
|
|
fseek(tf, - sizeof(olrtagrec), SEEK_CUR);
|
|
|
|
|
fwrite(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
|
|
|
|
Syslog('+', "OLR Untagged %d %s", atoi(buf), msgs.QWKname);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fclose(tf);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fclose(ma);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if ((ma = fopen(Msgname, "r")) != NULL) {
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
|
|
|
|
Area = 0;
|
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, ma) == 1) {
|
|
|
|
|
fseek(ma, msgshdr.syssize, SEEK_CUR);
|
|
|
|
|
Area++;
|
|
|
|
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && strlen(msgs.QWKname)) {
|
|
|
|
|
if (strcasecmp(msgs.QWKname, buf) == 0) {
|
|
|
|
|
if ((tf = fopen(Tagname, "r+")) != NULL) {
|
|
|
|
|
fseek(tf, (Area-1) * sizeof(olrtagrec), SEEK_SET);
|
|
|
|
|
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
|
|
|
|
if (olrtagrec.Tagged) {
|
|
|
|
|
if (msgs.OLR_Forced) {
|
|
|
|
|
printf("Area cannot be switched off\n");
|
|
|
|
|
} else {
|
|
|
|
|
olrtagrec.Tagged = FALSE;
|
|
|
|
|
fseek(tf, - sizeof(olrtagrec), SEEK_CUR);
|
|
|
|
|
fwrite(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
|
|
|
|
Syslog('+', "OLR Untagged %d %s", Area, msgs.QWKname);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-01 19:31:15 +00:00
|
|
|
|
}
|
|
|
|
|
fclose(tf);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-01 19:31:15 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-01 19:31:15 +00:00
|
|
|
|
}
|
|
|
|
|
fclose(ma);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
} while (buf[0] != '\0');
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
free(buf);
|
|
|
|
|
free(Tagname);
|
|
|
|
|
free(Msgname);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void New_Hdr(void);
|
|
|
|
|
void New_Hdr()
|
|
|
|
|
{
|
2002-07-01 19:31:15 +00:00
|
|
|
|
char *temp;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
temp = calloc(128, sizeof(char));
|
2002-07-01 19:31:15 +00:00
|
|
|
|
clear();
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(YELLOW, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* New or deleted mail areas at */
|
|
|
|
|
sprintf(temp, "%s%s", (char *) Language(364), CFG.bbs_name);
|
|
|
|
|
Center(temp);
|
|
|
|
|
free(temp);
|
|
|
|
|
printf("\n");
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(WHITE, BLUE);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Area State Type Description */
|
|
|
|
|
printf("%-79s\n", (char *) Language(365));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void New_Area(long);
|
|
|
|
|
void New_Area(long Area)
|
|
|
|
|
{
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(LIGHTCYAN, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* New */
|
|
|
|
|
printf("%4ld %s", Area, (char *)Language(391));
|
|
|
|
|
switch (msgs.Type) {
|
|
|
|
|
case LOCALMAIL: printf(Language(392)); /* Local */
|
|
|
|
|
break;
|
|
|
|
|
case NETMAIL: printf(Language(393)); /* Netmail */
|
|
|
|
|
break;
|
|
|
|
|
case LIST:
|
|
|
|
|
case ECHOMAIL: printf(Language(394)); /* Echomail */
|
|
|
|
|
break;
|
|
|
|
|
case NEWS: printf(Language(395)); /* News */
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
printf("%s\n", msgs.Name);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Old_Area(long);
|
|
|
|
|
void Old_Area(long Area)
|
|
|
|
|
{
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(LIGHTRED, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Del */
|
|
|
|
|
printf("%4ld %s\n", Area, (char *)Language(397));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Sync tagged areas file. If CFG.NewAreas is on then we show the
|
|
|
|
|
* changed areas to the user. This one is called by user.c during login.
|
|
|
|
|
*/
|
|
|
|
|
void OLR_SyncTags()
|
|
|
|
|
{
|
2003-03-02 13:29:33 +00:00
|
|
|
|
char *Tagname, *Msgname;
|
|
|
|
|
FILE *fp, *ma;
|
|
|
|
|
long Area;
|
|
|
|
|
int Changed = FALSE;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
Tagname = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
Msgname = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
sprintf(Tagname, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
sprintf(Msgname, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
|
|
|
|
|
|
|
|
|
if ((fp = fopen(Tagname, "r+")) == NULL) {
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* If the user has no .olrtagsfile yet, we silently create
|
|
|
|
|
* a new one. The user will not be notified of new areas
|
|
|
|
|
* of coarse.
|
|
|
|
|
*/
|
|
|
|
|
Syslog('m', "Creating %s", Tagname);
|
|
|
|
|
if ((fp = fopen(Tagname, "w")) != NULL) {
|
|
|
|
|
|
|
|
|
|
if ((ma = fopen(Msgname, "r")) != NULL) {
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
|
|
|
|
|
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, ma) == 1) {
|
|
|
|
|
memset(&olrtagrec, 0, sizeof(olrtagrec));
|
|
|
|
|
if ((msgs.Active) && Access(exitinfo.Security, msgs.RDSec) && strlen(msgs.QWKname)) {
|
|
|
|
|
olrtagrec.Available = TRUE;
|
|
|
|
|
olrtagrec.ScanNew = TRUE;
|
|
|
|
|
if (msgs.OLR_Forced || msgs.OLR_Default)
|
|
|
|
|
olrtagrec.Tagged = TRUE;
|
|
|
|
|
}
|
|
|
|
|
fwrite(&olrtagrec, sizeof(olrtagrec), 1, fp);
|
|
|
|
|
fseek(ma, msgshdr.syssize, SEEK_CUR);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
fclose(ma);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
/*
|
|
|
|
|
* The user has been here before...
|
|
|
|
|
*/
|
|
|
|
|
if ((ma = fopen(Msgname, "r")) != NULL) {
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
|
|
|
|
Area = 0;
|
|
|
|
|
|
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, ma) == 1) {
|
|
|
|
|
Area++;
|
|
|
|
|
|
|
|
|
|
if (fread(&olrtagrec, sizeof(olrtagrec), 1, fp) == 1) {
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Check if this is a new area for the user.
|
|
|
|
|
*/
|
|
|
|
|
if ((msgs.Active) && Access(exitinfo.Security, msgs.RDSec) && strlen(msgs.QWKname) && (!olrtagrec.Available)) {
|
|
|
|
|
Syslog('m', "New msg area %ld %s", Area, msgs.Name);
|
|
|
|
|
fseek(fp, - sizeof(olrtagrec), SEEK_CUR);
|
|
|
|
|
olrtagrec.Available = TRUE;
|
|
|
|
|
olrtagrec.ScanNew = TRUE;
|
|
|
|
|
if (msgs.OLR_Forced || msgs.OLR_Default)
|
|
|
|
|
olrtagrec.Tagged = TRUE;
|
|
|
|
|
fwrite(&olrtagrec, sizeof(olrtagrec), 1, fp);
|
|
|
|
|
if (CFG.NewAreas) {
|
|
|
|
|
if (!Changed) {
|
|
|
|
|
New_Hdr();
|
|
|
|
|
Changed = TRUE;
|
|
|
|
|
}
|
|
|
|
|
New_Area(Area);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
/*
|
|
|
|
|
* Check if this area is no longer
|
|
|
|
|
* available for the user.
|
|
|
|
|
*/
|
|
|
|
|
if (((!msgs.Active) || (!Access(exitinfo.Security, msgs.RDSec))) && olrtagrec.Available) {
|
|
|
|
|
Syslog('m', "Deleted msg area %ld", Area);
|
|
|
|
|
fseek(fp, - sizeof(olrtagrec), SEEK_CUR);
|
|
|
|
|
olrtagrec.Available = FALSE;
|
|
|
|
|
olrtagrec.ScanNew = FALSE;
|
|
|
|
|
olrtagrec.Tagged = FALSE;
|
|
|
|
|
fwrite(&olrtagrec, sizeof(olrtagrec), 1, fp);
|
|
|
|
|
if (CFG.NewAreas) {
|
|
|
|
|
if (!Changed) {
|
|
|
|
|
New_Hdr();
|
|
|
|
|
Changed = TRUE;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-03-02 13:29:33 +00:00
|
|
|
|
Old_Area(Area);
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-03-02 13:29:33 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
} else {
|
|
|
|
|
/*
|
|
|
|
|
* If the number if msg areas was increased,
|
|
|
|
|
* append a new tagrecord.
|
|
|
|
|
*/
|
|
|
|
|
memset(&olrtagrec, 0, sizeof(olrtagrec));
|
|
|
|
|
if ((msgs.Active) && Access(exitinfo.Security, msgs.RDSec) && strlen(msgs.QWKname)) {
|
|
|
|
|
Syslog('m', "Append new area %ld %s", Area, msgs.Name);
|
|
|
|
|
olrtagrec.Available = TRUE;
|
|
|
|
|
olrtagrec.ScanNew = TRUE;
|
|
|
|
|
if (msgs.OLR_Forced || msgs.OLR_Default)
|
|
|
|
|
olrtagrec.Tagged = TRUE;
|
|
|
|
|
if (CFG.NewAreas) {
|
|
|
|
|
if (!Changed) {
|
|
|
|
|
New_Hdr();
|
|
|
|
|
Changed = TRUE;
|
|
|
|
|
}
|
|
|
|
|
New_Area(Area);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fwrite(&olrtagrec, sizeof(olrtagrec), 1, fp);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-03-02 13:29:33 +00:00
|
|
|
|
fseek(ma, msgshdr.syssize, SEEK_CUR);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fclose(ma);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-03-02 13:29:33 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
fclose(fp);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if (Changed) {
|
|
|
|
|
colour(LIGHTGREEN, BLACK);
|
|
|
|
|
fLine(79);
|
|
|
|
|
Pause();
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
SetMsgArea(exitinfo.iLastMsgArea);
|
|
|
|
|
free(Tagname);
|
|
|
|
|
free(Msgname);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* View tagged areas, called from menu.
|
|
|
|
|
*/
|
|
|
|
|
void OLR_ViewTags()
|
|
|
|
|
{
|
2003-03-02 13:29:33 +00:00
|
|
|
|
char *Tagname, *Msgname;
|
|
|
|
|
FILE *tf, *ma;
|
|
|
|
|
long total, Area = 0;
|
|
|
|
|
int lines, input, ignore = FALSE, maxlines;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
WhosDoingWhat(OLR);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
Tagname = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
Msgname = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
sprintf(Tagname, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
sprintf(Msgname, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if ((tf = fopen(Tagname, "r")) == NULL) {
|
|
|
|
|
WriteError("$Can't open %s", Tagname);
|
|
|
|
|
free(Tagname);
|
|
|
|
|
free(Msgname);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if ((ma = fopen(Msgname, "r")) == NULL) {
|
|
|
|
|
WriteError("$Can't open %s", Msgname);
|
|
|
|
|
fclose(tf);
|
|
|
|
|
free(Tagname);
|
|
|
|
|
free(Msgname);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
clear();
|
|
|
|
|
colour(YELLOW, BLACK);
|
|
|
|
|
/* You have selected the following Conference(s): */
|
|
|
|
|
printf ("%s\n", (char *)Language(260));
|
|
|
|
|
colour(LIGHTCYAN, BLACK);
|
|
|
|
|
/* Conference Area Msgs Description */
|
|
|
|
|
printf ("\n%s\n", (char *)Language(229));
|
|
|
|
|
colour(CYAN, BLACK);
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
maxlines = lines = exitinfo.iScreenLen - 1;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, ma) == 1) {
|
|
|
|
|
fseek(ma, msgshdr.syssize, SEEK_CUR);
|
|
|
|
|
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
|
|
|
|
Area++;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if (olrtagrec.Tagged) {
|
|
|
|
|
if (Msg_Open(msgs.Base)) {
|
|
|
|
|
total = Msg_Number();
|
|
|
|
|
Msg_Close();
|
|
|
|
|
} else
|
|
|
|
|
total = 0;
|
|
|
|
|
if ( (lines != 0) || (ignore) ) {
|
|
|
|
|
lines--;
|
|
|
|
|
printf("%-20.20s %-5ld %-5ld %s\n", msgs.QWKname, Area, total, msgs.Name);
|
|
|
|
|
}
|
|
|
|
|
if (lines == 0) {
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
colour(WHITE, BLACK);
|
|
|
|
|
/* More (Y/n/=) */
|
|
|
|
|
printf("%s%c\x08", (char *) Language(61),Keystroke(61,0));
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
alarm_on();
|
|
|
|
|
input = toupper(Getone());
|
|
|
|
|
printf("%c\r",input);
|
|
|
|
|
if ((input == Keystroke(61, 0)) || (input == '\r'))
|
|
|
|
|
lines = maxlines;
|
|
|
|
|
|
|
|
|
|
if (input == Keystroke(61, 1)) {
|
|
|
|
|
break;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if (input == Keystroke(61, 2))
|
|
|
|
|
ignore = TRUE;
|
|
|
|
|
else
|
|
|
|
|
lines = maxlines;
|
|
|
|
|
colour(CYAN, BLACK);
|
|
|
|
|
}
|
|
|
|
|
fflush(stdout);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-03-02 13:29:33 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
fclose(tf);
|
|
|
|
|
fclose(ma);
|
|
|
|
|
Pause();
|
|
|
|
|
free(Tagname);
|
|
|
|
|
free(Msgname);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Prescan all selected areas. Show the user the areas and messages in it.
|
|
|
|
|
*/
|
|
|
|
|
int OLR_Prescan()
|
|
|
|
|
{
|
2003-03-02 13:29:33 +00:00
|
|
|
|
unsigned short RetVal = FALSE, Areas;
|
|
|
|
|
unsigned long Number;
|
|
|
|
|
char *Temp;
|
|
|
|
|
FILE *mf, *tf;
|
|
|
|
|
int x;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
WhosDoingWhat(OLR);
|
|
|
|
|
clear();
|
|
|
|
|
colour(LIGHTMAGENTA, BLACK);
|
|
|
|
|
/* Offline Reader Download */
|
|
|
|
|
printf("%s\n\n", (char *)Language(277));
|
|
|
|
|
fflush(stdout);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if (exitinfo.Email)
|
|
|
|
|
check_popmail(exitinfo.Name, exitinfo.Password);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
Temp = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
sprintf(Temp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
|
|
|
|
mf = fopen(Temp, "r");
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, mf);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
sprintf(Temp, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
tf = fopen(Temp, "r");
|
|
|
|
|
Total = TotalPersonal = Areas = 0;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(WHITE, BLUE);
|
|
|
|
|
/* Forum Description Msgs. Pers. */
|
|
|
|
|
printf("\n%s\n", (char *)Language(297));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, mf) == 1) {
|
|
|
|
|
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
|
|
|
|
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && strlen(msgs.QWKname) && olrtagrec.Tagged) {
|
|
|
|
|
if (Msg_Open(msgs.Base)) {
|
|
|
|
|
Areas++;
|
|
|
|
|
Current = Personal = 0;
|
|
|
|
|
colour(LIGHTCYAN, BLACK);
|
|
|
|
|
printf("%-20.20s %-41.41s ", msgs.QWKname, msgs.Name);
|
|
|
|
|
fflush(stdout);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
memset(&LR, 0, sizeof(LR));
|
|
|
|
|
LR.UserID = grecno;
|
|
|
|
|
if (Msg_GetLastRead(&LR))
|
|
|
|
|
Number = LR.HighReadMsg;
|
|
|
|
|
else
|
|
|
|
|
Number = Msg_Lowest() -1;
|
|
|
|
|
if (Number > Msg_Highest())
|
|
|
|
|
Number = Msg_Highest();
|
|
|
|
|
if (Msg_Next(&Number)) {
|
|
|
|
|
do {
|
|
|
|
|
Msg_ReadHeader(Number);
|
|
|
|
|
Current++;
|
|
|
|
|
Total++;
|
|
|
|
|
if ((strcasecmp(Msg.To, exitinfo.sUserName) == 0) || (strcasecmp(Msg.To, exitinfo.sHandle) == 0)) {
|
|
|
|
|
Personal++;
|
|
|
|
|
TotalPersonal++;
|
|
|
|
|
} else if (msgs.Type == NETMAIL) {
|
|
|
|
|
Current--;
|
|
|
|
|
Total--;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-03-02 13:29:33 +00:00
|
|
|
|
} while (Msg_Next(&Number));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-03-02 13:29:33 +00:00
|
|
|
|
|
|
|
|
|
colour(LIGHTGREEN, BLACK);
|
|
|
|
|
printf("%5lu %5lu\n", Current, Personal);
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
Msg_Close();
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-03-02 13:29:33 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
Syslog('+', "OLR Prescan: %u Areas, %lu Messages", Areas, Total);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(LIGHTBLUE, BLACK);
|
|
|
|
|
/* Total messages found: */
|
|
|
|
|
printf("\n%s %lu\n\n", (char *)Language(338), Total);
|
|
|
|
|
if (Total == 0L) {
|
|
|
|
|
colour(YELLOW, BLACK);
|
|
|
|
|
/* No messages found to download! */
|
|
|
|
|
printf("%s\n\007", (char *)Language(374));
|
|
|
|
|
Pause();
|
|
|
|
|
} else {
|
|
|
|
|
if (CFG.OLR_MaxMsgs != 0 && Total > CFG.OLR_MaxMsgs) {
|
|
|
|
|
/* Too much messages. Only the first will be packed! */
|
|
|
|
|
printf("%s %d %s\n\n\007", (char *)Language(377), CFG.OLR_MaxMsgs, (char *)Language(411));
|
|
|
|
|
Total = CFG.OLR_MaxMsgs;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(CFG.HiliteF, CFG.HiliteB);
|
|
|
|
|
/* Do you want to download these messages [Y/n]? */
|
|
|
|
|
printf("%s", (char *)Language(425));
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
alarm_on();
|
|
|
|
|
x = toupper(Getone());
|
|
|
|
|
|
|
|
|
|
if (x != Keystroke(425, 1)) {
|
|
|
|
|
RetVal = TRUE;
|
|
|
|
|
TotalPack = Total;
|
|
|
|
|
BarWidth = 0;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-03-02 13:29:33 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if (mf != NULL)
|
|
|
|
|
fclose(mf);
|
|
|
|
|
if (tf != NULL)
|
|
|
|
|
fclose(tf);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
free(Temp);
|
|
|
|
|
return(RetVal);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Draw progess bar
|
|
|
|
|
*/
|
|
|
|
|
void DrawBar(char *Pktname)
|
|
|
|
|
{
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(YELLOW, BLACK);
|
|
|
|
|
/* Preparing packet */
|
|
|
|
|
printf("\n%s %s...\n\n", (char *)Language(445), Pktname);
|
|
|
|
|
colour(LIGHTGREEN, BLACK);
|
|
|
|
|
printf("0%% 10%% 20%% 30%% 40%% 50%% 60%% 70%% 80%% 90%% 100%%\n");
|
|
|
|
|
printf("|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|\r");
|
|
|
|
|
fflush(stdout);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OLR_RestrictDate()
|
|
|
|
|
{
|
2003-03-02 13:29:33 +00:00
|
|
|
|
WhosDoingWhat(OLR);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
printf("Not Yet Implemented\n");
|
|
|
|
|
Pause();
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
VOID TOffline::RestrictDate (VOID)
|
|
|
|
|
{
|
|
|
|
|
int dd, mm, yy;
|
|
|
|
|
CHAR Temp[32];
|
|
|
|
|
ULONG Restrict;
|
|
|
|
|
struct tm ltm;
|
|
|
|
|
class TMsgTag *MsgTag = User->MsgTag;
|
|
|
|
|
|
|
|
|
|
memcpy (<m, localtime ((time_t *)&User->LastCall), sizeof (struct tm));
|
|
|
|
|
Embedded->Printf ("\n\026\001\017Enter date of oldest message to pack, or press <enter> for %d-%02d-%d: ", ltm.tm_mday, ltm.tm_mon + 1, ltm.tm_year % 100);
|
|
|
|
|
Embedded->Input (Temp, 10);
|
|
|
|
|
|
|
|
|
|
if (Embedded->AbortSession () == FALSE) {
|
|
|
|
|
Restrict = User->LastCall;
|
|
|
|
|
if (Temp[0] != '\0') {
|
|
|
|
|
sscanf (Temp, "%d-%d-%d", &dd, &mm, &yy);
|
|
|
|
|
if (yy < 90)
|
|
|
|
|
yy += 100;
|
|
|
|
|
memset (<m, 0, sizeof (struct tm));
|
|
|
|
|
ltm.tm_mday = dd;
|
|
|
|
|
ltm.tm_mon = mm - 1;
|
|
|
|
|
ltm.tm_year = yy;
|
|
|
|
|
Restrict = mktime (<m);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (MsgTag->First () == TRUE)
|
|
|
|
|
do {
|
|
|
|
|
if (MsgTag->Tagged == TRUE) {
|
|
|
|
|
MsgTag->LastRead = 0L;
|
|
|
|
|
MsgTag->OlderMsg = Restrict;
|
|
|
|
|
MsgTag->Update ();
|
|
|
|
|
}
|
|
|
|
|
} while (MsgTag->Next () == TRUE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
USHORT TOffline::TooOld (ULONG Restrict, class TMsgBase *Msg)
|
|
|
|
|
{
|
|
|
|
|
USHORT RetVal = FALSE;
|
|
|
|
|
struct tm ltm;
|
|
|
|
|
|
|
|
|
|
memset (<m, 0, sizeof (struct tm));
|
|
|
|
|
ltm.tm_mday = Msg->Written.Day;
|
|
|
|
|
ltm.tm_mon = Msg->Written.Month - 1;
|
|
|
|
|
ltm.tm_year = Msg->Written.Year - 1900;
|
|
|
|
|
if (mktime (<m) < Restrict)
|
|
|
|
|
RetVal = TRUE;
|
|
|
|
|
|
|
|
|
|
return (RetVal);
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Upload offline mail. Filenames: BBSID.NEW or BBSID.REP.
|
|
|
|
|
* Should also do hhhhhhhh.SU0 for point uploads.
|
|
|
|
|
* NOTE: THE FIRST PART OF THE CODE IS FROM UPLOAD_HOME
|
|
|
|
|
*/
|
|
|
|
|
void OLR_Upload(void)
|
|
|
|
|
{
|
2003-03-02 13:29:33 +00:00
|
|
|
|
char *File, *temp, *Arc, Dirpath[PATH_MAX], Filename[81];
|
2003-02-02 12:18:03 +00:00
|
|
|
|
time_t ElapstimeStart, ElapstimeFin, iTime;
|
|
|
|
|
int err, Strlen, RetVal = FALSE;
|
|
|
|
|
FILE *fp;
|
|
|
|
|
|
|
|
|
|
if (strlen(CFG.bbsid) == 0) {
|
|
|
|
|
printf("System configuration error, inform sysop\n");
|
|
|
|
|
WriteError("Config OLR bbsid not configured");
|
|
|
|
|
Pause();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
WhosDoingWhat(OLR);
|
|
|
|
|
clear();
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(LIGHTMAGENTA, BLACK);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
/* Offline Reader Upload */
|
|
|
|
|
printf("%s\n", (char *)Language(439));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (!ForceProtocol())
|
|
|
|
|
return;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
File = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
temp = calloc(PATH_MAX, sizeof(char));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (!uProtBatch) {
|
|
|
|
|
Enter(1);
|
|
|
|
|
/* Please enter file to upload: */
|
2003-03-02 13:29:33 +00:00
|
|
|
|
pout(YELLOW, BLACK, (char *) Language(276));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
colour(CFG.InputColourF, CFG.InputColourB);
|
|
|
|
|
GetstrC(File, 80);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
Syslog('+', "Filename entered \"%s\"", File);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if ((strcmp(File, "")) == 0)
|
|
|
|
|
return;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (File[0] == '.' || File[0] == '*' || File[0] == ' ') {
|
|
|
|
|
colour(CFG.HiliteF, CFG.HiliteB);
|
|
|
|
|
/* Illegal filename! */
|
|
|
|
|
printf("\n%s\n\n", (char *) Language(247));
|
|
|
|
|
Pause();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
Strlen = strlen(File);
|
|
|
|
|
Strlen--;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (File[Strlen] == '.' || File[Strlen] == '/' || File[Strlen] == ' ') {
|
|
|
|
|
colour(CFG.HiliteF, CFG.HiliteB);
|
|
|
|
|
/* Illegal Filename! */
|
|
|
|
|
printf("\n%s\n\n", (char *) Language(247));
|
|
|
|
|
Pause();
|
|
|
|
|
return;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (strncasecmp(File, CFG.bbsid, strlen(CFG.bbsid))) {
|
|
|
|
|
colour(CFG.HiliteF, CFG.HiliteB);
|
|
|
|
|
/* Illegal filename! */
|
|
|
|
|
printf("\n%s\n\n", (char *) Language(247));
|
|
|
|
|
Pause();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Syslog('+', "Filename accepted");
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
colour(CFG.HiliteF, CFG.HiliteB);
|
|
|
|
|
/* Please start your upload now */
|
|
|
|
|
printf("\n%s, %s\n\n", sProtAdvice, (char *) Language(283));
|
|
|
|
|
if (uProtBatch)
|
|
|
|
|
Syslog('+', "Upload using %s", sProtName);
|
|
|
|
|
else
|
|
|
|
|
Syslog('+', "Upload \"%s\" using %s", File, sProtName);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
sprintf(temp, "%s/%s/upl", CFG.bbs_usersdir, exitinfo.Name);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (chdir(temp)) {
|
|
|
|
|
WriteError("$Can't chdir to %s", temp);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
fflush(stdout);
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
sleep(2);
|
|
|
|
|
ElapstimeStart = time(NULL);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
/*
|
|
|
|
|
* Get the file
|
|
|
|
|
*/
|
|
|
|
|
Altime(7200);
|
|
|
|
|
alarm_set(7190);
|
|
|
|
|
if ((err = execute(sProtUp, (char *)"", NULL, NULL, NULL, NULL))) {
|
|
|
|
|
colour(CFG.HiliteF, CFG.HiliteB);
|
|
|
|
|
WriteError("$Upload error %d, prot: %s", err, sProtUp);
|
|
|
|
|
}
|
|
|
|
|
Altime(0);
|
|
|
|
|
alarm_off();
|
|
|
|
|
alarm_on();
|
|
|
|
|
printf("\n");
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
ElapstimeFin = time(NULL);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
/*
|
|
|
|
|
* Get the upload time.
|
|
|
|
|
*/
|
|
|
|
|
iTime = ElapstimeFin - ElapstimeStart;
|
|
|
|
|
if (!iTime)
|
|
|
|
|
iTime = 1;
|
|
|
|
|
|
|
|
|
|
Syslog('m', "Transfer time %ld", iTime);
|
|
|
|
|
Home();
|
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
sprintf(Dirpath, "%s/%s/upl", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
sprintf(Filename, "%s.NEW", CFG.bbsid);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (!RetVal) {
|
2003-03-02 13:29:33 +00:00
|
|
|
|
RetVal = getfilecase(Dirpath, Filename);
|
|
|
|
|
Syslog('m', "%s RetVal=%s", Filename, RetVal?"True":"False");
|
2003-02-02 12:18:03 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (!RetVal) {
|
2003-03-02 13:29:33 +00:00
|
|
|
|
sprintf(Filename, "%s.REP", CFG.bbsid);
|
|
|
|
|
RetVal = getfilecase(Dirpath, Filename);
|
|
|
|
|
Syslog('m', "%s RetVal=%s", Filename, RetVal?"True":"False");
|
2003-02-02 12:18:03 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (RetVal == FALSE) {
|
|
|
|
|
WriteError("Invalid OLR packed received");
|
|
|
|
|
/* Invalid packet received */
|
|
|
|
|
printf("%s\n\n", (char *)Language(440));
|
|
|
|
|
sleep(2);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2003-03-02 13:29:33 +00:00
|
|
|
|
|
|
|
|
|
sprintf(File, "%s/%s", Dirpath, Filename);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
Syslog('+', "Received OLR packet %s", File);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if ((Arc = GetFileType(File)) == NULL) {
|
|
|
|
|
/* Unknown compression type */
|
|
|
|
|
printf("%s\n", (char *)Language(441));
|
|
|
|
|
Syslog('+', "Unknown compression type");
|
|
|
|
|
Pause();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
Syslog('m', "File type is %s", Arc);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
sprintf(temp, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
|
|
|
|
if ((fp = fopen(temp, "r")) == NULL)
|
|
|
|
|
return;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
fread(&archiverhdr, sizeof(archiverhdr), 1, fp);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
while (fread(&archiver, archiverhdr.recsize, 1, fp) == 1) {
|
|
|
|
|
if ((strcmp(Arc, archiver.name) == 0) && archiver.available)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (strcmp(Arc, archiver.name) || (!archiver.available)) {
|
|
|
|
|
Syslog('+', "Archiver %s not available", Arc);
|
|
|
|
|
/* Archiver not available */
|
|
|
|
|
printf("%s\n", (char *)Language(442));
|
|
|
|
|
Pause();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
Syslog('m', "Archiver %s", archiver.comment);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
colour(CFG.TextColourF, CFG.TextColourB);
|
|
|
|
|
/* Unpacking archive */
|
|
|
|
|
printf("%s ", (char *) Language(201));
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
sprintf(temp, "%s %s", archiver.funarc, File);
|
|
|
|
|
Syslog('m', "Unarc %s", temp);
|
|
|
|
|
colour(CFG.HiliteF, CFG.HiliteB);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if ((err = execute(archiver.funarc, File, NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null"))) {
|
|
|
|
|
WriteError("$Failed %s", temp);
|
|
|
|
|
/* ERROR */
|
|
|
|
|
printf("%s\n", (char *) Language(217));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
fflush(stdout);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
Pause();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
/* Ok */
|
|
|
|
|
printf("%s\n", (char *) Language(200));
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
unlink(File);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
/*
|
2003-03-02 13:29:33 +00:00
|
|
|
|
* Check for BlueWave files, case insensitive.
|
2003-02-02 12:18:03 +00:00
|
|
|
|
*/
|
|
|
|
|
RetVal = FALSE;
|
2003-03-02 13:29:33 +00:00
|
|
|
|
sprintf(Dirpath, "%s/%s", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
sprintf(Filename, "%s.UPL", CFG.bbsid);
|
|
|
|
|
RetVal = getfilecase(Dirpath, Filename);
|
|
|
|
|
Syslog('m', "%s RetVal=%s", Filename, RetVal?"True":"False");
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if (!RetVal) {
|
|
|
|
|
sprintf(Filename, "%s.REQ", CFG.bbsid);
|
|
|
|
|
RetVal = getfilecase(Dirpath, Filename);
|
|
|
|
|
Syslog('m', "%s RetVal=%s", Filename, RetVal?"True":"False");
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if (!RetVal) {
|
|
|
|
|
sprintf(Filename, "%s.OLC", CFG.bbsid);
|
|
|
|
|
RetVal = getfilecase(Dirpath, Filename);
|
|
|
|
|
Syslog('m', "%s RetVal=%s", Filename, RetVal?"True":"False");
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (RetVal) {
|
2003-03-02 13:29:33 +00:00
|
|
|
|
Syslog('+', "OLR packet is BlueWave v3");
|
2003-02-02 12:18:03 +00:00
|
|
|
|
free(File);
|
|
|
|
|
free(temp);
|
|
|
|
|
BlueWave_Fetch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
/*
|
|
|
|
|
* Check for QWK packet
|
|
|
|
|
*/
|
|
|
|
|
sprintf(Filename, "%s.MSG", CFG.bbsid);
|
|
|
|
|
RetVal = getfilecase(Dirpath, Filename);
|
|
|
|
|
Syslog('m', "%s RetVal=%s", Filename, RetVal?"True":"False");
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (RetVal) {
|
|
|
|
|
Syslog('+', "OLR packet is QWK");
|
2001-08-17 05:46:24 +00:00
|
|
|
|
free(File);
|
|
|
|
|
free(temp);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
QWK_Fetch();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WriteError("OLR_Upload: Garbage in mailpacket, clean directory!");
|
|
|
|
|
/* Unknown type mailpacket */
|
|
|
|
|
printf("%s\n", (char *)Language(443));
|
|
|
|
|
Pause();
|
|
|
|
|
free(File);
|
|
|
|
|
free(temp);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
|
*
|
|
|
|
|
* BlueWave specific functions.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *Extensions[] = {
|
2002-07-03 19:34:57 +00:00
|
|
|
|
(char *)".SU0", (char *)".MO0", (char *)".TU0", (char *)".WE0", (char *)".TH0", (char *)".FR0", (char *)".SA0"
|
2001-08-17 05:46:24 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Download a BlueWave mailpacket, called from menu.
|
|
|
|
|
*/
|
|
|
|
|
void OLR_DownBW()
|
|
|
|
|
{
|
2002-07-03 19:34:57 +00:00
|
|
|
|
struct tm *tp;
|
|
|
|
|
time_t Now;
|
|
|
|
|
char Pktname[32], *Work, *Temp;
|
|
|
|
|
long Area = 0;
|
|
|
|
|
int RetVal = FALSE, rc;
|
|
|
|
|
FILE *fp, *tf, *mf, *af;
|
|
|
|
|
INF_HEADER Inf;
|
|
|
|
|
INF_AREA_INFO AreaInf;
|
|
|
|
|
unsigned long Start, High;
|
|
|
|
|
msg_high *mhl = NULL;
|
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (strlen(CFG.bbsid) == 0) {
|
|
|
|
|
printf("System configuration error, inform sysop\n");
|
|
|
|
|
WriteError("Config OLR bbsid not configured");
|
|
|
|
|
Pause();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if (!OLR_Prescan())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Total = TotalPersonal = 0;
|
|
|
|
|
clear();
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(LIGHTBLUE, BLACK);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
/* BlueWave Offline download */
|
|
|
|
|
printf("%s\n", (char *)Language(444));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
Work = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
Temp = calloc(PATH_MAX, sizeof(char));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
Now = time(NULL);
|
|
|
|
|
tp = localtime(&Now);
|
|
|
|
|
Syslog('+', "Preparing BlueWave packet");
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
sprintf(Pktname, "%s%s", CFG.bbsid , Extensions[tp->tm_wday]);
|
|
|
|
|
Syslog('m', "Packet name %s", Pktname);
|
|
|
|
|
sprintf(Work, "%s/%s/tmp", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
Syslog('m', "Work path %s", Work);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
sprintf(Temp, "%s/%s.INF", Work, CFG.bbsid);
|
|
|
|
|
if ((fp = fopen(Temp, "w+")) == NULL) {
|
|
|
|
|
WriteError("$Can't create %s", Temp);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
/*
|
|
|
|
|
* Write the info header.
|
|
|
|
|
*/
|
|
|
|
|
memset(&Inf, 0, sizeof(Inf));
|
|
|
|
|
Inf.ver = PACKET_LEVEL;
|
|
|
|
|
strcpy((char *)Inf.loginname, exitinfo.sUserName);
|
|
|
|
|
strcpy((char *)Inf.aliasname, exitinfo.sHandle);
|
|
|
|
|
Inf.zone = CFG.aka[0].zone;
|
|
|
|
|
Inf.net = CFG.aka[0].net;
|
|
|
|
|
Inf.node = CFG.aka[0].node;
|
|
|
|
|
Inf.point = CFG.aka[0].point;
|
|
|
|
|
strcpy((char *)Inf.sysop, CFG.sysop_name);
|
|
|
|
|
strcpy((char *)Inf.systemname, CFG.bbs_name);
|
|
|
|
|
Inf.maxfreqs = CFG.OLR_MaxReq;
|
|
|
|
|
if (exitinfo.HotKeys)
|
|
|
|
|
Inf.uflags |= INF_HOTKEYS;
|
|
|
|
|
if (exitinfo.GraphMode)
|
|
|
|
|
Inf.uflags |= INF_GRAPHICS;
|
|
|
|
|
if (exitinfo.OL_ExtInfo)
|
|
|
|
|
Inf.uflags |= INF_EXT_INFO;
|
|
|
|
|
Inf.credits = exitinfo.Credit;
|
|
|
|
|
Inf.inf_header_len = sizeof(INF_HEADER);
|
|
|
|
|
Inf.inf_areainfo_len = sizeof(INF_AREA_INFO);
|
|
|
|
|
Inf.mix_structlen = sizeof(MIX_REC);
|
|
|
|
|
Inf.fti_structlen = sizeof(FTI_REC);
|
|
|
|
|
Inf.uses_upl_file = TRUE;
|
|
|
|
|
Inf.can_forward = TRUE;
|
|
|
|
|
strcpy((char *)Inf.packet_id, CFG.bbsid);
|
|
|
|
|
fwrite(&Inf, sizeof(INF_HEADER), 1, fp);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
/*
|
|
|
|
|
* Check to see if this stuff is compiled packed. If not the
|
|
|
|
|
* download packet is useless.
|
|
|
|
|
*/
|
|
|
|
|
if ((sizeof(Inf) != ORIGINAL_INF_HEADER_LEN) || (sizeof(AreaInf) != ORIGINAL_INF_AREA_LEN)) {
|
|
|
|
|
WriteError("PANIC: Probably not \"packed\" compiled!");
|
|
|
|
|
fclose(fp);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
sprintf(Temp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
|
|
|
|
if ((mf = fopen(Temp, "r")) == NULL) {
|
|
|
|
|
WriteError("$Can't open %s", Temp);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, mf);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
sprintf(Temp, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
if ((tf = fopen(Temp, "r")) == NULL) {
|
|
|
|
|
WriteError("$Can't open %s", Temp);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
fclose(mf);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
/*
|
|
|
|
|
* Write the areas information
|
|
|
|
|
*/
|
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, mf) == 1) {
|
|
|
|
|
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
|
|
|
|
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
|
|
|
|
Area++;
|
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && strlen(msgs.QWKname)) {
|
2002-07-03 19:34:57 +00:00
|
|
|
|
memset(&AreaInf, 0, sizeof(AreaInf));
|
|
|
|
|
sprintf((char *)AreaInf.areanum, "%lu", Area);
|
|
|
|
|
strcpy((char *)AreaInf.echotag, msgs.QWKname);
|
|
|
|
|
strcpy((char *)AreaInf.title, msgs.Name);
|
|
|
|
|
if (olrtagrec.Tagged) {
|
|
|
|
|
AreaInf.area_flags |= INF_SCANNING;
|
|
|
|
|
RetVal = TRUE;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
switch(msgs.Type) {
|
|
|
|
|
case LOCALMAIL:
|
|
|
|
|
break;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
case NETMAIL: AreaInf.area_flags |= (INF_ECHO+INF_NETMAIL+INF_HASFILE);
|
|
|
|
|
break;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
case LIST:
|
|
|
|
|
case ECHOMAIL: AreaInf.area_flags |= INF_ECHO;
|
|
|
|
|
break;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
// case EMAIL: AreaInf.area_flags |= (INF_ECHO+INF_NETMAIL);
|
|
|
|
|
// AreaInf.network_type |= INF_NET_INTERNET;
|
|
|
|
|
// break;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
case NEWS: AreaInf.area_flags |= INF_ECHO;
|
|
|
|
|
AreaInf.network_type |= INF_NET_INTERNET;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch(msgs.MsgKinds) {
|
|
|
|
|
case BOTH: if (Access(exitinfo.Security, msgs.WRSec))
|
|
|
|
|
AreaInf.area_flags |= INF_POST;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PRIVATE: if (Access(exitinfo.Security, msgs.WRSec))
|
|
|
|
|
AreaInf.area_flags |= INF_POST;
|
|
|
|
|
AreaInf.area_flags |= INF_NO_PUBLIC;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PUBLIC: if (Access(exitinfo.Security, msgs.WRSec))
|
|
|
|
|
AreaInf.area_flags |= INF_POST;
|
|
|
|
|
AreaInf.area_flags |= INF_NO_PRIVATE;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case RONLY: break;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if (msgs.Aliases)
|
|
|
|
|
AreaInf.area_flags |= INF_ALIAS_NAME;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
fwrite(&AreaInf, sizeof(AreaInf), 1, fp);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
|
|
|
|
fclose(fp);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if (RetVal) {
|
|
|
|
|
Area = 0;
|
|
|
|
|
DrawBar(Pktname);
|
|
|
|
|
fseek(mf, sizeof(msgshdr), SEEK_SET);
|
|
|
|
|
fseek(tf, 0, SEEK_SET);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, mf) == 1) {
|
|
|
|
|
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
|
|
|
|
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
|
|
|
|
Area++;
|
|
|
|
|
if (olrtagrec.Tagged) {
|
|
|
|
|
if (Msg_Open(msgs.Base)) {
|
|
|
|
|
Current = Personal = 0;
|
|
|
|
|
if (Msg_Highest() != 0) {
|
|
|
|
|
memset(&LR, 0, sizeof(LR));
|
|
|
|
|
LR.UserID = grecno;
|
|
|
|
|
if (Msg_GetLastRead(&LR))
|
|
|
|
|
Start = LR.HighReadMsg;
|
|
|
|
|
else
|
|
|
|
|
Start = Msg_Lowest() -1;
|
|
|
|
|
if (Start > Msg_Highest())
|
|
|
|
|
Start = Msg_Highest();
|
|
|
|
|
if (Start < Msg_Highest()) {
|
|
|
|
|
Syslog('m', "First %lu, Last %lu, Start %lu", Msg_Lowest(), Msg_Highest(), Start);
|
|
|
|
|
High = BlueWave_PackArea(Start, Area);
|
|
|
|
|
fill_high(&mhl, Area, High, Personal);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
|
|
|
|
Syslog('+', "Area %-20s %5ld (%ld personal)", msgs.QWKname, Current, Personal);
|
|
|
|
|
Msg_Close();
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
Syslog('+', "Packed %ld messages (%ld personal)", Total, TotalPersonal);
|
|
|
|
|
}
|
|
|
|
|
fclose(tf);
|
|
|
|
|
|
|
|
|
|
rc = FALSE;
|
|
|
|
|
alarm_on();
|
|
|
|
|
|
|
|
|
|
if (Total) {
|
|
|
|
|
/* Packing with */
|
|
|
|
|
printf("\n%s ", (char *)Language(446));
|
|
|
|
|
sprintf(Temp, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
|
|
|
|
if ((af = fopen(Temp, "r")) != NULL) {
|
|
|
|
|
fread(&archiverhdr, sizeof(archiverhdr), 1, af);
|
|
|
|
|
while (fread(&archiver, archiverhdr.recsize, 1, af) == 1) {
|
|
|
|
|
if (archiver.available && (!strcmp(archiver.name, exitinfo.Archiver))) {
|
|
|
|
|
Syslog('+', "Archiver %s", archiver.comment);
|
|
|
|
|
printf("%s ", archiver.comment);
|
|
|
|
|
sprintf(Temp, "%s/%s.DAT", Work, CFG.bbsid);
|
|
|
|
|
AddArc(Temp, Pktname);
|
|
|
|
|
alarm_on();
|
|
|
|
|
sprintf(Temp, "%s/%s.FTI", Work, CFG.bbsid);
|
|
|
|
|
AddArc(Temp, Pktname);
|
|
|
|
|
sprintf(Temp, "%s/%s.INF", Work, CFG.bbsid);
|
|
|
|
|
AddArc(Temp, Pktname);
|
|
|
|
|
sprintf(Temp, "%s/%s.MIX", Work, CFG.bbsid);
|
|
|
|
|
AddArc(Temp, Pktname);
|
|
|
|
|
sprintf(Temp, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, Pktname);
|
|
|
|
|
rc = DownloadDirect(Temp, FALSE);
|
|
|
|
|
Syslog('m', "Download result %d", rc);
|
|
|
|
|
unlink(Temp);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
|
|
|
|
fclose(af);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
colour(CFG.HiliteF, CFG.HiliteB);
|
|
|
|
|
if (rc == FALSE) {
|
|
|
|
|
Syslog('+', "BlueWave download failed");
|
|
|
|
|
/* Download failed */
|
|
|
|
|
printf("%s", (char *)Language(447));
|
|
|
|
|
} else {
|
|
|
|
|
Syslog('+', "BlueWave download successfull");
|
|
|
|
|
/* Download successfull */
|
|
|
|
|
printf("\r%s\n", (char *)Language(448));
|
|
|
|
|
|
|
|
|
|
if (mhl != NULL)
|
|
|
|
|
UpdateLR(mhl, mf);
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
fclose(mf);
|
|
|
|
|
tidy_high(&mhl);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
free(Temp);
|
|
|
|
|
free(Work);
|
|
|
|
|
printf("\n\n");
|
|
|
|
|
Pause();
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* BlueWave Fetch reply packet.
|
|
|
|
|
*/
|
|
|
|
|
void BlueWave_Fetch()
|
|
|
|
|
{
|
2003-03-02 13:29:33 +00:00
|
|
|
|
char *temp, *buffer, *b, Dirpath[PATH_MAX], Filename[81], Echotag[20];
|
|
|
|
|
FILE *fp, *up = NULL, *mf, *tp = NULL, *iol = NULL;
|
2002-06-30 19:20:59 +00:00
|
|
|
|
UPL_HEADER Uph;
|
|
|
|
|
UPL_REC Upr;
|
|
|
|
|
REQ_REC Req;
|
2003-03-02 13:29:33 +00:00
|
|
|
|
int i = 0, j, Found, OLC_head, AreaChanges = FALSE;
|
2002-06-30 19:20:59 +00:00
|
|
|
|
fidoaddr dest;
|
|
|
|
|
time_t now;
|
|
|
|
|
struct tm *tm;
|
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(LIGHTBLUE, BLACK);
|
2002-06-30 19:20:59 +00:00
|
|
|
|
/* Processing BlueWave reply packet */
|
|
|
|
|
printf("%s\n", (char *)Language(450));
|
|
|
|
|
temp = calloc(PATH_MAX, sizeof(char));
|
2003-03-02 13:29:33 +00:00
|
|
|
|
b = calloc(256, sizeof(char));
|
2002-06-30 19:20:59 +00:00
|
|
|
|
buffer = b;
|
2003-03-02 13:29:33 +00:00
|
|
|
|
|
2002-06-30 19:20:59 +00:00
|
|
|
|
/*
|
|
|
|
|
* Process uploaded mail
|
|
|
|
|
*/
|
2003-03-02 13:29:33 +00:00
|
|
|
|
sprintf(Dirpath, "%s/%s", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
sprintf(Filename, "%s.UPL", CFG.bbsid);
|
|
|
|
|
if (getfilecase(Dirpath, Filename)) {
|
|
|
|
|
sprintf(temp, "%s/%s", Dirpath, Filename);
|
2002-06-30 19:20:59 +00:00
|
|
|
|
up = fopen(temp, "r");
|
|
|
|
|
}
|
|
|
|
|
if (up != NULL) {
|
|
|
|
|
fread(&Uph, sizeof(UPL_HEADER), 1, up);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
Syslog('+', "Processing BlueWave v3 \"%s\" file", Filename);
|
2002-06-30 19:20:59 +00:00
|
|
|
|
Syslog('+', "Client: %s %d.%d", Uph.reader_name, Uph.reader_major, Uph.reader_minor);
|
|
|
|
|
if (Uph.upl_header_len != sizeof(UPL_HEADER)) {
|
|
|
|
|
WriteError("Recordsize mismatch");
|
|
|
|
|
fclose(up);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
free(temp);
|
2002-06-30 19:20:59 +00:00
|
|
|
|
/* ERROR in packet */
|
|
|
|
|
printf("%s\n", (char *)Language(451));
|
|
|
|
|
Pause();
|
|
|
|
|
return;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-06-30 19:20:59 +00:00
|
|
|
|
Syslog('+', "Login %s, Alias %s", Uph.loginname, Uph.aliasname);
|
|
|
|
|
Syslog('m', "Tear: %s", Uph.reader_tear);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
if (strlen(Uph.reader_tear))
|
|
|
|
|
newtear = xstrcpy(Uph.reader_tear);
|
|
|
|
|
|
2002-06-30 19:20:59 +00:00
|
|
|
|
/* MORE CHECKS HERE */
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-06-30 19:20:59 +00:00
|
|
|
|
colour(CFG.TextColourF, CFG.TextColourB);
|
|
|
|
|
/* Import messages */
|
|
|
|
|
printf("%s ", (char *)Language(452));
|
|
|
|
|
colour(CFG.HiliteF, CFG.HiliteB);
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
|
|
memset(&Upr, 0, sizeof(UPL_REC));
|
|
|
|
|
while (fread(&Upr, Uph.upl_rec_len, 1, up) == 1) {
|
|
|
|
|
printf(".");
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
Syslog('m', " From : %s", Upr.from);
|
|
|
|
|
Syslog('m', " To : %s", Upr.to);
|
|
|
|
|
Syslog('m', " Subj : %s", Upr.subj);
|
|
|
|
|
now = Upr.unix_date;
|
|
|
|
|
tm = gmtime(&now);
|
|
|
|
|
Syslog('m', " Date : %02d-%02d-%d %02d:%02d:%02d", tm->tm_mday, tm->tm_mon+1,
|
|
|
|
|
tm->tm_year+1900, tm->tm_hour, tm->tm_min, tm->tm_sec);
|
|
|
|
|
Syslog('m', " Dest : %d:%d/%d.%d", Upr.destzone, Upr.destnet, Upr.destnode, Upr.destpoint);
|
|
|
|
|
if (Upr.msg_attr & UPL_INACTIVE)
|
|
|
|
|
Syslog('m', " Message is Inactive");
|
|
|
|
|
if (Upr.msg_attr & UPL_PRIVATE)
|
|
|
|
|
Syslog('m', " Message is Private");
|
|
|
|
|
if (Upr.msg_attr & UPL_HAS_FILE)
|
|
|
|
|
Syslog('m', " File Attach");
|
|
|
|
|
if (Upr.msg_attr & UPL_NETMAIL)
|
|
|
|
|
Syslog('m', " Is Netmail");
|
|
|
|
|
if (Upr.msg_attr & UPL_IS_REPLY)
|
|
|
|
|
Syslog('m', " Is Reply");
|
|
|
|
|
if (Upr.network_type)
|
|
|
|
|
Syslog('m', " Type : Internet");
|
|
|
|
|
else
|
|
|
|
|
Syslog('m', " Type : Fidonet");
|
|
|
|
|
Syslog('m', " File : %s", Upr.filename);
|
|
|
|
|
Syslog('m', " Tag : %s", Upr.echotag);
|
|
|
|
|
|
|
|
|
|
sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
|
|
|
|
if ((mf = fopen(temp, "r+")) != NULL) {
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, mf);
|
|
|
|
|
Found = FALSE;
|
|
|
|
|
|
|
|
|
|
if (strlen(Upr.echotag)) {
|
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, mf) == 1) {
|
|
|
|
|
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
|
|
|
|
if (msgs.Active && (strcasecmp(msgs.QWKname, Upr.echotag) == 0)) {
|
|
|
|
|
Found = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
/*
|
|
|
|
|
* If there is no echotag, the filename is used
|
|
|
|
|
* this is "areanum.msgnum" so we pick the part
|
|
|
|
|
* before the dot and pray that it's ok.
|
|
|
|
|
*/
|
|
|
|
|
temp = strtok(strdup(Upr.filename), ".");
|
|
|
|
|
if (fseek(mf, ((atoi(temp) -1) * (msgshdr.recsize + msgshdr.syssize)) + msgshdr.hdrsize, SEEK_SET) == 0)
|
|
|
|
|
if (fread(&msgs, msgshdr.recsize, 1, mf) == 1) {
|
|
|
|
|
Found = TRUE;
|
|
|
|
|
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-30 19:20:59 +00:00
|
|
|
|
/* SHOULD ALSO CHECK FROM FIELD */
|
|
|
|
|
if (!Found) {
|
|
|
|
|
WriteError("No msg area, File \"%s\"", Upr.filename);
|
|
|
|
|
} else {
|
|
|
|
|
if ((Access(exitinfo.Security, msgs.WRSec)) && (msgs.MsgKinds != RONLY)) {
|
|
|
|
|
|
|
|
|
|
if (Open_Msgbase(msgs.Base, 'w')) {
|
|
|
|
|
Msg_New();
|
|
|
|
|
strcpy(Msg.From, Upr.from);
|
|
|
|
|
strcpy(Msg.To, Upr.to);
|
|
|
|
|
strcpy(Msg.Subject, Upr.subj);
|
|
|
|
|
if (Upr.msg_attr & UPL_PRIVATE)
|
|
|
|
|
Msg.Private = TRUE;
|
|
|
|
|
if (msgs.MsgKinds == PRIVATE)
|
|
|
|
|
Msg.Private = TRUE;
|
2002-07-01 19:31:15 +00:00
|
|
|
|
Msg.Written = Upr.unix_date - (gmt_offset((time_t)0) * 60);
|
2002-06-30 19:20:59 +00:00
|
|
|
|
Msg.Arrived = time(NULL) - (gmt_offset((time_t)0) * 60);
|
|
|
|
|
Msg.Local = TRUE;
|
|
|
|
|
dest.zone = Upr.destzone;
|
|
|
|
|
dest.net = Upr.destnet;
|
|
|
|
|
dest.node = Upr.destnode;
|
|
|
|
|
dest.point = Upr.destpoint;
|
|
|
|
|
Add_Kludges(dest, FALSE, Upr.filename);
|
|
|
|
|
Syslog('+', "Msg (%ld) to \"%s\", \"%s\", in %s", Msg.Id, Msg.To, Msg.Subject, msgs.QWKname);
|
|
|
|
|
sprintf(temp, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, Upr.filename);
|
|
|
|
|
unlink(temp);
|
|
|
|
|
i++;
|
|
|
|
|
fseek(mf, - (msgshdr.recsize + msgshdr.syssize), SEEK_CUR);
|
|
|
|
|
msgs.Posted.total++;
|
|
|
|
|
msgs.Posted.tweek++;
|
|
|
|
|
msgs.Posted.tdow[Diw]++;
|
|
|
|
|
msgs.Posted.month[Miy]++;
|
|
|
|
|
msgs.LastPosted = time(NULL);
|
|
|
|
|
fwrite(&msgs, msgshdr.recsize, 1, mf);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Add quick mailscan info
|
|
|
|
|
*/
|
|
|
|
|
if (msgs.Type != LOCALMAIL) {
|
|
|
|
|
sprintf(temp, "%s/tmp/%smail.jam", getenv("MBSE_ROOT"),
|
|
|
|
|
((msgs.Type == ECHOMAIL) || (msgs.Type == LIST))? "echo" : "net");
|
|
|
|
|
if ((fp = fopen(temp, "a")) != NULL) {
|
|
|
|
|
fprintf(fp, "%s %lu\n", msgs.Base, Msg.Id);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-07-03 20:01:33 +00:00
|
|
|
|
Msg_Close();
|
2002-06-30 19:20:59 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
/* No Write access to area */
|
|
|
|
|
printf("\n%s %s\n", (char *)Language(453), msgs.Name);
|
|
|
|
|
WriteError("No Write Access to area %s", msgs.Name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fclose(mf);
|
|
|
|
|
}
|
|
|
|
|
memset(&Upr, 0, sizeof(UPL_REC));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-06-30 19:20:59 +00:00
|
|
|
|
printf("\n");
|
|
|
|
|
colour(CFG.TextColourF, CFG.TextColourB);
|
|
|
|
|
if (i) {
|
|
|
|
|
/* Messages imported */
|
|
|
|
|
printf("%d %s\n", i, (char *)Language(454));
|
|
|
|
|
ReadExitinfo();
|
|
|
|
|
exitinfo.iPosted += i;
|
|
|
|
|
WriteExitinfo();
|
|
|
|
|
do_mailout = TRUE;
|
|
|
|
|
}
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
fclose(up);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
sprintf(temp, "%s/%s", Dirpath, Filename);
|
2002-06-30 19:20:59 +00:00
|
|
|
|
unlink(temp);
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
if (newtear) {
|
|
|
|
|
free(newtear);
|
|
|
|
|
newtear = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-30 19:20:59 +00:00
|
|
|
|
/*
|
|
|
|
|
* Process offline configuration
|
|
|
|
|
*/
|
2003-03-02 13:29:33 +00:00
|
|
|
|
sprintf(Filename, "%s.OLC", CFG.bbsid);
|
|
|
|
|
if (getfilecase(Dirpath, Filename)) {
|
|
|
|
|
sprintf(temp, "%s/%s", Dirpath, Filename);
|
2002-06-30 19:20:59 +00:00
|
|
|
|
iol = fopen(temp, "r");
|
|
|
|
|
}
|
|
|
|
|
if (iol != NULL) {
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(LIGHTBLUE, BLACK);
|
|
|
|
|
/* Processing Offline Configuration */
|
|
|
|
|
printf("%s\n", (char *)Language(455));
|
|
|
|
|
Syslog('+', "Processing BlueWave v3 configuration file \"%s\"", Filename);
|
|
|
|
|
OLC_head = FALSE;
|
|
|
|
|
|
|
|
|
|
while (fgets(b, 255, iol) != NULL ) {
|
|
|
|
|
buffer = b;
|
|
|
|
|
for (j = 0; j < strlen(b); j++) {
|
|
|
|
|
if (*(b + j) == '\0')
|
|
|
|
|
break;
|
|
|
|
|
if (*(b + j) == '\r')
|
|
|
|
|
*(b + j) = '\0';
|
|
|
|
|
if (*(b + j) == '\n')
|
|
|
|
|
*(b + j) = '\0';
|
|
|
|
|
}
|
|
|
|
|
while (isspace(buffer[0]))
|
|
|
|
|
buffer++;
|
|
|
|
|
Syslog('m', "Reading: \"%s\"", printable(buffer, 0));
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* The .OLC file starts with [Global Mail Host Configuration]
|
|
|
|
|
* Then some global options.
|
|
|
|
|
* Then each mail area like [AREA_TAG]
|
|
|
|
|
* Then the area options.
|
|
|
|
|
*/
|
|
|
|
|
if ((strncasecmp(buffer,"[Global",7) == 0) && (strlen(buffer) > 22) ) {
|
|
|
|
|
OLC_head = TRUE;
|
|
|
|
|
continue;
|
|
|
|
|
} else {
|
|
|
|
|
if (buffer[0]=='[') {
|
|
|
|
|
strtok(buffer,"]");
|
|
|
|
|
buffer++;
|
|
|
|
|
strncpy(Echotag, buffer, 20);
|
|
|
|
|
if (OLC_head) {
|
|
|
|
|
OLC_head = FALSE;
|
|
|
|
|
if (AreaChanges) {
|
|
|
|
|
/*
|
|
|
|
|
* There are areachanges, first reset all areas.
|
|
|
|
|
*/
|
|
|
|
|
Syslog('m', "Resetting all areas");
|
|
|
|
|
sprintf(temp, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
if ((up = fopen(temp, "r+")) != NULL) {
|
|
|
|
|
sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
|
|
|
|
if ((mf = fopen(temp, "r")) != NULL) {
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, mf);
|
|
|
|
|
while (fread(&olrtagrec, sizeof(olrtagrec), 1, up) == 0) {
|
|
|
|
|
fread(&msgs, msgshdr.recsize, 1, mf);
|
|
|
|
|
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
|
|
|
|
if (!msgs.OLR_Forced)
|
|
|
|
|
olrtagrec.Tagged = FALSE;
|
|
|
|
|
fseek(up, - sizeof(olrtagrec), SEEK_CUR);
|
|
|
|
|
fwrite(&olrtagrec, sizeof(olrtagrec), 1, up);
|
|
|
|
|
}
|
|
|
|
|
fclose(mf);
|
|
|
|
|
}
|
|
|
|
|
fclose(up);
|
|
|
|
|
}
|
|
|
|
|
i = 0;
|
2002-06-20 21:02:44 +00:00
|
|
|
|
}
|
2002-06-30 19:20:59 +00:00
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
/*
|
|
|
|
|
* Process header commands
|
|
|
|
|
*/
|
|
|
|
|
if (OLC_head == TRUE){
|
|
|
|
|
if (strncasecmp(buffer,"AreaChanges", 11) == 0) {
|
|
|
|
|
buffer += 11;
|
|
|
|
|
while (isspace(buffer[0]) || buffer[0] == '=')
|
|
|
|
|
buffer++;
|
|
|
|
|
if ((strncasecmp(buffer,"TRUE",4)==0) || (strncasecmp(buffer,"YES",3)==0) || (strncasecmp(buffer,"ON",2)==0))
|
|
|
|
|
AreaChanges = TRUE;
|
|
|
|
|
}
|
|
|
|
|
if (strncasecmp(buffer,"MenuHotKeys", 11) == 0) {
|
|
|
|
|
Syslog('m', "%s - ignored", printable(buffer, 0));
|
|
|
|
|
}
|
|
|
|
|
if (strncasecmp(buffer,"ExpertMenus", 11 ) == 0) {
|
|
|
|
|
Syslog('m', "%s - ignored", printable(buffer, 0));
|
|
|
|
|
}
|
|
|
|
|
if (strncasecmp(buffer,"SkipUserMsgs", 12) == 0) {
|
|
|
|
|
Syslog('m', "%s - ignored", printable(buffer, 0));
|
|
|
|
|
}
|
|
|
|
|
if (strncasecmp(buffer,"DoorGraphics", 12) == 0) {
|
|
|
|
|
Syslog('m', "%s - ignored", printable(buffer, 0));
|
|
|
|
|
}
|
|
|
|
|
if (strncasecmp(buffer,"Password", 8) == 0) {
|
|
|
|
|
Syslog('m', "%s - ignored", printable(buffer, 0));
|
|
|
|
|
}
|
|
|
|
|
if (strncasecmp(buffer,"Filter", 6) == 0) {
|
|
|
|
|
Syslog('m', "%s - ignored", printable(buffer, 0));
|
|
|
|
|
}
|
|
|
|
|
if (strncasecmp(buffer,"Keyword", 7) == 0) {
|
|
|
|
|
Syslog('m', "%s - ignored", printable(buffer, 0));
|
|
|
|
|
}
|
|
|
|
|
if (strncasecmp(buffer,"Macro",5) == 0) {
|
|
|
|
|
Syslog('m', "%s - ignored", printable(buffer, 0));
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
} else {
|
|
|
|
|
if (strncasecmp(buffer,"Scan", 4) == 0) {
|
|
|
|
|
buffer+=4;
|
|
|
|
|
while (isspace(buffer[0]) || buffer[0] == '=')
|
|
|
|
|
buffer++;
|
|
|
|
|
if ((strncasecmp(buffer,"All",3)==0) || (strncasecmp(buffer,"Pers",4)==0)) {
|
|
|
|
|
if (strlen(Echotag) > 0) {
|
|
|
|
|
sprintf(temp, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
if ((up = fopen(temp, "r+")) != NULL) {
|
|
|
|
|
sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
|
|
|
|
if ((mf = fopen(temp, "r")) != NULL) {
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, mf);
|
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, mf) == 1) {
|
|
|
|
|
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
|
|
|
|
fread(&olrtagrec, sizeof(olrtagrec), 1, up);
|
|
|
|
|
if ((strcmp(msgs.QWKname, Echotag) == 0) && (msgs.Active) &&
|
|
|
|
|
(Access(exitinfo.Security, msgs.RDSec)) && strlen(msgs.QWKname)) {
|
|
|
|
|
Syslog('m', " Area %s", Echotag);
|
|
|
|
|
olrtagrec.Tagged = TRUE;
|
|
|
|
|
fseek(up, - sizeof(olrtagrec), SEEK_CUR);
|
|
|
|
|
fwrite(&olrtagrec, sizeof(olrtagrec), 1, up);
|
|
|
|
|
i++;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fclose(mf);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-03-02 13:29:33 +00:00
|
|
|
|
fclose(up);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-01 19:31:15 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-01 19:31:15 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-03-02 13:29:33 +00:00
|
|
|
|
fclose(iol);
|
|
|
|
|
sprintf(temp, "%s/%s", Dirpath, Filename);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
unlink(temp);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(CYAN, BLACK);
|
|
|
|
|
/* Message areas selected */
|
|
|
|
|
printf("%d %s\n", i, (char *)Language(456));
|
|
|
|
|
Syslog('+', " %d active message areas.", i);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/*
|
|
|
|
|
* Check for .REQ file.
|
|
|
|
|
*/
|
2003-03-02 13:29:33 +00:00
|
|
|
|
sprintf(Filename, "%s.REQ", CFG.bbsid);
|
|
|
|
|
if (getfilecase(Dirpath, Filename)) {
|
2002-07-01 19:31:15 +00:00
|
|
|
|
tp = fopen(temp, "r");
|
|
|
|
|
}
|
|
|
|
|
if (tp != NULL) {
|
|
|
|
|
i = 0;
|
2003-03-02 13:29:33 +00:00
|
|
|
|
// colour(LIGHTBLUE, BLACK);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Processing file requests */
|
2003-03-02 13:29:33 +00:00
|
|
|
|
// printf("%s\n", (char *)Language(457));
|
|
|
|
|
Syslog('+', "Processing file requests %s (not supported)", Filename);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
|
|
|
|
|
while (fread(&Req, sizeof(REQ_REC), 1, tp) == 1) {
|
|
|
|
|
Syslog('m', " File %s", Req.filename);
|
|
|
|
|
colour(CFG.TextColourF, CFG.TextColourB);
|
|
|
|
|
printf("%-12s ", Req.filename);
|
|
|
|
|
colour(CFG.HiliteF, CFG.HiliteB);
|
|
|
|
|
fflush(stdout);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
printf("\n");
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
fclose(tp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(temp);
|
|
|
|
|
free(b);
|
|
|
|
|
Pause();
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Add one area to the BlueWave download packet
|
|
|
|
|
*/
|
|
|
|
|
unsigned long BlueWave_PackArea(unsigned long ulLast, long Area)
|
|
|
|
|
{
|
2002-07-03 19:34:57 +00:00
|
|
|
|
FILE *fdm, *fdfti, *fdmix;
|
|
|
|
|
char *Temp, *Text;
|
|
|
|
|
unsigned long Number;
|
|
|
|
|
MIX_REC Mix;
|
|
|
|
|
FTI_REC Fti;
|
|
|
|
|
struct tm *tp;
|
|
|
|
|
int Pack;
|
|
|
|
|
|
|
|
|
|
Number = ulLast;
|
|
|
|
|
Temp = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
|
|
|
|
|
sprintf(Temp, "%s/%s/tmp/%s.FTI", CFG.bbs_usersdir, exitinfo.Name, CFG.bbsid);
|
|
|
|
|
fdfti = fopen(Temp, "a+");
|
|
|
|
|
|
|
|
|
|
sprintf(Temp, "%s/%s/tmp/%s.MIX", CFG.bbs_usersdir, exitinfo.Name, CFG.bbsid);
|
|
|
|
|
fdmix = fopen(Temp, "a+");
|
|
|
|
|
|
|
|
|
|
sprintf(Temp, "%s/%s/tmp/%s.DAT", CFG.bbs_usersdir, exitinfo.Name, CFG.bbsid);
|
|
|
|
|
fdm = fopen(Temp, "a+");
|
|
|
|
|
|
|
|
|
|
memset(&Mix, 0, sizeof(MIX_REC));
|
|
|
|
|
sprintf((char *)Mix.areanum, "%lu", Area);
|
|
|
|
|
Mix.msghptr = ftell(fdfti);
|
|
|
|
|
|
|
|
|
|
if ((fdfti != NULL) && (fdmix != NULL) && (fdm != NULL)) {
|
|
|
|
|
if (Msg_Next(&Number)) {
|
|
|
|
|
do {
|
|
|
|
|
Msg_ReadHeader(Number);
|
|
|
|
|
Msg_Read(Number, 78);
|
|
|
|
|
Pack = TRUE;
|
|
|
|
|
|
|
|
|
|
if ((strcasecmp(Msg.To, exitinfo.sUserName) == 0) || (strcasecmp(Msg.To, exitinfo.sHandle) == 0)) {
|
|
|
|
|
Personal++;
|
|
|
|
|
TotalPersonal++;
|
|
|
|
|
} else if (msgs.Type == NETMAIL) {
|
|
|
|
|
Pack = FALSE;
|
|
|
|
|
} else if (msgs.MsgKinds == PRIVATE ) {
|
|
|
|
|
Pack = FALSE;
|
|
|
|
|
} else if (msgs.MsgKinds == BOTH ) {
|
|
|
|
|
if (Msg.Private == TRUE )
|
|
|
|
|
Pack = FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Pack) {
|
|
|
|
|
Current++;
|
|
|
|
|
Total++;
|
|
|
|
|
memset (&Fti, 0, sizeof (FTI_REC));
|
|
|
|
|
|
|
|
|
|
Msg.From[sizeof(Fti.from) - 1] = '\0';
|
|
|
|
|
strcpy((char *)Fti.from, Msg.From);
|
|
|
|
|
Msg.To[sizeof(Fti.to) - 1] = '\0';
|
|
|
|
|
strcpy((char *)Fti.to, Msg.To);
|
|
|
|
|
Msg.Subject[sizeof(Fti.subject) - 1] = '\0';
|
|
|
|
|
strcpy((char *)Fti.subject, Msg.Subject);
|
|
|
|
|
tp = localtime(&Msg.Written);
|
|
|
|
|
sprintf((char *)Fti.date, "%2d %.3s %2d %2d:%02d:%02d", tp->tm_mday,
|
|
|
|
|
(char *) Language(398 + tp->tm_mon), tp->tm_year, tp->tm_hour, tp->tm_min, tp->tm_sec);
|
|
|
|
|
Fti.msgnum = Number;
|
|
|
|
|
Fti.msgptr = ftell(fdm);
|
|
|
|
|
Fti.replyto = Msg.Original;
|
|
|
|
|
Fti.replyat = Msg.Reply;
|
|
|
|
|
if (msgs.Type == NETMAIL) {
|
|
|
|
|
Fti.orig_zone = msgs.Aka.zone;
|
|
|
|
|
Fti.orig_net = msgs.Aka.net;
|
|
|
|
|
Fti.orig_node = msgs.Aka.node;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
Fti.msglength += fwrite(" ", 1, 1, fdm);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if ((Text = (char *)MsgText_First()) != NULL) {
|
2001-08-17 05:46:24 +00:00
|
|
|
|
do {
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if ((Text[0] != 0x01) || (strncmp(Text, "\001MSGID", 6) == 0) ||
|
|
|
|
|
((strncmp(Text, "\001FMPT ", 6) == 0) && (msgs.Type == NETMAIL)) || (exitinfo.OL_ExtInfo)) {
|
2002-07-03 19:34:57 +00:00
|
|
|
|
Fti.msglength += fwrite(Text, 1, strlen(Text), fdm);
|
|
|
|
|
Fti.msglength += fwrite("\r\n", 1, 2, fdm);
|
|
|
|
|
}
|
|
|
|
|
} while ((Text = (char *)MsgText_Next()) != NULL);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
fwrite(&Fti, sizeof (Fti), 1, fdfti);
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) {
|
|
|
|
|
BarWidth = (unsigned short)((Total * 61L) / TotalPack);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(CYAN, BLACK);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
printf("\r%.*s", BarWidth, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
fflush(stdout);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
} while (Msg_Next(&Number));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
Mix.totmsgs = (tWORD)Current;
|
|
|
|
|
Mix.numpers = (tWORD)Personal;
|
|
|
|
|
fwrite(&Mix, sizeof (Mix), 1, fdmix);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if (fdfti != NULL)
|
|
|
|
|
fclose(fdfti);
|
|
|
|
|
if (fdmix != NULL)
|
|
|
|
|
fclose(fdmix);
|
|
|
|
|
if (fdm != NULL)
|
|
|
|
|
fclose(fdm);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
free(Temp);
|
|
|
|
|
return Number;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************************
|
|
|
|
|
*
|
|
|
|
|
* QWK specific functions
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OLR_DownQWK(void)
|
|
|
|
|
{
|
2002-07-14 12:23:39 +00:00
|
|
|
|
struct tm *tp;
|
|
|
|
|
time_t Now;
|
|
|
|
|
char Pktname[32];
|
|
|
|
|
long Area = 0;
|
|
|
|
|
char *Work, *Temp;
|
|
|
|
|
int i, rc = 0;
|
|
|
|
|
FILE *fp = NULL, *tf, *mf, *af;
|
|
|
|
|
unsigned long Start, High;
|
|
|
|
|
msg_high *tmp, *mhl = NULL;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (strlen(CFG.bbsid) == 0) {
|
|
|
|
|
printf("System configuration error, inform sysop\n");
|
|
|
|
|
WriteError("Config OLR bbsid not configured");
|
|
|
|
|
Pause();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
if (!OLR_Prescan())
|
|
|
|
|
return;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
Total = TotalPersonal = 0L;
|
|
|
|
|
clear();
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(LIGHTBLUE, BLACK);
|
2002-07-14 12:23:39 +00:00
|
|
|
|
/* QWK Offline Download */
|
|
|
|
|
printf("%s\n", (char *)Language(458));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
Work = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
Temp = calloc(PATH_MAX, sizeof(char));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
Now = time(NULL);
|
|
|
|
|
tp = localtime(&Now);
|
|
|
|
|
Syslog('+', "Preparing QWK packet");
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
sprintf(Temp, "%s.QWK", CFG.bbsid);
|
|
|
|
|
sprintf(Pktname, "%s", tl(Temp));
|
|
|
|
|
Syslog('m', "Packet name %s", Pktname);
|
|
|
|
|
sprintf(Work, "%s/%s/tmp", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
Syslog('m', "Work path %s", Work);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
sprintf(Temp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
|
|
|
|
if ((mf = fopen(Temp, "r")) == NULL) {
|
|
|
|
|
WriteError("$Can't open %s", Temp);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
free(Temp);
|
|
|
|
|
free(Work);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, mf);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
sprintf(Temp, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
if ((tf = fopen(Temp, "r")) == NULL) {
|
|
|
|
|
WriteError("$Can't open %s", Temp);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
fclose(mf);
|
|
|
|
|
free(Temp);
|
|
|
|
|
free(Work);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
Area = 0;
|
|
|
|
|
DrawBar(Pktname);
|
|
|
|
|
fseek(mf, sizeof(msgshdr), SEEK_SET);
|
|
|
|
|
fseek(tf, 0, SEEK_SET);
|
|
|
|
|
|
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, mf) == 1) {
|
|
|
|
|
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
|
|
|
|
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
|
|
|
|
Area++;
|
|
|
|
|
if (olrtagrec.Tagged) {
|
|
|
|
|
if (Msg_Open(msgs.Base)) {
|
|
|
|
|
Current = Personal = 0;
|
|
|
|
|
if (Msg_Highest() != 0) {
|
|
|
|
|
memset(&LR, 0, sizeof(LR));
|
|
|
|
|
LR.UserID = grecno;
|
|
|
|
|
if (Msg_GetLastRead(&LR))
|
|
|
|
|
Start = LR.HighReadMsg;
|
|
|
|
|
else
|
|
|
|
|
Start = Msg_Lowest() -1;
|
|
|
|
|
if (Start > Msg_Highest())
|
|
|
|
|
Start = Msg_Highest();
|
|
|
|
|
if (Start < Msg_Highest()) {
|
|
|
|
|
Syslog('m', "First %lu, Last %lu, Start %lu", Msg_Lowest(), Msg_Highest(), Start);
|
|
|
|
|
High = QWK_PackArea(Start, Area);
|
|
|
|
|
fill_high(&mhl, Area, High, Personal);
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-14 12:23:39 +00:00
|
|
|
|
Syslog('+', "Area %-20s %5ld (%ld personal)", msgs.QWKname, Current, Personal);
|
|
|
|
|
Msg_Close();
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-14 12:23:39 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
sprintf(Temp, "%s/CONTROL.DAT", Work);
|
|
|
|
|
if ((fp = fopen(Temp, "w+")) != NULL) {
|
|
|
|
|
fprintf(fp, "%s\n", CFG.bbs_name);
|
|
|
|
|
fprintf(fp, "%s\n", CFG.location);
|
|
|
|
|
fprintf(fp, "%s\n", CFG.Phone);
|
|
|
|
|
fprintf(fp, "%s\n", CFG.sysop_name);
|
|
|
|
|
fprintf(fp, "00000,%s\n", CFG.bbsid);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
fprintf(fp, "%02d-%02d-%04d,%02d:%02d:%02d\n", tp->tm_mday, tp->tm_mon+1, tp->tm_year+1900,
|
2001-08-17 05:46:24 +00:00
|
|
|
|
tp->tm_hour, tp->tm_min, tp->tm_sec);
|
2002-07-14 12:23:39 +00:00
|
|
|
|
sprintf(Temp, "%s", exitinfo.sUserName);
|
|
|
|
|
fprintf(fp, "%s\n", tu(Temp));
|
|
|
|
|
fprintf(fp, " \n");
|
|
|
|
|
fprintf(fp, "0\n");
|
|
|
|
|
fprintf(fp, "%lu\n", Total);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
/*
|
|
|
|
|
* Count available areas.
|
|
|
|
|
*/
|
|
|
|
|
i = 0;
|
|
|
|
|
fseek(mf, msgshdr.hdrsize, SEEK_SET);
|
|
|
|
|
fseek(tf, 0, SEEK_SET);
|
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, mf) == 1) {
|
|
|
|
|
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
|
|
|
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && strlen(msgs.QWKname))
|
|
|
|
|
i++;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-14 12:23:39 +00:00
|
|
|
|
fprintf(fp, "%d\n", i - 1);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
/*
|
|
|
|
|
* Write available areas
|
|
|
|
|
*/
|
|
|
|
|
i = 0;
|
|
|
|
|
fseek(mf, msgshdr.hdrsize, SEEK_SET);
|
|
|
|
|
fseek(tf, 0, SEEK_SET);
|
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, mf) == 1) {
|
|
|
|
|
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
|
|
|
|
i++;
|
|
|
|
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && strlen(msgs.QWKname)) {
|
|
|
|
|
fprintf(fp, "%d\n%s\n", i, msgs.QWKname);
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
fprintf(fp, "WELCOME\n");
|
|
|
|
|
fprintf(fp, "NEWS\n");
|
|
|
|
|
fprintf(fp, "GOODBYE\n");
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
sprintf(Temp, "%s/DOOR.ID", Work);
|
|
|
|
|
if ((fp = fopen(Temp, "w+")) != 0) {
|
|
|
|
|
fprintf(fp, "DOOR = MBSE BBS QWK\n");
|
|
|
|
|
fprintf(fp, "VERSION = %s\n", VERSION);
|
|
|
|
|
fprintf(fp, "SYSTEM = %s\n", CFG.bbs_name);
|
|
|
|
|
fprintf(fp, "CONTROLNAME = MBSEQWK\n");
|
|
|
|
|
fprintf(fp, "CONTROLTYPE = ADD\n");
|
|
|
|
|
fprintf(fp, "CONTROLTYPE = DROP\n");
|
|
|
|
|
/*
|
|
|
|
|
* QWKE extensions
|
|
|
|
|
*/
|
|
|
|
|
// fprintf(fp, "CONTROLTYPE = MAXKEYWORDS 0\n");
|
|
|
|
|
// fprintf(fp, "CONTROLTYPE = MAXFILTERS 0\n");
|
|
|
|
|
// fprintf(fp, "CONTROLTYPE = MAXTWITS 0\n");
|
|
|
|
|
// fprintf(fp, "CONTROLTYPE = ALLOWATTACH\n");
|
|
|
|
|
// fprintf(fp, "CONTROLTYPE = ALLOWFILES\n");
|
|
|
|
|
// fprintf(fp, "CONTROLTYPE = ALLOWREQUESTS\n");
|
|
|
|
|
// fprintf(fp, "CONTROLTYPE = MAXREQUESTS 0\n");
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
Syslog('+', "Packed %ld messages (%ld personal)", Total, TotalPersonal);
|
|
|
|
|
fclose(tf);
|
|
|
|
|
|
|
|
|
|
if (Total) {
|
|
|
|
|
/* Packing with */
|
|
|
|
|
printf("\n%s ", (char *)Language(446));
|
|
|
|
|
sprintf(Temp, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
|
|
|
|
if ((af = fopen(Temp, "r")) != NULL) {
|
|
|
|
|
fread(&archiverhdr, sizeof(archiverhdr), 1, af);
|
|
|
|
|
while (fread(&archiver, archiverhdr.recsize, 1, af) == 1) {
|
|
|
|
|
if (archiver.available && (!strcmp(archiver.name, exitinfo.Archiver))) {
|
|
|
|
|
Syslog('+', "Archiver %s", archiver.comment);
|
|
|
|
|
printf("%s ", archiver.comment);
|
|
|
|
|
sprintf(Temp, "%s/CONTROL.DAT", Work);
|
|
|
|
|
AddArc(Temp, Pktname);
|
|
|
|
|
alarm_on();
|
|
|
|
|
sprintf(Temp, "%s/MESSAGES.DAT", Work);
|
|
|
|
|
AddArc(Temp, Pktname);
|
|
|
|
|
|
|
|
|
|
for (tmp = mhl; tmp; tmp = tmp->next) {
|
|
|
|
|
sprintf(Temp, "%s/%03ld.NDX", Work, tmp->Area);
|
|
|
|
|
AddArc(Temp, Pktname);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf(Temp, "%s/PERSONAL.NDX", Work);
|
|
|
|
|
if (TotalPersonal) {
|
|
|
|
|
AddArc(Temp, Pktname);
|
|
|
|
|
} else
|
|
|
|
|
unlink(Temp);
|
|
|
|
|
|
|
|
|
|
sprintf(Temp, "%s/DOOR.ID", Work);
|
|
|
|
|
AddArc(Temp, Pktname);
|
|
|
|
|
sprintf(Temp, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, Pktname);
|
|
|
|
|
rc = DownloadDirect(Temp, FALSE);
|
|
|
|
|
Syslog('m', "Download result %d", rc);
|
|
|
|
|
unlink(Temp);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-14 12:23:39 +00:00
|
|
|
|
}
|
|
|
|
|
fclose(af);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-14 12:23:39 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
colour(CFG.HiliteF, CFG.HiliteB);
|
|
|
|
|
if (rc == FALSE) {
|
|
|
|
|
Syslog('+', "QWK download failed");
|
|
|
|
|
/* Download failed */
|
|
|
|
|
printf("%s", (char *)Language(447));
|
|
|
|
|
} else {
|
|
|
|
|
Syslog('+', "QWK download successfull");
|
|
|
|
|
/* Download successfull */
|
|
|
|
|
printf("\r%s\n", (char *)Language(448));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
if (mhl != NULL)
|
|
|
|
|
UpdateLR(mhl, mf);
|
|
|
|
|
}
|
|
|
|
|
fclose(mf);
|
|
|
|
|
tidy_high(&mhl);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-14 12:23:39 +00:00
|
|
|
|
free(Temp);
|
|
|
|
|
free(Work);
|
|
|
|
|
printf("\n\n");
|
|
|
|
|
Pause();
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* QWK Fetch Reply packet
|
|
|
|
|
*/
|
|
|
|
|
void QWK_Fetch()
|
|
|
|
|
{
|
2003-03-02 13:29:33 +00:00
|
|
|
|
char *temp, *otemp, Temp[128], szLine[132], *pLine = NULL, *pBuff, Dirpath[PATH_MAX], Filename[81];
|
|
|
|
|
FILE *fp, *up = NULL, *op, *mf;
|
2002-07-03 19:34:57 +00:00
|
|
|
|
unsigned short nRec, i, r, x, nCol = 0, nWidth, nReaded, nPosted = 0;
|
|
|
|
|
unsigned long Area;
|
|
|
|
|
struct tm *ltm = NULL;
|
|
|
|
|
fidoaddr dest;
|
2002-07-03 21:16:23 +00:00
|
|
|
|
int HasTear;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(LIGHTBLUE, BLACK);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
/* Processing BlueWave reply packet */
|
|
|
|
|
printf("%s\n", (char *)Language(459));
|
|
|
|
|
temp = calloc(2048, sizeof(char));
|
|
|
|
|
otemp = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
nWidth = 78;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
sprintf(Dirpath, "%s/%s", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
sprintf(Filename, "%s.MSG", CFG.bbsid);
|
|
|
|
|
if (getfilecase(Dirpath, Filename)) {
|
2003-08-08 20:31:05 +00:00
|
|
|
|
sprintf(temp, "%s/%s", Dirpath, Filename);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
up = fopen(temp, "r");
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if (up != NULL) {
|
2003-03-02 13:29:33 +00:00
|
|
|
|
Syslog('+', "Processing QWK file %s", Filename);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
fread(&Temp, 128, 1, up);
|
|
|
|
|
Temp[8] = '\0';
|
|
|
|
|
if (strcmp(CFG.bbsid, StripSpaces(Temp, 8))) {
|
|
|
|
|
Syslog('?', "Wrong QWK packet id: \"%s\"", StripSpaces(Temp, 8));
|
|
|
|
|
fclose(up);
|
|
|
|
|
unlink(temp);
|
|
|
|
|
/* ERROR in packet */
|
|
|
|
|
printf("%s\n", (char *)Language(451));
|
|
|
|
|
free(temp);
|
|
|
|
|
free(otemp);
|
|
|
|
|
Pause();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
while (fread(&Qwk, sizeof(Qwk), 1, up) == 1) {
|
|
|
|
|
Area = atol(StripSpaces(Qwk.Msgnum, sizeof(Qwk.Msgnum)));
|
|
|
|
|
nRec = atoi(StripSpaces(Qwk.Msgrecs, sizeof(Qwk.Msgrecs)));
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Test for blank records.
|
|
|
|
|
*/
|
|
|
|
|
if (Area && nRec) {
|
|
|
|
|
Syslog('m', "Conference %u", Area);
|
|
|
|
|
Syslog('m', "Records %d", nRec);
|
|
|
|
|
Syslog('m', "To %s", tlcap(StripSpaces(Qwk.MsgTo, sizeof(Qwk.MsgTo))));
|
|
|
|
|
Syslog('m', "From %s", tlcap(StripSpaces(Qwk.MsgFrom, sizeof(Qwk.MsgFrom))));
|
|
|
|
|
Syslog('m', "Subject %s", StripSpaces(Qwk.MsgSubj, sizeof(Qwk.MsgSubj)));
|
|
|
|
|
sprintf(Temp, "%s", StripSpaces(Qwk.Msgdate, sizeof(Qwk.Msgdate)));
|
|
|
|
|
Syslog('m', "Date %s %s", Temp, StripSpaces(Qwk.Msgtime, sizeof(Qwk.Msgtime)));
|
|
|
|
|
|
|
|
|
|
if (strcmp("MBSEQWK", StripSpaces(Qwk.MsgTo, sizeof(Qwk.MsgTo))) == 0) {
|
|
|
|
|
Syslog('m', "Command %s", StripSpaces(Qwk.MsgSubj, sizeof(Qwk.MsgSubj)));
|
|
|
|
|
sprintf(otemp, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
if ((op = fopen(otemp, "r+")) != NULL) {
|
|
|
|
|
|
|
|
|
|
sprintf(otemp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
|
|
|
|
if ((mf = fopen(otemp, "r")) != NULL) {
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, mf);
|
|
|
|
|
fseek(mf, ((Area -1) * (msgshdr.recsize + msgshdr.syssize)) + msgshdr.hdrsize, SEEK_SET);
|
|
|
|
|
fread(&msgs, msgshdr.recsize, 1, mf);
|
|
|
|
|
fseek(op, (Area -1) * sizeof(olrtagrec), SEEK_SET);
|
|
|
|
|
fread(&olrtagrec, sizeof(olrtagrec), 1, op);
|
|
|
|
|
|
|
|
|
|
if (strcmp("ADD", StripSpaces(Qwk.MsgSubj, sizeof(Qwk.MsgSubj))) == 0) {
|
|
|
|
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) &&
|
|
|
|
|
strlen(msgs.QWKname) && !olrtagrec.Tagged) {
|
|
|
|
|
olrtagrec.Tagged = TRUE;
|
|
|
|
|
fseek(op, - sizeof(olrtagrec), SEEK_CUR);
|
|
|
|
|
Syslog('m', "%d", fwrite(&olrtagrec, sizeof(olrtagrec), 1, op));
|
|
|
|
|
Syslog('+', "QWK added area %s", msgs.QWKname);
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if (strcmp("DROP", StripSpaces(Qwk.MsgSubj, sizeof(Qwk.MsgSubj))) == 0) {
|
|
|
|
|
if (!msgs.OLR_Forced && olrtagrec.Tagged) {
|
|
|
|
|
olrtagrec.Tagged = FALSE;
|
|
|
|
|
fseek(op, - sizeof(olrtagrec), SEEK_CUR);
|
|
|
|
|
fwrite(&olrtagrec, sizeof(olrtagrec), 1, op);
|
|
|
|
|
Syslog('+', "QWK dropped area %s", msgs.QWKname);
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
fclose(mf);
|
|
|
|
|
}
|
|
|
|
|
fclose(op);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
/*
|
|
|
|
|
* Normal message
|
|
|
|
|
*/
|
|
|
|
|
Syslog('m', "Message");
|
2002-07-03 21:16:23 +00:00
|
|
|
|
HasTear = FALSE;
|
2002-07-03 19:34:57 +00:00
|
|
|
|
sprintf(otemp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
|
|
|
|
if ((mf = fopen(otemp, "r+")) != NULL) {
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, mf);
|
2003-08-08 20:31:05 +00:00
|
|
|
|
if ((fseek(mf, ((Area -1) * (msgshdr.recsize + msgshdr.syssize)) + msgshdr.hdrsize, SEEK_SET) == 0) &&
|
|
|
|
|
(fread(&msgs, msgshdr.recsize, 1, mf) == 1)) {
|
|
|
|
|
Syslog('m', "pos %d, should be %d", ftell(mf), ((Area) * (msgshdr.recsize + msgshdr.syssize)) + msgshdr.hdrsize - msgshdr.syssize);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
|
2003-08-08 20:31:05 +00:00
|
|
|
|
/*
|
|
|
|
|
* Check access to this area
|
|
|
|
|
*/
|
|
|
|
|
Syslog('m', "%s %s", msgs.QWKname, msgs.Base);
|
|
|
|
|
if (msgs.Active && strlen(msgs.QWKname) && Access(exitinfo.Security, msgs.WRSec) &&
|
2002-07-03 19:34:57 +00:00
|
|
|
|
(msgs.MsgKinds != RONLY)) {
|
2003-08-08 20:31:05 +00:00
|
|
|
|
if (Open_Msgbase(msgs.Base, 'w')) {
|
|
|
|
|
Msg_New();
|
|
|
|
|
pLine = szLine;
|
|
|
|
|
nCol = 0;
|
|
|
|
|
Syslog('m', "Msgbase open and locked");
|
|
|
|
|
strcpy(Msg.From, tlcap(StripSpaces(Qwk.MsgFrom, sizeof(Qwk.MsgFrom))));
|
|
|
|
|
strcpy(Msg.To, tlcap(StripSpaces(Qwk.MsgTo, sizeof(Qwk.MsgTo))));
|
|
|
|
|
strcpy(Msg.Subject, StripSpaces(Qwk.MsgSubj, sizeof(Qwk.MsgSubj)));
|
|
|
|
|
if ((Qwk.Msgstat == '*') || (Qwk.Msgstat == '+'))
|
|
|
|
|
Msg.Private = TRUE;
|
|
|
|
|
strcpy(Temp, StripSpaces(Qwk.Msgdate, sizeof(Qwk.Msgdate)));
|
|
|
|
|
ltm = malloc(sizeof(struct tm));
|
|
|
|
|
memset(ltm, 0, sizeof(struct tm));
|
|
|
|
|
ltm->tm_mday = atoi(&Temp[3]);
|
|
|
|
|
ltm->tm_mon = atoi(&Temp[0]) -1;
|
|
|
|
|
ltm->tm_year = atoi(&Temp[6]);
|
|
|
|
|
if (ltm->tm_year < 96)
|
|
|
|
|
ltm->tm_year += 100;
|
|
|
|
|
strcpy(Temp, StripSpaces(Qwk.Msgtime, sizeof(Qwk.Msgtime)));
|
|
|
|
|
ltm->tm_hour = atoi(&Temp[0]);
|
|
|
|
|
ltm->tm_min = atoi(&Temp[3]);
|
|
|
|
|
ltm->tm_sec = 0;
|
|
|
|
|
Msg.Written = mktime(ltm);
|
|
|
|
|
free(ltm);
|
|
|
|
|
Msg.Arrived = time(NULL) - (gmt_offset((time_t)0) * 60);
|
|
|
|
|
Msg.Local = TRUE;
|
|
|
|
|
memset(&dest, 0, sizeof(dest));
|
|
|
|
|
// dest.zone = Upr.destzone;
|
|
|
|
|
// dest.net = Upr.destnet;
|
|
|
|
|
// dest.node = Upr.destnode;
|
|
|
|
|
// dest.point = Upr.destpoint;
|
|
|
|
|
Add_Headkludges(fido2faddr(dest), FALSE);
|
|
|
|
|
|
|
|
|
|
for (r = 1; r < nRec; r++) {
|
|
|
|
|
nReaded = fread(Temp, 1, 128, up);
|
|
|
|
|
Syslog('m', "nReaded=%d", nReaded);
|
|
|
|
|
if (r == (nRec - 1)) {
|
|
|
|
|
x = 127;
|
|
|
|
|
while (x > 0 && Temp[x] == ' ') {
|
|
|
|
|
nReaded--;
|
|
|
|
|
x--;
|
|
|
|
|
}
|
|
|
|
|
Syslog('m', "Final=%d", nReaded);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-08-08 20:31:05 +00:00
|
|
|
|
for (i = 0, pBuff = Temp; i < nReaded; i++, pBuff++) {
|
|
|
|
|
if (*pBuff == '\r' || *pBuff == (char)0xE3) {
|
2002-07-03 19:34:57 +00:00
|
|
|
|
*pLine = '\0';
|
2003-08-08 20:31:05 +00:00
|
|
|
|
Syslog('m', "1 Len=%d \"%s\"", strlen(szLine), printable(szLine, 0));
|
2002-07-03 19:34:57 +00:00
|
|
|
|
MsgText_Add2(szLine);
|
2002-07-03 21:16:23 +00:00
|
|
|
|
if (strncmp(szLine, (char *)"--- ", 4) == 0)
|
|
|
|
|
HasTear = TRUE;
|
2003-08-08 20:31:05 +00:00
|
|
|
|
pLine = szLine;
|
|
|
|
|
nCol = 0;
|
|
|
|
|
} else if (*pBuff != '\n') {
|
|
|
|
|
*pLine++ = *pBuff;
|
|
|
|
|
nCol++;
|
|
|
|
|
if (nCol >= nWidth) {
|
|
|
|
|
*pLine = '\0';
|
|
|
|
|
while (nCol > 1 && *pLine != ' ') {
|
|
|
|
|
nCol--;
|
|
|
|
|
pLine--;
|
|
|
|
|
}
|
|
|
|
|
if (nCol > 0) {
|
|
|
|
|
while (*pLine == ' ')
|
|
|
|
|
pLine++;
|
|
|
|
|
strcpy (szWrp, pLine);
|
|
|
|
|
}
|
|
|
|
|
*pLine = '\0';
|
|
|
|
|
Syslog('m', "2 Len=%d \"%s\"", strlen(szLine), printable(szLine, 0));
|
|
|
|
|
MsgText_Add2(szLine);
|
|
|
|
|
if (strncmp(szLine, (char *)"--- ", 4) == 0)
|
|
|
|
|
HasTear = TRUE;
|
|
|
|
|
strcpy(szLine, szWrp);
|
|
|
|
|
pLine = strchr(szLine, '\0');
|
|
|
|
|
nCol = (short)strlen (szLine);
|
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
2003-08-08 20:31:05 +00:00
|
|
|
|
if (nCol > 0) {
|
|
|
|
|
*pLine = '\0';
|
|
|
|
|
Syslog('m', "3 Len=%d \"%s\"", strlen(szLine), printable(szLine, 0));
|
|
|
|
|
MsgText_Add2(szLine);
|
|
|
|
|
if (strncmp(szLine, (char *)"--- ", 4) == 0)
|
|
|
|
|
HasTear = TRUE;
|
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
|
2003-08-08 20:31:05 +00:00
|
|
|
|
Add_Footkludges(FALSE, NULL, HasTear);
|
|
|
|
|
Msg_AddMsg();
|
|
|
|
|
Msg_UnLock();
|
|
|
|
|
|
|
|
|
|
Syslog('+', "Msg (%ld) to \"%s\", \"%s\", in %s", Msg.Id, Msg.To, Msg.Subject, msgs.QWKname);
|
|
|
|
|
nPosted++;
|
|
|
|
|
Syslog('m', "Msgbase closed again");
|
|
|
|
|
fseek(mf, ((Area -1) * (msgshdr.recsize + msgshdr.syssize)) + msgshdr.hdrsize, SEEK_SET);
|
|
|
|
|
msgs.Posted.total++;
|
|
|
|
|
msgs.Posted.tweek++;
|
|
|
|
|
msgs.Posted.tdow[Diw]++;
|
|
|
|
|
msgs.Posted.month[Miy]++;
|
|
|
|
|
msgs.LastPosted = time(NULL);
|
|
|
|
|
fwrite(&msgs, msgshdr.recsize, 1, mf);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Add quick mailscan info
|
|
|
|
|
*/
|
|
|
|
|
if (msgs.Type != LOCALMAIL) {
|
|
|
|
|
sprintf(temp, "%s/tmp/%smail.jam", getenv("MBSE_ROOT"),
|
2002-07-03 19:34:57 +00:00
|
|
|
|
((msgs.Type == ECHOMAIL) || (msgs.Type == LIST))? "echo" : "net");
|
2003-08-08 20:31:05 +00:00
|
|
|
|
if ((fp = fopen(temp, "a")) != NULL) {
|
|
|
|
|
fprintf(fp, "%s %lu\n", msgs.Base, Msg.Id);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
2003-08-08 20:31:05 +00:00
|
|
|
|
Msg_Close();
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
2003-08-08 20:31:05 +00:00
|
|
|
|
} else {
|
|
|
|
|
Syslog('+', "Can't post messages in area %u", Area);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
2003-08-08 20:31:05 +00:00
|
|
|
|
fclose(mf);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
} else {
|
2003-08-08 20:31:05 +00:00
|
|
|
|
WriteError("$Can't read message area %u", Area);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
} else {
|
|
|
|
|
Syslog('m', "Skip blank record");
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
fclose(up);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("\n");
|
|
|
|
|
colour(CFG.TextColourF, CFG.TextColourB);
|
|
|
|
|
if (nPosted) {
|
|
|
|
|
/* Messages imported */
|
|
|
|
|
printf("%d %s\n", nPosted, (char *)Language(454));
|
|
|
|
|
ReadExitinfo();
|
|
|
|
|
exitinfo.iPosted += nPosted;
|
|
|
|
|
WriteExitinfo();
|
|
|
|
|
do_mailout = TRUE;
|
|
|
|
|
}
|
|
|
|
|
fflush(stdout);
|
2003-08-08 20:31:05 +00:00
|
|
|
|
sprintf(temp, "%s/%s", Dirpath, Filename);
|
|
|
|
|
Syslog('m', "Unlink %s rc=%d", temp, unlink(temp));
|
2002-07-03 19:34:57 +00:00
|
|
|
|
free(temp);
|
|
|
|
|
free(otemp);
|
|
|
|
|
Pause();
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
union Converter {
|
2002-07-03 19:34:57 +00:00
|
|
|
|
unsigned char uc[10];
|
|
|
|
|
unsigned short ui[5];
|
|
|
|
|
unsigned long ul[2];
|
|
|
|
|
float f[2];
|
|
|
|
|
double d[1];
|
2001-08-17 05:46:24 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float IEEToMSBIN(float f)
|
|
|
|
|
{
|
2002-07-03 19:34:57 +00:00
|
|
|
|
int sign, exp;
|
|
|
|
|
union Converter t;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
t.f[0] = f;
|
|
|
|
|
sign = t.uc[3] / 0x80;
|
|
|
|
|
exp = ((t.ui[1] >> 7) - 0x7F + 0x81) & 0xFF;
|
|
|
|
|
t.ui[1] = (t.ui[1] & 0x7F) | (sign << 7) | (exp << 8);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
return t.f[0];
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float MSBINToIEEE(float f)
|
|
|
|
|
{
|
2002-07-03 19:34:57 +00:00
|
|
|
|
union Converter t;
|
|
|
|
|
int sign, exp;
|
|
|
|
|
|
|
|
|
|
t.f[0] = f;
|
|
|
|
|
sign = t.uc[2] / 0x80;
|
|
|
|
|
exp = (t.uc[3] - 0x81 + 0x7f) & 0xff;
|
|
|
|
|
t.ui[1] = (t.ui[1] & 0x7f) | (exp << 7) | (sign << 15);
|
|
|
|
|
return t.f[0];
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Pack messages in one mail area
|
|
|
|
|
*/
|
|
|
|
|
unsigned long QWK_PackArea(unsigned long ulLast, long Area)
|
|
|
|
|
{
|
2002-07-03 19:34:57 +00:00
|
|
|
|
FILE *fdm, *fdi, *fdp;
|
|
|
|
|
float out, in;
|
|
|
|
|
char *Work, *Temp, *Text;
|
|
|
|
|
unsigned long Number, Pos, Size, Blocks;
|
|
|
|
|
int Pack = FALSE;
|
|
|
|
|
struct tm *tp;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
Number = ulLast;
|
|
|
|
|
Current = Personal = 0L;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
Temp = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
Work = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
sprintf(Work, "%s/%s/tmp", CFG.bbs_usersdir, exitinfo.Name);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
sprintf(Temp, "%s/%03ld.NDX", Work, Area);
|
|
|
|
|
fdi = fopen(Temp, "a+");
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
sprintf(Temp, "%s/PERSONAL.NDX", Work);
|
|
|
|
|
fdp = fopen(Temp, "a+");
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
/*
|
|
|
|
|
* Open MESSAGES.DAT, if it doesn't exist, create it and write
|
|
|
|
|
* the header. Then reopen the file in r/w mode.
|
|
|
|
|
*/
|
|
|
|
|
sprintf(Temp, "%s/MESSAGES.DAT", Work);
|
|
|
|
|
if ((fdm = fopen (Temp, "r+")) == NULL) {
|
|
|
|
|
Syslog('m', "Creating new %s", Temp);
|
|
|
|
|
fdm = fopen(Temp, "a+");
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
// The first record of the MESSAGE.DAT file must be the Sparkware id
|
|
|
|
|
// block, otherwise some applications may complain.
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
fprintf(fdm, "Produced by Qmail...");
|
|
|
|
|
fprintf(fdm, "Copywright (c) 1987 by Sparkware. ");
|
|
|
|
|
fprintf(fdm, "All Rights Reserved");
|
|
|
|
|
memset(Temp, ' ', 54);
|
|
|
|
|
fwrite(Temp, 54, 1, fdm);
|
|
|
|
|
fclose(fdm);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
sprintf(Temp, "%s/MESSAGES.DAT", Work);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
fdm = fopen(Temp, "r+");
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if ((fdm != NULL) && (fdp != NULL) && (fdi != NULL)) {
|
|
|
|
|
fseek(fdm, 0, SEEK_END);
|
|
|
|
|
if (Msg_Next(&Number)) {
|
|
|
|
|
do {
|
|
|
|
|
Msg_ReadHeader(Number);
|
|
|
|
|
Msg_Read(Number, 78);
|
|
|
|
|
Pack = TRUE;
|
|
|
|
|
if ((strcasecmp(Msg.To, exitinfo.sUserName) == 0) || (strcasecmp(Msg.To, exitinfo.sHandle) == 0)) {
|
|
|
|
|
Personal++;
|
|
|
|
|
TotalPersonal++;
|
|
|
|
|
fwrite(&out, sizeof(float), 1, fdp);
|
|
|
|
|
fwrite("", 1, 1, fdp);
|
|
|
|
|
} else if (msgs.Type == NETMAIL) {
|
|
|
|
|
Pack = FALSE;
|
|
|
|
|
} else if (msgs.MsgKinds == PRIVATE ) {
|
|
|
|
|
Pack = FALSE;
|
|
|
|
|
} else if (msgs.MsgKinds == BOTH ) {
|
|
|
|
|
if (Msg.Private == TRUE )
|
|
|
|
|
Pack = FALSE;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if (Pack) {
|
|
|
|
|
/*
|
|
|
|
|
* Calculate the recordnumber from the current file
|
|
|
|
|
* position and store it in M$oft BIN format.
|
|
|
|
|
*/
|
|
|
|
|
Pos = ftell(fdm);
|
|
|
|
|
Blocks = (Pos / 128L) + 1L;
|
|
|
|
|
sprintf(Temp, "%lu", Blocks);
|
|
|
|
|
in = atof(Temp);
|
|
|
|
|
out = IEEToMSBIN(in);
|
|
|
|
|
fwrite(&out, sizeof(float), 1, fdi);
|
|
|
|
|
fwrite(" ", 1, 1, fdi);
|
|
|
|
|
Current++;
|
|
|
|
|
Total++;
|
|
|
|
|
|
|
|
|
|
memset(&Qwk, ' ', sizeof(Qwk));
|
|
|
|
|
sprintf(Temp, "%-*lu", sizeof(Qwk.Msgnum), (long)Number);
|
|
|
|
|
Syslog('M', "Message %s", Temp);
|
|
|
|
|
memcpy(Qwk.Msgnum, Temp, sizeof(Qwk.Msgnum));
|
|
|
|
|
tp = localtime(&Msg.Written);
|
|
|
|
|
sprintf(Temp, "%02d-%02d-%02d", tp->tm_mon+1, tp->tm_mday, tp->tm_year % 100);
|
|
|
|
|
memcpy(Qwk.Msgdate, Temp, sizeof(Qwk.Msgdate));
|
|
|
|
|
sprintf(Temp, "%02d:%02d", tp->tm_hour, tp->tm_min);
|
|
|
|
|
memcpy(Qwk.Msgtime, Temp, sizeof(Qwk.Msgtime));
|
|
|
|
|
Msg.From[sizeof(Qwk.MsgFrom) - 1] = '\0';
|
|
|
|
|
memcpy(Qwk.MsgFrom, Msg.From, strlen(Msg.From));
|
|
|
|
|
Msg.To[sizeof(Qwk.MsgTo) - 1] = '\0';
|
|
|
|
|
memcpy(Qwk.MsgTo, Msg.To, strlen(Msg.To));
|
|
|
|
|
Msg.Subject[sizeof(Qwk.MsgSubj) - 1] = '\0';
|
|
|
|
|
memcpy(Qwk.MsgSubj, Msg.Subject, strlen(Msg.Subject));
|
|
|
|
|
Qwk.Msglive = 0xE1;
|
|
|
|
|
Qwk.Msgarealo = (unsigned char)(Area & 0xFF);
|
|
|
|
|
Qwk.Msgareahi = (unsigned char)((Area & 0xFF00) >> 8);
|
|
|
|
|
fwrite(&Qwk, sizeof(Qwk), 1, fdm);
|
|
|
|
|
Size = 128L;
|
|
|
|
|
if ((Text = (char *)MsgText_First()) != NULL) {
|
|
|
|
|
do {
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if ((Text[0] != 0x01) || (strncmp(Text, "\001MSGID", 6) == 0) ||
|
|
|
|
|
((strncmp(Text, "\001FMPT ", 6) == 0) && (msgs.Type == NETMAIL)) || (exitinfo.OL_ExtInfo)) {
|
2002-07-03 19:34:57 +00:00
|
|
|
|
Size += fwrite(Text, 1, strlen(Text), fdm);
|
|
|
|
|
Size += fwrite("\xE3", 1, 1, fdm);
|
|
|
|
|
}
|
|
|
|
|
} while ((Text = (char *)MsgText_Next()) != NULL);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if ((Size % 128L) != 0) {
|
|
|
|
|
memset(Temp, ' ', 128);
|
|
|
|
|
Size += fwrite(Temp, (int)(128L - (Size % 128L)), 1, fdm);
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
sprintf(Qwk.Msgrecs, "%-*lu", sizeof(Qwk.Msgrecs), (long)((ftell(fdm) - Pos) / 128L));
|
|
|
|
|
fseek(fdm, Pos, SEEK_SET);
|
|
|
|
|
fwrite(&Qwk, sizeof(Qwk), 1, fdm);
|
|
|
|
|
fseek(fdm, 0L, SEEK_END);
|
|
|
|
|
if ((Total % 16L) == 0L)
|
|
|
|
|
usleep(1);
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) {
|
|
|
|
|
BarWidth = (unsigned short)((Total * 61L) / TotalPack);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(CYAN, BLACK);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
printf("\r%.*s", BarWidth, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
} while (Msg_Next(&Number));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
} else {
|
|
|
|
|
WriteError("Not all files open");
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if (fdm != NULL)
|
|
|
|
|
fclose(fdm);
|
|
|
|
|
if (fdi != NULL)
|
|
|
|
|
fclose(fdi);
|
|
|
|
|
if (fdp != NULL)
|
|
|
|
|
fclose(fdp);
|
|
|
|
|
free(Work);
|
|
|
|
|
free(Temp);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
return Number;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *StripSpaces(char *String, int Size)
|
|
|
|
|
{
|
2002-07-03 19:34:57 +00:00
|
|
|
|
int x;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
memcpy(TempStr, String, Size);
|
|
|
|
|
TempStr[Size] = '\0';
|
|
|
|
|
if ((x = (Size - 1)) > 0) {
|
|
|
|
|
while (x > 0 && TempStr[x] == ' ')
|
|
|
|
|
TempStr[x--] = '\0';
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
return TempStr;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
|
*
|
|
|
|
|
* ASCII Offline Functions
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OLR_DownASCII(void)
|
|
|
|
|
{
|
2003-02-02 12:18:03 +00:00
|
|
|
|
struct tm *tp;
|
|
|
|
|
time_t Now;
|
|
|
|
|
char Pktname[32], *Work, *Temp;
|
|
|
|
|
long Area = 0;
|
|
|
|
|
int rc = 0;
|
|
|
|
|
FILE *fp = NULL, *tf, *mf, *af;
|
|
|
|
|
unsigned long Start, High;
|
|
|
|
|
msg_high *tmp, *mhl = NULL;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (strlen(CFG.bbsid) == 0) {
|
|
|
|
|
printf("System configuration error, inform sysop\n");
|
|
|
|
|
WriteError("Config OLR bbsid not configured");
|
|
|
|
|
Pause();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (!OLR_Prescan())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Total = TotalPersonal = 0L;
|
|
|
|
|
clear();
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(LIGHTBLUE, BLACK);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
/* ASCII Offline Download */
|
|
|
|
|
printf("%s\n", (char *)Language(460));
|
|
|
|
|
|
|
|
|
|
Work = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
Temp = calloc(PATH_MAX, sizeof(char));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
Now = time(NULL);
|
|
|
|
|
tp = localtime(&Now);
|
|
|
|
|
Syslog('+', "Preparing ASCII packet");
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
sprintf(Temp, "%s.MSG", CFG.bbsid);
|
|
|
|
|
sprintf(Pktname, "%s", tl(Temp));
|
|
|
|
|
sprintf(Work, "%s/%s/tmp", CFG.bbs_usersdir, exitinfo.Name);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
sprintf(Temp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
|
|
|
|
if ((mf = fopen(Temp, "r")) == NULL) {
|
|
|
|
|
WriteError("$Can't open %s", Temp);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, mf);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
sprintf(Temp, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
if ((tf = fopen(Temp, "r")) == NULL) {
|
|
|
|
|
WriteError("$Can't open %s", Temp);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
fclose(mf);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
Area = 0;
|
|
|
|
|
DrawBar(Pktname);
|
|
|
|
|
fseek(mf, sizeof(msgshdr), SEEK_SET);
|
|
|
|
|
fseek(tf, 0, SEEK_SET);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, mf) == 1) {
|
|
|
|
|
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
|
|
|
|
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
|
|
|
|
Area++;
|
|
|
|
|
if (olrtagrec.Tagged) {
|
|
|
|
|
if (Msg_Open(msgs.Base)) {
|
|
|
|
|
Current = Personal = 0;
|
|
|
|
|
if (Msg_Highest() != 0) {
|
|
|
|
|
memset(&LR, 0, sizeof(LR));
|
|
|
|
|
LR.UserID = grecno;
|
|
|
|
|
if (Msg_GetLastRead(&LR))
|
|
|
|
|
Start = LR.HighReadMsg;
|
|
|
|
|
else
|
|
|
|
|
Start = Msg_Lowest() -1;
|
|
|
|
|
if (Start > Msg_Highest())
|
|
|
|
|
Start = Msg_Highest();
|
|
|
|
|
if (Start < Msg_Highest()) {
|
|
|
|
|
High = ASCII_PackArea(Start, Area);
|
|
|
|
|
fill_high(&mhl, Area, High, Personal);
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-02-02 12:18:03 +00:00
|
|
|
|
Syslog('+', "Area %-20s %5ld (%ld personal)", msgs.QWKname, Current, Personal);
|
|
|
|
|
Msg_Close();
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-02-02 12:18:03 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (Total) {
|
|
|
|
|
/* Packing with */
|
|
|
|
|
printf("\n%s ", (char *)Language(446));
|
|
|
|
|
sprintf(Temp, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
|
|
|
|
if ((af = fopen(Temp, "r")) != NULL) {
|
|
|
|
|
fread(&archiverhdr, sizeof(archiverhdr), 1, af);
|
|
|
|
|
while (fread(&archiver, archiverhdr.recsize, 1, af) == 1) {
|
|
|
|
|
if (archiver.available && (!strcmp(archiver.name, exitinfo.Archiver))) {
|
|
|
|
|
Syslog('+', "Archiver %s", archiver.comment);
|
|
|
|
|
printf("%s ", archiver.comment);
|
|
|
|
|
alarm_on();
|
|
|
|
|
|
|
|
|
|
for (tmp = mhl; tmp; tmp = tmp->next) {
|
|
|
|
|
sprintf(Temp, "%s/%03ld.TXT", Work, tmp->Area);
|
|
|
|
|
AddArc(Temp, Pktname);
|
|
|
|
|
}
|
|
|
|
|
sprintf(Temp, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, Pktname);
|
|
|
|
|
rc = DownloadDirect(Temp, FALSE);
|
|
|
|
|
unlink(Temp);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-02-02 12:18:03 +00:00
|
|
|
|
}
|
|
|
|
|
fclose(af);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-02-02 12:18:03 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
colour(CFG.HiliteF, CFG.HiliteB);
|
|
|
|
|
if (rc == FALSE) {
|
|
|
|
|
Syslog('+', "ASCII download failed");
|
|
|
|
|
/* Download failed */
|
|
|
|
|
printf("%s", (char *)Language(447));
|
|
|
|
|
} else {
|
|
|
|
|
Syslog('+', "ASCII download successfull");
|
|
|
|
|
/* Download successfull */
|
|
|
|
|
printf("\r%s\n", (char *)Language(448));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (mhl != NULL)
|
|
|
|
|
UpdateLR(mhl, mf);
|
|
|
|
|
}
|
|
|
|
|
fclose(mf);
|
|
|
|
|
tidy_high(&mhl);
|
|
|
|
|
free(Temp);
|
|
|
|
|
free(Work);
|
|
|
|
|
printf("\n\n");
|
|
|
|
|
Pause();
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Pack messages in one mail area
|
|
|
|
|
*/
|
|
|
|
|
unsigned long ASCII_PackArea(unsigned long ulLast, long Area)
|
|
|
|
|
{
|
2003-03-02 13:29:33 +00:00
|
|
|
|
FILE *fp;
|
|
|
|
|
char *Work, *Temp, *Text;
|
|
|
|
|
unsigned long Number;
|
|
|
|
|
int Pack = FALSE;
|
|
|
|
|
struct tm *tp;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
Number = ulLast;
|
|
|
|
|
Current = Personal = 0L;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
Temp = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
Work = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
sprintf(Work, "%s/%s/tmp", CFG.bbs_usersdir, exitinfo.Name);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
sprintf(Temp, "%s/%03ld.TXT", Work, Area);
|
|
|
|
|
if ((fp = fopen(Temp, "a+")) != NULL) {
|
|
|
|
|
if (Msg_Next(&Number)) {
|
|
|
|
|
do {
|
|
|
|
|
Msg_ReadHeader(Number);
|
|
|
|
|
Msg_Read(Number, 78);
|
|
|
|
|
Pack = TRUE;
|
|
|
|
|
if ((strcasecmp(Msg.To, exitinfo.sUserName) == 0) || (strcasecmp(Msg.To, exitinfo.sHandle) == 0)) {
|
|
|
|
|
Personal++;
|
|
|
|
|
TotalPersonal++;
|
|
|
|
|
} else if (msgs.Type == NETMAIL) {
|
|
|
|
|
Pack = FALSE;
|
|
|
|
|
} else if ( msgs.MsgKinds == PRIVATE ) {
|
|
|
|
|
Pack = FALSE;
|
|
|
|
|
} else if (msgs.MsgKinds == BOTH ) {
|
|
|
|
|
if ( Msg.Private == TRUE )
|
|
|
|
|
Pack = FALSE;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if (Pack) {
|
|
|
|
|
fprintf (fp, "\n==============================================\n Msg. #%ld of %ld (%s)\n",
|
|
|
|
|
Number, Msg_Number(), msgs.Name);
|
|
|
|
|
tp = localtime(&Msg.Written);
|
|
|
|
|
fprintf (fp, " Date: %d %s %d %2d:%02d\n", tp->tm_mday,
|
2001-08-17 05:46:24 +00:00
|
|
|
|
GetMonth(tp->tm_mon + 1), tp->tm_year, tp->tm_hour, tp->tm_min);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
fprintf (fp, " From: %s\n", Msg.From);
|
|
|
|
|
if (Msg.To[0])
|
|
|
|
|
fprintf (fp, " To: %s\n", Msg.To);
|
|
|
|
|
fprintf (fp, "Subject: %s\n----------------------------------------------\n", Msg.Subject);
|
|
|
|
|
Current++;
|
|
|
|
|
Total++;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if ((Text = (char *)MsgText_First()) != NULL) {
|
|
|
|
|
do {
|
|
|
|
|
if (Text[0] != 0x01 && strncmp(Text, "SEEN-BY: ", 9))
|
|
|
|
|
fprintf(fp, "%s\n", Text);
|
|
|
|
|
} while ((Text = (char *)MsgText_Next()) != NULL);
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if ((Total % 16L) == 0L)
|
|
|
|
|
usleep(1);
|
|
|
|
|
|
|
|
|
|
if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) {
|
|
|
|
|
BarWidth = (unsigned short)((Total * 61L) / TotalPack);
|
|
|
|
|
colour(CYAN, BLACK);
|
|
|
|
|
printf("\r%.*s", BarWidth, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-03-02 13:29:33 +00:00
|
|
|
|
} while (Msg_Next(&Number));
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2003-03-02 13:29:33 +00:00
|
|
|
|
fclose(fp);
|
|
|
|
|
} else {
|
|
|
|
|
WriteError("Not all files open");
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
free(Work);
|
|
|
|
|
free(Temp);
|
|
|
|
|
return Number;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|