2000-02-25 11:04:07 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// GoldED+
|
|
|
|
// Copyright (C) 1990-1999 Odinn Sorensen
|
|
|
|
// Copyright (C) 1999-2000 Alexander S. Aganichev
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program 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
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU 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$
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Common code for the area compile.
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include <golded.h>
|
|
|
|
#include <gmoprot.h>
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Fix up the echoid and make default if none specified
|
|
|
|
|
|
|
|
void FixEchoid(char* echoid, int type) {
|
|
|
|
|
|
|
|
static uint netnum = 1;
|
|
|
|
static uint echonum = 1;
|
|
|
|
static uint localnum = 1;
|
|
|
|
|
|
|
|
if(*echoid == NUL) {
|
|
|
|
const char* t = CFG->areaautoid == AUTOID_LONG ? "MAIL" : "";
|
2003-12-10 08:35:16 +00:00
|
|
|
if(type & GMB_NET)
|
2000-02-25 11:04:07 +00:00
|
|
|
sprintf(echoid, "NET%s%03u", t, netnum++);
|
2003-12-10 08:35:16 +00:00
|
|
|
else if(type & GMB_ECHO)
|
2000-02-25 11:04:07 +00:00
|
|
|
sprintf(echoid, "ECHO%s%03u", t, echonum++);
|
2003-12-10 08:35:16 +00:00
|
|
|
else if(type & GMB_LOCAL)
|
2000-02-25 11:04:07 +00:00
|
|
|
sprintf(echoid, "LOCAL%03u", localnum++);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Sort a group of areas
|
|
|
|
|
|
|
|
void AreaList::SortAreaGroup(const char* options, int beginarea, int endarea) {
|
|
|
|
|
|
|
|
if(beginarea != endarea) {
|
|
|
|
const char* ptr = striinc("-S", options);
|
|
|
|
if(ptr) {
|
|
|
|
ptr += 2;
|
|
|
|
if(*ptr == '=')
|
|
|
|
ptr++;
|
|
|
|
Sort(ptr, beginarea, endarea);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Rename an echoid
|
|
|
|
|
2007-01-11 22:26:06 +00:00
|
|
|
void RenameArea(char* echoid)
|
|
|
|
{
|
|
|
|
std::vector<EchoRen>::iterator n = CFG->arearename.begin();
|
|
|
|
std::vector<EchoRen>::iterator end = CFG->arearename.end();
|
2000-02-25 11:04:07 +00:00
|
|
|
|
2007-01-11 22:26:06 +00:00
|
|
|
for (; n != end; n++)
|
|
|
|
{
|
|
|
|
if (strieql(echoid, n->from.c_str()))
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
strxcpy(echoid, n->to.c_str(), sizeof(Echo));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Check if the echoid is on the exclusion list
|
|
|
|
|
2007-01-11 22:26:06 +00:00
|
|
|
bool CheckExcl(char* echoid)
|
|
|
|
{
|
|
|
|
gstrarray::iterator n = CFG->areaexcl.begin();
|
|
|
|
gstrarray::iterator end1 = CFG->areaexcl.end();
|
2000-02-25 11:04:07 +00:00
|
|
|
|
2007-01-11 22:26:06 +00:00
|
|
|
for (; n != end1; n++)
|
|
|
|
{
|
|
|
|
if (strwild(echoid, n->c_str()))
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
// Found excl, now check for incl
|
2007-01-11 22:26:06 +00:00
|
|
|
gstrarray::iterator x = CFG->areaincl.begin();
|
|
|
|
gstrarray::iterator end2 = CFG->areaincl.end();
|
|
|
|
|
|
|
|
for (; x != end2; x++)
|
|
|
|
{
|
|
|
|
if (strwild(echoid, x->c_str()))
|
2000-02-25 11:04:07 +00:00
|
|
|
return false;
|
2007-01-11 22:26:06 +00:00
|
|
|
}
|
2000-02-25 11:04:07 +00:00
|
|
|
|
|
|
|
return true; // Echoid is excluded
|
|
|
|
}
|
|
|
|
}
|
2007-01-11 22:26:06 +00:00
|
|
|
|
2000-02-25 11:04:07 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Check if the echo is email or news
|
|
|
|
|
2007-01-11 22:26:06 +00:00
|
|
|
void CheckEMailOrNews(char* echoid, uint& type)
|
|
|
|
{
|
|
|
|
gstrarray::iterator i = CFG->areaisemail.begin();
|
|
|
|
gstrarray::iterator end = CFG->areaisemail.end();
|
2000-02-25 11:04:07 +00:00
|
|
|
|
2007-01-11 22:26:06 +00:00
|
|
|
for (; i != end; i++)
|
|
|
|
{
|
|
|
|
if (strwild(echoid, i->c_str()))
|
|
|
|
{
|
2003-12-10 08:35:16 +00:00
|
|
|
type = GMB_EMAIL | GMB_NET;
|
2000-02-25 11:04:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-01-11 22:26:06 +00:00
|
|
|
i = CFG->areaisnews.begin();
|
|
|
|
end = CFG->areaisnews.end();
|
|
|
|
|
|
|
|
for(; i != end; i++)
|
|
|
|
{
|
|
|
|
if (strwild(echoid, i->c_str()))
|
|
|
|
{
|
2003-12-10 08:35:16 +00:00
|
|
|
type = GMB_NEWSGROUP | GMB_ECHO;
|
2000-02-25 11:04:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Add or update area data
|
|
|
|
|
|
|
|
void AddNewArea(AreaCfg* aa) {
|
|
|
|
|
|
|
|
AL.AddNewArea(aa);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Add or update area data
|
|
|
|
|
|
|
|
void AddNewArea(AreaCfg& aa) {
|
|
|
|
|
|
|
|
AL.AddNewArea(&aa);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Add or update area data
|
|
|
|
|
2006-01-17 17:47:35 +00:00
|
|
|
void AreaList::AddNewArea(AreaCfg* aa)
|
|
|
|
{
|
|
|
|
if (veryverbose)
|
|
|
|
{
|
2001-07-16 20:35:42 +00:00
|
|
|
std::string temp;
|
2006-01-17 17:47:35 +00:00
|
|
|
STD_PRINT(" fmt=" << aa->basetype << ", eid=\"" << aa->echoid);
|
|
|
|
STD_PRINT("\", pth=\"" << aa->path << "\", brd=" << aa->board);
|
|
|
|
STD_PRINT(", gid=" << aa->groupid << ", aka=" << aa->aka.make_string(temp));
|
2006-01-20 11:55:12 +00:00
|
|
|
STD_PRINTNL(" " << aa->attr.make_string(temp));
|
2000-02-25 11:04:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Desc desc;
|
|
|
|
char buf[256];
|
|
|
|
bool newarea = true;
|
|
|
|
static int serial = 0;
|
|
|
|
static int net1st = false;
|
|
|
|
|
|
|
|
*desc = NUL;
|
|
|
|
|
|
|
|
// Make sure the path field is 100% correct for the msgbase
|
2007-01-08 12:09:42 +00:00
|
|
|
if ((aa->basetype == "FTS1") || (aa->basetype == "OPUS"))
|
|
|
|
{
|
2003-12-10 08:35:16 +00:00
|
|
|
if(*aa->path == NUL)
|
|
|
|
return;
|
|
|
|
MapPath(aa->path);
|
|
|
|
AddBackslash(aa->path);
|
|
|
|
strschg_environ(aa->path);
|
|
|
|
}
|
|
|
|
#ifndef GMB_NOHUDS
|
2007-01-08 12:09:42 +00:00
|
|
|
else if (aa->basetype == "HUDSON")
|
2006-05-14 17:17:32 +00:00
|
|
|
{
|
|
|
|
if ((aa->board < 1) or (aa->board > 200)) // Ignore areas with invalid numbers
|
2003-12-10 08:35:16 +00:00
|
|
|
return;
|
2006-05-14 17:17:32 +00:00
|
|
|
gsprintf(PRINTF_DECLARE_BUFFER(aa->path), "%u", aa->board);
|
2003-12-10 08:35:16 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifndef GMB_NOGOLD
|
2007-01-08 12:09:42 +00:00
|
|
|
else if (aa->basetype == "GOLDBASE")
|
2006-05-14 17:17:32 +00:00
|
|
|
{
|
|
|
|
if ((aa->board < 1) or (aa->board > 500)) // Ignore areas with invalid numbers
|
2003-12-10 08:35:16 +00:00
|
|
|
return;
|
2006-05-14 17:17:32 +00:00
|
|
|
gsprintf(PRINTF_DECLARE_BUFFER(aa->path), "%u", aa->board);
|
2003-12-10 08:35:16 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifndef GMB_NOEZY
|
2007-01-08 12:09:42 +00:00
|
|
|
else if (aa->basetype == "EZYCOM")
|
2006-05-14 17:17:32 +00:00
|
|
|
{
|
2003-12-10 08:35:16 +00:00
|
|
|
// Ignore areas with invalid numbers
|
2006-05-14 17:17:32 +00:00
|
|
|
if ((aa->board < 1) or (aa->board > 1536))
|
2003-12-10 08:35:16 +00:00
|
|
|
return;
|
2006-05-14 17:17:32 +00:00
|
|
|
gsprintf(PRINTF_DECLARE_BUFFER(aa->path), "%u", aa->board);
|
2003-12-10 08:35:16 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifndef GMB_NOWCAT
|
2007-01-08 12:09:42 +00:00
|
|
|
else if (aa->basetype == "WILDCAT")
|
|
|
|
{
|
2003-12-10 08:35:16 +00:00
|
|
|
if(*aa->path == NUL)
|
|
|
|
return;
|
|
|
|
MapPath(aa->path);
|
|
|
|
StripBackslash(aa->path);
|
|
|
|
strschg_environ(aa->path);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifndef GMB_NOXBBS
|
2007-01-08 12:09:42 +00:00
|
|
|
else if (aa->basetype == "ADEPTXBBS")
|
|
|
|
{
|
2003-12-10 08:35:16 +00:00
|
|
|
if(*aa->path == NUL)
|
|
|
|
return;
|
|
|
|
MapPath(aa->path);
|
|
|
|
StripBackslash(aa->path);
|
|
|
|
strschg_environ(aa->path);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifndef GMB_NOSQSH
|
2007-01-08 12:09:42 +00:00
|
|
|
else if (aa->basetype == "SQUISH")
|
|
|
|
{
|
2003-12-10 08:35:16 +00:00
|
|
|
if(*aa->path == NUL)
|
|
|
|
return;
|
|
|
|
MapPath(aa->path);
|
|
|
|
StripBackslash(aa->path);
|
|
|
|
strschg_environ(aa->path);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifndef GMB_NOJAM
|
2007-01-08 12:09:42 +00:00
|
|
|
else if (aa->basetype == "JAM")
|
|
|
|
{
|
2003-12-10 08:35:16 +00:00
|
|
|
if(*aa->path == NUL)
|
|
|
|
return;
|
|
|
|
MapPath(aa->path);
|
|
|
|
StripBackslash(aa->path);
|
|
|
|
strschg_environ(aa->path);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifndef GMB_NOPCB
|
2007-01-08 12:09:42 +00:00
|
|
|
else if (aa->basetype == "PCBOARD")
|
|
|
|
{
|
2003-12-10 08:35:16 +00:00
|
|
|
MapPath(aa->path);
|
|
|
|
StripBackslash(aa->path);
|
|
|
|
strschg_environ(aa->path);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifndef GMB_NOSMB
|
2007-01-08 12:09:42 +00:00
|
|
|
else if (aa->basetype == "SMB")
|
|
|
|
{
|
2003-12-10 08:35:16 +00:00
|
|
|
if(*aa->path == NUL)
|
|
|
|
return;
|
|
|
|
MapPath(aa->path);
|
|
|
|
StripBackslash(aa->path);
|
|
|
|
strschg_environ(aa->path);
|
|
|
|
}
|
|
|
|
#endif
|
2007-01-08 12:09:42 +00:00
|
|
|
else if (aa->basetype == "SEPARATOR")
|
|
|
|
{
|
2003-12-10 08:35:16 +00:00
|
|
|
}
|
|
|
|
else {
|
2000-02-25 11:04:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Note msgbase type
|
2003-12-10 08:35:16 +00:00
|
|
|
if(not find(basetypes, aa->basetype))
|
|
|
|
basetypes.push_back(aa->basetype);
|
2000-02-25 11:04:07 +00:00
|
|
|
|
|
|
|
// Things to do for real areas only
|
|
|
|
if(not aa->isseparator()) {
|
|
|
|
|
|
|
|
// If the echoid is missing, try to find it in the echolist
|
|
|
|
if(strblank(aa->echoid))
|
|
|
|
AFILE->echolist.FindEcho(aa->echoid, aa->path, aa->desc);
|
|
|
|
|
|
|
|
// Fix up the echoid
|
|
|
|
FixEchoid(aa->echoid, aa->type);
|
|
|
|
|
|
|
|
// Rename the echoid if necessary
|
|
|
|
RenameArea(aa->echoid);
|
|
|
|
|
|
|
|
// Do not accept excluded areas
|
|
|
|
if(CheckExcl(aa->echoid))
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Fix description
|
|
|
|
if(strblank(aa->desc))
|
|
|
|
strxcpy(aa->desc, aa->echoid, sizeof(aa->desc));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check if it's email or news
|
|
|
|
CheckEMailOrNews(aa->echoid, aa->type);
|
|
|
|
|
|
|
|
// Give each area a unique serial number
|
|
|
|
aa->areaid = serial++;
|
|
|
|
|
|
|
|
// Check if we already have the area (dup echoid or path)
|
|
|
|
int _currarea = 0;
|
2007-01-11 22:26:06 +00:00
|
|
|
area_iterator ap = idx.begin();
|
|
|
|
area_iterator end = idx.end();
|
|
|
|
|
|
|
|
for (; ap != end; ap++)
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
++_currarea;
|
2002-08-07 07:21:41 +00:00
|
|
|
int eq_echoid = strieql(aa->echoid, (*ap)->echoid());
|
2007-01-11 22:26:06 +00:00
|
|
|
if (eq_echoid)
|
|
|
|
{
|
2002-08-07 07:21:41 +00:00
|
|
|
newarea = false;
|
2007-01-11 22:26:06 +00:00
|
|
|
if (not (*ap)->isseparator())
|
|
|
|
{
|
|
|
|
if (strblank((*ap)->desc()))
|
2002-08-07 07:21:41 +00:00
|
|
|
strxcpy(desc, aa->desc, sizeof(desc));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2007-01-08 12:09:42 +00:00
|
|
|
else if(not (*ap)->isseparator())
|
|
|
|
{
|
2003-12-10 08:35:16 +00:00
|
|
|
bool eq_path = strieql(aa->path, (*ap)->path());
|
|
|
|
bool eq_board = (aa->board == (*ap)->board());
|
2007-01-08 12:09:42 +00:00
|
|
|
bool eq_msgbase = (aa->basetype == (*ap)->basetype());
|
|
|
|
bool eq_isfido = (((aa->basetype == "OPUS") || (aa->basetype == "FTS1")) &&
|
|
|
|
(((*ap)->basetype() == "OPUS") || ((*ap)->basetype() == "FTS1")));
|
|
|
|
|
|
|
|
if (eq_path and eq_board and (eq_msgbase or eq_isfido))
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
// We had it already, so override with the new data
|
|
|
|
newarea = false;
|
|
|
|
if(strblank((*ap)->desc()))
|
2001-10-07 08:24:26 +00:00
|
|
|
strxcpy(desc, aa->desc, sizeof(desc));
|
2000-02-25 11:04:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// If first netmail area, set default for AREAFREQTO and AREAREPLYTO
|
|
|
|
if((aa->isnet() and not aa->isseparator()) and not net1st) {
|
|
|
|
net1st = true;
|
|
|
|
if(not *CFG->areafreqto)
|
|
|
|
strcpy(CFG->areafreqto, aa->echoid);
|
|
|
|
if(not *CFG->areareplyto)
|
|
|
|
strcpy(CFG->areareplyto, aa->echoid);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Increase area index size if new area
|
|
|
|
if(newarea) {
|
2003-12-10 08:35:16 +00:00
|
|
|
idx.push_back(NewArea(aa->basetype));
|
2000-02-25 11:04:07 +00:00
|
|
|
throw_new(idx[_currarea]);
|
|
|
|
ap = idx.end(); --ap;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Add aka if not found
|
2007-01-11 22:26:06 +00:00
|
|
|
if (aa->aka.net)
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
bool found = false;
|
2007-01-11 22:26:06 +00:00
|
|
|
std::vector<gaka>::iterator i = CFG->aka.begin();
|
|
|
|
std::vector<gaka>::iterator end = CFG->aka.end();
|
|
|
|
|
|
|
|
for (; i != end; i++)
|
|
|
|
{
|
|
|
|
if (aa->aka == i->addr)
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
2007-01-11 22:26:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (not found) // Then add it
|
2000-02-25 11:04:07 +00:00
|
|
|
CfgAddress(aa->aka.make_string(buf)); // Add the aka
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// If address is missing, use main address
|
|
|
|
if(not CFG->aka.empty())
|
|
|
|
aa->aka = CFG->aka[0].addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Copy the data
|
|
|
|
if(newarea) {
|
|
|
|
(*ap)->set_echoid(aa->echoid);
|
|
|
|
(*ap)->set_path(aa->path);
|
|
|
|
(*ap)->set_board(aa->board);
|
2003-12-10 08:35:16 +00:00
|
|
|
(*ap)->set_basetype(aa->basetype);
|
2000-02-25 11:04:07 +00:00
|
|
|
}
|
|
|
|
(*ap)->set_desc(newarea or strblank(desc) ? aa->desc : desc);
|
|
|
|
(*ap)->set_areaid(aa->areaid);
|
|
|
|
(*ap)->set_groupid(aa->groupid);
|
|
|
|
(*ap)->set_type(aa->type);
|
|
|
|
(*ap)->set_aka(aa->aka);
|
|
|
|
(*ap)->set_originno(aa->originno);
|
|
|
|
(*ap)->set_attr(aa->attr);
|
|
|
|
(*ap)->set_scan(aa->scan);
|
|
|
|
(*ap)->set_scanexcl(aa->scanexcl);
|
|
|
|
(*ap)->set_scanincl(aa->scanincl);
|
|
|
|
(*ap)->set_pmscan(aa->pmscan);
|
|
|
|
(*ap)->set_pmscanexcl(aa->pmscanexcl);
|
|
|
|
(*ap)->set_pmscanincl(aa->pmscanincl);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Get areas from other programs
|
|
|
|
|
|
|
|
void AreaList::GetAreafile(char* value) {
|
|
|
|
|
|
|
|
const word CRC_ECHOLIST = 0xCE70;
|
|
|
|
|
|
|
|
word crcval;
|
|
|
|
char* keyword;
|
|
|
|
char* options;
|
|
|
|
int beginarea, endarea;
|
|
|
|
|
|
|
|
crcval = getkeyvalcrc(&keyword, &value);
|
|
|
|
options = throw_strdup(value);
|
|
|
|
|
|
|
|
beginarea = idx.size();
|
|
|
|
|
|
|
|
if(crcval == CRC_ECHOLIST)
|
|
|
|
ReadEcholist(value);
|
|
|
|
else {
|
|
|
|
AFILE->quiet = quiet;
|
|
|
|
AFILE->sharemode = CFG->sharemode;
|
|
|
|
AFILE->fidomsgtype = CFG->fidomsgtype;
|
|
|
|
AFILE->ra2usersbbs = CFG->ra2usersbbs;
|
|
|
|
AFILE->squishuserno = CFG->squishuserno;
|
2001-05-05 21:41:41 +00:00
|
|
|
AFILE->areapath = CFG->areapath;
|
|
|
|
AFILE->pcboardpath = CFG->pcboardpath;
|
2000-02-25 11:04:07 +00:00
|
|
|
|
|
|
|
if(not CFG->aka.empty())
|
|
|
|
AFILE->primary_aka = CFG->aka[0].addr;
|
|
|
|
else
|
|
|
|
AFILE->primary_aka = 0;
|
|
|
|
|
|
|
|
AFILE->attribsnet = CFG->attribsnet;
|
|
|
|
AFILE->attribsecho = CFG->attribsecho;
|
|
|
|
AFILE->attribsnews = CFG->attribsnews;
|
|
|
|
AFILE->attribsemail = CFG->attribsemail;
|
|
|
|
AFILE->attribslocal = CFG->attribslocal;
|
|
|
|
|
|
|
|
AFILE->ReadAreafile(crcval, value);
|
|
|
|
|
|
|
|
CFG->ra2usersbbs = AFILE->ra2usersbbs;
|
|
|
|
CFG->squishuserno = AFILE->squishuserno;
|
|
|
|
}
|
|
|
|
|
|
|
|
endarea = idx.size();
|
|
|
|
SortAreaGroup(options, beginarea, endarea);
|
|
|
|
|
|
|
|
throw_free(options);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Get area definition
|
|
|
|
|
|
|
|
void AreaList::GetArea(char* def) {
|
|
|
|
|
|
|
|
AreaCfg aa;
|
|
|
|
char* ptr;
|
|
|
|
char* tag;
|
|
|
|
char* desc;
|
|
|
|
char* base;
|
|
|
|
char* loc;
|
|
|
|
char* attr;
|
|
|
|
|
|
|
|
if(strnieql(def, "-FILE ", 6)) // Check for alternate formats
|
|
|
|
GetAreafile(def+6);
|
|
|
|
else {
|
|
|
|
tag = def;
|
|
|
|
desc = strskip_txt(tag);
|
|
|
|
*desc = NUL;
|
|
|
|
|
|
|
|
aa.reset();
|
|
|
|
|
|
|
|
// Split up the string definition
|
|
|
|
desc = strskip_wht(desc+1);
|
|
|
|
switch(*desc) {
|
|
|
|
case '\"':
|
|
|
|
base = strskip_to(desc+1, '\"')+1;
|
|
|
|
break;
|
|
|
|
case '\'':
|
|
|
|
base = strskip_to(desc+1, '\'')+1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
base = strskip_txt(desc);
|
|
|
|
}
|
|
|
|
*base = NUL;
|
|
|
|
base = strskip_wht(base+1);
|
|
|
|
loc = strskip_txt(base);
|
|
|
|
*loc = NUL;
|
|
|
|
loc = strskip_wht(loc+1);
|
|
|
|
attr = strpbrk(loc, " \t");
|
|
|
|
if(attr and *attr) {
|
|
|
|
*attr = NUL;
|
|
|
|
attr = strskip_wht(attr+1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Parse the individual parts
|
|
|
|
|
|
|
|
aa.setechoid(tag); // Copy the echotag
|
|
|
|
|
|
|
|
StripQuotes(desc); // Copy description, stripping quotes ("")
|
|
|
|
aa.setdesc(desc);
|
|
|
|
|
2005-10-31 22:18:26 +00:00
|
|
|
switch(g_toupper(*base)) { // Store area info
|
2000-02-25 11:04:07 +00:00
|
|
|
|
|
|
|
case '-':
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "SEPARATOR";
|
2000-02-25 11:04:07 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 'M':
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "SQUISH";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.setpath(loc);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'Y':
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "SMB";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.setpath(loc);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'H':
|
|
|
|
case 'R':
|
|
|
|
case 'Q':
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "HUDSON";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.board = (uint) atoi(loc);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'G':
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "GOLDBASE";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.board = (uint) atoi(loc);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'E':
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "EZYCOM";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.board = (uint) atoi(loc);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'J':
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "JAM";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.setpath(loc);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'P':
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "PCBOARD";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.setpath(loc);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'W':
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "WILDCAT";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.setpath(loc);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'X':
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "ADEPTXBBS";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.setpath(loc);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'S':
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "FTS1";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.setpath(loc);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'F':
|
|
|
|
case 'O':
|
|
|
|
default:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "OPUS";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.setpath(loc);
|
|
|
|
}
|
|
|
|
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.type = GMB_ECHO;
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.attr = CFG->attribsecho;
|
|
|
|
strupr(base);
|
|
|
|
if(strchr(base, 'N')) {
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.type = GMB_NET;
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.attr = CFG->attribsnet;
|
|
|
|
}
|
|
|
|
if(strchr(base, 'L')) {
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.type = GMB_LOCAL;
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.attr = CFG->attribslocal;
|
|
|
|
}
|
|
|
|
if(strchr(base, 'E')) {
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.type = GMB_ECHO;
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.attr = CFG->attribsecho;
|
|
|
|
}
|
|
|
|
if(attr) { // Get attributes and AKAs
|
|
|
|
GetAttribstr(&aa.attr, attr);
|
|
|
|
if((ptr = strpbrk(attr, "0123456789")) != NULL) {
|
|
|
|
int n = atoi(ptr);
|
|
|
|
if((n < 0) or ((uint) n >= CFG->aka.size()))
|
|
|
|
n = 0;
|
|
|
|
if(not CFG->aka.empty())
|
|
|
|
aa.aka = CFG->aka[n].addr; // Found AKA number
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(not aa.aka.net and not CFG->aka.empty())
|
|
|
|
aa.aka = CFG->aka[0].addr;
|
|
|
|
|
|
|
|
AddNewArea(&aa);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Get area definition (new)
|
|
|
|
//
|
|
|
|
// Syntax of AREADEF keyword:
|
|
|
|
//
|
|
|
|
// AREADEF <echoid> <"desc"> <group> <type> <msgbase> <path/board> <aka> <(attrs)> ["origin"]
|
|
|
|
//
|
|
|
|
// Examples:
|
|
|
|
//
|
|
|
|
// AREADEF NET.ALL "Netmail, Line 1" N Net Opus R:\NETMAIL\ 2:231/77 (PVT K/S)
|
|
|
|
// AREADEF TEST "Testing..." D Echo Hudson 67 . ()
|
|
|
|
// AREADEF 1LOCAL "Sysop <-> Users" L Local Squish R:\MAX\MSG\LOC\1LOCAL . (PVT) "Your Sysop * The Goldware BBS Line 1"
|
|
|
|
// AREADEF DANEINFO "DaneNet Info" D Echo Squish R:\MAX\MSG\231\DANEINFO . (R/O)
|
|
|
|
|
|
|
|
bool AreaList::GetAreaFirstPart(AreaCfg& aa, char*& key, char*& val) {
|
|
|
|
|
|
|
|
const word CRC_NET = 0xEC5E;
|
|
|
|
const word CRC_ECHO = 0xC2D1;
|
|
|
|
const word CRC_LOCAL = 0x4CD5;
|
|
|
|
const word CRC_EMAIL = 0x9C64;
|
|
|
|
const word CRC_NEWS = 0x61F1;
|
|
|
|
|
|
|
|
// Get echoid
|
|
|
|
getkeyval(&key, &val);
|
|
|
|
aa.setechoid(key);
|
|
|
|
|
|
|
|
// Get description
|
|
|
|
getkeyval(&key, &val);
|
|
|
|
aa.setdesc(key);
|
|
|
|
|
|
|
|
// Get group (letter)
|
|
|
|
getkeyval(&key, &val);
|
2002-10-26 16:28:01 +00:00
|
|
|
aa.groupid = getgroup(key);
|
2000-02-25 11:04:07 +00:00
|
|
|
|
|
|
|
// Get type
|
|
|
|
word crc = getkeyvalcrc(&key, &val);
|
|
|
|
switch(crc) {
|
|
|
|
case CRC_NET:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.type = GMB_NET;
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.attr = CFG->attribsnet;
|
|
|
|
break;
|
|
|
|
case CRC_ECHO:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.type = GMB_ECHO;
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.attr = CFG->attribsecho;
|
|
|
|
break;
|
|
|
|
case CRC_LOCAL:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.type = GMB_LOCAL;
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.attr = CFG->attribslocal;
|
|
|
|
break;
|
|
|
|
case CRC_EMAIL:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.type = GMB_EMAIL | GMB_NET;
|
2001-11-22 18:57:37 +00:00
|
|
|
aa.attr = CFG->attribsemail;
|
2000-02-25 11:04:07 +00:00
|
|
|
break;
|
|
|
|
case CRC_NEWS:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.type = GMB_NEWSGROUP | GMB_ECHO;
|
2001-11-22 18:57:37 +00:00
|
|
|
aa.attr = CFG->attribsnews;
|
2000-02-25 11:04:07 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void AreaList::GetAreaSep(char* val) {
|
|
|
|
|
|
|
|
char* key;
|
|
|
|
AreaCfg aa;
|
|
|
|
|
|
|
|
aa.reset();
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "SEPARATOR";
|
2000-02-25 11:04:07 +00:00
|
|
|
|
|
|
|
if(not GetAreaFirstPart(aa, key, val))
|
|
|
|
return;
|
|
|
|
|
2002-04-21 12:01:13 +00:00
|
|
|
// Get aka
|
|
|
|
getkeyval(&key, &val);
|
|
|
|
if(not CFG->aka.empty()) // Seed aka with main address
|
|
|
|
aa.aka = CFG->aka[0].addr;
|
|
|
|
|
|
|
|
aa.aka.set(key);
|
|
|
|
|
2000-02-25 11:04:07 +00:00
|
|
|
AddNewArea(&aa);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void AreaList::GetAreaDef(char* val) {
|
|
|
|
|
|
|
|
const word CRC_SEP = 0x2FC6;
|
|
|
|
const word CRC_FIDO = 0x3AC8;
|
|
|
|
const word CRC_OPUS = 0x1254;
|
|
|
|
const word CRC_SDMSG = 0xAEC0;
|
|
|
|
const word CRC_FTS1 = 0xEE2A;
|
|
|
|
const word CRC_FTSC = 0xEE58;
|
|
|
|
const word CRC_QBBS = 0x175B;
|
|
|
|
const word CRC_HUDSON = 0xBAB1;
|
|
|
|
const word CRC_SQUISH = 0xFCF6;
|
|
|
|
const word CRC_EZYCOM = 0xC81B;
|
|
|
|
const word CRC_JAM = 0xA8C3;
|
|
|
|
const word CRC_GOLD = 0x6134;
|
|
|
|
const word CRC_GOLDBASE = 0x560D;
|
|
|
|
const word CRC_PCB = 0x19B7;
|
|
|
|
const word CRC_PCBOARD = 0x84EC;
|
|
|
|
const word CRC_WCAT = 0xAEDB;
|
|
|
|
const word CRC_WILDCAT = 0x7F3A;
|
|
|
|
const word CRC_XBBS = 0xADC3;
|
|
|
|
const word CRC_SMB = 0x27D4;
|
|
|
|
|
|
|
|
char* key;
|
|
|
|
AreaCfg aa;
|
|
|
|
|
|
|
|
aa.reset();
|
|
|
|
|
|
|
|
if(not GetAreaFirstPart(aa, key, val))
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Get format
|
|
|
|
word crc = getkeyvalcrc(&key, &val);
|
|
|
|
getkeyval(&key, &val); // Get path/board
|
|
|
|
switch(crc) {
|
|
|
|
case CRC_SEP:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "SEPARATOR";
|
2000-02-25 11:04:07 +00:00
|
|
|
break;
|
|
|
|
case CRC_FIDO:
|
|
|
|
case CRC_OPUS:
|
|
|
|
case CRC_SDMSG:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "OPUS";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.setpath(key);
|
|
|
|
break;
|
|
|
|
case CRC_FTS1:
|
|
|
|
case CRC_FTSC:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "FTS1";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.setpath(key);
|
|
|
|
break;
|
|
|
|
case CRC_QBBS:
|
|
|
|
case CRC_HUDSON:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "HUDSON";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.board = (uint) atoi(key);
|
|
|
|
if((aa.board < 1) or (aa.board > 200)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CRC_GOLD:
|
|
|
|
case CRC_GOLDBASE:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "GOLDBASE";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.board = atoi(key);
|
|
|
|
if((aa.board < 1) or (aa.board > 500)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CRC_SQUISH:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "SQUISH";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.setpath(key);
|
|
|
|
break;
|
|
|
|
case CRC_SMB:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "SMB";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.setpath(key);
|
|
|
|
break;
|
|
|
|
case CRC_EZYCOM:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "EZYCOM";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.board = atoi(key);
|
|
|
|
break;
|
|
|
|
case CRC_JAM:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "JAM";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.setpath(key);
|
|
|
|
break;
|
|
|
|
case CRC_PCB:
|
|
|
|
case CRC_PCBOARD:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "PCBOARD";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.setpath(key);
|
|
|
|
break;
|
|
|
|
case CRC_WCAT:
|
|
|
|
case CRC_WILDCAT:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "WILDCAT";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.setpath(key);
|
|
|
|
break;
|
|
|
|
case CRC_XBBS:
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "ADEPTXBBS";
|
2000-02-25 11:04:07 +00:00
|
|
|
aa.setpath(key);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get aka
|
|
|
|
getkeyval(&key, &val);
|
|
|
|
if(not CFG->aka.empty()) // Seed aka with main address
|
|
|
|
aa.aka = CFG->aka[0].addr;
|
|
|
|
|
|
|
|
aa.aka.set(key);
|
|
|
|
|
|
|
|
// Get attributes
|
|
|
|
getkeyval(&key, &val);
|
|
|
|
GetAttribstr(&aa.attr, key);
|
|
|
|
|
|
|
|
// Get origin (optional)
|
|
|
|
getkeyval(&key, &val);
|
|
|
|
aa.setorigin(key);
|
|
|
|
|
|
|
|
// Add to arealist
|
|
|
|
AddNewArea(&aa);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ReadEcholist(char* val) {
|
|
|
|
|
|
|
|
AL.ReadEcholist(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void getdztoken(char** key, char** val) {
|
|
|
|
|
|
|
|
char* p = *val;
|
|
|
|
|
|
|
|
*key = p;
|
|
|
|
p = strskip_to(p, ',');
|
|
|
|
if(*p == ',')
|
|
|
|
*p++ = NUL;
|
|
|
|
*val = p;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
2006-04-26 17:06:23 +00:00
|
|
|
void AreaList::ReadEcholist(char* val)
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
char* key;
|
|
|
|
Path file;
|
|
|
|
char buf[256], options[80];
|
|
|
|
bool is_sqafix = false;
|
|
|
|
bool is_dz = false;
|
|
|
|
|
|
|
|
// Get filename or options
|
|
|
|
*file = NUL;
|
|
|
|
*options = NUL;
|
|
|
|
while(*val) {
|
|
|
|
getkeyval(&key, &val);
|
|
|
|
if(*key == '-') {
|
|
|
|
// Get option
|
|
|
|
if(strieql(key+1, "SQAFIX"))
|
|
|
|
is_sqafix = true;
|
|
|
|
else if(strieql(key+1, "DZ"))
|
|
|
|
is_dz = true;
|
|
|
|
else {
|
|
|
|
strcat(options, key);
|
|
|
|
strcat(options, " ");
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
strcpy(file, key);
|
|
|
|
}
|
|
|
|
|
2006-04-26 17:06:23 +00:00
|
|
|
if (*file)
|
|
|
|
{
|
|
|
|
gfile fp(file, "rt", CFG->sharemode);
|
|
|
|
if (fp.isopen())
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
void (*tok)(char**, char**);
|
|
|
|
|
|
|
|
if(is_dz)
|
|
|
|
tok = getdztoken;
|
|
|
|
else
|
|
|
|
tok = getkeyval;
|
|
|
|
|
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 11:04:07 +00:00
|
|
|
|
2006-04-26 17:06:23 +00:00
|
|
|
while (fp.Fgets((val=buf), sizeof(buf)))
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
// Get echoid
|
|
|
|
if(is_sqafix) {
|
|
|
|
tok(&key, &val);
|
|
|
|
if(not strieql(key, "EchoArea"))
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if(is_dz) {
|
2005-10-31 22:18:26 +00:00
|
|
|
if(not g_isalpha(*val) and (*val != ','))
|
2000-02-25 11:04:07 +00:00
|
|
|
continue;
|
|
|
|
tok(&key, &val);
|
|
|
|
}
|
|
|
|
tok(&key, &val);
|
|
|
|
if(*key and (*key != ';') and (*key != '%')) {
|
|
|
|
if(is_sqafix) {
|
|
|
|
char *grp, *desc;
|
|
|
|
tok(&grp, &val);
|
|
|
|
if((desc = strchr(val, '\"')) != NULL) {
|
|
|
|
char *p = strchr(++desc, '\"');
|
|
|
|
if(p)
|
|
|
|
*p = NUL;
|
|
|
|
else
|
|
|
|
desc = NULL;
|
|
|
|
}
|
2007-01-11 22:26:06 +00:00
|
|
|
|
|
|
|
area_iterator ap = idx.begin();
|
|
|
|
area_iterator end = idx.end();
|
|
|
|
|
|
|
|
for (; ap != end; ap++)
|
|
|
|
{
|
|
|
|
if (strieql(key, (*ap)->echoid()))
|
|
|
|
{
|
2005-10-31 22:18:26 +00:00
|
|
|
(*ap)->set_groupid(g_toupper(*grp));
|
2007-01-11 22:26:06 +00:00
|
|
|
if (desc) (*ap)->set_desc(desc);
|
2000-02-25 11:04:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
char *desc;
|
|
|
|
if(is_dz)
|
|
|
|
tok(&desc, &val);
|
|
|
|
else
|
|
|
|
desc = val;
|
2007-01-11 22:26:06 +00:00
|
|
|
|
|
|
|
area_iterator ap = idx.begin();
|
|
|
|
area_iterator end = idx.end();
|
|
|
|
|
|
|
|
for (; ap != end; ap++)
|
|
|
|
{
|
|
|
|
if (strieql(key, (*ap)->echoid()))
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
(*ap)->set_desc(desc);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void AreaList::GetAreaDesc(char* val) {
|
|
|
|
|
|
|
|
char* key;
|
|
|
|
Area* aa = NULL;
|
|
|
|
|
|
|
|
// Get echoid and find area
|
|
|
|
getkeyval(&key, &val);
|
2007-01-11 22:26:06 +00:00
|
|
|
|
|
|
|
area_iterator ap = idx.begin();
|
|
|
|
area_iterator end = idx.end();
|
|
|
|
|
|
|
|
for (; ap != end; ap++)
|
|
|
|
{
|
|
|
|
if (strieql(key, (*ap)->echoid()))
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
aa = *ap;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-01-11 22:26:06 +00:00
|
|
|
|
|
|
|
if (aa == NULL) // Not found, ignore
|
2000-02-25 11:04:07 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
// Get description
|
|
|
|
getkeyval(&key, &val);
|
|
|
|
aa->set_desc(key);
|
|
|
|
|
|
|
|
// Get group letter (optional)
|
|
|
|
getkeyval(&key, &val);
|
|
|
|
if(*key) {
|
|
|
|
if(*key != '-') {
|
2002-10-26 16:28:01 +00:00
|
|
|
aa->set_groupid(getgroup(key));
|
2000-02-25 11:04:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Get aka (optional)
|
|
|
|
getkeyval(&key, &val);
|
|
|
|
if(*key) {
|
|
|
|
|
|
|
|
if(*key != '-') {
|
|
|
|
ftn_addr aka;
|
|
|
|
if(not CFG->aka.empty()) // Seed aka with main address
|
|
|
|
aka = CFG->aka[0].addr;
|
|
|
|
|
|
|
|
aka.set(key);
|
|
|
|
aa->set_aka(aka);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get attributes (optional)
|
|
|
|
getkeyval(&key, &val);
|
|
|
|
if(*key) {
|
|
|
|
|
|
|
|
if(*key != '-') {
|
|
|
|
Attr attr;
|
|
|
|
GetAttribstr(&attr, key);
|
|
|
|
aa->set_attr(attr);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get origin (optional)
|
|
|
|
getkeyval(&key, &val);
|
|
|
|
if(*key)
|
|
|
|
aa->set_origin(key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
Area::Area(gmo_area* a) {
|
|
|
|
|
|
|
|
throw_new(a);
|
|
|
|
|
|
|
|
area = a;
|
|
|
|
adat = NULL;
|
|
|
|
bookmark = 0;
|
|
|
|
marks = 0;
|
|
|
|
unread = 0;
|
|
|
|
isvalidchg = false;
|
|
|
|
isunreadchg = false;
|
|
|
|
isreadmark = false;
|
|
|
|
isreadpm = false;
|
|
|
|
isscanned = false;
|
|
|
|
ispmscanned = false;
|
|
|
|
istossed = false;
|
2005-10-06 22:15:17 +00:00
|
|
|
findfirst = true;
|
2000-02-25 11:04:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
Area::~Area() {
|
|
|
|
|
2001-10-21 17:50:03 +00:00
|
|
|
if(isopen())
|
|
|
|
Close();
|
|
|
|
|
2000-02-25 11:04:07 +00:00
|
|
|
throw_delete(area);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
2007-01-11 22:26:06 +00:00
|
|
|
char* MapPath(char* map, bool reverse)
|
|
|
|
{
|
2001-05-05 21:41:41 +00:00
|
|
|
Path buf, cmap;
|
2000-02-25 11:04:07 +00:00
|
|
|
|
|
|
|
strxcpy(cmap, map, sizeof(Path));
|
|
|
|
if(reverse)
|
|
|
|
strchg(cmap, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
|
|
|
|
|
2007-01-11 22:26:06 +00:00
|
|
|
std::vector< std::pair<std::string, std::string> >::iterator i = CFG->mappath.begin();
|
|
|
|
std::vector< std::pair<std::string, std::string> >::iterator end = CFG->mappath.end();
|
|
|
|
|
|
|
|
for (i; i != end; i++)
|
|
|
|
{
|
2000-02-25 11:04:07 +00:00
|
|
|
const char* p = reverse ? i->second.c_str() : i->first.c_str();
|
|
|
|
const char* q = reverse ? i->first.c_str() : i->second.c_str();
|
|
|
|
if(strnieql(cmap, p, strlen(p))) {
|
|
|
|
strxcpy(buf, map, sizeof(Path));
|
2000-05-11 15:04:44 +00:00
|
|
|
strxmerge(map, sizeof(Path), q, buf+strlen(p), NULL);
|
2000-02-25 11:04:07 +00:00
|
|
|
char sl1, sl2;
|
|
|
|
char* ptr;
|
|
|
|
|
2003-04-16 08:43:49 +00:00
|
|
|
ptr = strpbrk((char *)p, "/\\");
|
2000-02-25 11:04:07 +00:00
|
|
|
sl1 = ptr ? *ptr : NUL;
|
2003-04-16 08:43:49 +00:00
|
|
|
ptr = strpbrk((char *)q, "/\\");
|
2000-02-25 11:04:07 +00:00
|
|
|
sl2 = ptr ? *ptr : NUL;
|
|
|
|
|
2000-05-11 15:04:44 +00:00
|
|
|
if(sl1 and sl2 and (sl1 != sl2))
|
2000-02-25 11:04:07 +00:00
|
|
|
strchg(map, sl1, sl2);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-09-29 16:06:10 +00:00
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Set area origin
|
|
|
|
|
2007-01-11 22:26:06 +00:00
|
|
|
int AreaCfgBase::setorigin(std::string& _origin)
|
|
|
|
{
|
|
|
|
if (not strblank(_origin.c_str()))
|
|
|
|
{
|
2002-09-29 16:06:10 +00:00
|
|
|
// Check if it already exists
|
2007-01-11 22:26:06 +00:00
|
|
|
gstrarray::iterator n = CFG->origin.begin();
|
|
|
|
gstrarray::iterator end = CFG->origin.end();
|
|
|
|
|
|
|
|
for (originno = 0; n != end; originno++, n++)
|
|
|
|
{
|
|
|
|
if (*n == _origin)
|
2002-09-29 16:06:10 +00:00
|
|
|
return originno;
|
2007-01-11 22:26:06 +00:00
|
|
|
}
|
2002-09-29 16:06:10 +00:00
|
|
|
|
|
|
|
// Not found, so add it
|
|
|
|
CfgOrigin(_origin.c_str());
|
|
|
|
// originno = CFG->origin.size()-1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return originno;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Set area echoid
|
|
|
|
|
|
|
|
const char* AreaCfg::setautoid(const char* _echoid) {
|
|
|
|
|
|
|
|
return strxcpy(echoid, CFG->areaautoid ? "" : _echoid, sizeof(Echo));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-02-25 11:04:07 +00:00
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|