2000-02-25 10:15:17 +00:00
|
|
|
// This may look like C code, but it is really -*- C++ -*-
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// The Goldware Library
|
|
|
|
// Copyright (C) 1990-1999 Odinn Sorensen
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// 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 LoraBBS (2.33 and 2.40).
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <gmemdbg.h>
|
|
|
|
#include <gfile.h>
|
|
|
|
#include <gstrall.h>
|
2006-01-17 17:47:35 +00:00
|
|
|
#if defined(__GOLD_GUI__)
|
|
|
|
#include <gvidall.h>
|
|
|
|
#include <gvidgui.h>
|
|
|
|
#endif
|
2000-08-23 19:24:19 +00:00
|
|
|
#undef GCFG_NOLORA
|
2000-02-25 10:15:17 +00:00
|
|
|
#include <gedacfg.h>
|
|
|
|
#include <gs_lo240.h>
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void gareafile::ReadLoraBBS(char* tag) {
|
|
|
|
|
|
|
|
Path _path;
|
|
|
|
*_path = NUL;
|
|
|
|
char options[80];
|
|
|
|
strcpy(options, tag);
|
|
|
|
char* ptr = strtok(tag, " \t");
|
|
|
|
while(ptr) {
|
|
|
|
if(*ptr != '-') {
|
|
|
|
AddBackslash(strcpy(_path, ptr));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ptr = strtok(NULL, " \t");
|
|
|
|
}
|
|
|
|
if(*_path == NUL) {
|
|
|
|
ptr = getenv("LORA");
|
|
|
|
if(ptr)
|
|
|
|
AddBackslash(strcpy(_path, ptr));
|
|
|
|
}
|
|
|
|
if(*_path == NUL) {
|
|
|
|
ptr = getenv("LORABBS");
|
|
|
|
if(ptr)
|
|
|
|
AddBackslash(strcpy(_path, ptr));
|
|
|
|
}
|
|
|
|
if(*_path == NUL)
|
|
|
|
strcpy(_path, areapath);
|
|
|
|
|
|
|
|
const char* _file = AddPath(_path, "config.dat");
|
2006-04-24 16:38:44 +00:00
|
|
|
gfile fp(_file, "rb");
|
2006-01-17 17:47:35 +00:00
|
|
|
if (fp.isopen())
|
|
|
|
{
|
|
|
|
if (not quiet)
|
2006-01-20 11:55:12 +00:00
|
|
|
STD_PRINTNL("* Reading " << _file);
|
2000-02-25 10:15:17 +00:00
|
|
|
|
|
|
|
_configuration* cfg = (_configuration*)throw_calloc(1, sizeof(_configuration));
|
2006-04-24 16:38:44 +00:00
|
|
|
fp.Fread(cfg, sizeof(_configuration));
|
|
|
|
fp.Fclose();
|
2000-02-25 10:15:17 +00:00
|
|
|
|
|
|
|
//CfgUsername(cfg->sysop);
|
|
|
|
|
2001-05-05 21:41:41 +00:00
|
|
|
CfgHudsonpath(cfg->quick_msgpath);
|
|
|
|
CfgGoldbasepath(cfg->quick_msgpath);
|
2000-02-25 10:15:17 +00:00
|
|
|
|
|
|
|
AreaCfg aa;
|
|
|
|
|
|
|
|
// Netmail *.MSG
|
|
|
|
if(not strblank(cfg->netmail_dir)) {
|
|
|
|
aa.reset();
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "OPUS";
|
2000-02-25 10:15:17 +00:00
|
|
|
aa.type = GMB_NET;
|
|
|
|
aa.aka = CAST(ftn_addr, cfg->alias[0]);
|
|
|
|
aa.setpath(cfg->netmail_dir);
|
|
|
|
aa.setdesc("LoraBBS Netmail");
|
|
|
|
aa.setautoid("NETMAIL");
|
|
|
|
AddNewArea(aa);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bad *.MSG
|
|
|
|
if(not strblank(cfg->bad_msgs)) {
|
|
|
|
aa.reset();
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "OPUS";
|
2000-02-25 10:15:17 +00:00
|
|
|
aa.type = GMB_ECHO;
|
|
|
|
aa.aka = CAST(ftn_addr, cfg->alias[0]);
|
|
|
|
aa.setpath(cfg->bad_msgs);
|
|
|
|
aa.setdesc("LoraBBS Bad Echo");
|
|
|
|
aa.setautoid("ECHO_BAD");
|
|
|
|
AddNewArea(aa);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Dupes *.MSG
|
|
|
|
if(not strblank(cfg->dupes)) {
|
|
|
|
aa.reset();
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "OPUS";
|
2000-02-25 10:15:17 +00:00
|
|
|
aa.type = GMB_ECHO;
|
|
|
|
aa.aka = CAST(ftn_addr, cfg->alias[0]);
|
|
|
|
aa.setpath(cfg->dupes);
|
|
|
|
aa.setdesc("LoraBBS Duplicate Msgs");
|
|
|
|
aa.setautoid("ECHO_DUPES");
|
|
|
|
AddNewArea(aa);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Personal mail *.MSG
|
|
|
|
if(cfg->save_my_mail and not strblank(cfg->my_mail)) {
|
|
|
|
aa.reset();
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "OPUS";
|
2000-02-25 10:15:17 +00:00
|
|
|
aa.type = GMB_ECHO;
|
|
|
|
aa.aka = CAST(ftn_addr, cfg->alias[0]);
|
|
|
|
aa.setpath(cfg->my_mail);
|
|
|
|
aa.setdesc("LoraBBS Personal Mail");
|
|
|
|
aa.setautoid("ECHO_PERSONAL");
|
|
|
|
AddNewArea(aa);
|
|
|
|
}
|
|
|
|
|
|
|
|
_file = AddPath(_path, "sysmsg.dat");
|
2006-04-24 16:38:44 +00:00
|
|
|
fp.Fopen(_file, "rb");
|
2006-01-17 17:47:35 +00:00
|
|
|
if (fp.isopen())
|
|
|
|
{
|
2006-04-24 16:38:44 +00:00
|
|
|
fp.SetvBuf(NULL, _IOFBF, 8192);
|
2000-02-25 10:15:17 +00:00
|
|
|
|
2006-01-17 17:47:35 +00:00
|
|
|
if (not quiet)
|
2006-01-20 11:55:12 +00:00
|
|
|
STD_PRINTNL("* Reading " << _file);
|
2000-02-25 10:15:17 +00:00
|
|
|
|
|
|
|
_sysmsg* sysmsg = (_sysmsg*)throw_calloc(1, sizeof(_sysmsg));
|
|
|
|
|
2006-04-24 16:38:44 +00:00
|
|
|
while (fp.Fread(sysmsg, sizeof(_sysmsg)) == 1)
|
|
|
|
{
|
2000-02-25 10:15:17 +00:00
|
|
|
if(sysmsg->passthrough)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
aa.reset();
|
|
|
|
|
|
|
|
if(sysmsg->gold_board) {
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "GOLDBASE";
|
2000-02-25 10:15:17 +00:00
|
|
|
aa.board = sysmsg->gold_board;
|
|
|
|
}
|
|
|
|
else if(sysmsg->quick_board) {
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "HUDSON";
|
2000-02-25 10:15:17 +00:00
|
|
|
aa.board = sysmsg->quick_board;
|
|
|
|
}
|
|
|
|
else if(sysmsg->pip_board) {
|
|
|
|
// Not supported (yet)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if(sysmsg->squish) {
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "SQUISH";
|
2000-02-25 10:15:17 +00:00
|
|
|
aa.setpath(sysmsg->msg_path);
|
|
|
|
}
|
|
|
|
else {
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "OPUS";
|
2000-02-25 10:15:17 +00:00
|
|
|
aa.setpath(sysmsg->msg_path);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(sysmsg->netmail) {
|
|
|
|
aa.type = GMB_NET;
|
|
|
|
aa.attr = attribsnet;
|
|
|
|
}
|
|
|
|
else if(sysmsg->echomail) {
|
|
|
|
aa.type = GMB_ECHO;
|
|
|
|
aa.attr = attribsecho;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
aa.type = GMB_LOCAL;
|
|
|
|
aa.attr = attribslocal;
|
|
|
|
}
|
|
|
|
|
|
|
|
aa.attr.pvt(sysmsg->doprivate);
|
|
|
|
|
|
|
|
aa.aka = CAST(ftn_addr, cfg->alias[sysmsg->use_alias]);
|
|
|
|
|
|
|
|
aa.setdesc(sysmsg->msg_name);
|
|
|
|
aa.setechoid(sysmsg->echotag);
|
|
|
|
aa.setorigin(sysmsg->origin);
|
|
|
|
|
|
|
|
AddNewArea(aa);
|
|
|
|
}
|
|
|
|
throw_free(sysmsg);
|
2006-04-24 16:38:44 +00:00
|
|
|
fp.Fclose();
|
2000-02-25 10:15:17 +00:00
|
|
|
}
|
|
|
|
throw_free(cfg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|