Added writing echomail.jam or netmail.jam

This commit is contained in:
Michiel Broek 2002-07-03 19:34:57 +00:00
parent 2a01693438
commit a3b7d623a7

View File

@ -1302,8 +1302,7 @@ void OLR_Upload(void)
char *Extensions[] = {
(char *)".SU0", (char *)".MO0", (char *)".TU0", (char *)".WE0",
(char *)".TH0", (char *)".FR0", (char *)".SA0"
(char *)".SU0", (char *)".MO0", (char *)".TU0", (char *)".WE0", (char *)".TH0", (char *)".FR0", (char *)".SA0"
};
@ -1315,8 +1314,7 @@ void OLR_DownBW()
{
struct tm *tp;
time_t Now;
char Pktname[32];
char *Work, *Temp;
char Pktname[32], *Work, *Temp;
long Area = 0;
int RetVal = FALSE, rc;
FILE *fp, *tf, *mf, *af;
@ -1386,8 +1384,7 @@ void OLR_DownBW()
* 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)) {
if ((sizeof(Inf) != ORIGINAL_INF_HEADER_LEN) || (sizeof(AreaInf) != ORIGINAL_INF_AREA_LEN)) {
WriteError("PANIC: Probably not \"packed\" compiled!");
fclose(fp);
return;
@ -1446,6 +1443,7 @@ void OLR_DownBW()
AreaInf.network_type |= INF_NET_INTERNET;
break;
}
switch(msgs.MsgKinds) {
case BOTH: if (Access(exitinfo.Security, msgs.WRSec))
AreaInf.area_flags |= INF_POST;
@ -1573,7 +1571,7 @@ void BlueWave_Fetch()
{
char *temp;
char *buffer,*b;
FILE *up, *mf, *tp, *iol;
FILE *fp, *up, *mf, *tp, *iol;
UPL_HEADER Uph;
UPL_REC Upr;
PDQ_HEADER Pdh;
@ -1716,6 +1714,18 @@ void BlueWave_Fetch()
msgs.Posted.month[Miy]++;
msgs.LastPosted = time(NULL);
fwrite(&msgs, msgshdr.recsize, 1, mf);
/*
* Add quick mailscan info
*/
if (msgs.Type != LOCALMAIL) {
sprintf(temp, "%s/tmp/%smail.jam", getenv("MBSE_ROOT"),
((msgs.Type == ECHOMAIL) || (msgs.Type == LIST))? "echo" : "net");
if ((fp = fopen(temp, "a")) != NULL) {
fprintf(fp, "%s %lu\n", msgs.Base, Msg.Id);
fclose(fp);
}
}
}
} else {
/* No Write access to area */
@ -2095,8 +2105,7 @@ unsigned long BlueWave_PackArea(unsigned long ulLast, long Area)
Msg_Read(Number, 78);
Pack = TRUE;
if ((strcasecmp(Msg.To, exitinfo.sUserName) == 0) ||
(strcasecmp(Msg.To, exitinfo.sHandle) == 0)) {
if ((strcasecmp(Msg.To, exitinfo.sUserName) == 0) || (strcasecmp(Msg.To, exitinfo.sHandle) == 0)) {
Personal++;
TotalPersonal++;
} else if (msgs.Type == NETMAIL) {
@ -2104,7 +2113,8 @@ unsigned long BlueWave_PackArea(unsigned long ulLast, long Area)
} else if (msgs.MsgKinds == PRIVATE ) {
Pack = FALSE;
} else if (msgs.MsgKinds == BOTH ) {
if (Msg.Private == TRUE ) Pack = FALSE;
if (Msg.Private == TRUE )
Pack = FALSE;
}
if (Pack) {
@ -2120,8 +2130,7 @@ unsigned long BlueWave_PackArea(unsigned long ulLast, long Area)
strcpy((char *)Fti.subject, Msg.Subject);
tp = localtime(&Msg.Written);
sprintf((char *)Fti.date, "%2d %.3s %2d %2d:%02d:%02d", tp->tm_mday,
(char *) Language(398 + tp->tm_mon), tp->tm_year,
tp->tm_hour, tp->tm_min, tp->tm_sec);
(char *) Language(398 + tp->tm_mon), tp->tm_year, tp->tm_hour, tp->tm_min, tp->tm_sec);
Fti.msgnum = Number;
Fti.msgptr = ftell(fdm);
Fti.replyto = Msg.Original;
@ -2134,11 +2143,10 @@ unsigned long BlueWave_PackArea(unsigned long ulLast, long Area)
Fti.msglength += fwrite(" ", 1, 1, fdm);
if ((Text = (char *)MsgText_First()) != NULL)
if ((Text = (char *)MsgText_First()) != NULL) {
do {
if ((Text[0] != 0x01 && strncmp(Text, "SEEN-BY: ", 9))||
(strncmp(Text, "\001MSGID", 6) == 0) /* ||
(exitinfo.OL_ExtInfo) */ ) {
(strncmp(Text, "\001MSGID", 6) == 0) /* || (exitinfo.OL_ExtInfo) */ ) {
Fti.msglength += fwrite(Text, 1, strlen(Text), fdm);
Fti.msglength += fwrite("\r\n", 1, 2, fdm);
}
@ -2146,6 +2154,7 @@ unsigned long BlueWave_PackArea(unsigned long ulLast, long Area)
fwrite(&Fti, sizeof (Fti), 1, fdfti);
}
}
if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) {
BarWidth = (unsigned short)((Total * 61L) / TotalPack);
@ -2397,7 +2406,7 @@ void OLR_DownQWK(void)
void QWK_Fetch()
{
char *temp, *otemp, Temp[128], szLine[132], *pLine = NULL, *pBuff;
FILE *up, *op, *mf;
FILE *fp, *up, *op, *mf;
unsigned short nRec, i, r, x, nCol = 0, nWidth, nReaded, nPosted = 0;
unsigned long Area;
struct tm *ltm = NULL;
@ -2457,8 +2466,7 @@ void QWK_Fetch()
sprintf(otemp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if ((mf = fopen(otemp, "r")) != NULL) {
fread(&msgshdr, sizeof(msgshdr), 1, mf);
fseek(mf, ((Area -1) * (msgshdr.recsize + msgshdr.syssize)) +
msgshdr.hdrsize, SEEK_SET);
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);
@ -2494,8 +2502,7 @@ void QWK_Fetch()
sprintf(otemp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if ((mf = fopen(otemp, "r+")) != NULL) {
fread(&msgshdr, sizeof(msgshdr), 1, mf);
fseek(mf, ((Area -1) * (msgshdr.recsize + msgshdr.syssize)) +
msgshdr.hdrsize, SEEK_SET);
fseek(mf, ((Area -1) * (msgshdr.recsize + msgshdr.syssize)) + msgshdr.hdrsize, SEEK_SET);
fread(&msgs, msgshdr.recsize, 1, mf);
/*
@ -2588,19 +2595,29 @@ void QWK_Fetch()
Add_Footkludges(FALSE, NULL);
Msg_AddMsg();
Syslog('+', "Msg (%ld) to \"%s\", \"%s\", in %s", Msg.Id,
Msg.To, Msg.Subject, msgs.QWKname);
Syslog('+', "Msg (%ld) to \"%s\", \"%s\", in %s", Msg.Id, Msg.To, Msg.Subject, msgs.QWKname);
nPosted++;
Close_Msgbase();
Syslog('m', "Msgbase closed again");
fseek(mf, ((Area -1) * (msgshdr.recsize + msgshdr.syssize)) +
msgshdr.hdrsize, SEEK_SET);
fseek(mf, ((Area -1) * (msgshdr.recsize + msgshdr.syssize)) + msgshdr.hdrsize, SEEK_SET);
msgs.Posted.total++;
msgs.Posted.tweek++;
msgs.Posted.tdow[Diw]++;
msgs.Posted.month[Miy]++;
msgs.LastPosted = time(NULL);
fwrite(&msgs, msgshdr.recsize, 1, mf);
/*
* Add quick mailscan info
*/
if (msgs.Type != LOCALMAIL) {
sprintf(temp, "%s/tmp/%smail.jam", getenv("MBSE_ROOT"),
((msgs.Type == ECHOMAIL) || (msgs.Type == LIST))? "echo" : "net");
if ((fp = fopen(temp, "a")) != NULL) {
fprintf(fp, "%s %lu\n", msgs.Base, Msg.Id);
fclose(fp);
}
}
}
} else {
Syslog('+', "Can't post messages in area %u", Area);
@ -2728,8 +2745,7 @@ unsigned long QWK_PackArea(unsigned long ulLast, long Area)
Msg_ReadHeader(Number);
Msg_Read(Number, 78);
Pack = TRUE;
if ((strcasecmp(Msg.To, exitinfo.sUserName) == 0) ||
(strcasecmp(Msg.To, exitinfo.sHandle) == 0)) {
if ((strcasecmp(Msg.To, exitinfo.sUserName) == 0) || (strcasecmp(Msg.To, exitinfo.sHandle) == 0)) {
Personal++;
TotalPersonal++;
fwrite(&out, sizeof(float), 1, fdp);
@ -2739,7 +2755,8 @@ unsigned long QWK_PackArea(unsigned long ulLast, long Area)
} else if (msgs.MsgKinds == PRIVATE ) {
Pack = FALSE;
} else if (msgs.MsgKinds == BOTH ) {
if (Msg.Private == TRUE ) Pack = FALSE;
if (Msg.Private == TRUE )
Pack = FALSE;
}
if (Pack) {