2000-02-25 10:15:17 +00:00
|
|
|
// This may look like C code, but it is really -*- C++ -*-
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// The Goldware Library
|
2002-05-12 13:07:37 +00:00
|
|
|
// Copyright (C) 1999, 2002 Alexander S. Aganichev
|
2000-02-25 10:15:17 +00:00
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// 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 QEcho (by Eugene Sorochinsky)
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
#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_NOQECHO
|
2000-02-25 10:15:17 +00:00
|
|
|
#include <gedacfg.h>
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
|
|
|
|
void gareafile::ReadQEchoFile(char* file, char* options, char* origin) {
|
|
|
|
|
|
|
|
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)
|
|
|
|
STD_PRINT("* Reading " << file << std::endl);
|
2000-02-25 10:15:17 +00:00
|
|
|
|
|
|
|
while(fgets(buf, sizeof(buf), fp)) {
|
|
|
|
|
|
|
|
char* ptr = strtok(buf, " \t");
|
|
|
|
aa.reset();
|
2002-05-12 13:07:37 +00:00
|
|
|
|
|
|
|
if(isdigit(*ptr))
|
|
|
|
aa.groupid = 0x8000+atoi(ptr);
|
2005-10-31 22:18:26 +00:00
|
|
|
else if(g_isalpha(*ptr))
|
|
|
|
aa.groupid = g_toupper(*ptr);
|
2000-02-25 10:15:17 +00:00
|
|
|
|
|
|
|
if((ptr = strtok(NULL, " \t")) != NULL) {
|
|
|
|
if(*ptr == '*') {
|
|
|
|
// skip ExpireDays
|
|
|
|
if((ptr = strtok(NULL, " \t")) == NULL)
|
|
|
|
continue;
|
|
|
|
if((ptr = strtok(NULL, " \t")) == NULL)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
aa.type = GMB_ECHO;
|
|
|
|
aa.setechoid(ptr);
|
|
|
|
if((ptr = strtok(NULL, " \t")) != NULL)
|
|
|
|
if(not strieql("Passthrough", ptr)) {
|
2001-05-05 21:41:41 +00:00
|
|
|
aa.setpath(ptr);
|
2003-12-10 08:35:16 +00:00
|
|
|
aa.basetype = "JAM";
|
2000-02-25 10:15:17 +00:00
|
|
|
if((ptr = strtok(NULL, " \t")) != NULL)
|
|
|
|
if((*ptr == '*') and ((ptr = strtok(NULL, " \t")) != NULL)) {
|
|
|
|
CfgAddress(ptr);
|
|
|
|
aa.aka.set(ptr);
|
|
|
|
aa.attr = attribsecho;
|
|
|
|
aa.setorigin(origin);
|
|
|
|
AddNewArea(aa);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|
|
|
|
// Read areas from QEcho (echomail processor)
|
|
|
|
|
|
|
|
void gareafile::ReadQEcho(char* tag) {
|
|
|
|
|
|
|
|
char origin[80];
|
|
|
|
char options[80];
|
|
|
|
Path file;
|
|
|
|
|
|
|
|
*origin = NUL;
|
|
|
|
*file = NUL;
|
2005-12-08 18:48:15 +00:00
|
|
|
options[79] = 0;
|
|
|
|
strncpy(options, tag, 79);
|
2000-02-25 10:15:17 +00:00
|
|
|
char* ptr = strtok(tag, " \t");
|
|
|
|
while(ptr) {
|
|
|
|
if(*ptr != '-')
|
|
|
|
strcpy(file, ptr);
|
|
|
|
ptr = strtok(NULL, " \t");
|
|
|
|
}
|
|
|
|
|
|
|
|
if(not *file)
|
|
|
|
strcpy(file, "/etc/qecho/AreaList");
|
|
|
|
|
|
|
|
ReadQEchoFile(file, options, origin);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------
|