Added GoldED groupid's for sorting
This commit is contained in:
parent
95d3eb2092
commit
6e92eb3437
11
ChangeLog
11
ChangeLog
@ -1,7 +1,10 @@
|
|||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
|
|
||||||
v0.83.16 13-Mar-2006
|
v0.83.17 27-Mar-2006
|
||||||
|
|
||||||
|
|
||||||
|
v0.83.16 13-Mar-2006 - 27-Mar-2006
|
||||||
|
|
||||||
mbfido:
|
mbfido:
|
||||||
If sending crash to a node not in the setup, a default
|
If sending crash to a node not in the setup, a default
|
||||||
@ -9,9 +12,15 @@ v0.83.16 13-Mar-2006
|
|||||||
Accept unpacket mail for own points.
|
Accept unpacket mail for own points.
|
||||||
In created ticfiles in advanced seen-by mode, setting the node
|
In created ticfiles in advanced seen-by mode, setting the node
|
||||||
to 4d will add point numbers to the seen-by lines if needed.
|
to 4d will add point numbers to the seen-by lines if needed.
|
||||||
|
When message areas are auto changed, the updated golded.inc
|
||||||
|
file now has the groupid numbers from the groups in echomail
|
||||||
|
or news areas.
|
||||||
|
|
||||||
mbsetup:
|
mbsetup:
|
||||||
Added setup switch for tic nodes that need a 4d seen-by line.
|
Added setup switch for tic nodes that need a 4d seen-by line.
|
||||||
|
When saving message areas, the golded.inc file now has the
|
||||||
|
groupid numbers from the groups in echomail or news areas.
|
||||||
|
The message groups now handle groupnumbers for golded groups.
|
||||||
|
|
||||||
|
|
||||||
v0.83.15 05-Mar-2006 - 13-Mar-2006
|
v0.83.15 05-Mar-2006 - 13-Mar-2006
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 13 KiB |
@ -14,7 +14,7 @@
|
|||||||
</HEAD>
|
</HEAD>
|
||||||
<BODY>
|
<BODY>
|
||||||
<BLOCKQUOTE>
|
<BLOCKQUOTE>
|
||||||
<div align="right"><h5>Last update 23-Feb-2004</h5></div>
|
<div align="right"><h5>Last update 27-Mar-2006</h5></div>
|
||||||
<div align="center"><H1>MBSE BBS Setup - Mail Setup - Message Groups.</H1></div>
|
<div align="center"><H1>MBSE BBS Setup - Mail Setup - Message Groups.</H1></div>
|
||||||
|
|
||||||
<H3>Introduction.</H3>
|
<H3>Introduction.</H3>
|
||||||
@ -56,6 +56,7 @@ skip a number of extra areas for future expansion.
|
|||||||
<strong>Uplink </strong>The Fidonet aka of your uplink.
|
<strong>Uplink </strong>The Fidonet aka of your uplink.
|
||||||
<strong>Areas </strong>Areas file in the path defined in 1.4.6 screen 2.
|
<strong>Areas </strong>Areas file in the path defined in 1.4.6 screen 2.
|
||||||
<strong>Charset </strong>Default character set to use.
|
<strong>Charset </strong>Default character set to use.
|
||||||
|
<strong>GoldED grp </strong>Groupnumber for GoldED include file.
|
||||||
</pre>
|
</pre>
|
||||||
<P>
|
<P>
|
||||||
<IMG SRC="../images/emgroup.png" alt='Mail groups setup'>
|
<IMG SRC="../images/emgroup.png" alt='Mail groups setup'>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: Create Message Area
|
* Purpose ...............: Create Message Area
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2005
|
* Copyright (C) 1997-2006
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -358,8 +358,8 @@ void msged_areas(FILE *fp)
|
|||||||
|
|
||||||
void gold_areas(FILE *fp)
|
void gold_areas(FILE *fp)
|
||||||
{
|
{
|
||||||
char *temp, *aka;
|
char *temp, *aka, groupid[13];
|
||||||
FILE *no;
|
FILE *no, *fil;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
@ -387,11 +387,39 @@ void gold_areas(FILE *fp)
|
|||||||
else
|
else
|
||||||
fprintf(fp, "AREA%d", i);
|
fprintf(fp, "AREA%d", i);
|
||||||
fprintf(fp, " \"%s\" ", msgs.Name);
|
fprintf(fp, " \"%s\" ", msgs.Name);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set a default groupid
|
||||||
|
*/
|
||||||
switch (msgs.Type) {
|
switch (msgs.Type) {
|
||||||
case LOCALMAIL : fprintf(fp, "0 Local"); break;
|
case LOCALMAIL : snprintf(groupid, 13, "O"); break;
|
||||||
case NETMAIL : fprintf(fp, "N Net"); break;
|
case NETMAIL : snprintf(groupid, 13, "N"); break;
|
||||||
case ECHOMAIL : fprintf(fp, "C Echo"); break;
|
case ECHOMAIL : snprintf(groupid, 13, "C"); break;
|
||||||
case NEWS : fprintf(fp, "I News"); break;
|
case NEWS : snprintf(groupid, 13, "I"); break;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Now try to find a real groupid
|
||||||
|
*/
|
||||||
|
if (((msgs.Type == ECHOMAIL) || (msgs.Type == NEWS)) && strlen(msgs.Group)) {
|
||||||
|
snprintf(temp, PATH_MAX, "%s/etc/mgroups.data", getenv("MBSE_ROOT"));
|
||||||
|
if ((fil = fopen(temp, "r")) != NULL) {
|
||||||
|
fread(&mgrouphdr, sizeof(mgrouphdr), 1, fil);
|
||||||
|
while (fread(&mgroup, mgrouphdr.recsize, 1, fil) == 1) {
|
||||||
|
if (mgroup.Active && !strcmp(msgs.Group, mgroup.Name) && mgroup.GoldEDgroup) {
|
||||||
|
snprintf(groupid, 13, "%d", mgroup.GoldEDgroup);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(fil);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fprintf(fp, "%s ", groupid);
|
||||||
|
|
||||||
|
switch (msgs.Type) {
|
||||||
|
case LOCALMAIL : fprintf(fp, "Local"); break;
|
||||||
|
case NETMAIL : fprintf(fp, "Net"); break;
|
||||||
|
case ECHOMAIL : fprintf(fp, "Echo"); break;
|
||||||
|
case NEWS : fprintf(fp, "News"); break;
|
||||||
}
|
}
|
||||||
aka = xstrcpy(strtok(aka2str(msgs.Aka), "@"));
|
aka = xstrcpy(strtok(aka2str(msgs.Aka), "@"));
|
||||||
fprintf(fp, " JAM %s %s ", msgs.Base, aka);
|
fprintf(fp, " JAM %s %s ", msgs.Base, aka);
|
||||||
|
@ -1780,57 +1780,88 @@ void msged_areas(FILE *fp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AREADEF Syntax: Echoid "Description" Groupid Type Format Path or board Aka (Attributes) "Origin"
|
||||||
|
*/
|
||||||
void gold_areas(FILE *fp)
|
void gold_areas(FILE *fp)
|
||||||
{
|
{
|
||||||
char *temp, *aka;
|
char *temp, *aka, groupid[13];
|
||||||
FILE *no;
|
FILE *no, *fil;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
snprintf(temp, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
snprintf(temp, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
||||||
if ((no = fopen(temp, "r")) == NULL)
|
if ((no = fopen(temp, "r")) == NULL) {
|
||||||
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);
|
free(temp);
|
||||||
fprintf(fp, "\n");
|
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);
|
||||||
|
/*
|
||||||
|
* Set a default groupid
|
||||||
|
*/
|
||||||
|
switch (msgs.Type) {
|
||||||
|
case LOCALMAIL : snprintf(groupid, 13, "O"); break;
|
||||||
|
case NETMAIL : snprintf(groupid, 13, "N"); break;
|
||||||
|
case ECHOMAIL : snprintf(groupid, 13, "C"); break;
|
||||||
|
case NEWS : snprintf(groupid, 13, "I"); break;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Now try to find a real groupid
|
||||||
|
*/
|
||||||
|
if (((msgs.Type == ECHOMAIL) || (msgs.Type == NEWS)) && strlen(msgs.Group)) {
|
||||||
|
snprintf(temp, PATH_MAX, "%s/etc/mgroups.data", getenv("MBSE_ROOT"));
|
||||||
|
if ((fil = fopen(temp, "r")) != NULL) {
|
||||||
|
fread(&mgrouphdr, sizeof(mgrouphdr), 1, fil);
|
||||||
|
while (fread(&mgroup, mgrouphdr.recsize, 1, fil) == 1) {
|
||||||
|
if (mgroup.Active && !strcmp(msgs.Group, mgroup.Name) && mgroup.GoldEDgroup) {
|
||||||
|
snprintf(groupid, 13, "%d", mgroup.GoldEDgroup);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(fil);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fprintf(fp, "%s ", groupid);
|
||||||
|
|
||||||
|
switch (msgs.Type) {
|
||||||
|
case LOCALMAIL : fprintf(fp, "Local"); break;
|
||||||
|
case NETMAIL : fprintf(fp, "Net"); break;
|
||||||
|
case ECHOMAIL : fprintf(fp, "Echo"); break;
|
||||||
|
case NEWS : fprintf(fp, "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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: Setup MGroups.
|
* Purpose ...............: Setup MGroups.
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2005
|
* Copyright (C) 1997-2006
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -41,7 +41,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int MGrpUpdated = 0;
|
int MGrpUpdated = 0;
|
||||||
|
unsigned int *gedgrps;
|
||||||
|
extern int exp_golded;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -98,76 +100,87 @@ int CountMGroup(void)
|
|||||||
int OpenMGroup(void);
|
int OpenMGroup(void);
|
||||||
int OpenMGroup(void)
|
int OpenMGroup(void)
|
||||||
{
|
{
|
||||||
FILE *fin, *fout;
|
FILE *fin, *fout;
|
||||||
char fnin[PATH_MAX], fnout[PATH_MAX], temp[13];
|
char fnin[PATH_MAX], fnout[PATH_MAX], temp[13];
|
||||||
int oldsize;
|
int oldsize, i, record;
|
||||||
int i;
|
|
||||||
|
|
||||||
snprintf(fnin, PATH_MAX, "%s/etc/mgroups.data", getenv("MBSE_ROOT"));
|
/*
|
||||||
snprintf(fnout, PATH_MAX, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
|
* Init GoldED grouptable
|
||||||
if ((fin = fopen(fnin, "r")) != NULL) {
|
*/
|
||||||
if ((fout = fopen(fnout, "w")) != NULL) {
|
gedgrps = (unsigned int *)malloc(1001 * sizeof(unsigned int));
|
||||||
MGrpUpdated = 0;
|
memset(gedgrps, 0, 1001 * sizeof(unsigned int));
|
||||||
fread(&mgrouphdr, sizeof(mgrouphdr), 1, fin);
|
|
||||||
fseek(fin, 0, SEEK_SET);
|
|
||||||
fread(&mgrouphdr, mgrouphdr.hdrsize, 1, fin);
|
|
||||||
if (mgrouphdr.hdrsize != sizeof(mgrouphdr)) {
|
|
||||||
mgrouphdr.hdrsize = sizeof(mgrouphdr);
|
|
||||||
mgrouphdr.lastupd = time(NULL);
|
|
||||||
MGrpUpdated = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
snprintf(fnin, PATH_MAX, "%s/etc/mgroups.data", getenv("MBSE_ROOT"));
|
||||||
* In case we are automaitc upgrading the data format
|
snprintf(fnout, PATH_MAX, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
|
||||||
* we save the old format. If it is changed, the
|
if ((fin = fopen(fnin, "r")) != NULL) {
|
||||||
* database must always be updated.
|
if ((fout = fopen(fnout, "w")) != NULL) {
|
||||||
*/
|
MGrpUpdated = 0;
|
||||||
oldsize = mgrouphdr.recsize;
|
fread(&mgrouphdr, sizeof(mgrouphdr), 1, fin);
|
||||||
if (oldsize != sizeof(mgroup))
|
fseek(fin, 0, SEEK_SET);
|
||||||
MGrpUpdated = 1;
|
fread(&mgrouphdr, mgrouphdr.hdrsize, 1, fin);
|
||||||
mgrouphdr.hdrsize = sizeof(mgrouphdr);
|
if (mgrouphdr.hdrsize != sizeof(mgrouphdr)) {
|
||||||
mgrouphdr.recsize = sizeof(mgroup);
|
mgrouphdr.hdrsize = sizeof(mgrouphdr);
|
||||||
fwrite(&mgrouphdr, sizeof(mgrouphdr), 1, fout);
|
mgrouphdr.lastupd = time(NULL);
|
||||||
|
MGrpUpdated = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (MGrpUpdated)
|
/*
|
||||||
Syslog('+', "Updated %s, format changed", fnin);
|
* In case we are automaitc upgrading the data format
|
||||||
|
* we save the old format. If it is changed, the
|
||||||
|
* database must always be updated.
|
||||||
|
*/
|
||||||
|
oldsize = mgrouphdr.recsize;
|
||||||
|
if (oldsize != sizeof(mgroup))
|
||||||
|
MGrpUpdated = 1;
|
||||||
|
mgrouphdr.hdrsize = sizeof(mgrouphdr);
|
||||||
|
mgrouphdr.recsize = sizeof(mgroup);
|
||||||
|
fwrite(&mgrouphdr, sizeof(mgrouphdr), 1, fout);
|
||||||
|
|
||||||
/*
|
if (MGrpUpdated)
|
||||||
* The datarecord is filled with zero's before each
|
Syslog('+', "Updated %s, format changed", fnin);
|
||||||
* read, so if the format changed, the new fields
|
|
||||||
* will be empty.
|
|
||||||
*/
|
|
||||||
memset(&mgroup, 0, sizeof(mgroup));
|
|
||||||
while (fread(&mgroup, oldsize, 1, fin) == 1) {
|
|
||||||
if (MGrpUpdated && !strlen(mgroup.BasePath)) {
|
|
||||||
memset(&temp, 0, sizeof(temp));
|
|
||||||
strcpy(temp, mgroup.Name);
|
|
||||||
for (i = 0; i < strlen(temp); i++) {
|
|
||||||
if (isupper(temp[i]))
|
|
||||||
temp[i] = tolower(temp[i]);
|
|
||||||
if (temp[i] == '.')
|
|
||||||
temp[i] = '/';
|
|
||||||
}
|
|
||||||
snprintf(mgroup.BasePath, 65, "%s/var/mail/%s", getenv("MBSE_ROOT"), temp);
|
|
||||||
}
|
|
||||||
if (MGrpUpdated && !mgroup.LinkSec.level) {
|
|
||||||
mgroup.LinkSec.level = 1;
|
|
||||||
mgroup.LinkSec.flags = 1;
|
|
||||||
}
|
|
||||||
if (MGrpUpdated && (mgroup.Charset == FTNC_NONE)) {
|
|
||||||
mgroup.Charset = FTNC_CP437;
|
|
||||||
}
|
|
||||||
fwrite(&mgroup, sizeof(mgroup), 1, fout);
|
|
||||||
memset(&mgroup, 0, sizeof(mgroup));
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(fin);
|
/*
|
||||||
fclose(fout);
|
* The datarecord is filled with zero's before each
|
||||||
return 0;
|
* read, so if the format changed, the new fields
|
||||||
} else
|
* will be empty.
|
||||||
return -1;
|
*/
|
||||||
}
|
memset(&mgroup, 0, sizeof(mgroup));
|
||||||
return -1;
|
record = 0;
|
||||||
|
while (fread(&mgroup, oldsize, 1, fin) == 1) {
|
||||||
|
record++;
|
||||||
|
if (MGrpUpdated && !strlen(mgroup.BasePath)) {
|
||||||
|
memset(&temp, 0, sizeof(temp));
|
||||||
|
strcpy(temp, mgroup.Name);
|
||||||
|
for (i = 0; i < strlen(temp); i++) {
|
||||||
|
if (isupper(temp[i]))
|
||||||
|
temp[i] = tolower(temp[i]);
|
||||||
|
if (temp[i] == '.')
|
||||||
|
temp[i] = '/';
|
||||||
|
}
|
||||||
|
snprintf(mgroup.BasePath, 65, "%s/var/mail/%s", getenv("MBSE_ROOT"), temp);
|
||||||
|
}
|
||||||
|
if (MGrpUpdated && !mgroup.LinkSec.level) {
|
||||||
|
mgroup.LinkSec.level = 1;
|
||||||
|
mgroup.LinkSec.flags = 1;
|
||||||
|
}
|
||||||
|
if (MGrpUpdated && (mgroup.Charset == FTNC_NONE)) {
|
||||||
|
mgroup.Charset = FTNC_CP437;
|
||||||
|
}
|
||||||
|
if (MGrpUpdated && !mgroup.GoldEDgroup) {
|
||||||
|
mgroup.GoldEDgroup = record;
|
||||||
|
}
|
||||||
|
fwrite(&mgroup, sizeof(mgroup), 1, fout);
|
||||||
|
gedgrps[mgroup.GoldEDgroup] = 1;
|
||||||
|
memset(&mgroup, 0, sizeof(mgroup));
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fin);
|
||||||
|
fclose(fout);
|
||||||
|
return 0;
|
||||||
|
} else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -175,55 +188,58 @@ int OpenMGroup(void)
|
|||||||
void CloseMGroup(int);
|
void CloseMGroup(int);
|
||||||
void CloseMGroup(int force)
|
void CloseMGroup(int force)
|
||||||
{
|
{
|
||||||
char fin[PATH_MAX], fout[PATH_MAX];
|
char fin[PATH_MAX], fout[PATH_MAX];
|
||||||
FILE *fi, *fo;
|
FILE *fi, *fo;
|
||||||
st_list *mgr = NULL, *tmp;
|
st_list *mgr = NULL, *tmp;
|
||||||
|
|
||||||
snprintf(fin, PATH_MAX, "%s/etc/mgroups.data", getenv("MBSE_ROOT"));
|
free(gedgrps);
|
||||||
snprintf(fout, PATH_MAX, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
|
snprintf(fin, PATH_MAX, "%s/etc/mgroups.data", getenv("MBSE_ROOT"));
|
||||||
|
snprintf(fout, PATH_MAX, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
|
||||||
|
|
||||||
if (MGrpUpdated == 1) {
|
if (MGrpUpdated == 1) {
|
||||||
if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
|
if (force || (yes_no((char *)"Database is changed, save changes") == 1)) {
|
||||||
working(1, 0, 0);
|
working(1, 0, 0);
|
||||||
fi = fopen(fout, "r");
|
fi = fopen(fout, "r");
|
||||||
fo = fopen(fin, "w");
|
fo = fopen(fin, "w");
|
||||||
fread(&mgrouphdr, mgrouphdr.hdrsize, 1, fi);
|
fread(&mgrouphdr, mgrouphdr.hdrsize, 1, fi);
|
||||||
fwrite(&mgrouphdr, mgrouphdr.hdrsize, 1, fo);
|
fwrite(&mgrouphdr, mgrouphdr.hdrsize, 1, fo);
|
||||||
|
|
||||||
while (fread(&mgroup, mgrouphdr.recsize, 1, fi) == 1)
|
while (fread(&mgroup, mgrouphdr.recsize, 1, fi) == 1)
|
||||||
if (!mgroup.Deleted)
|
if (!mgroup.Deleted)
|
||||||
fill_stlist(&mgr, mgroup.Name, ftell(fi) - mgrouphdr.recsize);
|
fill_stlist(&mgr, mgroup.Name, ftell(fi) - mgrouphdr.recsize);
|
||||||
sort_stlist(&mgr);
|
sort_stlist(&mgr);
|
||||||
|
|
||||||
for (tmp = mgr; tmp; tmp = tmp->next) {
|
for (tmp = mgr; tmp; tmp = tmp->next) {
|
||||||
fseek(fi, tmp->pos, SEEK_SET);
|
fseek(fi, tmp->pos, SEEK_SET);
|
||||||
fread(&mgroup, mgrouphdr.recsize, 1, fi);
|
fread(&mgroup, mgrouphdr.recsize, 1, fi);
|
||||||
fwrite(&mgroup, mgrouphdr.recsize, 1, fo);
|
fwrite(&mgroup, mgrouphdr.recsize, 1, fo);
|
||||||
}
|
}
|
||||||
|
|
||||||
tidy_stlist(&mgr);
|
tidy_stlist(&mgr);
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
fclose(fo);
|
fclose(fo);
|
||||||
unlink(fout);
|
unlink(fout);
|
||||||
chmod(fin, 0660);
|
chmod(fin, 0660);
|
||||||
disk_reset();
|
disk_reset();
|
||||||
Syslog('+', "Updated \"mgroups.data\"");
|
Syslog('+', "Updated \"mgroups.data\"");
|
||||||
if (!force)
|
if (!force)
|
||||||
working(6, 0, 0);
|
working(6, 0, 0);
|
||||||
return;
|
exp_golded = TRUE;
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
chmod(fin, 0660);
|
}
|
||||||
working(1, 0, 0);
|
chmod(fin, 0660);
|
||||||
unlink(fout);
|
working(1, 0, 0);
|
||||||
|
unlink(fout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int AppendMGroup(void)
|
int AppendMGroup(void)
|
||||||
{
|
{
|
||||||
FILE *fil;
|
FILE *fil;
|
||||||
char ffile[PATH_MAX];
|
char ffile[PATH_MAX];
|
||||||
|
int i;
|
||||||
|
|
||||||
snprintf(ffile, PATH_MAX, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
|
snprintf(ffile, PATH_MAX, "%s/etc/mgroups.temp", getenv("MBSE_ROOT"));
|
||||||
if ((fil = fopen(ffile, "a")) != NULL) {
|
if ((fil = fopen(ffile, "a")) != NULL) {
|
||||||
@ -232,6 +248,13 @@ int AppendMGroup(void)
|
|||||||
mgroup.LinkSec.level = 1;
|
mgroup.LinkSec.level = 1;
|
||||||
mgroup.LinkSec.flags = 1;
|
mgroup.LinkSec.flags = 1;
|
||||||
mgroup.Charset = FTNC_CP437;
|
mgroup.Charset = FTNC_CP437;
|
||||||
|
for (i = 1; i < 1000; i++) {
|
||||||
|
if (gedgrps[i] == 0) {
|
||||||
|
gedgrps[i] = 1;
|
||||||
|
mgroup.GoldEDgroup = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
fwrite(&mgroup, sizeof(mgroup), 1, fil);
|
fwrite(&mgroup, sizeof(mgroup), 1, fil);
|
||||||
fclose(fil);
|
fclose(fil);
|
||||||
MGrpUpdated = 1;
|
MGrpUpdated = 1;
|
||||||
@ -270,6 +293,7 @@ void MgScreen(void)
|
|||||||
mbse_mvprintw(19,26, "19. Areas");
|
mbse_mvprintw(19,26, "19. Areas");
|
||||||
|
|
||||||
mbse_mvprintw(14,54, "20. Charset");
|
mbse_mvprintw(14,54, "20. Charset");
|
||||||
|
mbse_mvprintw(15,54, "21. GED grp");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -304,6 +328,7 @@ int EditMGrpRec(int Area)
|
|||||||
static int offset;
|
static int offset;
|
||||||
static int i, j, tmp;
|
static int i, j, tmp;
|
||||||
unsigned int crc, crc1;
|
unsigned int crc, crc1;
|
||||||
|
int oldgrp, newgrp;
|
||||||
|
|
||||||
clr_index();
|
clr_index();
|
||||||
working(1, 0, 0);
|
working(1, 0, 0);
|
||||||
@ -351,8 +376,9 @@ int EditMGrpRec(int Area)
|
|||||||
show_str( 19,42,12, mgroup.AreaFile);
|
show_str( 19,42,12, mgroup.AreaFile);
|
||||||
|
|
||||||
show_charset(14,70, mgroup.Charset);
|
show_charset(14,70, mgroup.Charset);
|
||||||
|
show_int( 15, 70, mgroup.GoldEDgroup);
|
||||||
|
|
||||||
j = select_menu(20);
|
j = select_menu(21);
|
||||||
switch(j) {
|
switch(j) {
|
||||||
case 0: if (!mgroup.StartArea && strlen(mgroup.AreaFile)) {
|
case 0: if (!mgroup.StartArea && strlen(mgroup.AreaFile)) {
|
||||||
errmsg("Areas file defined but no BBS start area");
|
errmsg("Areas file defined but no BBS start area");
|
||||||
@ -429,6 +455,20 @@ int EditMGrpRec(int Area)
|
|||||||
case 19:E_STR( 19,42,12, mgroup.AreaFile, "The name of the ^Areas File^ from the uplink (case sensitive)")
|
case 19:E_STR( 19,42,12, mgroup.AreaFile, "The name of the ^Areas File^ from the uplink (case sensitive)")
|
||||||
case 20:mgroup.Charset = edit_charset(14, 70, mgroup.Charset);
|
case 20:mgroup.Charset = edit_charset(14, 70, mgroup.Charset);
|
||||||
break;
|
break;
|
||||||
|
case 21:oldgrp = mgroup.GoldEDgroup;
|
||||||
|
newgrp = edit_int(15, 70, oldgrp, (char *)"The new groupnumber for the ^GoldED groups^ (1..999)");
|
||||||
|
if ((newgrp < 1) || (newgrp > 999)) {
|
||||||
|
errmsg("Groupnumber must be between 1 and 999");
|
||||||
|
} else if (newgrp && (newgrp != oldgrp)) {
|
||||||
|
if (gedgrps[newgrp] == 1) {
|
||||||
|
errmsg("This groupnumber is already in use");
|
||||||
|
} else {
|
||||||
|
gedgrps[oldgrp] = 0;
|
||||||
|
gedgrps[newgrp] = 1;
|
||||||
|
mgroup.GoldEDgroup = newgrp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -698,6 +738,7 @@ int mail_group_doc(FILE *fp, FILE *toc, int page)
|
|||||||
add_webtable(wp, (char *)"Auto add/del areas", getboolean(mgroup.AutoChange));
|
add_webtable(wp, (char *)"Auto add/del areas", getboolean(mgroup.AutoChange));
|
||||||
add_webtable(wp, (char *)"User add/del areas", getboolean(mgroup.UserChange));
|
add_webtable(wp, (char *)"User add/del areas", getboolean(mgroup.UserChange));
|
||||||
add_webtable(wp, (char *)"Default charset", getftnchrs(mgroup.Charset));
|
add_webtable(wp, (char *)"Default charset", getftnchrs(mgroup.Charset));
|
||||||
|
add_webdigit(wp, (char *)"GoldED groupid", mgroup.GoldEDgroup);
|
||||||
tt = (time_t)mgroup.StartDate;
|
tt = (time_t)mgroup.StartDate;
|
||||||
add_webtable(wp, (char *)"Start area date", ctime(&tt));
|
add_webtable(wp, (char *)"Start area date", ctime(&tt));
|
||||||
tt = (time_t)mgroup.LastDate;
|
tt = (time_t)mgroup.LastDate;
|
||||||
@ -793,6 +834,7 @@ int mail_group_doc(FILE *fp, FILE *toc, int page)
|
|||||||
fprintf(fp, " Auto add/del areas %s\n", getboolean(mgroup.AutoChange));
|
fprintf(fp, " Auto add/del areas %s\n", getboolean(mgroup.AutoChange));
|
||||||
fprintf(fp, " User add/del areas %s\n", getboolean(mgroup.UserChange));
|
fprintf(fp, " User add/del areas %s\n", getboolean(mgroup.UserChange));
|
||||||
fprintf(fp, " Default charset %s\n", getftnchrs(mgroup.Charset));
|
fprintf(fp, " Default charset %s\n", getftnchrs(mgroup.Charset));
|
||||||
|
fprintf(fp, " GoldED groupid %d\n", mgroup.GoldEDgroup);
|
||||||
tt = (time_t)mgroup.StartDate;
|
tt = (time_t)mgroup.StartDate;
|
||||||
fprintf(fp, " Start area date %s", ctime(&tt));
|
fprintf(fp, " Start area date %s", ctime(&tt));
|
||||||
tt = (time_t)mgroup.LastDate;
|
tt = (time_t)mgroup.LastDate;
|
||||||
|
Reference in New Issue
Block a user