1 //  This may look like C code, but it is really -*- C++ -*-
2 
3 //  ------------------------------------------------------------------
4 //  The Goldware Library
5 //  Copyright (C) 1990-1999 Odinn Sorensen
6 //  Copyright (C) 1999-2000 Alexander S. Aganichev
7 //  ------------------------------------------------------------------
8 //  This library is free software; you can redistribute it and/or
9 //  modify it under the terms of the GNU Library General Public
10 //  License as published by the Free Software Foundation; either
11 //  version 2 of the License, or (at your option) any later version.
12 //
13 //  This library is distributed in the hope that it will be useful,
14 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 //  Library General Public License for more details.
17 //
18 //  You should have received a copy of the GNU Library General Public
19 //  License along with this program; if not, write to the Free
20 //  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 //  MA 02111-1307, USA
22 //  ------------------------------------------------------------------
23 //  $Id: gedacfg.h,v 1.20 2007/01/11 22:26:06 ssianky Exp $
24 //  ------------------------------------------------------------------
25 //  AREAFILE processor.
26 //  ------------------------------------------------------------------
27 
28 #ifndef __gedacfg_h
29 #define __gedacfg_h
30 
31 
32 //  ------------------------------------------------------------------
33 
34 #include <iostream>
35 #include <iomanip>
36 #include <string>
37 #include <gftnall.h>
38 #include <gfile.h>
39 #include <gmsgattr.h>
40 #include <geall.h>
41 
42 
43 //  ------------------------------------------------------------------
44 //  Area types
45 
46 const uint GMB_NET       = 0x0001;
47 const uint GMB_EMAIL     = 0x0002;
48 const uint GMB_ECHO      = 0x0004;
49 const uint GMB_NEWSGROUP = 0x0008;
50 const uint GMB_LOCAL     = 0x0010;
51 const uint GMB_QWK       = 0x1000;
52 const uint GMB_SOUP      = 0x2000;
53 const uint GMB_NONE      = 0x00ff;
54 const uint GMB_DEFAULT   = 0xf00f;
55 
56 
57 //  ------------------------------------------------------------------
58 
59 class AreaCfgBase {
60 
61 public:
62 
63   int      areaid;          // Unique internal area number
64   int      groupid;         // Group id (A-Z)
65   int      originno;        // Origin number
66   uint     board;           // Board number (Hudson/Goldbase/Ezycom/PCBoard fmts)
67   uint     type;            // Type of msgarea (GMB_xxx)
68   std::string basetype;     // Type of msgbase
69   ftn_addr aka;             // The AKA to use in the area
70   ftn_attr attr;            // Default attributes
71   byte     scan       : 1;  // TRUE if listed with AREASCAN
72   byte     scanexcl   : 1;  // TRUE if listed with AREASCANEXCL
73   byte     scanincl   : 1;  // TRUE if listed with AREASCANINCL
74   byte     pmscan     : 1;  // TRUE if listed with AREAPMSCAN
75   byte     pmscanexcl : 1;  // TRUE if listed with AREAPMSCANEXCL
76   byte     pmscanincl : 1;  // TRUE if listed with AREAPMSCANINCL
77 
78   int setorigin(std::string& origin);
79 
isseparator()80   bool isseparator() const           { return (basetype == "SEPARATOR"); }
81 
isnet()82   bool isnet() const                 { return !!(type & GMB_NET); }
isecho()83   bool isecho() const                { return !!(type & GMB_ECHO); }
islocal()84   bool islocal() const               { return !!(type & GMB_LOCAL); }
isemail()85   bool isemail() const               { return !!(type & GMB_EMAIL); }
isnewsgroup()86   bool isnewsgroup() const           { return !!(type & GMB_NEWSGROUP); }
isinternet()87   bool isinternet() const            { return !!(type & (GMB_EMAIL|GMB_NEWSGROUP)); }
isqwk()88   bool isqwk() const                 { return !!(type & GMB_QWK); }
issoup()89   bool issoup() const                { return !!(type & GMB_SOUP); }
90 
91 };
92 
93 
94 //  ------------------------------------------------------------------
95 
96 class AreaCfg : public AreaCfgBase {
97 
98 public:
99 
100   static int autoid;
101 
102   Echo          echoid;    // Echo tag
103   Desc          desc;      // Area description
104   Path          path;      // Path to message area
105   std::string   origin;    // Origin
106 
AreaCfg()107   AreaCfg()   { reset(); }
~AreaCfg()108   ~AreaCfg()  { }
109 
110   AreaCfg& operator=(const AreaCfg& x);
111 
112   void reset();
113 
114   const char* setdesc(const char* s);
115   const char* setautoid(const char* s);
116   const char* setechoid(const char* s);
117   const char* setorigin(const char* s);
118   const char* setpath(const char* s);
119 };
120 
121 
122 //  ------------------------------------------------------------------
123 
124 struct EchoList {
125 
126   Echo echoid;
127   Path path;
128   Desc desc;
129 };
130 
131 
132 //  ------------------------------------------------------------------
133 
134 struct DescList {
135 
136   Echo echoid;
137   Desc desc;
138 };
139 
140 
141 //  ------------------------------------------------------------------
142 
143 class EchoListClass {
144 
145 private:
146 
147   EchoList** echolist;
148   DescList** desclist;
149   int echos;
150   int descs;
151 
152 public:
153 
154   EchoListClass();
155   ~EchoListClass();
156 
157   void FreeAll();
Echos()158   int  Echos() { return(echos); }
159   void SortEchos();
160   void AddDesc(char* echoid, char* desc);
161   int  FindDesc(char* echoid, char** desc);
162   void AddEcho(char* echoid, char* path, char* desc);
163   int  FindEcho(char* echoid, char* path, char* desc);
164   int  GetEcho(int n, char** echoid, char** path, char** desc);
165 };
166 
167 
168 //  ------------------------------------------------------------------
169 
170 class gareafile {
171 
172 protected:
173 
174   Path pathprefix;
175 
176 #ifndef GCFG_NOFIDOCONF
177   // Fidoconfig parser functions
178   void gettok(char** key, char** val);
179 #endif
180 #if !defined(GCFG_NOCMAIL) || !defined(GCFG_NOCECHO)
181   // Crashmail II parser function
182   bool jbstrcpy(char *dest, char *src, size_t maxlen, size_t *jbc);
183   void ReadCrashmailCfg(const char* file);
184 #endif
185 #ifndef GCFG_NOTIMED
186   // Timed parser function
187   void nullastbackslash(char* val);
188 #endif
189 #ifndef GCFG_NOWATERGATE
190   // Watergate parser function
191   const char *gettype(const char *msgtype, const byte wtrtype);
192 #endif
193 #ifndef GCFG_NOXMAIL
194   // XMail parser function
195   char* ClipDosFilename(char* __file);
196 #endif
197 
198   void adjustpath(char* path);
199 
200 #ifndef GCFG_NODB
201   void ReadDB130(char* tag, char* dbpath);
202   void ReadDB1046(char* file, char* tag);
203   void ReadDB1047A22(char* file, int reclen, char* tag);
204   void ReadDB2011(char* file, int reclen, char* tag);
205 #endif
206 #ifndef GCFG_NOEZY
207   void ReadEzycom102(gfile &fp, char* path, char* file, char* options);
208   void ReadEzycom110(gfile &fp, char* path, char* file, char* options);
209 #endif
210 #ifndef GCFG_NOFE
211   void ReadFastecho11x(int fh);
212   void ReadFastecho141(int fh);
213   void ReadFastecho142(int fh);
214 #endif
215 #ifndef GCFG_NOFMAIL
216   void ReadFMail092(gfile &fp, char* path, char* file, char* options);
217   void ReadFMail098(gfile &fp, char* path, char* file, char* options);
218   void ReadFMail116(gfile &fp, char* path, char* file, char* options);
219 #endif
220 #ifndef GCFG_NOFIDOCONF
221   AreaCfg echoareadefaults;
222   bool ReadHPTLine(gfile &f, std::string& str);
223   void ReadHPTFile(char* path, char* file, char* origin, int group);
224 #endif
225 #ifndef GCFG_NOIMAIL
226   void ReadIMail160(char* options, char* file, char* impath);
227   void ReadIMail170(char* options, char* file, char* impath);
228   void ReadIMail185(char* options, char* file, char* impath);
229 #endif
230 #ifndef GCFG_NOMAXIMUS
231   void ReadMaximus3(char* mxpath, char* areafile, char* options);
232 #endif
233 #ifndef GCFG_NOQBBS
234   void ReadQ260(char* qbpath, char* origin, char* options);
235   void ReadQ276(char* qbpath, char* origin, char* options);
236 #endif
237 #ifndef GCFG_NOQECHO
238   void ReadQEchoFile(char* file, char* options, char* origin);
239 #endif
240 #ifndef GCFG_NOSPCT
241   void ParseSpaceArea(const char *type_path, AreaCfg &aa);
242   void ReadSpaceCtl(const char *path);
243   void ReadSpaceNtm(const char *path);
244   void ReadSpaceAr(const char *path);
245 #endif
246 #if !defined(GCFG_NOSQSH) || !defined(GCFG_NOPARTOSS)
247   void ReadSquishFile(char* path, char* file, char* options, char* origin, int group);
248 #endif
249 #ifndef GCFG_NOTIMED
250   void ReadTimedFile(char* path, char* file, char* options, char* origin);
251 #endif
252 #ifndef GCFG_NOTERMAIL
253   void ReadTmailFile(char* file, char* options, char* origin);
254 #endif
255 #ifndef GCFG_NOWATERGATE
256   void ReadWtrGteFile(char* options, gfile &fp);
257 #endif
258 #ifndef GCFG_NOXBBS
259   void ReadAdeptXbbsFile(char* path, char* file, char* options);
260 #endif
261 #ifndef GCFG_NOXMAIL
262   void ReadxMailFile(char* file, char* options);
263 #endif
264 
265 public:
266 
267   gareafile();
268 
269   EchoListClass echolist;
270 
271   int quiet;
272 
273   int sharemode;
274   const char *fidomsgtype;
275   int ra2usersbbs;
276   int squishuserno;
277 
278   const char *areapath;
279   const char *pcboardpath;
280 
281   ftn_addr primary_aka;
282 
283   ftn_attr attribsnet;
284   ftn_attr attribsecho;
285   ftn_attr attribsnews;
286   ftn_attr attribsemail;
287   ftn_attr attribslocal;
288 
289   void GetAreasBBS(char* name, char* origin, char* options);
290 
291   void ReadAreasBBS(char* tag);
292 #ifndef GCFG_NOXBBS
293   void ReadAdeptXBBS(char* tag);
294 #endif
295 #if !defined(GCFG_NOCMAIL) || !defined(GCFG_NOCECHO)
296   void ReadCrashmail(char* tag);
297 #endif
298 #ifndef GCFG_NODB
299   void ReadDBridge(char* tag);
300 #endif
301 #ifndef GCFG_NODUTCHIE
302   void ReadDutchie(char* tag);
303 #endif
304 #ifndef GCFG_NOEZY
305   void ReadEzycom(char* tag);
306 #endif
307 #ifndef GCFG_NOFE
308   void ReadFastecho(char* tag);
309 #endif
310 #ifndef GCFG_NOFIDOPCB
311   void ReadFidoPCB(char* tag);
312 #endif
313 #ifndef GCFG_NOFMAIL
314   void ReadFMail(char* tag);
315 #endif
316 #ifndef GCFG_NOFD
317   void ReadFrontDoor(char* tag);
318 #endif
319 #ifndef GCFG_NOGECHO
320   void ReadGEcho(char* tag);
321 #endif
322 #ifndef GCFG_NOFIDOCONF
323   void ReadHPT(char* tag);
324 #endif
325 #ifndef GCFG_NOIMAIL
326   void ReadIMail(char* tag);
327 #endif
328 #ifndef GCFG_NOINTERMAIL
329   void ReadInterMail(char* tag);
330 #endif
331 #ifndef GCFG_NOLORA
332   void ReadLoraBBS(char* tag);
333 #endif
334 #ifndef GCFG_NOMAXIMUS
335   void ReadMaximus(char* tag);
336 #endif
337 #ifndef GCFG_NOME2
338   void ReadME2(char* tag);
339 #endif
340 #ifndef GCFG_NOOPUS
341   void ReadOpus(char* tag);
342 #endif
343 #ifndef GCFG_NOPCB
344   void ReadPCBoard(char* tag);
345 #endif
346 #ifndef GCFG_NOPORTAL
347   void ReadPortal(char* tag);
348 #endif
349 #ifndef GCFG_NOPROBOARD
350   void ReadProBoard(char* tag);
351 #endif
352 #ifndef GCFG_NOQECHO
353   void ReadQEcho(char* tag);
354 #endif
355 #ifndef GCFG_NOQFRONT
356   void ReadQFront(char* tag);
357 #endif
358 #ifndef GCFG_NOQBBS
359   void ReadQuickBBS(char* tag);
360 #endif
361 #ifndef GCFG_NORAECHO
362   void ReadRaEcho(char* tag);
363 #endif
364 #ifndef GCFG_NORA
365   void ReadRemoteAccess(char* tag);
366 #endif
367 #if !defined(GCFG_NOSQSH) || !defined(GCFG_NOPARTOSS)
368   void ReadSquish(char* tag);
369 #endif
370 #ifndef GCFG_NOSPCT
371   void ReadSpaceToss(char *tag);
372 #endif
373 #ifndef GCFG_NOSBBS
374   void ReadSuperBBS(char* tag);
375 #endif
376 #ifndef GCFG_NOTIMED
377   void ReadTimed(char* tag);
378 #endif
379 #ifndef GCFG_NOTERMAIL
380   void ReadTmail(char* tag);
381 #endif
382 #ifndef GCFG_NOTOSSCAN
383   void ReadTosScan(char* tag);
384 #endif
385 #ifndef GCFG_NOWMAIL
386   void ReadWMail(char* tag);
387 #endif
388 #ifndef GCFG_NOWATERGATE
389   void ReadWtrGte(char* tag);
390 #endif
391 #ifndef GCFG_NOXMAIL
392   void ReadXMail(char* tag);
393 #endif
394 #ifndef GCFG_NOSYNCHRONET
395   void ReadSynchronet(char* tag);
396 #endif
397 
398   bool ReadAreafile(word crc, char* parameters);
399 };
400 
401 
402 //  ------------------------------------------------------------------
403 
404 void AddNewArea(AreaCfg& aa);
405 void CfgAddress(char* value);
406 void CfgOrigin(const char* value);
407 void CfgUsername(char* value);
408 void CfgJAMSMAPIHighwater(bool value);
409 void ReadEcholist(char* value);
410 void SetAreaDesc(char* echoid, char* desc);
411 
412 void CfgAdeptxbbspath(const char *path, bool force = false);
413 void CfgEzycommsgbase(const char *path, bool force = false);
414 void CfgEzycomuserbase(const char *path, bool force = false);
415 void CfgGoldbasepath(const char *path, bool force = false);
416 void CfgHudsonpath(const char *path, bool force = false);
417 void CfgJampath(const char *path, bool force = false);
418 void CfgPcboardpath(const char *path, bool force = false);
419 void CfgSquishuserpath(const char *path, bool force = false);
420 void CfgFidolastread(const char *path);
421 
422 
423 //  ------------------------------------------------------------------
424 
425 #endif
426 
427 //  ------------------------------------------------------------------
428