From 24e164dfc80471900a3e8ff0ec2ffd10624a30ce Mon Sep 17 00:00:00 2001 From: "Alexander S. Aganichev" Date: Mon, 22 Oct 2001 15:05:30 +0000 Subject: [PATCH] Added SpaceToss config --- Config.def | 4 +- docs/notework.txt | 4 + goldlib/gcfg/gcfg.all | 1 + goldlib/gcfg/gxspace.cpp | 286 ++++++++++++++++++++++++++++++++++++++ goldlib/gcfg/gxsquish.cpp | 4 +- 5 files changed, 295 insertions(+), 4 deletions(-) create mode 100644 goldlib/gcfg/gxspace.cpp diff --git a/Config.def b/Config.def index 6561513..b6da6b9 100644 --- a/Config.def +++ b/Config.def @@ -52,8 +52,8 @@ #CPPFLAGS+=-DGCFG_NORAECHO # Uncomment to disable RemoteAccess support #CPPFLAGS+=-DGCFG_NORA -# Uncomment to disable SpaceTosser support -CPPFLAGS+=-DGCFG_NOSPCT +# Uncomment to disable SpaceToss support +#CPPFLAGS+=-DGCFG_NOSPCT # Uncomment to disable Squish support #CPPFLAGS+=-DGCFG_NOSQSH # Uncomment to disable SuperBBS support diff --git a/docs/notework.txt b/docs/notework.txt index f333d4d..db4165f 100644 --- a/docs/notework.txt +++ b/docs/notework.txt @@ -12,6 +12,10 @@ ______________________________________________________________________ Notes for GoldED+ 1.1.5, /snapshot/ ______________________________________________________________________ ++ Added support for SpaceToss areafile. WARNING: there's no known way + to obtain primary AKA for echo areas from tosser config so you'll + need to define them manually. Main AKA will be used by default. + - Thanks to Pavel Tsekov few more memory leaks was eliminated. ! Added "COLOR READER URL" for highlighting URLs and e-mail's. diff --git a/goldlib/gcfg/gcfg.all b/goldlib/gcfg/gcfg.all index 9621f8e..7f2528f 100644 --- a/goldlib/gcfg/gcfg.all +++ b/goldlib/gcfg/gcfg.all @@ -58,6 +58,7 @@ gxqecho cpp all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg gxquick cpp all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg gxra cpp all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg gxraecho cpp all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg +gxspace cpp all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg gxsquish cpp all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg gxsuper cpp all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg gxtimed cpp all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg diff --git a/goldlib/gcfg/gxspace.cpp b/goldlib/gcfg/gxspace.cpp new file mode 100644 index 0000000..14cba42 --- /dev/null +++ b/goldlib/gcfg/gxspace.cpp @@ -0,0 +1,286 @@ +// This may look like C code, but it is really -*- C++ -*- + +// ------------------------------------------------------------------ +// The Goldware Library +// Copyright (C) 1999-2000 Alexander S. Aganichev +// ------------------------------------------------------------------ +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this program; if not, write to the Free +// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, +// MA 02111-1307, USA +// ------------------------------------------------------------------ +// $Id$ +// ------------------------------------------------------------------ +// Read areas from SpaceToss 1.10 +// ------------------------------------------------------------------ + +#include +#include +#include +#include +#undef GCFG_NOSPCT +#include + + +// ------------------------------------------------------------------ + +void gareafile::ParseSpaceArea(const char *type_path, AreaCfg &aa) { + + if(strnieql(type_path, "msg", 3)) + aa.msgbase = fidomsgtype; + else if(strnieql(type_path, "hud", 3)) + aa.msgbase = GMB_HUDSON; + else if(strnieql(type_path, "jam", 3)) + aa.msgbase = GMB_JAM; + else if(strnieql(type_path, "sqh", 3)) + aa.msgbase = GMB_SQUISH; + else { + aa.msgbase = 0; + return; + } + aa.setpath(type_path+3); +} + + +// ------------------------------------------------------------------ + +void gareafile::ReadSpaceAr(const char* file) { + + const word CRC_BEGINAREA = 0x78EE; + const word CRC_NAME = 0x3B63; + const word CRC_DESC = 0x8A2A; + const word CRC_PATH = 0x0212; + const word CRC_FLAGS = 0xF81A; + const word CRC_GROUP = 0x1C9B; + const word CRC_ENDAREA = 0x3E9F; + + FILE* fp = fsopen(file, "rb", sharemode); + if(fp) { + setvbuf(fp, NULL, _IOFBF, 8192); + + if(not quiet) + cout << "* Reading " << file << endl; + + char buf[4000]; + AreaCfg aa; + + aa.reset(); + + while(fgets(buf, 4000, fp) != NULL) { + + char* key; + char* val = buf; + switch(getkeyvalcrc(&key, &val)) { + case CRC_BEGINAREA: + aa.type = GMB_ECHO; + aa.attr = attribsecho; + aa.aka = primary_aka; + break; + case CRC_NAME: + aa.setechoid(val); + break; + case CRC_DESC: + aa.setdesc(val); + break; + case CRC_PATH: + ParseSpaceArea(val, aa); + break; + case CRC_FLAGS: + if(strpbrk(val,"Ll")) { + aa.type = GMB_LOCAL; + aa.attr = attribslocal; + } + break; + case CRC_GROUP: + aa.groupid = toupper(*val); + break; + case CRC_ENDAREA: + if(aa.msgbase) + AddNewArea(aa); + aa.reset(); + break; + } + } + + fclose(fp); + } +} + + +// ------------------------------------------------------------------ + +void gareafile::ReadSpaceNtm(const char* file) { + + const word CRC_BEGINNETMAIL = 0x4DF0; + const word CRC_NAME = 0x3B63; + const word CRC_ADDRESS = 0xFDD6; + const word CRC_PATH = 0x0212; + const word CRC_AUTOEXPORT = 0xE0E1; + const word CRC_ENDNETMAIL = 0xD995; + + FILE* fp = fsopen(file, "rb", sharemode); + if(fp) { + setvbuf(fp, NULL, _IOFBF, 8192); + + if(not quiet) + cout << "* Reading " << file << endl; + + char buf[4000]; + AreaCfg aa; + bool exportarea = false; + + aa.reset(); + + while(fgets(buf, 4000, fp) != NULL) { + + char* key; + char* val = buf; + switch(getkeyvalcrc(&key, &val)) { + case CRC_BEGINNETMAIL: + aa.setautoid("NETMAIL"); + aa.type = GMB_NET; + aa.attr = attribsnet; + aa.aka = primary_aka; + exportarea = false; + break; + case CRC_ADDRESS: + aa.aka.set(val); + case CRC_NAME: { + char echodesc[256]; + strxmerge(echodesc, 256, "Netmail for ", val, NULL); + aa.setdesc(echodesc); + break; + } + case CRC_PATH: + ParseSpaceArea(val, aa); + break; + case CRC_AUTOEXPORT: + exportarea = GetYesno(val) ? true : false; + break; + case CRC_ENDNETMAIL: + if(exportarea and aa.msgbase) + AddNewArea(aa); + aa.reset(); + break; + } + } + + fclose(fp); + } +} + + +// ------------------------------------------------------------------ + +void gareafile::ReadSpaceCtl(const char* file) { + + const word CRC_ADDRESS = 0xFDD6; + const word CRC_AKA = 0x13A4; + const word CRC_NETMAIL = 0xE42E; + const word CRC_BADMAIL = 0xE697; + const word CRC_DUPEMAIL = 0xB38B; + + FILE* fp = fsopen(file, "rb", sharemode); + if(fp) { + setvbuf(fp, NULL, _IOFBF, 8192); + + if(not quiet) + cout << "* Reading " << file << endl; + + char buf[4000]; + AreaCfg aa; + + aa.reset(); + + while(fgets(buf, 4000, fp) != NULL) { + + aa.type = 0xFF; + + char* key; + char* val = buf; + switch(getkeyvalcrc(&key, &val)) { + case CRC_ADDRESS: + case CRC_AKA: + CfgAddress(buf); + break; + case CRC_NETMAIL: + aa.setautoid("NETMAIL"); + aa.setdesc("SpaceToss Netmail"); + aa.type = GMB_NET; + aa.attr = attribsnet; + break; + case CRC_BADMAIL: + aa.setautoid("BADMAIL"); + aa.setdesc("SpaceToss Badmail"); + aa.type = GMB_LOCAL; + aa.attr = attribslocal; + break; + case CRC_DUPEMAIL: + aa.setautoid("DUPEMAIL"); + aa.setdesc("SpaceToss Dupemail"); + aa.type = GMB_LOCAL; + aa.attr = attribslocal; + break; + } + + if(aa.type != 0xFF) { + + aa.aka = primary_aka; + + // Get type/path + ParseSpaceArea(val, aa); + + if(aa.msgbase) { + AddNewArea(aa); + } + } + + aa.reset(); + } + + fclose(fp); + } +} + + +// ------------------------------------------------------------------ +// Read areas from SpaceToss (echomail processor) + +void gareafile::ReadSpaceToss(char* tag) { + + Path file, path; + char options[80]; + + strcpy(options, tag); + char* ptr = strtok(tag, " \t"); + while(ptr) { + if(*ptr != '-') { + strcpy(file, ptr); + } + ptr = strtok(NULL, " \t"); + } + + extractdirname(path, file); + + CfgSquishuserpath(path); + + MakePathname(file, path, "spctoss.ctl"); + ReadSpaceCtl(file); + MakePathname(file, path, "spctoss.ntm"); + ReadSpaceNtm(file); + MakePathname(file, path, "spctoss.ar"); + ReadSpaceAr(file); +} + + +// ------------------------------------------------------------------ diff --git a/goldlib/gcfg/gxsquish.cpp b/goldlib/gcfg/gxsquish.cpp index af91652..6f8f73e 100644 --- a/goldlib/gcfg/gxsquish.cpp +++ b/goldlib/gcfg/gxsquish.cpp @@ -90,10 +90,10 @@ void gareafile::ReadSquishFile(char* path, char* file, char* options, char* orig aa.type = GMB_NET; break; case CRC_ECHOAREA: - case CRC_DUPEAREA: - case CRC_BADAREA: aa.type = GMB_ECHO; break; + case CRC_DUPEAREA: + case CRC_BADAREA: case CRC_LOCALAREA: aa.type = GMB_LOCAL; break;