Changed un_attach function

This commit is contained in:
Michiel Broek 2004-07-24 19:18:11 +00:00
parent 5963f66cb1
commit e82497976b
4 changed files with 40 additions and 15 deletions

View File

@ -159,8 +159,8 @@ int is_my_tic(char *filename, char *ticfile)
/*
* The real unatach function, return 1 if a file is removed.
*/
int check_flo(faddr *, char *, char);
int check_flo(faddr *node, char *filename, char flavor)
int check_flo(faddr *, char *, char, int);
int check_flo(faddr *node, char *filename, char flavor, int fdn)
{
char *flofile, *ticfile, *buf;
FILE *fp;
@ -189,7 +189,7 @@ int check_flo(faddr *node, char *filename, char flavor)
fflush(fp);
fseek(fp, newpos, SEEK_SET);
filepos = newpos;
if (fgets(buf, PATH_MAX +2, fp)) {
if (fdn && fgets(buf, PATH_MAX +2, fp)) {
Striplf(buf);
if (buf[strlen(buf)-1] == '\r')
buf[strlen(buf)-1] = '\0';
@ -202,6 +202,8 @@ int check_flo(faddr *node, char *filename, char flavor)
} else {
Syslog('p', "Removed old %s for %s", basename(filename), ascfnode(node, 0x1f));
}
} else {
Syslog('p', "Removed old %s for %s", basename(filename), ascfnode(node, 0x1f));
}
rc = 1;
break;
@ -227,8 +229,8 @@ void un_attach(faddr *node, char *filename, int fdn)
{
Syslog('p', "un_attach: %s %s %s", ascfnode(node, 0x1f), filename, fdn ?"FDN":"NOR");
if (check_flo(node, filename, 'h') == 0)
if (check_flo(node, filename, 'f') == 0)
check_flo(node, filename, 'c');
if (check_flo(node, filename, 'h', fdn) == 0)
if (check_flo(node, filename, 'f', fdn) == 0)
check_flo(node, filename, 'c', fdn);
}

View File

@ -292,7 +292,7 @@ int Add_BBS(qualify **qal)
for (tmpq = *qal; tmpq; tmpq = tmpq->next) {
if (tmpq->send) {
taka = fido2faddr(tmpq->aka);
un_attach(taka, temp2);
un_attach(taka, temp2, TRUE);
tidy_faddr(taka);
}
}

View File

@ -39,6 +39,7 @@
extern int net_msgs;
extern int net_in;
extern int do_scan;
@ -94,7 +95,7 @@ int toss_msgs(void)
*/
int toss_onemsg(char *msgname)
{
int rc = 0;
int rc = 0, islocal;
char *temp, *dospath, *flagstr = NULL, *l, *r, *msgid = NULL;
char fromUserName[36], toUserName[36], subject[72], DateTime[20];
FILE *fp, *np;
@ -275,7 +276,6 @@ int toss_onemsg(char *msgname)
}
Msg.Written = parsefdate(DateTime, NULL);
Msg.Arrived = time(NULL) - (gmt_offset((time_t)0) * 60);
Msg.Local = TRUE;
Msg.KillSent = ((Attribute & M_KILLSENT));
Msg.Hold = ((Attribute & M_HOLD));
@ -289,6 +289,25 @@ int toss_onemsg(char *msgname)
Msg.Direct = flag_on((char *)"DIR", flagstr);
Msg.Gate = flag_on((char *)"ZON", flagstr);
if ((origZone == destZone) && (origNet == destNet) && (origNode == destNode) && (origPoint == destPoint)) {
/*
* Message is local, make the message appear as a received netmail
*/
Msg.Netmail = TRUE;
islocal = TRUE;
if ((strncasecmp(toUserName, "sysop", 5) == 0) ||
(strncasecmp(toUserName, "postmaster", 10) == 0) ||
(strncasecmp(toUserName, "coordinator", 11) == 0)) {
Syslog('+', " Readdress from %s to %s", toUserName, CFG.sysop_name);
sprintf(toUserName, "%s", CFG.sysop_name);
strcpy(Msg.To, toUserName);
}
net_in++;
} else {
Msg.Local = TRUE;
islocal = FALSE;
}
Syslog('m', "Netmail is %s", islocal ? "Local":"for export");
Msg.Private = TRUE;
if (origPoint)
@ -329,11 +348,13 @@ int toss_onemsg(char *msgname)
msgs.Posted.month[Miy]++;
UpdateMsgs();
do_scan = TRUE;
sprintf(temp, "%s/tmp/netmail.jam", getenv("MBSE_ROOT"));
if ((np = fopen(temp, "a")) != NULL) {
fprintf(np, "%s %lu\n", msgs.Base, Msg.Id);
fclose(np);
if (!islocal) {
do_scan = TRUE;
sprintf(temp, "%s/tmp/netmail.jam", getenv("MBSE_ROOT"));
if ((np = fopen(temp, "a")) != NULL) {
fprintf(np, "%s %lu\n", msgs.Base, Msg.Id);
fclose(np);
}
}
Msg_Close();

View File

@ -274,7 +274,9 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t
* If message to "sysop" or "postmaster" replace it
* with the sysops real name.
*/
if ((strncasecmp(name, "sysop", 5) == 0) || (strcasecmp(name, "postmaster") == 0)) {
if ((strncasecmp(name, "sysop", 5) == 0) ||
(strcasecmp(name, "postmaster") == 0) ||
(strcasecmp(name, "coordinator") == 0)) {
Syslog('+', " Readdress from %s to %s", name, CFG.sysop_name);
sprintf(name, "%s", CFG.sysop_name);
}