Recreate golded.inc and msg.txt when message areas are auto created

This commit is contained in:
Michiel Broek 2005-08-10 18:57:22 +00:00
parent 11bede30c4
commit 60326e7a3d
7 changed files with 186 additions and 11 deletions

View File

@ -26,6 +26,8 @@ v0.71.3 13-Jun-2005
mbfido:
Fixed commandline parser for mail recipients.
Added subject line clean in several places.
When message areas are autocreated, golded.inc and msg.txt are
recreated for the external editors.
mbsetup:
Added setup switches per node to disable PLZ or GZ and BZ2

3
TODO
View File

@ -98,9 +98,6 @@ mbfido:
N: Add statistic mail messages. Via AMC??
N: With auto created areas golded.inc is not adjusted to the new
setup.
N: After readalias we need to free the alias list when mbfido ends.
N: Reimplement characterset conversion again on the gateway.

View File

@ -138,7 +138,7 @@ addpkt.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h addpkt.h
bwrite.o: ../config.h ../lib/mbselib.h bwrite.h
forward.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/diesel.h tic.h sendmail.h rollover.h mgrutil.h forward.h
lhash.o: ../config.h ../lib/mbselib.h lhash.h
mbfido.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/nodelist.h ../lib/mbsedb.h ../lib/msg.h flock.h tosspkt.h unpack.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 mgrutil.h backalias.h rfc2ftn.h dirsession.h dirlock.h queue.h msg.h
mbfido.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/nodelist.h ../lib/mbsedb.h ../lib/msg.h flock.h tosspkt.h unpack.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 mgrutil.h backalias.h rfc2ftn.h dirsession.h dirlock.h queue.h msg.h createm.h
mkftnhdr.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h atoul.h hash.h msgflags.h aliasdb.h mkftnhdr.h
ping.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/msg.h ../lib/msgtext.h ../lib/mbsedb.h sendmail.h postnetmail.h ping.h
rfc2ftn.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbinet.h ../lib/mbsedb.h ../lib/msg.h ../lib/msgtext.h mkftnhdr.h hash.h rollover.h postnetmail.h postecho.h msgflags.h rfc2ftn.h

View File

@ -4,7 +4,7 @@
* Purpose ...............: Create Message Area
*
*****************************************************************************
* Copyright (C) 1997-2004
* Copyright (C) 1997-2005
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -39,6 +39,8 @@
#define MCHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
extern int areas_changed;
int create_msgarea(char *marea, faddr *p_from)
{
@ -285,6 +287,7 @@ int CheckEchoGroup(char *Area, int SendUplink, faddr *f)
else
Mgrlog("Auto created echo %s, group %s, area %ld, for node %s",
msgs.Tag, msgs.Group, offset, ascfnode(f , 0x1f));
areas_changed = TRUE;
return 0;
} /* if (strcmp(tag, Area) == 0) */
} /* if (strlen(buf) && isalnum(buf[0])) */
@ -298,3 +301,175 @@ int CheckEchoGroup(char *Area, int SendUplink, faddr *f)
}
void msged_areas(FILE *fp)
{
char *temp, *aka;
FILE *no;
int i = 0;
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if ((no = fopen(temp, "r")) == NULL) {
free(temp);
return;
}
fread(&msgshdr, sizeof(msgshdr), 1, no);
fseek(no, 0, SEEK_SET);
fread(&msgshdr, msgshdr.hdrsize, 1, no);
while (fread(&msgs, msgshdr.recsize, 1, no) == 1) {
i++;
if (msgs.Active) {
fprintf(fp, "Jam ");
switch (msgs.Type) {
case LOCALMAIL: fprintf(fp, "l"); break;
case NETMAIL: fprintf(fp, "mp"); break;
case ECHOMAIL: fprintf(fp, "e"); break;
case NEWS: fprintf(fp, "e"); break;
}
if (((msgs.Type == NEWS) || (msgs.Type == ECHOMAIL)) && strlen(msgs.Tag) && strlen(msgs.Newsgroup)) {
fprintf(fp, "u");
}
fprintf(fp, "8");
fprintf(fp, " \"%s\" %s", msgs.Name, msgs.Base);
if (msgs.Type == ECHOMAIL)
fprintf(fp, " %s", msgs.Tag);
if (msgs.Type != LOCALMAIL) {
aka = xstrcpy(strtok(aka2str(msgs.Aka), "@"));
fprintf(fp, " %s", aka);
free(aka);
}
fprintf(fp, "\n");
}
fseek(no, msgshdr.syssize, SEEK_CUR);
}
fclose(no);
free(temp);
}
void gold_areas(FILE *fp)
{
char *temp, *aka;
FILE *no;
int i = 0;
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if ((no = fopen(temp, "r")) == NULL) {
free(temp);
return;
}
fread(&msgshdr, sizeof(msgshdr), 1, no);
fseek(no, 0, SEEK_SET);
fread(&msgshdr, msgshdr.hdrsize, 1, no);
fprintf(fp, "; Message Areas\n;\n");
fprintf(fp, "AREASCAN *\n");
fprintf(fp, "AREATYPEORDER Net Email Echo News Local\n");
while (fread(&msgs, msgshdr.recsize, 1, no) == 1) {
i++;
if (msgs.Active) {
fprintf(fp, "AREADEF ");
if (strlen(msgs.Tag))
fprintf(fp, "%s", msgs.Tag);
else
fprintf(fp, "AREA%d", i);
fprintf(fp, " \"%s\" ", msgs.Name);
switch (msgs.Type) {
case LOCALMAIL : fprintf(fp, "0 Local"); break;
case NETMAIL : fprintf(fp, "N Net"); break;
case ECHOMAIL : fprintf(fp, "C Echo"); break;
case NEWS : fprintf(fp, "I News"); break;
}
aka = xstrcpy(strtok(aka2str(msgs.Aka), "@"));
fprintf(fp, " JAM %s %s ", msgs.Base, aka);
free(aka);
if (msgs.Type == NETMAIL)
fprintf(fp, "(Loc Pvt)");
else
fprintf(fp, "(Loc)");
fprintf(fp, " \"%s\"\n", msgs.Origin);
}
fseek(no, msgshdr.syssize, SEEK_CUR);
}
fclose(no);
free(temp);
fprintf(fp, "\n");
}
void gold_akamatch(FILE *fp)
{
char temp[PATH_MAX];
FILE *fido;
faddr *want, *ta;
int i;
sprintf(temp, "%s/etc/fidonet.data", getenv("MBSE_ROOT"));
if ((fido = fopen(temp, "r")) == NULL)
return;
fprintf(fp, "; AKA Matching\n;\n");
want = (faddr *)malloc(sizeof(faddr));
fread(&fidonethdr, sizeof(fidonethdr), 1, fido);
while ((fread(&fidonet, fidonethdr.recsize, 1, fido)) == 1) {
if (fidonet.available) {
for (i = 0; i < 6; i++) {
if (fidonet.zone[i]) {
want->zone = fidonet.zone[0];
want->net = 0;
want->node = 0;
want->point = 0;
want->name = NULL;
want->domain = NULL;
ta = bestaka_s(want);
fprintf(fp, "AKAMATCH %d:* %s\n", fidonet.zone[i], ascfnode(ta, 0xf));
tidy_faddr(ta);
}
}
}
}
free(want);
fprintf(fp, ";\n");
fprintf(fp, "AKAMATCHNET YES\n");
fprintf(fp, "AKAMATCHECHO YES\n");
fprintf(fp, "AKAMATCHLOCAL NO\n\n");
fprintf(fp, "; NODELISTS\n;\n");
fprintf(fp, "NODEPATH %s/\n", CFG.nodelists);
fseek(fido, fidonethdr.hdrsize, SEEK_SET);
while ((fread(&fidonet, fidonethdr.recsize, 1, fido)) == 1) {
if (fidonet.available) {
fprintf(fp, "NODELIST %s.*\n", fidonet.nodelist);
for (i = 0; i < 6; i++)
if (strlen(fidonet.seclist[i].nodelist) || fidonet.seclist[i].zone)
fprintf(fp, "NODELIST %s.*\n", fidonet.seclist[i].nodelist);
}
}
// fprintf(fp, "USERLIST golded.lst\n");
fprintf(fp, "LOOKUPNET YES\n");
fprintf(fp, "LOOKUPECHO NO\n");
fprintf(fp, "LOOKUPLOCAL NO\n\n");
fclose(fido);
}

View File

@ -4,9 +4,11 @@
#define _CREATEM_H
int create_msgarea(char *, faddr *);
int CheckEchoGroup(char *, int, faddr *);
int create_msgarea(char *, faddr *);
int CheckEchoGroup(char *, int, faddr *);
void msged_areas(FILE *);
void gold_areas(FILE *);
void gold_akamatch(FILE *);
#endif

View File

@ -708,7 +708,6 @@ int TossMail(void)
int files = 0, files_ok = 0, rc = 0, maxrc = 0;
fd_list *fdl = NULL;
areas_changed = TRUE;
if (do_unprot)
inbound = xstrcpy(CFG.inbound);
else

View File

@ -1,8 +1,8 @@
/* mbfido.h */
#ifndef _MBFIDO_H
#define _MBFIDO_H
/* $Id$ */
void Help(void);
void ProgName(void);
void die(int);