From 1d93090e5a1ee077f4ae69969dfd6e55c2f0aa73 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Fri, 18 Jun 2004 19:54:13 +0000 Subject: [PATCH] Added experimental support for the ICM flag (FSP-1033) --- ChangeLog | 10 ++++++++++ lib/nodelist.c | 31 ++++++++----------------------- lib/nodelist.conf | 10 +++++----- lib/nodelist.h | 5 ++++- mbcico/call.c | 5 ++--- mbcico/mbout.c | 5 ++--- mbcico/outstat.c | 6 ++---- mbsebbs/mail.c | 4 +--- mbsetup/m_node.c | 8 ++++++++ mbtask/outstat.c | 47 ++++++++++++++--------------------------------- mbtask/outstat.h | 4 ++++ 11 files changed, 60 insertions(+), 75 deletions(-) diff --git a/ChangeLog b/ChangeLog index 31861da2..507ed171 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ $Id$ + WARNING!!!!! + + This is a testversion for the ICM flag (FSP-1033). This flag + is not yet accepted. It is also possible that certain nodes + are not called anymore!! Please report if so, but only Fidonet + nodes, or if from other nets, show me the nodelist entry too. + + v0.61.0 06-Jun-2004. @@ -33,6 +41,8 @@ v0.61.0 06-Jun-2004. mbsetup: In mail and files group edit screens, to make an area active existing connections check is skipped. + If a node record is deleted, the outbox and directory paths + are removed as well if they are empty. v0.60.0 09-Feb-2004 - 04-Jun-2004 diff --git a/lib/nodelist.c b/lib/nodelist.c index cfc449b5..dc4d4e67 100644 --- a/lib/nodelist.c +++ b/lib/nodelist.c @@ -1091,13 +1091,20 @@ node *getnlent(faddr *addr) if (addr->domain == NULL) addr->domain = xstrcpy(nodebuf.addr.domain); + nodebuf.can_pots = (nodebuf.mflags || nodebuf.dflags) ? TRUE : FALSE; + nodebuf.can_ip = (nodebuf.iflags) ? TRUE : FALSE; + nodebuf.is_cm = (nodebuf.oflags & 0x00000001) ? TRUE : FALSE; + nodebuf.is_icm = (nodebuf.oflags & 0x00000002) ? TRUE : FALSE; + Syslog('n', "getnlent: system %s, %s", nodebuf.name, nodebuf.location); Syslog('n', "getnlent: sysop %s, %s", nodebuf.sysop, nodebuf.phone); Syslog('n', "getnlent: URL %s", printable(nodebuf.url, 0)); + Syslog('n', "getnlent: online POTS %s CM %s, IP %s ICM %s", nodebuf.can_pots ?"Yes":"No", + nodebuf.is_cm ?"Yes":"No", nodebuf.can_ip ?"Yes":"No", nodebuf.is_icm ?"Yes":"No"); // moflags(nodebuf.mflags); // diflags(nodebuf.dflags); // ipflags(nodebuf.iflags); - olflags(nodebuf.oflags); +// olflags(nodebuf.oflags); // rqflags(nodebuf.xflags); free(mydomain); @@ -1225,25 +1232,3 @@ void ipflags(unsigned long flags) } - -unsigned long getCMmask(void) -{ - nodelist_flag **tmpm; - static unsigned long mask = 0L; - - for (tmpm = &nl_online; *tmpm; tmpm=&((*tmpm)->next)) { - if (strcmp("CM", (*tmpm)->name) == 0) { - mask |= (*tmpm)->value; - } - if (strcmp("ICM", (*tmpm)->name) == 0) { - mask |= (*tmpm)->value; - } - } - if (mask) - return mask; - - WriteError("CM and ICM mask not found in %s/etc/nodelist.conf", getenv("MBSE_ROOT")); - return 0; -} - - diff --git a/lib/nodelist.conf b/lib/nodelist.conf index 52e01942..77a31d9c 100644 --- a/lib/nodelist.conf +++ b/lib/nodelist.conf @@ -44,13 +44,13 @@ -# Online special flags. +# Online special flags. CM and ICM must be the first two! # online CM 0x00000001 -online MO 0x00000002 -online LO 0x00000004 -online MN 0x00000008 -online ICM 0x00000010 +online ICM 0x00000002 +online MO 0x00000004 +online LO 0x00000008 +online MN 0x00000010 # Request flags, masks: diff --git a/lib/nodelist.h b/lib/nodelist.h index 3789262f..beaf5a08 100644 --- a/lib/nodelist.h +++ b/lib/nodelist.h @@ -34,6 +34,10 @@ typedef struct _node { int t1; /* T flag, first char */ int t2; /* T flag, second char */ char *url; /* URL for connection */ + unsigned is_cm : 1; /* Node is CM */ + unsigned is_icm : 1; /* Node is ICM */ + unsigned can_pots : 1; /* Can do POTS or ISDN */ + unsigned can_ip : 1; /* Can do TCP/IP */ } node; @@ -122,7 +126,6 @@ void rqflags(unsigned long); void moflags(unsigned long); void diflags(unsigned long); void ipflags(unsigned long); -unsigned long getCMmask(void); #endif diff --git a/mbcico/call.c b/mbcico/call.c index 5ef0a530..199473ca 100644 --- a/mbcico/call.c +++ b/mbcico/call.c @@ -102,7 +102,6 @@ int call(faddr *addr) { int rc = 1; char *p, temp[81]; - unsigned long cmmask; /* * First check if node is locked, if not lock it immediatly @@ -136,7 +135,6 @@ int call(faddr *addr) */ noderecord(addr); rdoptions(TRUE); - cmmask = getCMmask(); /* * Fill default history info in case we get a FTS0001 session @@ -205,7 +203,8 @@ int call(faddr *addr) } } - if (((nlent->oflags & cmmask) == 0) && (!IsZMH())) { + if (((nlent->can_pots && nlent->is_cm) == FALSE) && ((nlent->can_ip && nlent->is_icm) == FALSE) && (!IsZMH())) { +// if (((nlent->oflags & cmmask) == 0) && (!IsZMH())) { Syslog('?', "Warning: calling non-CM system outside ZMH"); } diff --git a/mbcico/mbout.c b/mbcico/mbout.c index c1a2c55d..a964f38e 100644 --- a/mbcico/mbout.c +++ b/mbcico/mbout.c @@ -171,7 +171,6 @@ int main(int argc, char *argv[]) faddr *addr = NULL; node *nlent; FILE *fl; - unsigned long cmmask; most_debug = TRUE; @@ -316,14 +315,14 @@ int main(int argc, char *argv[]) free(nlent->url); nlent->url = NULL; - cmmask = getCMmask(); if (nlent->pflag == NL_DUMMY) Fatal((char *)"Node is not in nodelist", MBERR_NODE_NOT_IN_LIST); if (nlent->pflag == NL_DOWN) Fatal((char *)"Node has status Down", MBERR_NODE_MAY_NOT_CALL); if (nlent->pflag == NL_HOLD) Fatal((char *)"Node has status Hold", MBERR_NODE_MAY_NOT_CALL); - if (((nlent->oflags & cmmask) == 0) && (flavor == 'c')) + if (((nlent->can_pots && nlent->is_cm) == FALSE) && ((nlent->can_ip && nlent->is_icm) == FALSE) && (flavor == 'c')) +// if (((nlent->oflags & cmmask) == 0) && (flavor == 'c')) Fatal((char *)"Node is not CM, must use Immediate, Normal or Hold flavor", MBERR_NODE_MAY_NOT_CALL); if (argv[4][0] == '-') diff --git a/mbcico/outstat.c b/mbcico/outstat.c index 50c7a399..c20e25ca 100644 --- a/mbcico/outstat.c +++ b/mbcico/outstat.c @@ -457,7 +457,6 @@ int pollnode(faddr *addr, int stop) { char *pol; int rc = 0; - unsigned long cmmask; FILE *fp; callstat *cst; node *nlent; @@ -511,9 +510,8 @@ int pollnode(faddr *addr, int stop) rc = MBERR_CANNOT_MAKE_POLL; } else { fclose(fp); - cmmask = getCMmask(); - Syslog('s', "oflags %08x (i)cmmask %08x", nlent->oflags, cmmask); - if (((nlent->oflags & cmmask) == 0) && (!IsZMH())) { + if (((nlent->can_pots && nlent->is_cm) == FALSE) && ((nlent->can_ip && nlent->is_icm) == FALSE) && (!IsZMH())) { +// if (((nlent->oflags & cmmask) == 0) && (!IsZMH())) { Syslog('+', "Created poll for %s, non-CM node outside ZMH", ascfnode(addr, 0x1f)); if (!do_quiet) printf("Created poll for %s, non-CM node outside ZMH\n", ascfnode(addr, 0x1f)); diff --git a/mbsebbs/mail.c b/mbsebbs/mail.c index e602c21f..3e61495f 100644 --- a/mbsebbs/mail.c +++ b/mbsebbs/mail.c @@ -187,7 +187,6 @@ int Crash_Option(faddr *Dest) node *Nlent; int rc = 0; unsigned short point; - unsigned long cmmask; if (exitinfo.Security.level < CFG.iCrashLevel) return 0; @@ -196,8 +195,7 @@ int Crash_Option(faddr *Dest) Dest->point = 0; if (((Nlent = getnlent(Dest)) != NULL) && (Nlent->addr.zone)) { - cmmask = getCMmask(); - if (Nlent->oflags & cmmask) { + if ((Nlent->can_pots && Nlent->is_cm) || (Nlent->can_ip && Nlent->is_icm)) { /* Crash [y/N]: */ pout(CYAN, BLACK, (char *)Language(461)); colour(CFG.MsgInputColourF, CFG.MsgInputColourB); diff --git a/mbsetup/m_node.c b/mbsetup/m_node.c index ff42d8ec..86bd9ff8 100644 --- a/mbsetup/m_node.c +++ b/mbsetup/m_node.c @@ -229,6 +229,14 @@ void CloseNoderec(int Force) while (fread(&nodes, nodeshdr.recsize, 1, fi) == 1) { if (!nodes.Deleted) fill_stlist(&nod, nodes.Sysop, ftell(fi) - nodeshdr.recsize); + else { + /* + * Remove obsolete paths + */ + unlink(nodes.Dir_out_path); + unlink(nodes.Dir_in_path); + unlink(nodes.OutBox); + } fseek(fi, nodeshdr.filegrp + nodeshdr.mailgrp, SEEK_CUR); } sort_stlist(&nod); diff --git a/mbtask/outstat.c b/mbtask/outstat.c index 849007f4..0bfedff6 100644 --- a/mbtask/outstat.c +++ b/mbtask/outstat.c @@ -265,11 +265,9 @@ int outstat() DIR *dp = NULL; struct dirent *de; struct stat sb; - unsigned long cmmask, ibnmask = 0, ifcmask = 0, itnmask = 0; + unsigned long ibnmask = 0, ifcmask = 0, itnmask = 0; nodelist_modem **tmpm; - nodelist_flag **tmpf; - cmmask = getCMmask(); for (tmpm = &nl_tcpip; *tmpm; tmpm=&((*tmpm)->next)) { if (strcmp((*tmpm)->name, "IBN") == 0) ibnmask = (*tmpm)->mask; @@ -534,7 +532,7 @@ int outstat() * If the node has internet and we have internet configured, * check if we can send immediatly. Works for CM and ICM. */ - if (TCFG.max_tcp && (tmp->olflags & cmmask) && + if (TCFG.max_tcp && ((tmp->can_ip && tmp->is_icm) || (!tmp->can_pots && tmp->can_ip && tmp->is_cm)) && (((tmp->flavors) & F_IMM) || ((tmp->flavors) & F_CRASH) || ((tmp->flavors) & F_NORMAL)) && ((tmp->ipflags & ibnmask) || (tmp->ipflags & ifcmask) || (tmp->ipflags & itnmask))) { tmp->flavors |= F_CALL; @@ -548,25 +546,13 @@ int outstat() /* * Immediate mail, send if node is CM or is in a Txx window or is in ZMH. */ - cmmask = 0L; - for (tmpf = &nl_online; *tmpf; tmpf=&((*tmpf)->next)) { - if (strcmp("CM", (*tmpf)->name) == 0) { - cmmask = (*tmpf)->value; - } - } - if ((tmp->olflags & cmmask) || T_window || iszmh) { + if (tmp->is_cm || T_window || iszmh) { tmp->flavors |= F_CALL; } /* * Now check again for the ICM flag. */ - cmmask = 0L; - for (tmpf = &nl_online; *tmpf; tmpf=&((*tmpf)->next)) { - if (strcmp("ICM", (*tmpf)->name) == 0) { - cmmask = (*tmpf)->value; - } - } - if ((tmp->olflags & cmmask) && TCFG.max_tcp && + if (tmp->is_icm && TCFG.max_tcp && ((tmp->ipflags & ibnmask) || (tmp->ipflags & ifcmask) || (tmp->ipflags & itnmask))) { tmp->flavors |= F_CALL; } @@ -577,30 +563,17 @@ int outstat() /* * Crash mail, send if node is CM or is in a Txx window or is in ZMH. */ - cmmask = 0L; - for (tmpf = &nl_online; *tmpf; tmpf=&((*tmpf)->next)) { - if (strcmp("CM", (*tmpf)->name) == 0) { - cmmask = (*tmpf)->value; - } - } - if ((tmp->olflags & cmmask) || T_window || iszmh) { + if (tmp->is_cm || T_window || iszmh) { tmp->flavors |= F_CALL; } /* * Now check again for the ICM flag. */ - cmmask = 0L; - for (tmpf = &nl_online; *tmpf; tmpf=&((*tmpf)->next)) { - if (strcmp("ICM", (*tmpf)->name) == 0) { - cmmask = (*tmpf)->value; - } - } - if ((tmp->olflags & cmmask) && TCFG.max_tcp && + if (tmp->is_icm && TCFG.max_tcp && ((tmp->ipflags & ibnmask) || (tmp->ipflags & ifcmask) || (tmp->ipflags & itnmask))) { tmp->flavors |= F_CALL; } } - cmmask = getCMmask(); if ((tmp->flavors) & F_NORMAL) flstr[2]='N'; @@ -792,6 +765,10 @@ int each(faddr *addr, char flavor, int isflo, char *fname) (*tmp)->ipflags = nlent->iflags; (*tmp)->t1 = nlent->t1; (*tmp)->t2 = nlent->t2; + (*tmp)->can_pots = nlent->can_pots; + (*tmp)->can_ip = nlent->can_ip; + (*tmp)->is_cm = nlent->is_cm; + (*tmp)->is_icm = nlent->is_icm; } else { (*tmp)->olflags = 0L; (*tmp)->moflags = 0L; @@ -799,6 +776,10 @@ int each(faddr *addr, char flavor, int isflo, char *fname) (*tmp)->ipflags = 0L; (*tmp)->t1 = '\0'; (*tmp)->t2 = '\0'; + (*tmp)->can_pots = FALSE; + (*tmp)->can_ip = FALSE; + (*tmp)->is_cm = FALSE; + (*tmp)->is_icm = FALSE; } (*tmp)->time = time(NULL); (*tmp)->size = 0L; diff --git a/mbtask/outstat.h b/mbtask/outstat.h index 1a496947..f6a46133 100644 --- a/mbtask/outstat.h +++ b/mbtask/outstat.h @@ -28,6 +28,10 @@ typedef struct _alist int t1; /* First Txx flag */ int t2; /* Second Txx flag */ int callmode; /* Call method */ + unsigned can_pots : 1; + unsigned can_ip : 1; + unsigned is_cm : 1; + unsigned is_icm : 1; } _alist_l;