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 Terminate Mail (TMAIL).
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <gcrcall.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_NOTERMAIL
|
2000-02-25 10:15:17 +00:00
|
|
|
#include <gedacfg.h>
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void gareafile::ReadTmailFile(char* file, char* options, char* origin) {
|
|
|
|
|
|
|
|
const word CRC_NAME = 0x3B63;
|
|
|
|
const word CRC_ADDRESS = 0xFDD6;
|
|
|
|
const word CRC_NETMAIL = 0xE42E;
|
|
|
|
const word CRC_AREAFILE = 0xB487;
|
|
|
|
const word CRC_ORIGIN = 0x4CE5;
|
|
|
|
const word CRC_ECHOFILE = 0x3EAA;
|
|
|
|
const word CRC_DESC = 0x8A2A;
|
|
|
|
|
|
|
|
AreaCfg aa;
|
|
|
|
char buf[512];
|
|
|
|
|
|
|
|
FILE* fp = fsopen(file, "rb", sharemode);
|
2006-01-17 17:47:35 +00:00
|
|
|
if (fp)
|
|
|
|
{
|
2000-02-25 10:15:17 +00:00
|
|
|
setvbuf(fp, NULL, _IOFBF, 8192);
|
|
|
|
|
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
|
|
|
|
|
|
|
aa.reset();
|
|
|
|
|
|
|
|
while(fgets(buf, sizeof(buf), fp)) {
|
|
|
|
|
|
|
|
char* ptr = strskip_wht(strtrim(buf));
|
|
|
|
if(*ptr != '%' and *ptr) {
|
|
|
|
|
2002-09-29 16:06:10 +00:00
|
|
|
aa.type = GMB_NONE;
|
2000-02-25 10:15:17 +00:00
|
|
|
|
|
|
|
char* key;
|
|
|
|
char* val = ptr;
|
|
|
|
switch(getkeyvalcrc(&key, &val)) {
|
|
|
|
case CRC_NAME:
|
|
|
|
CfgUsername(val);
|
|
|
|
break;
|
|
|
|
case CRC_ADDRESS:
|
|
|
|
CfgAddress(val);
|
|
|
|
break;
|
|
|
|
case CRC_NETMAIL:
|
|
|
|
aa.reset();
|
|
|
|
aa.type = GMB_NET;
|
|
|
|
aa.attr = attribsnet;
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = fidomsgtype;
|
2000-02-25 10:15:17 +00:00
|
|
|
aa.setdesc("Terminate Netmail");
|
|
|
|
aa.setautoid("NETMAIL");
|
|
|
|
adjustpath(val);
|
|
|
|
aa.setpath(val);
|
|
|
|
aa.setorigin(origin);
|
|
|
|
AddNewArea(aa);
|
|
|
|
break;
|
|
|
|
case CRC_AREAFILE:
|
|
|
|
adjustpath(val);
|
|
|
|
ReadAreasBBS(val);
|
|
|
|
break;
|
|
|
|
case CRC_ORIGIN:
|
|
|
|
strcpy(origin, val);
|
|
|
|
break;
|
|
|
|
case CRC_ECHOFILE:
|
|
|
|
adjustpath(val);
|
|
|
|
ReadEcholist(val);
|
|
|
|
break;
|
|
|
|
case CRC_DESC:
|
|
|
|
getkeyval(&key, &val);
|
|
|
|
ptr = key;
|
|
|
|
getkeyval(&key, &val);
|
|
|
|
strchg(key, '_', ' ');
|
|
|
|
strtrim(key);
|
|
|
|
SetAreaDesc(ptr, key);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Read areas from TMAIL
|
|
|
|
|
|
|
|
void gareafile::ReadTmail(char* tag) {
|
|
|
|
|
|
|
|
char origin[80];
|
|
|
|
char options[80];
|
|
|
|
Path file, path, tmailcfg;
|
|
|
|
|
|
|
|
*path = NUL;
|
|
|
|
*origin = NUL;
|
|
|
|
strcpy(tmailcfg, "tmail.cfg");
|
|
|
|
strcpy(options, tag);
|
|
|
|
char* ptr = strtok(tag, " \t");
|
|
|
|
while(ptr) {
|
|
|
|
if(*ptr != '-') {
|
|
|
|
AddBackslash(strcpy(path, ptr));
|
|
|
|
}
|
|
|
|
else {
|
2005-10-31 22:18:26 +00:00
|
|
|
if(g_toupper(*(++ptr)) == 'C') {
|
2000-02-25 10:15:17 +00:00
|
|
|
if(*(++ptr) == ':')
|
|
|
|
ptr++;
|
|
|
|
strcpy(tmailcfg, ptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ptr = strtok(NULL, " \t");
|
|
|
|
}
|
|
|
|
if(*path == NUL) {
|
|
|
|
ptr = getenv("TMAIL");
|
|
|
|
if(ptr)
|
|
|
|
AddBackslash(strcpy(path, ptr));
|
|
|
|
}
|
|
|
|
|
|
|
|
MakePathname(file, path, tmailcfg);
|
|
|
|
if(not fexist(file)) {
|
|
|
|
strcpy(tmailcfg, "tm.cfg");
|
|
|
|
MakePathname(file, path, tmailcfg);
|
|
|
|
}
|
|
|
|
|
|
|
|
strcpy(pathprefix, path);
|
|
|
|
ReadTmailFile(file, options, origin);
|
|
|
|
*pathprefix = NUL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|