TIC netmail forward now uses a template
This commit is contained in:
parent
4d543c8de6
commit
f5e883cc6f
@ -4696,6 +4696,7 @@ v0.33.20 10-Feb-2002
|
||||
the diesel macro language.
|
||||
The tic file forward function now uses only filenames in the
|
||||
subject of the netmail messages without the path.
|
||||
The tic file forward netmails now uses template forward.tic
|
||||
|
||||
mball:
|
||||
Will not crash anymore when it needs more then 10 minutes to
|
||||
|
Binary file not shown.
@ -36,6 +36,8 @@
|
||||
#include "clcomm.h"
|
||||
#include "diesel.h"
|
||||
|
||||
static int firstrandom = TRUE;
|
||||
|
||||
|
||||
void MacroVars( const char *codes, const char *fmt, ...)
|
||||
{
|
||||
@ -187,6 +189,53 @@ char *ParseMacro( const char *line, int *dieselrc)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Add random fortune cookie to the macrovars
|
||||
*/
|
||||
void Cookie(void);
|
||||
void Cookie(void)
|
||||
{
|
||||
FILE *olf;
|
||||
char *fname;
|
||||
long recno, records;
|
||||
|
||||
fname = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(fname, "%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
||||
|
||||
if ((olf = fopen(fname, "r")) == NULL) {
|
||||
WriteError("$Can't open %s", fname);
|
||||
free(fname);
|
||||
return;
|
||||
}
|
||||
|
||||
fread(&olhdr, sizeof(olhdr), 1, olf);
|
||||
fseek(olf, 0, SEEK_END);
|
||||
records = (ftell(olf) - olhdr.hdrsize) / olhdr.recsize;
|
||||
|
||||
if (firstrandom) {
|
||||
srand(getpid());
|
||||
firstrandom = FALSE;
|
||||
}
|
||||
recno = 1+(int) (1.0 * records * rand() / (RAND_MAX + 1.0));
|
||||
Syslog('f', "Selected quote %d out of %d records", recno, records);
|
||||
|
||||
if (fseek(olf, olhdr.hdrsize + (recno * olhdr.recsize), SEEK_SET) == 0) {
|
||||
if (fread(&ol, olhdr.recsize, 1, olf) == 1) {
|
||||
MacroVars("F", "s", ol.Oneline);
|
||||
} else {
|
||||
WriteError("Can't read %s", fname);
|
||||
}
|
||||
} else {
|
||||
WriteError("$Can't seek record %d in %s", recno, fname);
|
||||
}
|
||||
fclose(olf);
|
||||
free(fname);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
FILE *OpenMacro(const char *filename, int Language)
|
||||
{
|
||||
FILE *pLang, *fi = NULL;
|
||||
@ -236,6 +285,7 @@ FILE *OpenMacro(const char *filename, int Language)
|
||||
sprintf(temp, "%s-%s", OsName(), OsCPU());
|
||||
MacroVars("HLMNOSTUVYZ", "ssssssssssd", CFG.www_url, CFG.location, CFG.sysdomain, CFG.bbs_name, temp,
|
||||
CFG.sysop_name, CFG.comment, CFG.sysop, VERSION, aka2str(CFG.aka[0]), 0);
|
||||
Cookie();
|
||||
}
|
||||
|
||||
free(temp);
|
||||
|
@ -7,7 +7,7 @@ include ../Makefile.global
|
||||
SRCS = addbbs.c backalias.c flock.c hatch.c mbdiff.c mgrutil.c pack.c \
|
||||
ptic.c sendmail.c tracker.c addpkt.c bwrite.c forward.c lhash.c \
|
||||
mbfido.c mkftnhdr.c ping.c rfc2ftn.c storeecho.c ulock.c aliasdb.c \
|
||||
cookie.c fsort.c magic.c mbfile.c mover.c post.c rnews.c storenet.c \
|
||||
fsort.c magic.c mbfile.c mover.c post.c rnews.c storenet.c \
|
||||
utic.c announce.c fflist.c ftn2rfc.c makestat.c mbindex.c msgutil.c \
|
||||
postecho.c rollover.c tic.c areamgr.c filefind.c grlist.c maketags.c \
|
||||
mbmsg.c newspost.c postemail.c scan.c toberep.c atoul.c filemgr.c \
|
||||
@ -18,7 +18,7 @@ SRCS = addbbs.c backalias.c flock.c hatch.c mbdiff.c mgrutil.c pack.c \
|
||||
HDRS = addbbs.h backalias.h flock.h hatch.h mbdiff.h mgrutil.h pack.h \
|
||||
postnetmail.h scannews.h tosspkt.h addpkt.h bwrite.h forward.h \
|
||||
lhash.h mbfido.h mkftnhdr.h paths.h ptic.h sendmail.h tracker.h \
|
||||
aliasdb.h cookie.h fsort.h magic.h mbfile.h mover.h ping.h rfc2ftn.h \
|
||||
aliasdb.h fsort.h magic.h mbfile.h mover.h ping.h rfc2ftn.h \
|
||||
storeecho.h ulock.h announce.h fflist.h ftn2rfc.h makestat.h mbindex.h \
|
||||
msgutil.h post.h rnews.h storenet.h utic.h areamgr.h filefind.h \
|
||||
grlist.h maketags.h mbmsg.h newspost.h postecho.h rollover.h tic.h \
|
||||
@ -29,7 +29,7 @@ HDRS = addbbs.h backalias.h flock.h hatch.h mbdiff.h mgrutil.h pack.h \
|
||||
MBFIDO_OBJS = flock.o tosspkt.o mbfido.o hatch.o maketags.o virscan.o tracker.o \
|
||||
makestat.o scannews.o lhash.o bounce.o pack.o ulock.o tic.o ptic.o \
|
||||
utic.o mover.o hash.o mkftnhdr.o addbbs.o magic.o fsort.o toberep.o \
|
||||
ftn2rfc.o atoul.o ping.o cookie.o forward.o sendmail.o scan.o addpkt.o \
|
||||
ftn2rfc.o atoul.o ping.o forward.o sendmail.o scan.o addpkt.o \
|
||||
storenet.o storeecho.o areamgr.o filemgr.o notify.o mgrutil.o rollover.o \
|
||||
bwrite.o rfc2ftn.o rnews.o newspost.o aliasdb.o postemail.o postnetmail.o \
|
||||
postecho.o backalias.o createm.o createf.o
|
||||
@ -146,7 +146,7 @@ sendmail.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../li
|
||||
tracker.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbnode.h ../lib/dbftn.h tracker.h
|
||||
addpkt.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/dbnode.h ../lib/dbmsgs.h pack.h addpkt.h
|
||||
bwrite.o: ../lib/libs.h bwrite.h
|
||||
forward.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbnode.h ../lib/dbtic.h tic.h cookie.h sendmail.h rollover.h forward.h
|
||||
forward.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbnode.h ../lib/dbtic.h ../lib/diesel.h tic.h sendmail.h rollover.h mgrutil.h forward.h
|
||||
lhash.o: ../lib/libs.h ../lib/clcomm.h lhash.h
|
||||
mbfido.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbdupe.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbuser.h ../lib/dbftn.h ../lib/dbtic.h ../lib/msg.h flock.h tosspkt.h pack.h ulock.h tic.h fsort.h scan.h mbfido.h tracker.h notify.h rollover.h hatch.h scannews.h maketags.h makestat.h newspost.h rnews.h backalias.h rfc2ftn.h
|
||||
mkftnhdr.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h atoul.h hash.h aliasdb.h mkftnhdr.h
|
||||
@ -155,7 +155,6 @@ rfc2ftn.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib
|
||||
storeecho.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbmsgs.h ../lib/dbuser.h rollover.h storeecho.h
|
||||
ulock.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h flock.h ulock.h
|
||||
aliasdb.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h aliasdb.h
|
||||
cookie.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h cookie.h
|
||||
fsort.o: ../lib/libs.h ../lib/clcomm.h fsort.h
|
||||
magic.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbtic.h tic.h utic.h magic.h
|
||||
mbfile.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbfkill.h mbfadopt.h mbfindex.h mbfcheck.h mbfpack.h mbflist.h mbfimport.h mbftoberep.h mbfmove.h mbfdel.h mbfutil.h mbfile.h
|
||||
@ -174,7 +173,7 @@ postecho.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../li
|
||||
rollover.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h rollover.h
|
||||
tic.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/dbftn.h ../lib/clcomm.h ulock.h ptic.h fsort.h pack.h tic.h
|
||||
areamgr.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h ../lib/diesel.h sendmail.h mgrutil.h scan.h createm.h areamgr.h
|
||||
filefind.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/msg.h ../lib/msgtext.h fflist.h filefind.h msgutil.h
|
||||
filefind.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/msg.h ../lib/msgtext.h ../lib/diesel.h fflist.h filefind.h msgutil.h
|
||||
grlist.o: ../lib/libs.h ../lib/clcomm.h grlist.h
|
||||
maketags.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h maketags.h
|
||||
mbmsg.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/dbcfg.h post.h mbmsg.h
|
||||
|
@ -464,12 +464,13 @@ void A_Status(faddr *t, char *replyid)
|
||||
|
||||
subject = calloc(255, sizeof(char));
|
||||
sprintf(subject,"AreaMgr Status");
|
||||
|
||||
Syslog('+', "AreaMgr: Status");
|
||||
|
||||
if (Miy == 0)
|
||||
i = 11;
|
||||
else
|
||||
i = Miy - 1;
|
||||
MacroVars("DCEFGRPQRpqrsYy","ddddcsddddddsss",
|
||||
MacroVars("DCEfGvPQRpqrsYy","ddddcsddddddsss",
|
||||
nodes.Direct,
|
||||
nodes.Crash,
|
||||
nodes.Hold,
|
||||
@ -487,7 +488,6 @@ void A_Status(faddr *t, char *replyid)
|
||||
ascfnode(bestaka_s(t), 0xf)
|
||||
);
|
||||
GetRpSubject("areamgr.status",subject);
|
||||
Syslog('+', "AreaMgr: Status");
|
||||
|
||||
if ((fi = OpenMacro("areamgr.status", nodes.Language)) == NULL ){
|
||||
MacroClear();
|
||||
|
@ -292,7 +292,7 @@ void F_Status(faddr *t, char *replyid)
|
||||
i = 11;
|
||||
else
|
||||
i = Miy - 1;
|
||||
MacroVars("ABCDEFGIJabcdefghijkls", "ddddddddddddddddddddds",
|
||||
MacroVars("ABCDEfGIJabcdefghijkls", "ddddddddddddddddddddds",
|
||||
nodes.Message,
|
||||
nodes.Tic,
|
||||
nodes.AdvTic,
|
||||
|
@ -36,10 +36,11 @@
|
||||
#include "../lib/clcomm.h"
|
||||
#include "../lib/dbnode.h"
|
||||
#include "../lib/dbtic.h"
|
||||
#include "../lib/diesel.h"
|
||||
#include "tic.h"
|
||||
#include "cookie.h"
|
||||
#include "sendmail.h"
|
||||
#include "rollover.h"
|
||||
#include "mgrutil.h"
|
||||
#include "forward.h"
|
||||
|
||||
|
||||
@ -47,13 +48,14 @@
|
||||
|
||||
void ForwardFile(fidoaddr Node, fa_list *sbl)
|
||||
{
|
||||
char *subject = NULL, *temp, *fwdfile = NULL, *ticfile = NULL, fname[PATH_MAX], *ticname;
|
||||
FILE *fp, *net;
|
||||
char *subject = NULL, *temp, *line, *fwdfile = NULL, *ticfile = NULL, fname[PATH_MAX], *ticname;
|
||||
FILE *fp, *fi, *net;
|
||||
char flavor;
|
||||
faddr *dest, *route, *Fa;
|
||||
int i, z, n;
|
||||
time_t now;
|
||||
fa_list *tmp;
|
||||
long filepos;
|
||||
|
||||
Syslog('+', "Forward file to %s", aka2str(Node));
|
||||
|
||||
@ -133,32 +135,38 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
|
||||
* Send netmail message if the node has it turned on.
|
||||
*/
|
||||
if (nodes.Message) {
|
||||
if ((net = SendMgrMail(fido2faddr(Node), CFG.ct_KeepMgr, TRUE, (char *)"Filemgr", subject, NULL)) != NULL) {
|
||||
fprintf(net, " Dear %s\r", nodes.Sysop);
|
||||
fprintf(net, "\r");
|
||||
fprintf(net, "I sent the following file to your system:\r");
|
||||
fprintf(net, "\r");
|
||||
if (TIC.SendOrg)
|
||||
fprintf(net, "File : %s\r", TIC.RealName);
|
||||
else
|
||||
fprintf(net, "File : %s\r", TIC.NewName);
|
||||
fprintf(net, "Description : %s\r", TIC.TicIn.Desc);
|
||||
fprintf(net, "Area : %s %s\r", TIC.TicIn.Area, TIC.TicIn.AreaDesc);
|
||||
fprintf(net, "Size : %ld\r", (long)(TIC.FileSize));
|
||||
fprintf(net, "CRC : %s\r", TIC.TicIn.Crc);
|
||||
fprintf(net, "Origin : %s\r", TIC.TicIn.Origin);
|
||||
if (strlen(TIC.TicIn.Magic))
|
||||
fprintf(net, "Magic : %s\r", TIC.TicIn.Magic);
|
||||
if (strlen(TIC.TicIn.Replace))
|
||||
fprintf(net, "Replaces : %s\r", TIC.TicIn.Replace);
|
||||
fprintf(net, "\r\r");
|
||||
fprintf(net, "With regards, %s\r\r", CFG.sysop_name);
|
||||
fprintf(net, "... %s\r\r", Cookie());
|
||||
fprintf(net, "%s\r", TearLine());
|
||||
CloseMail(net, fido2faddr(Node));
|
||||
} else {
|
||||
WriteError("$Can't create netmail");
|
||||
if ((net = SendMgrMail(fido2faddr(Node), CFG.ct_KeepMgr, TRUE, (char *)"Filemgr", subject, NULL)) != NULL) {
|
||||
if ((fi = OpenMacro("forward.tic", nodes.Language)) != NULL) {
|
||||
MacroVars("abcfghijmns", "ssdsddsssss", TIC.TicIn.Area, TIC.TicIn.AreaDesc, TIC.FileCost,
|
||||
TIC.TicIn.FullName, TIC.FileSize, TIC.FileSize / 1024,
|
||||
TIC.TicIn.Crc, TIC.TicIn.Origin, " ", TIC.TicIn.LDesc[0], nodes.Sysop);
|
||||
if (TIC.SendOrg)
|
||||
MacroVars("e", "s", TIC.RealName);
|
||||
else
|
||||
MacroVars("e", "s", TIC.NewName);
|
||||
if (strlen(TIC.TicIn.Magic))
|
||||
MacroVars("k", "s", TIC.TicIn.Magic);
|
||||
if (strlen(TIC.TicIn.Replace))
|
||||
MacroVars("l", "s", TIC.TicIn.Replace);
|
||||
MacroRead(fi, net);
|
||||
filepos = ftell(fi);
|
||||
for (i = 1; i < 25; i++) {
|
||||
fseek(fi, filepos, SEEK_SET);
|
||||
if (strlen(TIC.TicIn.LDesc[i])) {
|
||||
MacroRead(fi, net);
|
||||
} else {
|
||||
line = calloc(255, sizeof(char));
|
||||
while ((fgets(line, 254, fi) != NULL) && ((line[0]!='@') || (line[1]!='|'))) {}
|
||||
free(line);
|
||||
}
|
||||
}
|
||||
MacroRead(fi, net);
|
||||
fprintf(net, "%s\r", TearLine());
|
||||
CloseMail(net, fido2faddr(Node));
|
||||
}
|
||||
} else {
|
||||
WriteError("$Can't create netmail");
|
||||
}
|
||||
}
|
||||
free(subject);
|
||||
|
||||
|
Reference in New Issue
Block a user