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
|
|
|
|
|
*
|
|
|
|
|
*****************************************************************************
|
2007-02-25 20:28:00 +00:00
|
|
|
|
* Copyright (C) 1997-2007
|
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
|
2003-08-15 20:05:34 +00:00
|
|
|
|
* Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
2001-08-17 05:46:24 +00:00
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
2002-06-30 12:48:44 +00:00
|
|
|
|
#include "../config.h"
|
2004-02-21 17:22:00 +00:00
|
|
|
|
#include "../lib/mbselib.h"
|
2001-08-17 05:46:24 +00:00
|
|
|
|
#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/bluewave.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"
|
2004-10-27 11:08:09 +00:00
|
|
|
|
#include "term.h"
|
2004-11-03 20:48:45 +00:00
|
|
|
|
#include "ttyio.h"
|
|
|
|
|
#include "openport.h"
|
2004-11-05 21:14:04 +00:00
|
|
|
|
#include "transfer.h"
|
2004-11-03 20:48:45 +00:00
|
|
|
|
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
|
|
|
|
|
2005-10-11 20:49:41 +00:00
|
|
|
|
int Total, TotalPersonal, Current, Personal;
|
|
|
|
|
unsigned int TotalPack;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
unsigned short BarWidth;
|
|
|
|
|
lastread LR;
|
|
|
|
|
static char TempStr[128];
|
|
|
|
|
extern int do_mailout;
|
2005-10-07 20:42:35 +00:00
|
|
|
|
extern int cols;
|
|
|
|
|
extern int rows;
|
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;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
unsigned int Area;
|
2006-03-05 16:10:03 +00:00
|
|
|
|
char Tag[60];
|
2005-10-11 20:49:41 +00:00
|
|
|
|
unsigned int LastMsg;
|
|
|
|
|
unsigned int Personal;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
} msg_high;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Internal prototypes.
|
|
|
|
|
*/
|
|
|
|
|
void AddArc(char *, char *);
|
|
|
|
|
void tidy_high(msg_high **);
|
2006-03-05 16:10:03 +00:00
|
|
|
|
void fill_high(msg_high **, unsigned int, char *, unsigned int, unsigned int);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
void UpdateLR(msg_high *, FILE *);
|
|
|
|
|
void Add_Kludges(fidoaddr, int, char *);
|
|
|
|
|
int OLR_Prescan(void);
|
|
|
|
|
void DrawBar(char *);
|
2005-10-11 20:49:41 +00:00
|
|
|
|
unsigned int BlueWave_PackArea(unsigned int, int);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
void BlueWave_Fetch(void);
|
2005-10-11 20:49:41 +00:00
|
|
|
|
unsigned int QWK_PackArea(unsigned int, int);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
void QWK_Fetch(void);
|
|
|
|
|
float IEEToMSBIN(float);
|
|
|
|
|
float MSBINToIEE(float);
|
|
|
|
|
char *StripSpaces(char *, int);
|
2006-03-05 16:10:03 +00:00
|
|
|
|
unsigned int ASCII_PackArea(unsigned int, int, char *);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
|
*
|
|
|
|
|
* Global Functions
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AddArc(char *Temp, char *Pktname)
|
|
|
|
|
{
|
2004-03-02 20:47:23 +00:00
|
|
|
|
execute_str((char *)archiver.marc, Pktname, Temp, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
|
2002-07-01 19:31:15 +00:00
|
|
|
|
unlink(Temp);
|
|
|
|
|
printf(".");
|
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
|
|
|
|
|
*/
|
2006-03-05 16:10:03 +00:00
|
|
|
|
void fill_high(msg_high **hdp, unsigned int Area, char *tag, unsigned int Last, unsigned int Pers)
|
2001-08-17 05:46:24 +00:00
|
|
|
|
{
|
2002-07-01 19:31:15 +00:00
|
|
|
|
msg_high *tmp;
|
|
|
|
|
|
|
|
|
|
tmp = (msg_high *)malloc(sizeof(msg_high));
|
|
|
|
|
tmp->next = *hdp;
|
|
|
|
|
tmp->Area = Area;
|
2006-03-05 16:10:03 +00:00
|
|
|
|
snprintf(tmp->Tag, 51, "%s", tag);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
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
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Updating lastread pointer */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(YELLOW, BLACK, (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) {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTCHAR('.');
|
2002-07-01 19:31:15 +00:00
|
|
|
|
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;
|
2004-11-03 20:48:45 +00:00
|
|
|
|
char *buf, msg[81];
|
2005-10-11 20:49:41 +00:00
|
|
|
|
int total, Offset, Area;
|
2002-07-01 19:31:15 +00:00
|
|
|
|
int lines, input, ignore = FALSE, maxlines;
|
|
|
|
|
|
2003-10-11 21:22:16 +00:00
|
|
|
|
WhosDoingWhat(OLR, NULL);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
|
|
|
|
|
Msgname = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
Tagname = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
buf = calloc(81, sizeof(char));
|
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Msgname, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
|
|
|
|
snprintf(Tagname, PATH_MAX, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
|
|
|
|
|
clear();
|
|
|
|
|
/* Tag Offline Reader message areas */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(YELLOW, BLACK, (char *)Language(66));
|
2002-07-01 19:31:15 +00:00
|
|
|
|
|
|
|
|
|
do {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(1);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Enter the name of the conference, or ? for a list: */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(WHITE, BLACK, (char *)Language(228));
|
2002-07-01 19:31:15 +00:00
|
|
|
|
colour(CFG.InputColourF, CFG.InputColourB);
|
|
|
|
|
GetstrC(buf, 20);
|
|
|
|
|
|
|
|
|
|
if (buf[0] == '?') {
|
2005-10-07 20:42:35 +00:00
|
|
|
|
maxlines = lines = rows - 1;
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Conference Area Msgs Description */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTCYAN, BLACK, (char *)Language(229));
|
2002-07-01 19:31:15 +00:00
|
|
|
|
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;
|
|
|
|
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && (!olrtagrec.Tagged) && strlen(msgs.QWKname)) {
|
|
|
|
|
if ( (lines != 0) || (ignore) ) {
|
|
|
|
|
lines--;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(msg, 81, "%-20.20s %-5d %-5d %s", msgs.QWKname, Area, total, msgs.Name);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(CYAN, BLACK, msg);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
}
|
|
|
|
|
if (lines == 0) {
|
|
|
|
|
/* More (Y/n/=) */
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(msg, 81, "%s%c\x08", (char *) Language(61),Keystroke(61,0));
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(WHITE, BLACK, msg);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
alarm_on();
|
2004-11-03 20:48:45 +00:00
|
|
|
|
input = toupper(Readkey());
|
|
|
|
|
PUTCHAR(input);
|
|
|
|
|
PUTCHAR('\r');
|
2002-07-01 19:31:15 +00:00
|
|
|
|
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()
|
|
|
|
|
{
|
2004-11-03 20:48:45 +00:00
|
|
|
|
char *Msgname, *Tagname, *buf, msg[81];
|
2002-07-01 19:31:15 +00:00
|
|
|
|
FILE *ma, *tf;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
int total, Offset, Area;
|
2002-07-01 19:31:15 +00:00
|
|
|
|
int lines, input, ignore = FALSE, maxlines;
|
|
|
|
|
|
2003-10-11 21:22:16 +00:00
|
|
|
|
WhosDoingWhat(OLR, NULL);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
|
|
|
|
|
Msgname = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
Tagname = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
buf = calloc(81, sizeof(char));
|
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Msgname, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
|
|
|
|
snprintf(Tagname, PATH_MAX, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
|
|
|
|
|
clear();
|
|
|
|
|
/* Untag Offline Reader message areas */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(YELLOW, BLACK, (char *)Language(256));
|
2002-07-01 19:31:15 +00:00
|
|
|
|
|
|
|
|
|
do {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(1);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Enter the name of the conference, or ? for a list: */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(WHITE, BLACK, (char *)Language(228));
|
2002-07-01 19:31:15 +00:00
|
|
|
|
colour(CFG.InputColourF, CFG.InputColourB);
|
|
|
|
|
GetstrC(buf, 20);
|
|
|
|
|
|
|
|
|
|
if (buf[0] == '?') {
|
2005-10-07 20:42:35 +00:00
|
|
|
|
maxlines = lines = rows - 1;
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Conference Area Msgs Description */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTCYAN, BLACK, (char *)Language(229));
|
2002-07-01 19:31:15 +00:00
|
|
|
|
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;
|
|
|
|
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && olrtagrec.Tagged && strlen(msgs.QWKname)) {
|
|
|
|
|
if ( (lines != 0) || (ignore) ) {
|
|
|
|
|
lines--;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(msg, 81, "%-20.20s %-5d %-5d %s", msgs.QWKname, Area, total, msgs.Name);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(CYAN, BLACK, msg);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
}
|
|
|
|
|
if (lines == 0) {
|
|
|
|
|
/* More (Y/n/=) */
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(msg, 81, "%s%c\x08", (char *) Language(61),Keystroke(61,0));
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(WHITE, BLACK, msg);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
alarm_on();
|
2004-11-03 20:48:45 +00:00
|
|
|
|
input = toupper(Readkey());
|
|
|
|
|
PUTCHAR(input);
|
|
|
|
|
PUTCHAR('\r');
|
2002-07-01 19:31:15 +00:00
|
|
|
|
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) {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTRED, BLACK, (char *)"Area cannot be switched off");
|
2002-07-01 19:31:15 +00:00
|
|
|
|
} 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 */
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, 128, "%s%s", (char *) Language(364), CFG.bbs_name);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
Center(temp);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(1);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(WHITE, BLUE);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Area State Type Description */
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, 128, "%-79s", (char *) Language(365));
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(WHITE, BLUE, temp);
|
|
|
|
|
free(temp);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-10-11 20:49:41 +00:00
|
|
|
|
void New_Area(int);
|
|
|
|
|
void New_Area(int Area)
|
2001-08-17 05:46:24 +00:00
|
|
|
|
{
|
2004-11-03 20:48:45 +00:00
|
|
|
|
char msg[81];
|
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* New */
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(msg, 81, "%4d %s", Area, (char *)Language(391));
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(LIGHTCYAN, BLACK, msg);
|
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
switch (msgs.Type) {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
case LOCALMAIL: PUTSTR((char *)Language(392)); /* Local */
|
2002-07-01 19:31:15 +00:00
|
|
|
|
break;
|
2004-11-03 20:48:45 +00:00
|
|
|
|
case NETMAIL: PUTSTR((char *)Language(393)); /* Netmail */
|
2002-07-01 19:31:15 +00:00
|
|
|
|
break;
|
|
|
|
|
case LIST:
|
2004-11-03 20:48:45 +00:00
|
|
|
|
case ECHOMAIL: PUTSTR((char *)Language(394)); /* Echomail */
|
2002-07-01 19:31:15 +00:00
|
|
|
|
break;
|
2004-11-03 20:48:45 +00:00
|
|
|
|
case NEWS: PUTSTR((char *)Language(395)); /* News */
|
2002-07-01 19:31:15 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTSTR(msgs.Name);
|
|
|
|
|
Enter(1);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-10-11 20:49:41 +00:00
|
|
|
|
void Old_Area(int);
|
|
|
|
|
void Old_Area(int Area)
|
2001-08-17 05:46:24 +00:00
|
|
|
|
{
|
2004-11-03 20:48:45 +00:00
|
|
|
|
char msg[81];
|
|
|
|
|
|
2002-07-01 19:31:15 +00:00
|
|
|
|
/* Del */
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(msg, 81, "%4d %s", Area, (char *)Language(397));
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTRED, BLACK, msg);
|
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;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
int Area;
|
2003-03-02 13:29:33 +00:00
|
|
|
|
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));
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Tagname, PATH_MAX, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
snprintf(Msgname, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
2003-03-02 13:29:33 +00:00
|
|
|
|
|
|
|
|
|
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);
|
2007-06-09 11:48:48 +00:00
|
|
|
|
if (utf8)
|
|
|
|
|
chartran_init((char *)"CP437", (char *)"UTF-8", 'B');
|
2007-06-16 11:21:16 +00:00
|
|
|
|
PUTSTR(chartran(fLine_str(79)));
|
2007-06-09 11:48:48 +00:00
|
|
|
|
chartran_close();
|
2003-03-02 13:29:33 +00:00
|
|
|
|
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()
|
|
|
|
|
{
|
2004-11-03 20:48:45 +00:00
|
|
|
|
char *Tagname, *Msgname, msg[81];
|
2003-03-02 13:29:33 +00:00
|
|
|
|
FILE *tf, *ma;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
int total, Area = 0;
|
2003-03-02 13:29:33 +00:00
|
|
|
|
int lines, input, ignore = FALSE, maxlines;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-10-11 21:22:16 +00:00
|
|
|
|
WhosDoingWhat(OLR, NULL);
|
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));
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Tagname, PATH_MAX, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
snprintf(Msgname, PATH_MAX, "%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();
|
|
|
|
|
/* You have selected the following Conference(s): */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(YELLOW, BLACK, (char *)Language(260));
|
|
|
|
|
Enter(1);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
/* Conference Area Msgs Description */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTCYAN, BLACK, (char *)Language(229));
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(CYAN, BLACK);
|
2005-10-07 20:42:35 +00:00
|
|
|
|
maxlines = lines = rows - 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--;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(msg, 81, "%-20.20s %-5d %-5d %s", msgs.QWKname, Area, total, msgs.Name);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTSTR(msg);
|
|
|
|
|
Enter(1);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
}
|
|
|
|
|
if (lines == 0) {
|
|
|
|
|
/* More (Y/n/=) */
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(msg, 81, "%s%c\x08", (char *) Language(61),Keystroke(61,0));
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(WHITE, BLACK, msg);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
alarm_on();
|
2004-11-03 20:48:45 +00:00
|
|
|
|
input = toupper(Readkey());
|
|
|
|
|
PUTCHAR(input);
|
|
|
|
|
PUTCHAR('\r');
|
2003-03-02 13:29:33 +00:00
|
|
|
|
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);
|
|
|
|
|
}
|
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;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
unsigned int Number;
|
2004-11-03 20:48:45 +00:00
|
|
|
|
char *Temp, msg[81];
|
2003-03-02 13:29:33 +00:00
|
|
|
|
FILE *mf, *tf;
|
|
|
|
|
int x;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-10-11 21:22:16 +00:00
|
|
|
|
WhosDoingWhat(OLR, NULL);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
clear();
|
|
|
|
|
/* Offline Reader Download */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(LIGHTMAGENTA, BLACK, (char *)Language(277));
|
|
|
|
|
Enter(2);
|
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));
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
2003-03-02 13:29:33 +00:00
|
|
|
|
mf = fopen(Temp, "r");
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, mf);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
tf = fopen(Temp, "r");
|
|
|
|
|
Total = TotalPersonal = Areas = 0;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(1);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
colour(WHITE, BLUE);
|
|
|
|
|
/* Forum Description Msgs. Pers. */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(WHITE, BLUE, (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;
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(msg, 81, "%-20.20s %-41.41s ", msgs.QWKname, msgs.Name);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(LIGHTCYAN, BLACK, msg);
|
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
|
|
|
|
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(msg, 81, "%5u %5u", Current, Personal);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTGREEN, BLACK, msg);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
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
|
|
|
|
|
2005-10-11 20:49:41 +00:00
|
|
|
|
Syslog('+', "OLR Prescan: %u Areas, %u Messages", Areas, Total);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(1);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
/* Total messages found: */
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(msg, 81, "%s %u", (char *)Language(338), Total);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(LIGHTBLUE, BLACK, msg);
|
|
|
|
|
Enter(2);
|
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if (Total == 0L) {
|
|
|
|
|
/* No messages found to download! */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(YELLOW, BLACK, (char *)Language(374));
|
|
|
|
|
PUTCHAR('\007');
|
2003-03-02 13:29:33 +00:00
|
|
|
|
Pause();
|
|
|
|
|
} else {
|
|
|
|
|
if (CFG.OLR_MaxMsgs != 0 && Total > CFG.OLR_MaxMsgs) {
|
|
|
|
|
/* Too much messages. Only the first will be packed! */
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(msg, 81, "%s %d %s", (char *)Language(377), CFG.OLR_MaxMsgs, (char *)Language(411));
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTCHAR('\007');
|
|
|
|
|
Enter(2);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
Total = CFG.OLR_MaxMsgs;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-03-02 13:29:33 +00:00
|
|
|
|
/* Do you want to download these messages [Y/n]? */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(CFG.HiliteF, CFG.HiliteB, (char *)Language(425));
|
2003-03-02 13:29:33 +00:00
|
|
|
|
alarm_on();
|
2004-11-03 20:48:45 +00:00
|
|
|
|
x = toupper(Readkey());
|
2003-03-02 13:29:33 +00:00
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
2004-11-03 20:48:45 +00:00
|
|
|
|
char msg[81];
|
|
|
|
|
|
|
|
|
|
Enter(1);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
/* Preparing packet */
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(msg, 81, "%s %s...", (char *)Language(445), Pktname);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(YELLOW, BLACK, msg);
|
|
|
|
|
Enter(2);
|
|
|
|
|
poutCR(LIGHTGREEN, BLACK, (char *)"0%% 10%% 20%% 30%% 40%% 50%% 60%% 70%% 80%% 90%% 100%%");
|
|
|
|
|
PUTSTR((char *)"|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|");
|
|
|
|
|
PUTCHAR('\r');
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OLR_RestrictDate()
|
|
|
|
|
{
|
2003-10-11 21:22:16 +00:00
|
|
|
|
WhosDoingWhat(OLR, NULL);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTSTR((char *)"Not Yet Implemented");
|
|
|
|
|
Enter(1);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
Pause();
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Upload offline mail. Filenames: BBSID.NEW or BBSID.REP.
|
|
|
|
|
* Should also do hhhhhhhh.SU0 for point uploads.
|
|
|
|
|
*/
|
|
|
|
|
void OLR_Upload(void)
|
|
|
|
|
{
|
2004-11-06 22:01:51 +00:00
|
|
|
|
char *File, *temp, *Arc, Dirpath[PATH_MAX], Filename[81];
|
|
|
|
|
int rc = 0, RetVal = FALSE;
|
2003-02-02 12:18:03 +00:00
|
|
|
|
FILE *fp;
|
2004-11-06 22:01:51 +00:00
|
|
|
|
up_list *up = NULL, *tmpf;
|
2003-02-02 12:18:03 +00:00
|
|
|
|
|
|
|
|
|
if (strlen(CFG.bbsid) == 0) {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTSTR((char *)"System configuration error, inform sysop");
|
|
|
|
|
Enter(1);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
WriteError("Config OLR bbsid not configured");
|
|
|
|
|
Pause();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2003-10-11 21:22:16 +00:00
|
|
|
|
WhosDoingWhat(OLR, NULL);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
clear();
|
|
|
|
|
/* Offline Reader Upload */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTMAGENTA, BLACK, (char *)Language(439));
|
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
|
|
|
|
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(1);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2004-11-06 22:01:51 +00:00
|
|
|
|
if ((rc = upload(&up))) {
|
|
|
|
|
Syslog('+', "Upload failed, rc=%d", rc);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Home();
|
2004-11-06 22:01:51 +00:00
|
|
|
|
Enter(1);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Dirpath, PATH_MAX, "%s/%s/upl", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
snprintf(Filename, 81, "%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) {
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Filename, 81, "%s.REP", CFG.bbsid);
|
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 == FALSE) {
|
|
|
|
|
WriteError("Invalid OLR packed received");
|
2004-11-06 22:01:51 +00:00
|
|
|
|
for (tmpf = up; tmpf; tmpf = tmpf->next) {
|
|
|
|
|
Syslog('+', "Delete %s", tmpf->filename);
|
|
|
|
|
unlink(tmpf->filename);
|
|
|
|
|
}
|
|
|
|
|
tidy_upload(&up);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
/* Invalid packet received */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(LIGHTRED, BLACK, (char *)Language(440));
|
|
|
|
|
Enter(2);
|
2004-11-06 22:01:51 +00:00
|
|
|
|
sleep(3);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2004-11-06 22:01:51 +00:00
|
|
|
|
tidy_upload(&up);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(File, PATH_MAX, "%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 */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTRED, BLACK, (char *)Language(441));
|
2003-02-02 12:18:03 +00:00
|
|
|
|
Syslog('+', "Unknown compression type");
|
|
|
|
|
Pause();
|
2004-11-06 22:01:51 +00:00
|
|
|
|
unlink(File);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
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
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
2003-02-02 12:18:03 +00:00
|
|
|
|
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 */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTRED, BLACK, (char *)Language(442));
|
2003-02-02 12:18:03 +00:00
|
|
|
|
Pause();
|
2004-11-06 22:01:51 +00:00
|
|
|
|
unlink(File);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
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 */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(CFG.TextColourF, CFG.TextColourB, (char *) Language(201));
|
|
|
|
|
PUTCHAR(' ');
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s %s", archiver.funarc, File);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
Syslog('m', "Unarc %s", temp);
|
|
|
|
|
colour(CFG.HiliteF, CFG.HiliteB);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2004-11-06 22:01:51 +00:00
|
|
|
|
rc = execute_str(archiver.funarc, File, NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
|
2004-11-03 20:48:45 +00:00
|
|
|
|
if (rawport() != 0) {
|
|
|
|
|
WriteError("Unable to set raw mode");
|
|
|
|
|
}
|
2004-11-06 22:01:51 +00:00
|
|
|
|
if (rc) {
|
2003-02-02 12:18:03 +00:00
|
|
|
|
WriteError("$Failed %s", temp);
|
|
|
|
|
/* ERROR */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTRED, BLACK, (char *) Language(217));
|
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 */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTSTR((char *) Language(200));
|
|
|
|
|
Enter(1);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
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;
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Dirpath, PATH_MAX, "%s/%s", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
snprintf(Filename, 81, "%s.UPL", CFG.bbsid);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
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) {
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Filename, 81, "%s.REQ", CFG.bbsid);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
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) {
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Filename, 81, "%s.OLC", CFG.bbsid);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
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
|
|
|
|
|
*/
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Filename, 81, "%s.MSG", CFG.bbsid);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
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 */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTRED, BLACK, (char *)Language(443));
|
2003-02-02 12:18:03 +00:00
|
|
|
|
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;
|
2006-01-22 14:23:10 +00:00
|
|
|
|
char Pktname[32], *Work, *Temp, *cwd = NULL;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
int Area = 0;
|
2004-11-06 16:27:46 +00:00
|
|
|
|
int RetVal = FALSE, rc = 0;
|
2002-07-03 19:34:57 +00:00
|
|
|
|
FILE *fp, *tf, *mf, *af;
|
|
|
|
|
INF_HEADER Inf;
|
|
|
|
|
INF_AREA_INFO AreaInf;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
unsigned int Start, High;
|
2002-07-03 19:34:57 +00:00
|
|
|
|
msg_high *mhl = NULL;
|
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
if (strlen(CFG.bbsid) == 0) {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTSTR((char *)"System configuration error, inform sysop");
|
|
|
|
|
Enter(1);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
WriteError("Config OLR bbsid not configured");
|
|
|
|
|
Pause();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if (!OLR_Prescan())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Total = TotalPersonal = 0;
|
|
|
|
|
clear();
|
|
|
|
|
/* BlueWave Offline download */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTBLUE, BLACK, (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
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Pktname, 32, "%s%s", CFG.bbsid , Extensions[tp->tm_wday]);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
Syslog('m', "Packet name %s", Pktname);
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Work, PATH_MAX, "%s/%s/tmp", CFG.bbs_usersdir, exitinfo.Name);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
Syslog('m', "Work path %s", Work);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/%s.INF", Work, CFG.bbsid);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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;
|
2006-01-22 21:06:59 +00:00
|
|
|
|
strncpy((char *)Inf.loginname, exitinfo.sUserName, 43);
|
|
|
|
|
strncpy((char *)Inf.aliasname, exitinfo.sHandle, 43);
|
|
|
|
|
Inf.zone = le_us(CFG.aka[0].zone);
|
|
|
|
|
Inf.net = le_us(CFG.aka[0].net);
|
|
|
|
|
Inf.node = le_us(CFG.aka[0].node);
|
|
|
|
|
Inf.point = le_us(CFG.aka[0].point);
|
|
|
|
|
strncpy((char *)Inf.sysop, CFG.sysop_name, 41);
|
|
|
|
|
strncpy((char *)Inf.systemname, CFG.bbs_name, 65);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
Inf.maxfreqs = CFG.OLR_MaxReq;
|
|
|
|
|
if (exitinfo.HotKeys)
|
2006-01-22 21:06:59 +00:00
|
|
|
|
Inf.uflags |= le_us(INF_HOTKEYS);
|
2007-02-25 20:28:00 +00:00
|
|
|
|
Inf.uflags |= le_us(INF_GRAPHICS);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if (exitinfo.OL_ExtInfo)
|
2006-01-22 21:06:59 +00:00
|
|
|
|
Inf.uflags |= le_us(INF_EXT_INFO);
|
|
|
|
|
Inf.credits = le_us(exitinfo.Credit);
|
|
|
|
|
Inf.inf_header_len = le_us((unsigned short)sizeof(INF_HEADER));
|
|
|
|
|
Inf.inf_areainfo_len = le_us((unsigned short)sizeof(INF_AREA_INFO));
|
|
|
|
|
Inf.mix_structlen = le_us((unsigned short)sizeof(MIX_REC));
|
|
|
|
|
Inf.fti_structlen = le_us((unsigned short)sizeof(FTI_REC));
|
2002-07-03 19:34:57 +00:00
|
|
|
|
Inf.uses_upl_file = TRUE;
|
|
|
|
|
Inf.can_forward = TRUE;
|
2006-01-22 21:06:59 +00:00
|
|
|
|
strncpy((char *)Inf.packet_id, CFG.bbsid, 9);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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));
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf((char *)AreaInf.areanum, 6, "%u", Area);
|
2005-08-29 10:29:22 +00:00
|
|
|
|
strncpy((char *)AreaInf.echotag, msgs.QWKname, 21);
|
|
|
|
|
strncpy((char *)AreaInf.title, msgs.Name, 50);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if (olrtagrec.Tagged) {
|
2006-01-22 21:06:59 +00:00
|
|
|
|
AreaInf.area_flags |= le_us((tWORD)INF_SCANNING);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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
|
|
|
|
|
2006-01-22 21:06:59 +00:00
|
|
|
|
case NETMAIL: AreaInf.area_flags |= le_us((tWORD)(INF_ECHO+INF_NETMAIL+INF_HASFILE));
|
2002-07-03 19:34:57 +00:00
|
|
|
|
break;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
case LIST:
|
2006-01-22 21:06:59 +00:00
|
|
|
|
case ECHOMAIL: AreaInf.area_flags |= le_us((tWORD)INF_ECHO);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
break;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2006-01-22 21:06:59 +00:00
|
|
|
|
// case EMAIL: AreaInf.area_flags |= le_us((tWORD)(INF_ECHO+INF_NETMAIL));
|
|
|
|
|
// AreaInf.network_type |= le_us((tWORD)INF_NET_INTERNET);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
// break;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2006-01-22 21:06:59 +00:00
|
|
|
|
case NEWS: AreaInf.area_flags |= le_us((tWORD)INF_ECHO);
|
|
|
|
|
AreaInf.network_type |= le_us((tWORD)INF_NET_INTERNET);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch(msgs.MsgKinds) {
|
|
|
|
|
case BOTH: if (Access(exitinfo.Security, msgs.WRSec))
|
2006-01-22 21:06:59 +00:00
|
|
|
|
AreaInf.area_flags |= le_us((tWORD)INF_POST);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PRIVATE: if (Access(exitinfo.Security, msgs.WRSec))
|
2006-01-22 21:06:59 +00:00
|
|
|
|
AreaInf.area_flags |= le_us((tWORD)INF_POST);
|
|
|
|
|
AreaInf.area_flags |= le_us((tWORD)INF_NO_PUBLIC);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PUBLIC: if (Access(exitinfo.Security, msgs.WRSec))
|
2006-01-22 21:06:59 +00:00
|
|
|
|
AreaInf.area_flags |= le_us((tWORD)INF_POST);
|
|
|
|
|
AreaInf.area_flags |= le_us((tWORD)INF_NO_PRIVATE);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case RONLY: break;
|
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if (msgs.Aliases)
|
2006-01-22 21:06:59 +00:00
|
|
|
|
AreaInf.area_flags |= le_us((tWORD)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);
|
2006-03-05 16:10:03 +00:00
|
|
|
|
fill_high(&mhl, Area, msgs.Tag, 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);
|
|
|
|
|
|
|
|
|
|
alarm_on();
|
|
|
|
|
|
|
|
|
|
if (Total) {
|
|
|
|
|
/* Packing with */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(1);
|
|
|
|
|
PUTSTR((char *)Language(446));
|
|
|
|
|
PUTCHAR(' ');
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTSTR(archiver.comment);
|
|
|
|
|
PUTCHAR(' ');
|
2006-01-22 14:23:10 +00:00
|
|
|
|
cwd = getcwd(cwd, PATH_MAX);
|
|
|
|
|
chdir(Work);
|
|
|
|
|
snprintf(Temp, PATH_MAX, "%s.DAT", CFG.bbsid);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
AddArc(Temp, Pktname);
|
|
|
|
|
alarm_on();
|
2006-01-22 14:23:10 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s.FTI", CFG.bbsid);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
AddArc(Temp, Pktname);
|
2006-01-22 14:23:10 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s.INF", CFG.bbsid);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
AddArc(Temp, Pktname);
|
2006-01-22 14:23:10 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s.MIX", CFG.bbsid);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
AddArc(Temp, Pktname);
|
2006-01-22 14:23:10 +00:00
|
|
|
|
chdir(cwd);
|
|
|
|
|
free(cwd);
|
|
|
|
|
cwd = NULL;
|
2006-01-22 21:06:59 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/%s/tmp/%s", CFG.bbs_usersdir, exitinfo.Name, Pktname);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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
|
|
|
|
|
2004-11-06 16:27:46 +00:00
|
|
|
|
if (rc) {
|
2002-07-03 19:34:57 +00:00
|
|
|
|
Syslog('+', "BlueWave download failed");
|
|
|
|
|
/* Download failed */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(CFG.HiliteF, CFG.HiliteB, (char *)Language(447));
|
2002-07-03 19:34:57 +00:00
|
|
|
|
} else {
|
|
|
|
|
Syslog('+', "BlueWave download successfull");
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTCHAR('\r');
|
2002-07-03 19:34:57 +00:00
|
|
|
|
/* Download successfull */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(CFG.HiliteF, CFG.HiliteB, (char *)Language(448));
|
2002-07-03 19:34:57 +00:00
|
|
|
|
|
|
|
|
|
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);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(2);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
/* Processing BlueWave reply packet */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTBLUE, BLACK, (char *)Language(450));
|
2002-06-30 19:20:59 +00:00
|
|
|
|
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
|
|
|
|
|
*/
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Dirpath, PATH_MAX, "%s/%s", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
snprintf(Filename, 81, "%s.UPL", CFG.bbsid);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if (getfilecase(Dirpath, Filename)) {
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%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);
|
2006-01-23 15:59:23 +00:00
|
|
|
|
if (le_us(Uph.upl_header_len) != sizeof(UPL_HEADER)) {
|
2002-06-30 19:20:59 +00:00
|
|
|
|
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 */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTRED, BLACK, (char *)Language(451));
|
2002-06-30 19:20:59 +00:00
|
|
|
|
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);
|
2007-08-25 18:32:07 +00:00
|
|
|
|
if (strlen((char *)Uph.reader_tear))
|
|
|
|
|
newtear = xstrcpy((char *)Uph.reader_tear);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
|
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 */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(CFG.TextColourF, CFG.TextColourB, (char *)Language(452));
|
|
|
|
|
PUTCHAR(' ');
|
2002-06-30 19:20:59 +00:00
|
|
|
|
colour(CFG.HiliteF, CFG.HiliteB);
|
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
|
|
memset(&Upr, 0, sizeof(UPL_REC));
|
2006-01-23 16:27:16 +00:00
|
|
|
|
Syslog('m', "Start UPL reply records");
|
|
|
|
|
while (fread(&Upr, le_us(Uph.upl_rec_len), 1, up) == 1) {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTCHAR('.');
|
2002-06-30 19:20:59 +00:00
|
|
|
|
Syslog('m', " From : %s", Upr.from);
|
|
|
|
|
Syslog('m', " To : %s", Upr.to);
|
|
|
|
|
Syslog('m', " Subj : %s", Upr.subj);
|
2006-01-22 21:06:59 +00:00
|
|
|
|
now = (time_t)le_int((int)Upr.unix_date);
|
2002-06-30 19:20:59 +00:00
|
|
|
|
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);
|
2006-01-22 21:06:59 +00:00
|
|
|
|
Syslog('m', " Dest : %d:%d/%d.%d", le_us(Upr.destzone), le_us(Upr.destnet),
|
|
|
|
|
le_us(Upr.destnode), le_us(Upr.destpoint));
|
|
|
|
|
if (Upr.msg_attr & le_us(UPL_INACTIVE))
|
2002-06-30 19:20:59 +00:00
|
|
|
|
Syslog('m', " Message is Inactive");
|
2006-01-22 21:06:59 +00:00
|
|
|
|
if (Upr.msg_attr & le_us(UPL_PRIVATE))
|
2002-06-30 19:20:59 +00:00
|
|
|
|
Syslog('m', " Message is Private");
|
2006-01-22 21:06:59 +00:00
|
|
|
|
if (Upr.msg_attr & le_us(UPL_HAS_FILE))
|
2002-06-30 19:20:59 +00:00
|
|
|
|
Syslog('m', " File Attach");
|
2006-01-22 21:06:59 +00:00
|
|
|
|
if (Upr.msg_attr & le_us(UPL_NETMAIL))
|
2002-06-30 19:20:59 +00:00
|
|
|
|
Syslog('m', " Is Netmail");
|
2006-01-22 21:06:59 +00:00
|
|
|
|
if (Upr.msg_attr & le_us(UPL_IS_REPLY))
|
2002-06-30 19:20:59 +00:00
|
|
|
|
Syslog('m', " Is Reply");
|
|
|
|
|
if (Upr.network_type)
|
|
|
|
|
Syslog('m', " Type : Internet");
|
|
|
|
|
else
|
|
|
|
|
Syslog('m', " Type : Fidonet");
|
2007-08-25 18:32:07 +00:00
|
|
|
|
getfilecase(Dirpath, (char *)Upr.filename);
|
2002-06-30 19:20:59 +00:00
|
|
|
|
Syslog('m', " File : %s", Upr.filename);
|
|
|
|
|
Syslog('m', " Tag : %s", Upr.echotag);
|
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
2002-06-30 19:20:59 +00:00
|
|
|
|
if ((mf = fopen(temp, "r+")) != NULL) {
|
|
|
|
|
fread(&msgshdr, sizeof(msgshdr), 1, mf);
|
|
|
|
|
Found = FALSE;
|
|
|
|
|
|
2007-08-25 18:32:07 +00:00
|
|
|
|
if (strlen((char *)Upr.echotag)) {
|
2002-06-30 19:20:59 +00:00
|
|
|
|
while (fread(&msgs, msgshdr.recsize, 1, mf) == 1) {
|
|
|
|
|
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
2007-08-25 18:32:07 +00:00
|
|
|
|
if (msgs.Active && (strcasecmp(msgs.QWKname, (char *)Upr.echotag) == 0)) {
|
2002-06-30 19:20:59 +00:00
|
|
|
|
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.
|
|
|
|
|
*/
|
2007-08-25 18:32:07 +00:00
|
|
|
|
temp = strtok(strdup((char *)Upr.filename), ".");
|
2002-06-30 19:20:59 +00:00
|
|
|
|
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();
|
2007-08-25 18:32:07 +00:00
|
|
|
|
strcpy(Msg.From, (char *)Upr.from);
|
|
|
|
|
strcpy(Msg.To, (char *)Upr.to);
|
|
|
|
|
strcpy(Msg.Subject, (char *)Upr.subj);
|
2005-08-10 15:32:42 +00:00
|
|
|
|
mbse_CleanSubject(Msg.Subject);
|
2006-01-22 21:06:59 +00:00
|
|
|
|
if (Upr.msg_attr & le_us(UPL_PRIVATE))
|
2002-06-30 19:20:59 +00:00
|
|
|
|
Msg.Private = TRUE;
|
|
|
|
|
if (msgs.MsgKinds == PRIVATE)
|
|
|
|
|
Msg.Private = TRUE;
|
2006-01-22 21:06:59 +00:00
|
|
|
|
Msg.Written = le_int((int)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;
|
2006-01-22 21:06:59 +00:00
|
|
|
|
dest.zone = le_us(Upr.destzone);
|
|
|
|
|
dest.net = le_us(Upr.destnet);
|
|
|
|
|
dest.node = le_us(Upr.destnode);
|
|
|
|
|
dest.point = le_us(Upr.destpoint);
|
2007-08-25 18:32:07 +00:00
|
|
|
|
Add_Kludges(dest, FALSE, (char *)Upr.filename);
|
2002-06-30 19:20:59 +00:00
|
|
|
|
Syslog('+', "Msg (%ld) to \"%s\", \"%s\", in %s", Msg.Id, Msg.To, Msg.Subject, msgs.QWKname);
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, Upr.filename);
|
2002-06-30 19:20:59 +00:00
|
|
|
|
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) {
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s/tmp/%smail.jam", getenv("MBSE_ROOT"),
|
2002-07-03 19:34:57 +00:00
|
|
|
|
((msgs.Type == ECHOMAIL) || (msgs.Type == LIST))? "echo" : "net");
|
|
|
|
|
if ((fp = fopen(temp, "a")) != NULL) {
|
2005-10-11 20:49:41 +00:00
|
|
|
|
fprintf(fp, "%s %u\n", msgs.Base, Msg.Id);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-09-14 12:24:18 +00:00
|
|
|
|
Close_Msgbase(msgs.Base);
|
2002-06-30 19:20:59 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(1);
|
2002-06-30 19:20:59 +00:00
|
|
|
|
/* No Write access to area */
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s %s", (char *)Language(453), msgs.Name);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTRED, BLACK, temp);
|
2002-06-30 19:20:59 +00:00
|
|
|
|
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
|
|
|
|
}
|
2006-01-23 16:27:16 +00:00
|
|
|
|
Syslog('m', "Stop UPL reply records");
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(1);
|
2002-06-30 19:20:59 +00:00
|
|
|
|
if (i) {
|
|
|
|
|
/* Messages imported */
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%d %s", i, (char *)Language(454));
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(CFG.TextColourF, CFG.TextColourB, temp);
|
2002-06-30 19:20:59 +00:00
|
|
|
|
ReadExitinfo();
|
|
|
|
|
exitinfo.iPosted += i;
|
|
|
|
|
WriteExitinfo();
|
|
|
|
|
do_mailout = TRUE;
|
|
|
|
|
}
|
|
|
|
|
fclose(up);
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%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
|
|
|
|
|
*/
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Filename, 81, "%s.OLC", CFG.bbsid);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if (getfilecase(Dirpath, Filename)) {
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%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
|
|
|
|
/* Processing Offline Configuration */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTBLUE, BLACK, (char *)Language(455));
|
2003-03-02 13:29:33 +00:00
|
|
|
|
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");
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if ((up = fopen(temp, "r+")) != NULL) {
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
2003-03-02 13:29:33 +00:00
|
|
|
|
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) {
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if ((up = fopen(temp, "r+")) != NULL) {
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
2003-03-02 13:29:33 +00:00
|
|
|
|
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);
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s/%s", Dirpath, Filename);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
unlink(temp);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
/* Message areas selected */
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%d %s", i, (char *)Language(456));
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(CYAN, BLACK, temp);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
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
|
|
|
|
/*
|
2006-01-22 21:06:59 +00:00
|
|
|
|
* Check for .REQ file. This file should be saved in the users home
|
|
|
|
|
* directory so that the next time a OLR download is done the
|
|
|
|
|
* requests are added.
|
|
|
|
|
* FIXME: nothing implemented yet!
|
2002-07-01 19:31:15 +00:00
|
|
|
|
*/
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Filename, 81, "%s.REQ", CFG.bbsid);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
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));
|
2006-01-22 21:06:59 +00:00
|
|
|
|
Syslog('+', "Reading 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);
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%-12s ", Req.filename);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(CFG.TextColourF, CFG.TextColourB, temp);
|
2002-07-01 19:31:15 +00:00
|
|
|
|
colour(CFG.HiliteF, CFG.HiliteB);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(1);
|
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
|
|
|
|
|
*/
|
2005-10-11 20:49:41 +00:00
|
|
|
|
unsigned int BlueWave_PackArea(unsigned int ulLast, int Area)
|
2001-08-17 05:46:24 +00:00
|
|
|
|
{
|
2002-07-03 19:34:57 +00:00
|
|
|
|
FILE *fdm, *fdfti, *fdmix;
|
2004-11-03 20:48:45 +00:00
|
|
|
|
char *Temp, *Text, msg[81];
|
2005-10-11 20:49:41 +00:00
|
|
|
|
unsigned int Number;
|
2002-07-03 19:34:57 +00:00
|
|
|
|
MIX_REC Mix;
|
|
|
|
|
FTI_REC Fti;
|
|
|
|
|
struct tm *tp;
|
2006-01-23 15:40:21 +00:00
|
|
|
|
int Pack, length;
|
2002-07-03 19:34:57 +00:00
|
|
|
|
|
|
|
|
|
Number = ulLast;
|
|
|
|
|
Temp = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/%s/tmp/%s.FTI", CFG.bbs_usersdir, exitinfo.Name, CFG.bbsid);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
fdfti = fopen(Temp, "a+");
|
2006-01-23 15:01:12 +00:00
|
|
|
|
fseek(fdfti, 0, SEEK_END); /* We need to do this, else ftell doesn't work right */
|
2002-07-03 19:34:57 +00:00
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/%s/tmp/%s.MIX", CFG.bbs_usersdir, exitinfo.Name, CFG.bbsid);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
fdmix = fopen(Temp, "a+");
|
2006-01-23 15:40:21 +00:00
|
|
|
|
fseek(fdmix, 0, SEEK_END);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/%s/tmp/%s.DAT", CFG.bbs_usersdir, exitinfo.Name, CFG.bbsid);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
fdm = fopen(Temp, "a+");
|
2006-01-23 15:40:21 +00:00
|
|
|
|
fseek(fdm, 0, SEEK_END);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
|
|
|
|
|
memset(&Mix, 0, sizeof(MIX_REC));
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf((char *)Mix.areanum, 6, "%u", Area);
|
2006-01-23 15:01:12 +00:00
|
|
|
|
// Syslog('m', "fti position: %d", ftell(fdfti));
|
2006-01-22 21:06:59 +00:00
|
|
|
|
Mix.msghptr = le_int((int)ftell(fdfti));
|
2002-07-03 19:34:57 +00:00
|
|
|
|
|
|
|
|
|
if ((fdfti != NULL) && (fdmix != NULL) && (fdm != NULL)) {
|
|
|
|
|
if (Msg_Next(&Number)) {
|
|
|
|
|
do {
|
|
|
|
|
Msg_ReadHeader(Number);
|
2004-09-12 12:59:38 +00:00
|
|
|
|
Msg_Read(Number, 79);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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));
|
|
|
|
|
|
2006-01-22 21:06:59 +00:00
|
|
|
|
strncpy((char *)Fti.from, Msg.From, 36);
|
|
|
|
|
strncpy((char *)Fti.to, Msg.To, 36);
|
|
|
|
|
strncpy((char *)Fti.subject, Msg.Subject, 72);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
tp = localtime(&Msg.Written);
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf((char *)Fti.date, 20, "%2d %.3s %2d %2d:%02d:%02d", tp->tm_mday,
|
2002-07-03 19:34:57 +00:00
|
|
|
|
(char *) Language(398 + tp->tm_mon), tp->tm_year, tp->tm_hour, tp->tm_min, tp->tm_sec);
|
2006-01-22 21:06:59 +00:00
|
|
|
|
Fti.msgnum = le_us((tWORD)Number);
|
2006-01-23 15:40:21 +00:00
|
|
|
|
Fti.msgptr = le_int((tLONG)ftell(fdm));
|
2006-01-22 21:06:59 +00:00
|
|
|
|
Fti.replyto = le_us((tWORD)Msg.Original);
|
|
|
|
|
Fti.replyat = le_us((tWORD)Msg.Reply);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if (msgs.Type == NETMAIL) {
|
2006-01-22 21:06:59 +00:00
|
|
|
|
Fti.orig_zone = le_us(msgs.Aka.zone);
|
|
|
|
|
Fti.orig_net = le_us(msgs.Aka.net);
|
|
|
|
|
Fti.orig_node = le_us(msgs.Aka.node);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2006-01-23 15:40:21 +00:00
|
|
|
|
length = (int)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)) {
|
2006-01-23 15:40:21 +00:00
|
|
|
|
length += fwrite(Text, 1, strlen(Text), fdm);
|
|
|
|
|
length += fwrite("\r\n", 1, 2, fdm);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
|
|
|
|
} while ((Text = (char *)MsgText_Next()) != NULL);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2006-01-23 15:40:21 +00:00
|
|
|
|
Fti.msglength = le_int(length);
|
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);
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(msg, 81, "\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>");
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(CYAN, BLACK, msg);
|
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
|
|
|
|
|
2006-01-22 21:06:59 +00:00
|
|
|
|
Mix.totmsgs = le_us((tWORD)Current);
|
|
|
|
|
Mix.numpers = le_us((tWORD)Personal);
|
2006-01-23 15:01:12 +00:00
|
|
|
|
// Syslog('m', "mix: %6s %6d %6d %6d", Mix.areanum, Mix.totmsgs, Mix.numpers, Mix.msghptr);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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;
|
2006-01-22 14:38:18 +00:00
|
|
|
|
char Pktname[32], *cwd = NULL, *Work, *Temp;
|
|
|
|
|
int Area = 0, i, rc = 0;
|
2002-07-14 12:23:39 +00:00
|
|
|
|
FILE *fp = NULL, *tf, *mf, *af;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
unsigned int Start, High;
|
2002-07-14 12:23:39 +00:00
|
|
|
|
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) {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTRED, BLACK, (char *)"System configuration error, inform sysop");
|
2003-02-02 12:18:03 +00:00
|
|
|
|
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();
|
|
|
|
|
/* QWK Offline Download */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTBLUE, BLACK, (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
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s.QWK", CFG.bbsid);
|
|
|
|
|
snprintf(Pktname, 32, "%s", tl(Temp));
|
2002-07-14 12:23:39 +00:00
|
|
|
|
Syslog('m', "Packet name %s", Pktname);
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Work, PATH_MAX, "%s/%s/tmp", CFG.bbs_usersdir, exitinfo.Name);
|
2002-07-14 12:23:39 +00:00
|
|
|
|
Syslog('m', "Work path %s", Work);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
2002-07-14 12:23:39 +00:00
|
|
|
|
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
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
2002-07-14 12:23:39 +00:00
|
|
|
|
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);
|
2006-03-05 16:10:03 +00:00
|
|
|
|
fill_high(&mhl, Area, msgs.Tag, High, Personal);
|
2002-07-14 12:23:39 +00:00
|
|
|
|
}
|
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
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/CONTROL.DAT", Work);
|
2002-07-14 12:23:39 +00:00
|
|
|
|
if ((fp = fopen(Temp, "w+")) != NULL) {
|
|
|
|
|
fprintf(fp, "%s\n", CFG.bbs_name);
|
|
|
|
|
fprintf(fp, "%s\n", CFG.location);
|
2004-07-22 20:30:58 +00:00
|
|
|
|
fprintf(fp, "-Unpublished-\n");
|
2002-07-14 12:23:39 +00:00
|
|
|
|
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);
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s", exitinfo.sUserName);
|
2002-07-14 12:23:39 +00:00
|
|
|
|
fprintf(fp, "%s\n", tu(Temp));
|
|
|
|
|
fprintf(fp, " \n");
|
|
|
|
|
fprintf(fp, "0\n");
|
2005-10-11 20:49:41 +00:00
|
|
|
|
fprintf(fp, "%u\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
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/DOOR.ID", Work);
|
2002-07-14 12:23:39 +00:00
|
|
|
|
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) {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(1);
|
2002-07-14 12:23:39 +00:00
|
|
|
|
/* Packing with */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTSTR((char *)Language(446));
|
|
|
|
|
PUTCHAR(' ');
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
2002-07-14 12:23:39 +00:00
|
|
|
|
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);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTSTR(archiver.comment);
|
|
|
|
|
PUTCHAR(' ');
|
2006-01-22 14:23:10 +00:00
|
|
|
|
cwd = getcwd(cwd, PATH_MAX);
|
2006-01-22 21:06:59 +00:00
|
|
|
|
Syslog('m', "chdir(%s) rc=%d", Work, chdir(Work));
|
2006-01-22 14:23:10 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "CONTROL.DAT");
|
2002-07-14 12:23:39 +00:00
|
|
|
|
AddArc(Temp, Pktname);
|
|
|
|
|
alarm_on();
|
2006-01-22 14:23:10 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "MESSAGES.DAT");
|
2002-07-14 12:23:39 +00:00
|
|
|
|
AddArc(Temp, Pktname);
|
|
|
|
|
|
|
|
|
|
for (tmp = mhl; tmp; tmp = tmp->next) {
|
2006-01-22 14:23:10 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%03d.NDX", tmp->Area);
|
2002-07-14 12:23:39 +00:00
|
|
|
|
AddArc(Temp, Pktname);
|
|
|
|
|
}
|
|
|
|
|
|
2006-01-22 14:23:10 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "PERSONAL.NDX");
|
2002-07-14 12:23:39 +00:00
|
|
|
|
if (TotalPersonal) {
|
|
|
|
|
AddArc(Temp, Pktname);
|
|
|
|
|
} else
|
|
|
|
|
unlink(Temp);
|
|
|
|
|
|
2006-01-22 14:23:10 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "DOOR.ID");
|
2002-07-14 12:23:39 +00:00
|
|
|
|
AddArc(Temp, Pktname);
|
2006-01-22 14:23:10 +00:00
|
|
|
|
chdir(cwd);
|
|
|
|
|
free(cwd);
|
|
|
|
|
cwd = NULL;
|
2006-01-22 21:06:59 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/%s/tmp/%s", CFG.bbs_usersdir, exitinfo.Name, Pktname);
|
2002-07-14 12:23:39 +00:00
|
|
|
|
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
|
|
|
|
|
2004-11-06 16:27:46 +00:00
|
|
|
|
if (rc) {
|
2002-07-14 12:23:39 +00:00
|
|
|
|
Syslog('+', "QWK download failed");
|
|
|
|
|
/* Download failed */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(CFG.HiliteF, CFG.HiliteB, (char *)Language(447));
|
2002-07-14 12:23:39 +00:00
|
|
|
|
} else {
|
|
|
|
|
Syslog('+', "QWK download successfull");
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTCHAR('\r');
|
2002-07-14 12:23:39 +00:00
|
|
|
|
/* Download successfull */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(CFG.HiliteF, CFG.HiliteB, (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);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(2);
|
2002-07-14 12:23:39 +00:00
|
|
|
|
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;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
unsigned int Area;
|
2002-07-03 19:34:57 +00:00
|
|
|
|
struct tm *ltm = NULL;
|
|
|
|
|
fidoaddr dest;
|
2002-07-03 21:16:23 +00:00
|
|
|
|
int HasTear;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2002-07-03 19:34:57 +00:00
|
|
|
|
/* Processing BlueWave reply packet */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTBLUE, BLACK, (char *)Language(459));
|
2003-09-02 20:25:42 +00:00
|
|
|
|
temp = calloc(PATH_MAX, sizeof(char));
|
2002-07-03 19:34:57 +00:00
|
|
|
|
otemp = calloc(PATH_MAX, sizeof(char));
|
|
|
|
|
nWidth = 78;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Dirpath, PATH_MAX, "%s/%s", CFG.bbs_usersdir, exitinfo.Name);
|
|
|
|
|
snprintf(Filename, 81, "%s.MSG", CFG.bbsid);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if (getfilecase(Dirpath, Filename)) {
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%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 */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTRED, BLACK, (char *)Language(451));
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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) {
|
2007-08-25 18:32:07 +00:00
|
|
|
|
Area = atol(StripSpaces((char *)Qwk.Msgnum, sizeof(Qwk.Msgnum)));
|
|
|
|
|
nRec = atoi(StripSpaces((char *)Qwk.Msgrecs, sizeof(Qwk.Msgrecs)));
|
2002-07-03 19:34:57 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Test for blank records.
|
|
|
|
|
*/
|
|
|
|
|
if (Area && nRec) {
|
|
|
|
|
Syslog('m', "Conference %u", Area);
|
|
|
|
|
Syslog('m', "Records %d", nRec);
|
2007-08-25 18:32:07 +00:00
|
|
|
|
Syslog('m', "To %s", tlcap(StripSpaces((char *)Qwk.MsgTo, sizeof(Qwk.MsgTo))));
|
|
|
|
|
Syslog('m', "From %s", tlcap(StripSpaces((char *)Qwk.MsgFrom, sizeof(Qwk.MsgFrom))));
|
|
|
|
|
Syslog('m', "Subject %s", StripSpaces((char *)Qwk.MsgSubj, sizeof(Qwk.MsgSubj)));
|
|
|
|
|
snprintf(Temp, 128, "%s", StripSpaces((char *)Qwk.Msgdate, sizeof(Qwk.Msgdate)));
|
|
|
|
|
Syslog('m', "Date %s %s", Temp, StripSpaces((char *)Qwk.Msgtime, sizeof(Qwk.Msgtime)));
|
|
|
|
|
|
|
|
|
|
if (strcmp("MBSEQWK", StripSpaces((char *)Qwk.MsgTo, sizeof(Qwk.MsgTo))) == 0) {
|
|
|
|
|
Syslog('m', "Command %s", StripSpaces((char *)Qwk.MsgSubj, sizeof(Qwk.MsgSubj)));
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(otemp, PATH_MAX, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if ((op = fopen(otemp, "r+")) != NULL) {
|
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(otemp, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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);
|
|
|
|
|
|
2007-08-25 18:32:07 +00:00
|
|
|
|
if (strcmp((char *)"ADD", StripSpaces((char *)Qwk.MsgSubj, sizeof(Qwk.MsgSubj))) == 0) {
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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
|
|
|
|
|
2007-08-25 18:32:07 +00:00
|
|
|
|
if (strcmp((char *)"DROP", StripSpaces((char *)Qwk.MsgSubj, sizeof(Qwk.MsgSubj))) == 0) {
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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;
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(otemp, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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");
|
2007-08-25 18:32:07 +00:00
|
|
|
|
strcpy(Msg.From, tlcap(StripSpaces((char *)Qwk.MsgFrom, sizeof(Qwk.MsgFrom))));
|
|
|
|
|
strcpy(Msg.To, tlcap(StripSpaces((char *)Qwk.MsgTo, sizeof(Qwk.MsgTo))));
|
|
|
|
|
strcpy(Msg.Subject, StripSpaces((char *)Qwk.MsgSubj, sizeof(Qwk.MsgSubj)));
|
2003-08-08 20:31:05 +00:00
|
|
|
|
if ((Qwk.Msgstat == '*') || (Qwk.Msgstat == '+'))
|
|
|
|
|
Msg.Private = TRUE;
|
2007-08-25 18:32:07 +00:00
|
|
|
|
strcpy(Temp, StripSpaces((char *)Qwk.Msgdate, sizeof(Qwk.Msgdate)));
|
2003-08-08 20:31:05 +00:00
|
|
|
|
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;
|
2007-08-25 18:32:07 +00:00
|
|
|
|
strcpy(Temp, StripSpaces((char *)Qwk.Msgtime, sizeof(Qwk.Msgtime)));
|
2003-08-08 20:31:05 +00:00
|
|
|
|
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--;
|
|
|
|
|
}
|
2006-01-23 20:18:57 +00:00
|
|
|
|
// 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';
|
2006-01-23 20:18:57 +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++;
|
|
|
|
|
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) {
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%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) {
|
2005-10-11 20:49:41 +00:00
|
|
|
|
fprintf(fp, "%s %u\n", msgs.Base, Msg.Id);
|
2003-08-08 20:31:05 +00:00
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
2003-09-14 12:24:18 +00:00
|
|
|
|
Close_Msgbase(msgs.Base);
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(1);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
if (nPosted) {
|
|
|
|
|
/* Messages imported */
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, 81, "%d %s", nPosted, (char *)Language(454));
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(CFG.TextColourF, CFG.TextColourB, temp);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
ReadExitinfo();
|
|
|
|
|
exitinfo.iPosted += nPosted;
|
|
|
|
|
WriteExitinfo();
|
|
|
|
|
do_mailout = TRUE;
|
|
|
|
|
}
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(temp, PATH_MAX, "%s/%s", Dirpath, Filename);
|
2003-08-08 20:31:05 +00:00
|
|
|
|
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];
|
2005-10-11 20:49:41 +00:00
|
|
|
|
unsigned int ul[2];
|
2002-07-03 19:34:57 +00:00
|
|
|
|
float f[2];
|
|
|
|
|
double d[1];
|
2001-08-17 05:46:24 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
float IEEToMSBIN(float f)
|
|
|
|
|
{
|
2003-12-16 21:50:32 +00:00
|
|
|
|
int sign, expo;
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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;
|
2003-12-16 21:50:32 +00:00
|
|
|
|
expo = ((t.ui[1] >> 7) - 0x7F + 0x81) & 0xFF;
|
|
|
|
|
t.ui[1] = (t.ui[1] & 0x7F) | (sign << 7) | (expo << 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;
|
2003-12-16 21:50:32 +00:00
|
|
|
|
int sign, expo;
|
2002-07-03 19:34:57 +00:00
|
|
|
|
|
|
|
|
|
t.f[0] = f;
|
|
|
|
|
sign = t.uc[2] / 0x80;
|
2003-12-16 21:50:32 +00:00
|
|
|
|
expo = (t.uc[3] - 0x81 + 0x7f) & 0xff;
|
|
|
|
|
t.ui[1] = (t.ui[1] & 0x7f) | (expo << 7) | (sign << 15);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
return t.f[0];
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Pack messages in one mail area
|
|
|
|
|
*/
|
2005-10-11 20:49:41 +00:00
|
|
|
|
unsigned int QWK_PackArea(unsigned int ulLast, int Area)
|
2001-08-17 05:46:24 +00:00
|
|
|
|
{
|
2002-07-03 19:34:57 +00:00
|
|
|
|
FILE *fdm, *fdi, *fdp;
|
|
|
|
|
float out, in;
|
2004-11-03 20:48:45 +00:00
|
|
|
|
char *Work, *Temp, *Text, msg[81];
|
2005-10-11 20:49:41 +00:00
|
|
|
|
unsigned int Number, Pos, Size, Blocks;
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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));
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Work, PATH_MAX, "%s/%s/tmp", CFG.bbs_usersdir, exitinfo.Name);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/%03d.NDX", Work, Area);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
fdi = fopen(Temp, "a+");
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/PERSONAL.NDX", Work);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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.
|
|
|
|
|
*/
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/MESSAGES.DAT", Work);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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);
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%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);
|
2004-09-12 12:59:38 +00:00
|
|
|
|
Msg_Read(Number, 79);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(Temp, 6, "%u", Blocks);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
in = atof(Temp);
|
|
|
|
|
out = IEEToMSBIN(in);
|
|
|
|
|
fwrite(&out, sizeof(float), 1, fdi);
|
|
|
|
|
fwrite(" ", 1, 1, fdi);
|
|
|
|
|
Current++;
|
|
|
|
|
Total++;
|
|
|
|
|
|
|
|
|
|
memset(&Qwk, ' ', sizeof(Qwk));
|
2005-10-11 20:49:41 +00:00
|
|
|
|
snprintf(Temp, 81, "%-*u", (int)sizeof(Qwk.Msgnum), (int)Number);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
Syslog('M', "Message %s", Temp);
|
|
|
|
|
memcpy(Qwk.Msgnum, Temp, sizeof(Qwk.Msgnum));
|
|
|
|
|
tp = localtime(&Msg.Written);
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, 81, "%02d-%02d-%02d", tp->tm_mon+1, tp->tm_mday, tp->tm_year % 100);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
memcpy(Qwk.Msgdate, Temp, sizeof(Qwk.Msgdate));
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, 81, "%02d:%02d", tp->tm_hour, tp->tm_min);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
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
|
|
|
|
|
2007-08-25 18:32:07 +00:00
|
|
|
|
snprintf((char *)Qwk.Msgrecs, 6, "%-*u", (int)sizeof(Qwk.Msgrecs), (int)((ftell(fdm) - Pos) / 128L));
|
2002-07-03 19:34:57 +00:00
|
|
|
|
fseek(fdm, Pos, SEEK_SET);
|
|
|
|
|
fwrite(&Qwk, sizeof(Qwk), 1, fdm);
|
|
|
|
|
fseek(fdm, 0L, SEEK_END);
|
|
|
|
|
if ((Total % 16L) == 0L)
|
2004-01-25 10:57:35 +00:00
|
|
|
|
msleep(1);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
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);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTCHAR('\r');
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(msg, 81, "%.*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>");
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(CYAN, BLACK, msg);
|
2002-07-03 19:34:57 +00:00
|
|
|
|
}
|
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;
|
2006-03-05 16:10:03 +00:00
|
|
|
|
char Pktname[32], *Work, *Temp, *cwd = NULL, Atag[60], Kinds[12];
|
|
|
|
|
int Area = 0, i, rc = 0;
|
|
|
|
|
FILE *fp = NULL, *tf, *mf, *af, *inf;
|
2005-10-11 20:49:41 +00:00
|
|
|
|
unsigned int Start, High;
|
2003-02-02 12:18:03 +00:00
|
|
|
|
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) {
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTRED, BLACK, (char *)"System configuration error, inform sysop");
|
2003-02-02 12:18:03 +00:00
|
|
|
|
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();
|
|
|
|
|
/* ASCII Offline Download */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(LIGHTBLUE, BLACK, (char *)Language(460));
|
2003-02-02 12:18:03 +00:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s.MSG", CFG.bbsid);
|
|
|
|
|
snprintf(Pktname, 32, "%s", tl(Temp));
|
|
|
|
|
snprintf(Work, PATH_MAX, "%s/%s/tmp", CFG.bbs_usersdir, exitinfo.Name);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
2003-02-02 12:18:03 +00:00
|
|
|
|
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
|
|
|
|
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
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
|
|
|
|
|
2006-03-05 16:10:03 +00:00
|
|
|
|
snprintf(Atag, 9, CFG.bbsid);
|
|
|
|
|
tl(Atag);
|
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/%s/tmp/%s.info", CFG.bbs_usersdir, exitinfo.Name, Atag);
|
|
|
|
|
if ((inf = fopen(Temp, "a+")) == NULL) {
|
|
|
|
|
WriteError("$Can't create %s", Temp);
|
|
|
|
|
fclose(tf);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
fclose(mf);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-13 21:06:44 +00:00
|
|
|
|
/*
|
|
|
|
|
* Write generic bbs info
|
|
|
|
|
*/
|
|
|
|
|
fprintf(inf, "BBS %s\n", CFG.bbs_name);
|
|
|
|
|
for (i = 0; i < 40; i++) {
|
|
|
|
|
if (CFG.akavalid[i])
|
|
|
|
|
fprintf(inf, "Aka %s\n", aka2str(CFG.aka[i]));
|
|
|
|
|
}
|
|
|
|
|
fprintf(inf, "Domain %s\n", CFG.sysdomain);
|
|
|
|
|
fprintf(inf, "Version mbsebbs v%s\n", VERSION);
|
|
|
|
|
fprintf(inf, "\n");
|
|
|
|
|
|
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
|
|
|
|
|
2006-03-05 16:10:03 +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++;
|
2006-03-05 16:10:03 +00:00
|
|
|
|
|
|
|
|
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec)) {
|
|
|
|
|
if (strlen(msgs.Tag))
|
|
|
|
|
snprintf(Atag, 51, msgs.Tag);
|
|
|
|
|
else
|
|
|
|
|
snprintf(Atag, 51, "%d", Area);
|
|
|
|
|
switch (msgs.Type) {
|
|
|
|
|
case LOCALMAIL: snprintf(Temp, 81, "Local");
|
|
|
|
|
break;
|
|
|
|
|
case NETMAIL: snprintf(Temp, 81, "Net");
|
|
|
|
|
break;
|
|
|
|
|
case ECHOMAIL: snprintf(Temp, 81, "Echo");
|
|
|
|
|
break;
|
|
|
|
|
case NEWS: snprintf(Temp, 81, "News");
|
|
|
|
|
break;
|
|
|
|
|
case LIST: snprintf(Temp, 81, "List");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
switch (msgs.MsgKinds) {
|
|
|
|
|
case BOTH: snprintf(Kinds, 12, "PvtPub");
|
|
|
|
|
break;
|
|
|
|
|
case PRIVATE: snprintf(Kinds, 12, "Pvt");
|
|
|
|
|
break;
|
|
|
|
|
case PUBLIC: snprintf(Kinds, 12, "Pub");
|
|
|
|
|
break;
|
|
|
|
|
case RONLY: snprintf(Kinds, 12, "RO");
|
|
|
|
|
break;
|
|
|
|
|
case FTNMOD: snprintf(Kinds, 12, "FtnMod");
|
|
|
|
|
break;
|
|
|
|
|
case USEMOD: snprintf(Kinds, 12, "UseMod");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
fprintf(inf, "Area %s,%s,%s,%s,%s\n", Atag, Temp, Kinds, olrtagrec.Tagged ?"S":"U", msgs.Name);
|
|
|
|
|
}
|
|
|
|
|
|
2003-02-02 12:18:03 +00:00
|
|
|
|
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()) {
|
2006-03-05 16:10:03 +00:00
|
|
|
|
if (strlen(msgs.Tag))
|
|
|
|
|
snprintf(Atag, 60, "%s_%s", CFG.bbsid, msgs.Tag);
|
|
|
|
|
else
|
|
|
|
|
snprintf(Atag, 60, "%s_%d", CFG.bbsid, Area);
|
|
|
|
|
for (i = 0; i < strlen(Atag); i++) {
|
|
|
|
|
if (Atag[i] == '.')
|
|
|
|
|
Atag[i] = '_';
|
|
|
|
|
Atag[i] = tolower(Atag[i]);
|
|
|
|
|
}
|
|
|
|
|
High = ASCII_PackArea(Start, Area, Atag);
|
|
|
|
|
fill_high(&mhl, Area, Atag, High, Personal);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
}
|
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
|
|
|
|
}
|
2006-03-05 16:10:03 +00:00
|
|
|
|
fclose(inf);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2006-03-05 16:10:03 +00:00
|
|
|
|
/*
|
|
|
|
|
* In ASCII mode we allways download, even if there are no messages
|
|
|
|
|
* packed. However we do have a .info file for the user.
|
|
|
|
|
*/
|
|
|
|
|
Enter(1);
|
|
|
|
|
/* Packing with */
|
|
|
|
|
PUTSTR((char *)Language(446));
|
|
|
|
|
PUTCHAR(' ');
|
|
|
|
|
snprintf(Temp, PATH_MAX, "%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);
|
|
|
|
|
PUTSTR(archiver.comment);
|
|
|
|
|
PUTCHAR(' ');
|
|
|
|
|
cwd = getcwd(cwd, PATH_MAX);
|
|
|
|
|
chdir(Work);
|
|
|
|
|
alarm_on();
|
|
|
|
|
|
|
|
|
|
snprintf(Temp, PATH_MAX, "%s.info", CFG.bbsid);
|
|
|
|
|
tl(Temp);
|
|
|
|
|
AddArc(Temp, Pktname);
|
|
|
|
|
|
|
|
|
|
for (tmp = mhl; tmp; tmp = tmp->next) {
|
|
|
|
|
snprintf(Temp, PATH_MAX, "%s.text", tmp->Tag);
|
|
|
|
|
AddArc(Temp, Pktname);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2006-03-05 16:10:03 +00:00
|
|
|
|
chdir(cwd);
|
|
|
|
|
free(cwd);
|
|
|
|
|
cwd = NULL;
|
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/%s/tmp/%s", CFG.bbs_usersdir, exitinfo.Name, Pktname);
|
|
|
|
|
rc = DownloadDirect(Temp, FALSE);
|
|
|
|
|
unlink(Temp);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
2006-03-05 16:10:03 +00:00
|
|
|
|
fclose(af);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
}
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2004-11-06 16:27:46 +00:00
|
|
|
|
if (rc) {
|
2003-02-02 12:18:03 +00:00
|
|
|
|
Syslog('+', "ASCII download failed");
|
|
|
|
|
/* Download failed */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(CFG.HiliteF, CFG.HiliteB, (char *)Language(447));
|
2003-02-02 12:18:03 +00:00
|
|
|
|
} else {
|
|
|
|
|
Syslog('+', "ASCII download successfull");
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTCHAR('\r');
|
2003-02-02 12:18:03 +00:00
|
|
|
|
/* Download successfull */
|
2004-11-03 20:48:45 +00:00
|
|
|
|
poutCR(CFG.HiliteF, CFG.HiliteB, (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);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
Enter(2);
|
2003-02-02 12:18:03 +00:00
|
|
|
|
Pause();
|
2001-08-17 05:46:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Pack messages in one mail area
|
|
|
|
|
*/
|
2006-03-05 16:10:03 +00:00
|
|
|
|
unsigned int ASCII_PackArea(unsigned int ulLast, int Area, char *Atag)
|
2001-08-17 05:46:24 +00:00
|
|
|
|
{
|
2003-03-02 13:29:33 +00:00
|
|
|
|
FILE *fp;
|
2004-11-03 20:48:45 +00:00
|
|
|
|
char *Work, *Temp, *Text, msg[81];
|
2005-10-11 20:49:41 +00:00
|
|
|
|
unsigned int Number;
|
2003-03-02 13:29:33 +00:00
|
|
|
|
int Pack = FALSE;
|
2006-03-13 21:06:44 +00:00
|
|
|
|
time_t now;
|
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));
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(Work, PATH_MAX, "%s/%s/tmp", CFG.bbs_usersdir, exitinfo.Name);
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2006-03-05 16:10:03 +00:00
|
|
|
|
snprintf(Temp, PATH_MAX, "%s/%s.text", Work, Atag);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if ((fp = fopen(Temp, "a+")) != NULL) {
|
|
|
|
|
if (Msg_Next(&Number)) {
|
|
|
|
|
do {
|
|
|
|
|
Msg_ReadHeader(Number);
|
2004-09-12 12:59:38 +00:00
|
|
|
|
Msg_Read(Number, 79);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
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) {
|
2006-03-13 21:06:44 +00:00
|
|
|
|
fprintf(fp, "#@ olrmsg\n");
|
|
|
|
|
// fprintf(fp, " Msg: #%d of %d (%s)\n", Number, Msg_Number(), msgs.Name);
|
|
|
|
|
// tp = localtime(&Msg.Written);
|
|
|
|
|
// fprintf(fp, " Date: %d %s %d %2d:%02d\n", tp->tm_mday,
|
|
|
|
|
// GetMonth(tp->tm_mon + 1), tp->tm_year, tp->tm_hour, tp->tm_min);
|
|
|
|
|
now = (time_t)Msg.Written;
|
|
|
|
|
fprintf(fp, "Date: %s\n", rfcdate(now));
|
|
|
|
|
fprintf(fp, "From: %s\n", Msg.From);
|
|
|
|
|
if (strlen(Msg.FromAddress))
|
|
|
|
|
fprintf(fp, "From-ftn: %s\n", Msg.FromAddress);
|
|
|
|
|
fprintf(fp, "Subject: %s\n", Msg.Subject);
|
|
|
|
|
if (Msg.To[0]) {
|
|
|
|
|
fprintf (fp, "To: %s\n", Msg.To);
|
|
|
|
|
if (strlen(Msg.ToAddress))
|
|
|
|
|
fprintf(fp, "To-ftn: %s\n", Msg.ToAddress);
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-05 16:10:03 +00:00
|
|
|
|
/*
|
2006-03-13 21:06:44 +00:00
|
|
|
|
* If present, add the msgid, origin line and reply.
|
2006-03-05 16:10:03 +00:00
|
|
|
|
*/
|
|
|
|
|
if ((Text = (char *)MsgText_First()) != NULL) {
|
|
|
|
|
do {
|
|
|
|
|
if (strncmp(Text, "\001MSGID: ", 8) == 0) {
|
2006-03-13 21:06:44 +00:00
|
|
|
|
fprintf(fp, "Message-ID: %s\n", Text+8);
|
|
|
|
|
}
|
|
|
|
|
if (strncmp(Text, "\001REPLY: ", 8) == 0) {
|
|
|
|
|
fprintf(fp, "In-Reply-To: %s\n", Text+8);
|
|
|
|
|
}
|
|
|
|
|
if (strncmp(Text, " * Origin: ", 11) == 0) {
|
|
|
|
|
fprintf(fp, "Organisation: %s\n", Text+11);
|
2006-03-05 16:10:03 +00:00
|
|
|
|
}
|
|
|
|
|
} while ((Text = (char *)MsgText_Next()) != NULL);
|
|
|
|
|
}
|
2006-03-13 21:06:44 +00:00
|
|
|
|
fprintf(fp, "\n");
|
2003-03-02 13:29:33 +00:00
|
|
|
|
Current++;
|
|
|
|
|
Total++;
|
2001-08-17 05:46:24 +00:00
|
|
|
|
|
2006-03-13 21:06:44 +00:00
|
|
|
|
/*
|
|
|
|
|
* Add message body
|
|
|
|
|
*/
|
2003-03-02 13:29:33 +00:00
|
|
|
|
if ((Text = (char *)MsgText_First()) != NULL) {
|
|
|
|
|
do {
|
2006-03-13 21:06:44 +00:00
|
|
|
|
if (Text[0] != 0x01 && strncmp(Text, "SEEN-BY: ", 9) && strncmp(Text, " * Origin: ", 11)) {
|
|
|
|
|
if (strcmp(Text, "#@ olrmsg") == 0)
|
|
|
|
|
fprintf(fp, "-");
|
2003-03-02 13:29:33 +00:00
|
|
|
|
fprintf(fp, "%s\n", Text);
|
2006-03-13 21:06:44 +00:00
|
|
|
|
}
|
2003-03-02 13:29:33 +00:00
|
|
|
|
} 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)
|
2004-01-25 10:57:35 +00:00
|
|
|
|
msleep(1);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
|
|
|
|
|
if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) {
|
|
|
|
|
BarWidth = (unsigned short)((Total * 61L) / TotalPack);
|
2004-11-03 20:48:45 +00:00
|
|
|
|
PUTCHAR('\r');
|
2005-08-29 10:29:22 +00:00
|
|
|
|
snprintf(msg, 81, "%.*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>");
|
2004-11-03 20:48:45 +00:00
|
|
|
|
pout(CYAN, BLACK, msg);
|
2003-03-02 13:29:33 +00:00
|
|
|
|
}
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|