Some updates

This commit is contained in:
Michiel Broek
2002-02-16 23:16:42 +00:00
parent 66d13e78eb
commit ea59f6ffa6
10 changed files with 191 additions and 128 deletions

View File

@@ -90,7 +90,7 @@ int create_msgarea(char *marea, faddr *p_from)
}
fread(&msgshdr, sizeof(msgshdr), 1, mp);
offset = msgshdr.hdrsize + ((mgroup.StartArea -1) * (msgshdr.recsize + msgshdr.syssize));
if (fseek(mp, offset, SEEK_SET) == -1) {
if (fseek(mp, offset, SEEK_SET)) {
WriteError("$Can't seek in %s", temp);
fclose(ap);
fclose(gp);
@@ -115,6 +115,18 @@ int create_msgarea(char *marea, faddr *p_from)
if (!rc) {
Syslog('m', "No free slot, append after last record");
fseek(mp, 0, SEEK_END);
if (ftell(mp) < msgshdr.hdrsize + ((mgroup.StartArea -1) * (msgshdr.recsize + msgshdr.syssize))) {
Syslog('m', "Database too small, expanding...");
memset(&msgs, 0, sizeof(msgs));
memset(&System, 0, sizeof(System));
while (TRUE) {
fwrite(&msgs, sizeof(msgs), 1, mp);
for (i = 0; i < (msgshdr.syssize / sizeof(System)); i++)
fwrite(&System, sizeof(System), 1, mp);
if (ftell(mp) >= msgshdr.hdrsize + ((mgroup.StartArea -1) * (msgshdr.recsize + msgshdr.syssize)))
break;
}
}
rc = 1;
}
@@ -142,6 +154,9 @@ int create_msgarea(char *marea, faddr *p_from)
msgs.Ftncode = CHRS_DEFAULT_FTN;
msgs.MaxArticles = CFG.maxarticles;
tag = tl(tag);
for (i = 0; i < strlen(tag); i++)
if (tag[i] == '.')
tag[i] = '/';
sprintf(msgs.Base, "%s/%s", mgroup.BasePath, tag);
fwrite(&msgs, sizeof(msgs), 1, mp);

View File

@@ -568,13 +568,12 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
newsgroup = xstrcpy(msgs.Newsgroup);
if (strlen(msgs.Distribution))
distribution = xstrcpy(msgs.Distribution);
if (strlen(msgs.Moderator)) {
moderator = xstrcpy(msgs.Moderator);
if (msgs.MsgKinds == USEMOD)
modtype = 1;
}
Syslog('M', "newsgroup %s, distribution %s, moderator %s modtype %d",
printable(newsgroup, 0), printable(distribution, 0), printable(moderator, 0), modtype);
// if (strlen(msgs.Moderator)) {
// moderator = xstrcpy(msgs.Moderator);
// if (msgs.MsgKinds == USEMOD)
// modtype = 1;
// }
Syslog('M', "newsgroup %s, distribution %s", printable(newsgroup, 0), printable(distribution, 0));
newsmode = TRUE;
if ((modtype == 1) && (!hdr((char *)"Approved",msg)) &&
(!hdr((char *)"RFC-Approved",kmsg)) && (!hdr((char *)"Approved",kmsg)))

View File

@@ -330,8 +330,8 @@ int rfc2ftn(FILE *fp, faddr *recipient)
p++;
if ((q = strchr(p,'\n')))
*q='\0';
if (newsmode && strlen(msgs.Moderator) && (strcasestr(msgs.Moderator,p)))
removeapproved = TRUE;
// if (newsmode && strlen(msgs.Moderator) && (strcasestr(msgs.Moderator,p)))
// removeapproved = TRUE;
if (q)
*q='\n';
}

View File

@@ -185,9 +185,9 @@ int LoadTic(char *inb, char *tfn)
}
Temp = calloc(PATH_MAX, sizeof(char));
Buf = calloc(257, sizeof(char));
Buf = calloc(PATH_MAX, sizeof(char));
while ((fgets(Buf, 255, tfp)) != NULL) {
while ((fgets(Buf, PATH_MAX -1, tfp)) != NULL) {
/*
* Remove all garbage from the .TIC file.
*/
@@ -200,7 +200,12 @@ int LoadTic(char *inb, char *tfn)
}
Temp[j] = '\0';
// Syslog('f', "TIC: %s", Temp);
if (strlen(Temp) > 255) {
Syslog('+', "Truncating TIC line of %d characters", strlen(Temp));
Temp[255] = '\0';
}
Syslog('f', "TIC: %s", Temp);
if (strncasecmp(Temp, "hatch", 5) == 0) {
TIC.TicIn.Hatch = TRUE;
@@ -290,7 +295,7 @@ int LoadTic(char *inb, char *tfn)
strncpy(TIC.TicIn.LDesc[TIC.TicIn.TotLDesc], Temp+6, 80);
TIC.TicIn.TotLDesc++;
}
} else if (strncasecmp(Temp, "destination ", 12) != 0) {
} else if (strncasecmp(Temp, "destination ", 12) == 0) {
/*
* Drop this one
*/