From b1b4fc72c27b5b0d43513dc9da23f9272e3b77bd Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Wed, 15 Jan 2014 02:28:03 +0000 Subject: [PATCH] Implement feature request from access_d: ZONE_BLIND threshold If the ZONE_BLIND option is specified in the sbbsecho.cfg file and it is followed by a decimal number (e.g. "ZONE_BLIND 4"), then all zones less than or equal to that number (the threshold) will be treated as a single zone and all zones greater than that number (the threshold) will be treated as separate zones (normal FTN behavior). The default zone blind threshold is 0xffff (all possible zones), when zone blind is used. --- src/sbbs3/rechocfg.c | 5 ++++- src/sbbs3/sbbsecho.c | 18 ++++++++++++------ src/sbbs3/sbbsecho.h | 3 ++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/sbbs3/rechocfg.c b/src/sbbs3/rechocfg.c index 0551fdb9ae..b506da54f9 100644 --- a/src/sbbs3/rechocfg.c +++ b/src/sbbs3/rechocfg.c @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2012 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2014 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -203,6 +203,7 @@ void read_echo_cfg() cfg.log_level=LOG_INFO; cfg.check_path=TRUE; cfg.zone_blind=FALSE; + cfg.zone_blind_threshold=0xffff; SAFECOPY(cfg.sysop_alias,"SYSOP"); while(1) { @@ -273,6 +274,8 @@ void read_echo_cfg() if(!stricmp(tmp,"ZONE_BLIND")) { cfg.zone_blind=TRUE; + if(*p && isdigit(*p)) /* threshold specified (zones > this threshold will be treated normally/separately) */ + cfg.zone_blind_threshold=atoi(p); continue; } diff --git a/src/sbbs3/sbbsecho.c b/src/sbbs3/sbbsecho.c index 88e6f8749f..a71f0d3e2c 100644 --- a/src/sbbs3/sbbsecho.c +++ b/src/sbbs3/sbbsecho.c @@ -2682,6 +2682,12 @@ char *pktname(BOOL temp) } return(NULL); /* This should never happen */ } + +BOOL zone_blind(uint16_t zone) +{ + return cfg.zone_blind && zone <= cfg.zone_blind_threshold; +} + /****************************************************************************** This function puts a message into a Fido packet, writing both the header information and the message body @@ -2743,13 +2749,13 @@ void putfmsg(FILE *stream,char *fbuf,fmsghdr_t fmsghdr,areasbbs_t area } if(area.name) { /* EchoMail, Not NetMail */ - if(!cfg.zone_blind && addr.zone!=fmsghdr.destzone) /* Zone Gate */ + if(!zone_blind(fmsghdr.destzone) && addr.zone!=fmsghdr.destzone) /* Zone Gate */ fprintf(stream,"SEEN-BY: %d/%d\r",fmsghdr.destnet,fmsghdr.destnode); else { fprintf(stream,"SEEN-BY:"); for(i=0;i<seenbys.addrs;i++) { /* Put back original SEEN-BYs */ strcpy(seenby," "); - if(!cfg.zone_blind && seenbys.addr[i].zone!=addr.zone) + if(!zone_blind(seenbys.addr[i].zone) && seenbys.addr[i].zone!=addr.zone) continue; if(seenbys.addr[i].net!=addr.net || !net_exists) { net_exists=1; @@ -2776,7 +2782,7 @@ void putfmsg(FILE *stream,char *fbuf,fmsghdr_t fmsghdr,areasbbs_t area if(node<cfg.nodecfgs && (cfg.nodecfg[node].attr&ATTR_PASSIVE)) continue; strcpy(seenby," "); - if((!cfg.zone_blind && area.uplink[i].zone!=addr.zone) || area.uplink[i].point) + if((!zone_blind(area.uplink[i].zone) && area.uplink[i].zone!=addr.zone) || area.uplink[i].point) continue; for(j=0;j<seenbys.addrs;j++) if(!memcmp(&area.uplink[i],&seenbys.addr[j],sizeof(faddr_t))) @@ -2805,7 +2811,7 @@ void putfmsg(FILE *stream,char *fbuf,fmsghdr_t fmsghdr,areasbbs_t area for(i=0;i<scfg.total_faddrs;i++) { /* Add AKAs to SEEN-BYs */ strcpy(seenby," "); - if((!cfg.zone_blind && scfg.faddr[i].zone!=addr.zone) || scfg.faddr[i].point) + if((!zone_blind(scfg.faddr[i].zone) && scfg.faddr[i].zone!=addr.zone) || scfg.faddr[i].point) continue; for(j=0;j<seenbys.addrs;j++) if(!memcmp(&scfg.faddr[i],&seenbys.addr[j],sizeof(faddr_t))) @@ -2837,7 +2843,7 @@ void putfmsg(FILE *stream,char *fbuf,fmsghdr_t fmsghdr,areasbbs_t area addr=getsysfaddr(fmsghdr.destzone); for(i=0;i<paths.addrs;i++) { /* Put back the original PATH */ strcpy(seenby," "); - if((!cfg.zone_blind && paths.addr[i].zone!=addr.zone) || paths.addr[i].point) + if((!zone_blind(paths.addr[i].zone) && paths.addr[i].zone!=addr.zone) || paths.addr[i].point) continue; if(paths.addr[i].net!=addr.net || !net_exists) { net_exists=1; @@ -3057,7 +3063,7 @@ BOOL check_psb(addrlist_t* addrlist, faddr_t compaddr) int i; for(i=0;i<addrlist->addrs;i++) { - if(!cfg.zone_blind && compaddr.zone != addrlist->addr[i].zone) + if(!zone_blind(addrlist->addr[i].zone) && compaddr.zone != addrlist->addr[i].zone) continue; if(compaddr.net != addrlist->addr[i].net) continue; diff --git a/src/sbbs3/sbbsecho.h b/src/sbbs3/sbbsecho.h index c1b395b9b7..ed001efe86 100644 --- a/src/sbbs3/sbbsecho.h +++ b/src/sbbs3/sbbsecho.h @@ -38,7 +38,7 @@ /* Portions written by Allen Christiansen 1994-1996 */ #define SBBSECHO_VERSION_MAJOR 2 -#define SBBSECHO_VERSION_MINOR 25 +#define SBBSECHO_VERSION_MINOR 26 #define SBBSECHO_PRODUCT_CODE 0x12FF /* from http://ftsc.org/docs/ftscprod.013 */ @@ -242,6 +242,7 @@ typedef struct { areasbbs_t *area; /* Each area configuration */ BOOL check_path; /* Enable circular path detection */ BOOL zone_blind; /* Pretend zones don't matter when parsing and constructing PATH and SEEN-BY lines (per Wilfred van Velzen, 2:280/464) */ + uint16_t zone_blind_threshold; /* Zones below this number (e.g. 4) will be treated as the same zone when zone_blind is enabled */ } config_t; #ifdef __WATCOMC__ -- GitLab