Added Synchronet config reader

This commit is contained in:
Alexander S. Aganichev 2002-09-21 10:14:04 +00:00
parent 4e16730adc
commit 9d4ae516d5
7 changed files with 243 additions and 0 deletions

View File

@ -70,3 +70,5 @@
#CPPFLAGS+=-DGCFG_NOWMAIL
# Uncomment to disable xMail support
#CPPFLAGS+=-DGCFG_NOXMAIL
# Uncomment to disable SBBS support
#CPPFLAGS+=-DGCFG_NOSBBS

View File

@ -12,6 +12,25 @@ ______________________________________________________________________
Notes for GoldED+ 1.1.5, /snapshot/
______________________________________________________________________
+ Added Synchronet configuration parser:
Areafile Synchronet path\to\msgs.cnf
+ Added clipboard support for the input prompts. Since the selection
keys are not available the action is performed on the whole line.
Default assignments (which cannont be redefined -- sorry):
Shift-Ins, Ctrl-V Paste
Shift-Del, Ctrl-X Cut
Ctrl-Ins, Ctrl-C Copy
In overwrite mode paste overwrites the whole input line otherwise
inserts one line from the clipboard from the current position.
Also added alias to Ctrl-R key - Alt-Backspace which reverts the
input prompt to it's initial value.
+ Added Midnight Commander compatible clipboard support for UNIX
version. Should only be available if "~/.cedit" directory exist at
GoldED+ startup time. (not tested)

View File

@ -61,6 +61,7 @@ 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
gxsync 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
gxtmail cpp all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg
gxts cpp all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg

View File

@ -350,6 +350,7 @@ bool gareafile::ReadAreafile(word crc, char* parameters) {
const word CRC_WATERGATE = 0x3ADB;
const word CRC_WMAIL = 0xB167;
const word CRC_XMAIL = 0x9D56;
const word CRC_SBBS = 0xFD1E;
switch(crc) {
#ifndef GCFG_NOXBBS
@ -461,6 +462,9 @@ bool gareafile::ReadAreafile(word crc, char* parameters) {
#endif
#ifndef GCFG_NOXMAIL
case CRC_XMAIL: ReadXMail(parameters); break;
#endif
#ifndef GCFG_NOXMAIL
case CRC_SBBS: ReadSynchronet(parameters); break;
#endif
default: return false;
}

View File

@ -437,6 +437,9 @@ public:
#ifndef GCFG_NOXMAIL
void ReadXMail(char* tag);
#endif
#ifndef GCFG_NOSBBS
void ReadSynchronet(char* tag);
#endif
bool ReadAreafile(word crc, char* parameters);
};

100
goldlib/gcfg/gs_sync.h Normal file
View File

@ -0,0 +1,100 @@
// This may look like C code, but it is really -*- C++ -*-
// ------------------------------------------------------------------
// The Goldware Library
// Copyright (C) 1994 Digital Dynamics
// Copyright (C) 2002 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$
// ------------------------------------------------------------------
// Synchronet BBS Definitions and Structures
// ------------------------------------------------------------------
#ifndef __gs_sync_h
#define __gs_sync_h
// ------------------------------------------------------------------
#include <gdefs.h>
#include <gftnall.h>
// ------------------------------------------------------------------
#if defined(GOLD_CANPACK)
#pragma pack(1)
#endif
// ------------------------------------------------------------------
const int LEN_DIR = 63; // Maximum length of directory paths
const int LEN_ARSTR = 40; // Max length of Access Requirement string
const int LEN_GSNAME = 15; // Group/Lib short name
const int LEN_GLNAME = 40; // Group/Lib long name
const int LEN_SSNAME = 25; // Sub/Dir short name
const int LEN_SLNAME = 40; // Sub/Dir long name
const int LEN_SQWKNAME = 10;
// ------------------------------------------------------------------
typedef struct { // Message group info
char lname[LEN_GLNAME+1], // Short name
sname[LEN_GSNAME+1]; // Long name
uchar ar[LEN_ARSTR+1], // Access requirements
unused[96]; // unused
} grp_t;
typedef struct { // Message sub board info
ushort grp; // Which group this sub belongs to
char lname[LEN_SLNAME+1], // Long name - used for listing
sname[LEN_SSNAME+1], // Short name - used for prompts
qwkname[LEN_SQWKNAME+1], // QWK name
code[9], // Eight character code
data_dir[LEN_DIR+1]; // Data file directory
uchar ar[LEN_ARSTR+1], // Access requirements
read_ar[LEN_ARSTR+1], // Read requirements
post_ar[LEN_ARSTR+1], // Post requirements
op_ar[LEN_ARSTR+1]; // Operator requirements
ulong misc; // Miscellaneous flags
char tagline[81], // Optional QWK net tag line
origline[51], // Optional EchoMail origin line
echomail_sem[LEN_DIR+1], // EchoMail semaphore for this sub
echopath[LEN_DIR+1]; // EchoMail path
ftn_addr faddr; // FidoNet address
ulong maxmsgs, // Max number of messages allowed
maxcrcs; // Max number of CRCs to keep
ushort maxage, // Max age of messages (in days)
ptridx; // Index into pointer file
uchar mod_ar[LEN_ARSTR+1]; // Moderated user requirements
ushort qwkconf; // QWK configuration
uchar unused[53]; // unused
} sub_t;
// ------------------------------------------------------------------
#if defined(GOLD_CANPACK)
#pragma pack()
#endif
// ------------------------------------------------------------------
#endif // __gs_sync_h
// ------------------------------------------------------------------

114
goldlib/gcfg/gxsync.cpp Normal file
View File

@ -0,0 +1,114 @@
// This may look like C code, but it is really -*- C++ -*-
// ------------------------------------------------------------------
// The Goldware Library
// Copyright (C) 2002 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 Synchronet BBS
// ------------------------------------------------------------------
#include <cstdlib>
#include <gcrcall.h>
#include <gstrall.h>
#undef GCFG_NOCMAIL
#include <gedacfg.h>
#include <gs_sync.h>
// ------------------------------------------------------------------
// Synchronet configuration reader
void gareafile::ReadSynchronet(char* tag) {
Path file, path;
char options[80];
ushort shrt, i;
grp_t grp;
sub_t sub;
strcpy(options, tag);
char* ptr = strtok(tag, " \t");
while(ptr) {
if(*ptr != '-') {
strcpy(file, ptr);
strschg_environ(file);
}
ptr = strtok(NULL, " \t");
}
if(not fexist(file)) {
AddBackslash(file);
strcat(file, "msgs.cnf");
}
extractdirname(path, file);
FILE* in = fsopen(file, "rb", sharemode);
if(in) {
setvbuf(in, NULL, _IOFBF, 8192);
if(not quiet)
std::cout << "* Reading " << file << std::endl;
// Skip header:
// max_qwkmsgs 4
// mail_maxcrcs 4
// mail_maxage 2
// unused (NULL) 512
// unused (0xff) 512
fseek(in, 1034, SEEK_CUR);
if(fread(&shrt, sizeof(ushort), 1, in) == 1) {
for(i = 0; i < shrt; i++) {
if(fread(&grp, sizeof(grp_t), 1, in) != 1)
break;
}
}
if(fread(&shrt, sizeof(ushort), 1, in) == 1) {
for(i = 0; i < shrt; i++) {
if(fread(&sub, sizeof(sub_t), 1, in) != 1)
break;
AreaCfg aa;
aa.reset();
aa.type = GMB_ECHO;
aa.attr = attribsecho;
aa.msgbase = GMB_SMB;
aa.setechoid(sub.code);
aa.setdesc(sub.lname);
aa.groupid = 0x8000 + sub.grp;
if(*sub.echopath)
MakePathname(file, sub.echopath, sub.code);
else
MakePathname(file, path, sub.code);
aa.setpath(file);
aa.aka = primary_aka;
aa.aka.set(sub.faddr);
if(*sub.origline)
aa.setorigin(sub.origline);
AddNewArea(aa);
}
}
}
fclose(in);
}
// ------------------------------------------------------------------