Initial revision.

This commit is contained in:
Alexander S. Aganichev 2000-02-25 11:04:07 +00:00
parent 5932b8817b
commit c451e3fb50
85 changed files with 47662 additions and 0 deletions

20
golded3/Makefile Normal file
View File

@ -0,0 +1,20 @@
# -*- makefile -*-
TOP=..
SHORTTARGET=ged
TARGET=golded3
GLIBS=gmb3 gall gcfg uulib
INCS=-I. -I$(TOP)/goldlib/gall -I$(TOP)/goldlib/gcfg -I$(TOP)/goldlib/gmb3 -I$(TOP)/goldlib/uulib
ifeq ($(findstring EMX, $(PATH)), EMX)
STDLIBS=-los2me -lstdcpp
GLIBS+=glibc
else
ifeq ($(TERM),cygwin)
STDLIBS=-luser32 -lwinmm
GLIBS+=glibc
endif
endif
include $(TOP)/GNUmakef.inc
include $(TOP)/GNUmakef.prg

441
golded3/gcalst.cpp Normal file
View File

@ -0,0 +1,441 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Arealist configuration and other one-time stuff.
// ------------------------------------------------------------------
#include <cerrno>
#include <fcntl.h>
#include <golded.h>
#include <gmoprot.h>
// FTS-0001 is FTS so leave it anyway :-)
#include <gmofido.h>
#ifndef GMB_NOEZY
#include <gmoezyc.h>
#endif
#if not defined(GMB_NOHUDS) and not defined(GMB_NOGOLD)
#include <gmohuds.h>
#endif
#ifndef GMB_NOJAM
#include <gmojamm.h>
#endif
#ifndef GMB_NOSQSH
#include <gmosqsh.h>
#endif
#ifndef GMB_NOPCB
#include <gmopcbd.h>
#endif
#ifndef GMB_NOWCAT
#include <gmowcat.h>
#endif
#ifndef GMB_NOXBBS
#include <gmoxbbs.h>
#endif
#ifndef GMB_NOSMB
#include <gmosmb.h>
#endif
// ------------------------------------------------------------------
// Arealist constructor
AreaList::AreaList() : idx() {
item = idx.begin();
*sortspec = NUL;
for(uint i = 0; i < 16; i++)
*alistselections[0] = NUL;
}
// ------------------------------------------------------------------
// Arealist destructor
AreaList::~AreaList() {
Reset();
}
// ------------------------------------------------------------------
void AreaList::SetDefaultMarks() {
strcpy(alistselections[0], LNG->ArealistSelections1);
for(uint i = 1; i < 16; i++)
strcpy(alistselections[i], LNG->ArealistSelections2);
}
// ------------------------------------------------------------------
// Arealist deallocate and reset data
void AreaList::Reset() {
ListScan.Reset();
while(not idx.empty()) {
delete idx.back();
idx.pop_back();
}
}
// ------------------------------------------------------------------
// Return a new'ed area of the specified format
Area* AreaList::NewArea(int msgbase) {
gmo_area* ap = NULL;
switch(msgbase) {
case MT_SEPARATOR: ap = new SepArea; break;
case MT_FTS1:
case MT_OPUS: ap = new FidoArea; break;
#ifndef GMB_NOEZY
case MT_EZYCOM: ap = new EzycomArea; break;
#endif
#ifndef GMB_NOGOLD
case MT_GOLDBASE: ap = new GoldArea; break;
#endif
#ifndef GMB_NOHUDS
case MT_HUDSON: ap = new HudsArea; break;
#endif
#ifndef GMB_NOJAM
case MT_JAM: ap = new JamArea; break;
#endif
#ifndef GMB_NOPCB
case MT_PCBOARD: ap = new PcbArea; break;
#endif
#ifndef GMB_NOSQSH
case MT_SQUISH: ap = new SquishArea; break;
#endif
#ifndef GMB_NOWCAT
case MT_WILDCAT: ap = new WCatArea; break;
#endif
#ifndef GMB_NOXBBS
case MT_ADEPTXBBS: ap = new XbbsArea; break;
#endif
#ifndef GMB_NOSMB
case MT_SMB: ap = new SMBArea; break;
#endif
}
return new Area(ap);
}
// ------------------------------------------------------------------
// Write lastreads for the next session
void AreaList::WriteGoldLast() {
word GOLDLAST_VER = CUR_GOLDLAST_VER;
gfile fp;
ggoldlast entry;
Path lst;
strcpy(lst, AddPath(CFG->goldpath, CFG->goldlast));
fp.fopen(lst, "wb", CFG->sharemode);
if(fp.isopen()) {
fp.setvbuf(NULL, _IOFBF, 8192);
fp.fwrite(&GOLDLAST_VER, sizeof(word));
fp.fwrite(AL.alistselections, sizeof(AL.alistselections));
for(area_iterator ap = idx.begin(); ap != idx.end(); ap++) {
if((*ap)->isscanned and not (*ap)->isseparator()) {
// Write fixed header
entry.crcechoid = strCrc32((*ap)->echoid(), false);
entry.lastread = (*ap)->lastread();
entry.msgncount = (*ap)->Msgn.Count();
entry.unread = (*ap)->unread;
entry.marks = (*ap)->marks;
entry.flags = 0;
if((*ap)->isscanned)
entry.flags |= 1;
if((*ap)->isvalidchg)
entry.flags |= 2;
if((*ap)->isunreadchg)
entry.flags |= 4;
fp.fwrite(&entry, sizeof(entry));
// Write variable length extensions
(*ap)->Mark.Save(fp);
(*ap)->PMrk.Save(fp);
}
}
fp.fclose();
}
}
// ------------------------------------------------------------------
// Read the lastreads from the last session
void AreaList::ReadGoldLast() {
word GOLDLAST_VER;
gfile fp;
ggoldlast entry;
fp.fopen(AddPath(CFG->goldpath, CFG->goldlast), "rb", CFG->sharemode);
if(fp.isopen()) {
fp.setvbuf(NULL, _IOFBF, 8192);
fp.fread(&GOLDLAST_VER, sizeof(word));
if(GOLDLAST_VER != CUR_GOLDLAST_VER) {
fp.close();
return;
}
fp.fread(AL.alistselections, sizeof(AL.alistselections));
while(fp.fread(&entry, sizeof(entry))) {
bool found = false;
for(area_iterator ap = idx.begin(); ap != idx.end(); ap++) {
if(strCrc32((*ap)->echoid(), false) == entry.crcechoid) {
(*ap)->set_lastread(entry.lastread);
(*ap)->Msgn.count = entry.msgncount;
(*ap)->unread = entry.unread;
(*ap)->marks = entry.marks;
(*ap)->isscanned = (entry.flags & 1) ? true : false;
(*ap)->isvalidchg = (entry.flags & 2) ? true : false;
(*ap)->UpdateAreadata();
(*ap)->isunreadchg = (entry.flags & 4) ? true : false;
(*ap)->Mark.Load(fp);
(*ap)->PMrk.Load(fp);
found = true;
break;
}
}
if(not found) {
// skip stored message marks
dword dw;
fp.fread(&dw, sizeof(dword));
fp.fseek(dw*sizeof(dword), SEEK_CUR);
fp.fread(&dw, sizeof(dword));
fp.fseek(dw*sizeof(dword), SEEK_CUR);
}
}
fp.fclose();
}
}
// ------------------------------------------------------------------
// Write all areas to GOLDAREA.INC in AREADEF format
void AreaList::WriteAreaDef(const char* file) {
int tmp;
FILE* fp;
Path path;
char groupid[10], echoid[sizeof(Echo)+2];
int maxechoid=0, maxdesc=0, maxgroupid=0, maxpath=0, maxaddr=0, maxattr=0;
char desc[sizeof(Desc)+2], type[6], msgbase[7], addr[40], attr[150], origin[163];
fp = fsopen(file, "wt", CFG->sharemode);
if(fp) {
area_iterator aa;
for(aa = idx.begin(); aa != idx.end(); aa++) {
tmp = strlen((*aa)->echoid());
if(strchr((*aa)->echoid(), ' '))
tmp += 2;
maxechoid = MaxV(maxechoid, tmp);
tmp = strlen((*aa)->desc())+2;
maxdesc = MaxV(maxdesc, tmp);
tmp = strlen((*aa)->path());
if(strchr((*aa)->path(), ' '))
tmp += 2;
maxpath = MaxV(maxpath, tmp);
if((*aa)->groupid() & 0x8000u)
sprintf(groupid, "#%u", (*aa)->groupid()&0x7FFF);
else if(isupper((*aa)->groupid()))
*groupid = (char)(*aa)->groupid(), groupid[1] = NUL;
else
*groupid = '0', groupid[1] = NUL;
tmp = strlen(groupid);
maxgroupid = MaxV(maxgroupid, tmp);
if(memcmp(&(*aa)->aka(), &CFG->aka[0], sizeof(Addr)))
(*aa)->aka().make_string(addr);
else
strcpy(addr, ".");
tmp = strlen(addr);
maxaddr = MaxV(maxaddr, tmp);
tmp = strlen(MakeAttrStr(attr, &(*aa)->attr()));
maxattr = MaxV(maxattr, tmp+2);
}
for(aa = idx.begin(); aa != idx.end(); aa++) {
sprintf(desc, "\"%s\"", (*aa)->desc());
if((*aa)->groupid() & 0x8000u)
sprintf(groupid, "#%u", (*aa)->groupid()&0x7FFF);
else if(isupper((*aa)->groupid()))
*groupid = (char)(*aa)->groupid(), groupid[1] = NUL;
else
*groupid = '0', groupid[1] = NUL;
if((*aa)->isemail())
strcpy(type, "EMail");
else if((*aa)->isnewsgroup())
strcpy(type, "News ");
else if((*aa)->isnet())
strcpy(type, "Net ");
else if((*aa)->isecho())
strcpy(type, "Echo ");
else if((*aa)->islocal())
strcpy(type, "Local");
switch((*aa)->msgbase()) {
case MT_OPUS: strcpy(msgbase, "Opus "); break;
case MT_FTS1: strcpy(msgbase, "Fts1 "); break;
#ifndef GMB_NOHUDS
case MT_HUDSON: strcpy(msgbase, "Hudson"); break;
#endif
#ifndef GMB_NOGOLD
case MT_GOLDBASE: strcpy(msgbase, "Gold "); break;
#endif
#ifndef GMB_NOSQSH
case MT_SQUISH: strcpy(msgbase, "Squish"); break;
#endif
#ifndef GMB_NOEZY
case MT_EZYCOM: strcpy(msgbase, "Ezycom"); break;
#endif
#ifndef GMB_NOJAM
case MT_JAM: strcpy(msgbase, "Jam "); break;
#endif
#ifndef GMB_NOPCB
case MT_PCBOARD: strcpy(msgbase, "Pcb "); break;
#endif
#ifndef GMB_NOWCAT
case MT_WILDCAT: strcpy(msgbase, "WCat "); break;
#endif
#ifndef GMB_NOXBBS
case MT_ADEPTXBBS: strcpy(msgbase, "XBBS "); break;
#endif
#ifndef GMB_NOSMB
case MT_SMB: strcpy(msgbase, "SMB "); break;
#endif
}
if(strchr((*aa)->echoid(), ' '))
sprintf(echoid, "\"%s\"", (*aa)->echoid());
else
strcpy(echoid, (*aa)->echoid());
if((*aa)->isseparator()) {
fprintf(fp, "AREASEP %-*s %-*s %*s %s\n",
maxechoid, echoid,
maxdesc, desc,
maxgroupid, groupid,
strtrim(type)
);
}
else {
if(strchr((*aa)->path(), ' '))
sprintf(path, "\"%s\"", (*aa)->path());
else
strcpy(path, (*aa)->path());
if(memcmp(&(*aa)->aka(), &CFG->aka[0], sizeof(Addr)))
(*aa)->aka().make_string(addr);
else
strcpy(addr, ".");
*attr = '('; /*)*/
MakeAttrStr(attr+1, &(*aa)->attr());
strcat(attr, /*(*/ ")");
if((*aa)->originno())
sprintf(origin, " \"%.*s\"", (int)sizeof(origin)-4, CFG->origin[(*aa)->originno()].c_str());
else
*origin = NUL;
fprintf(fp, "AREADEF %-*s %-*s %*s %s %s %-*s %-*s %-*s%s\n",
maxechoid, echoid,
maxdesc, desc,
maxgroupid, groupid,
type,
msgbase,
maxpath, path,
maxaddr, addr,
maxattr, attr,
origin
);
}
}
fclose(fp);
}
}
// ------------------------------------------------------------------
void SetAreaDesc(char* echoid, char* desc) {
AL.SetAreaDesc(echoid, desc);
}
// ------------------------------------------------------------------
void AreaList::SetAreaDesc(char* echoid, char* desc) {
for(area_iterator ap = idx.begin(); ap != idx.end(); ap++) {
if(strieql(echoid, (*ap)->echoid())) {
(*ap)->set_desc(desc);
break;
}
}
}
// ------------------------------------------------------------------
void PcbAdjustArea(uint rec, const char* msgfile) {
for(uint n=0; n<AL.size(); n++) {
Area* a = AL[n];
if(a->ispcboard()) {
if((a->board() == rec) and (*a->path() == NUL)) {
a->set_path(msgfile);
break;
}
else if(strieql(a->path(), msgfile)) {
a->set_board(rec);
break;
}
}
}
}
// ------------------------------------------------------------------

1119
golded3/gcarea.cpp Normal file

File diff suppressed because it is too large Load Diff

881
golded3/gccfgg.cpp Normal file
View File

@ -0,0 +1,881 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Main GOLDED.CFG compiler.
// ------------------------------------------------------------------
#include <golded.h>
#include <gmoprot.h>
// ------------------------------------------------------------------
extern char v7nodeflags[16][9];
extern char v7modemtype[8][9];
// ------------------------------------------------------------------
// Read GOLDED.CFG
bool ReadGoldedCfg(int& force) {
gfile fp;
CfgInit2();
Path golded_cfg;
strcpy(golded_cfg, AddPath(CFG->goldpath, CFG->goldcfg));
if(ReadCfg(golded_cfg)) {
// Unallocate echolist
AFILE->echolist.FreeAll();
// Set default paths
if(*CFG->temppath == NUL) strcpy(CFG->temppath, CFG->goldpath);
if(*CFG->areapath == NUL) strcpy(CFG->areapath, CFG->goldpath);
if(*CFG->inboundpath == NUL) strcpy(CFG->inboundpath, CFG->goldpath);
if(*CFG->soundpath == NUL) strcpy(CFG->soundpath, CFG->goldpath);
if(*CFG->cookiepath == NUL) strcpy(CFG->cookiepath, CFG->goldpath);
if(*CFG->templatepath == NUL) strcpy(CFG->templatepath, CFG->goldpath);
if(*CFG->squishuserpath == NUL) {
char* ptr = getenv("MAXIMUS");
if(ptr) {
if(is_dir(ptr))
AddBackslash(strcpy(CFG->squishuserpath, ptr));
}
else {
ptr = getenv("SQUISH");
if(ptr)
AddBackslash(strcpy(CFG->squishuserpath, ptr));
else
strcpy(CFG->squishuserpath, CFG->areapath);
}
}
if(*CFG->hudsonpath == NUL) strcpy(CFG->hudsonpath, CFG->goldpath);
if(*CFG->hudsonsyspath == NUL) strcpy(CFG->hudsonsyspath, CFG->hudsonpath);
if(*CFG->goldbasepath == NUL) strcpy(CFG->goldbasepath, CFG->hudsonpath);
if(*CFG->goldbasesyspath == NUL) strcpy(CFG->goldbasesyspath, CFG->goldbasepath);
if(*CFG->jampath == NUL) strcpy(CFG->jampath, CFG->hudsonpath);
MakePathname(CFG->goldcfg, CFG->goldpath, CFG->goldcfg);
MakePathname(CFG->helpcfg.fn, CFG->goldpath, CFG->helpcfg.fn);
MakePathname(CFG->helpged, CFG->goldpath, CFG->helpged);
MakePathname(CFG->keyscfg, CFG->goldpath, CFG->keyscfg);
MakePathname(CFG->langcfg, CFG->goldpath, CFG->langcfg);
MakePathname(CFG->xlatged, CFG->goldpath, CFG->xlatged);
MakePathname(CFG->confirmfile, CFG->goldpath, CFG->confirmfile);
MakePathname(CFG->logfile, CFG->goldpath, CFG->logfile);
MakePathname(CFG->userlistfile, CFG->nodepath, CFG->userlistfile);
MakePathname(CFG->outputfile, CFG->goldpath, CFG->outputfile);
MakePathname(CFG->inputfile, CFG->goldpath, CFG->inputfile);
if(*CFG->souptosslog)
MakePathname(CFG->souptosslog, CFG->goldpath, CFG->souptosslog);
vector<Tpl>::iterator t;
for(t = CFG->tpl.begin(); t != CFG->tpl.end(); t++)
MakePathname(t->file, CFG->templatepath, t->file);
MakePathname(CFG->semaphore.importlist, CFG->areapath, CFG->semaphore.importlist);
MakePathname(CFG->semaphore.exportlist, CFG->areapath, CFG->semaphore.exportlist);
MakePathname(CFG->semaphore.echoscan, CFG->areapath, CFG->semaphore.echoscan);
MakePathname(CFG->semaphore.netscan, CFG->areapath, CFG->semaphore.netscan);
MakePathname(CFG->semaphore.scanall, CFG->goldpath, CFG->semaphore.scanall);
MakePathname(CFG->semaphore.scanthis, CFG->goldpath, CFG->semaphore.scanthis);
MakePathname(CFG->semaphore.scannetmail,CFG->goldpath, CFG->semaphore.scannetmail);
MakePathname(CFG->semaphore.pmscanall, CFG->goldpath, CFG->semaphore.pmscanall);
MakePathname(CFG->semaphore.pmscanthis, CFG->goldpath, CFG->semaphore.pmscanthis);
MakePathname(CFG->semaphore.pmscannetmail, CFG->goldpath, CFG->semaphore.pmscannetmail);
MakePathname(CFG->semaphore.qwkimport, CFG->goldpath, CFG->semaphore.qwkimport);
MakePathname(CFG->semaphore.qwkexport, CFG->goldpath, CFG->semaphore.qwkexport);
MakePathname(CFG->semaphore.soupimport, CFG->goldpath, CFG->semaphore.soupimport);
MakePathname(CFG->semaphore.soupexport, CFG->goldpath, CFG->semaphore.soupexport);
MakePathname(CFG->semaphore.exitnow, CFG->goldpath, CFG->semaphore.exitnow);
strschg_environ(CFG->jampath);
strschg_environ(CFG->semaphore.importlist);
strschg_environ(CFG->semaphore.exportlist);
strschg_environ(CFG->semaphore.echoscan);
strschg_environ(CFG->semaphore.netscan);
if(strieql(CFG->semaphore.exportlist, AddPath(CFG->jampath, "echomail.jam"))) {
cout << "* Warning: SEMAPHORE EXPORTLIST must not be the same as ECHOMAIL.JAM!" << endl;
SayBibi();
cfgerrors++;
}
}
// Set default xlatimport
if(*CFG->xlatimport == NUL)
strcpy(CFG->xlatimport, CFG->xlatlocalset);
ReadXlatTables();
// Free all mapfile name allocations
vector<Map>::iterator xlt;
for(xlt = CFG->xlatescset.begin(); xlt != CFG->xlatescset.end(); xlt++)
throw_release(xlt->mapfile);
for(xlt = CFG->xlatcharset.begin(); xlt != CFG->xlatcharset.end(); xlt++)
throw_release(xlt->mapfile);
return true;
}
// ------------------------------------------------------------------
// Write GOLDED.GED
void WriteGoldGed() {
// Mark areas according to scan/pmscan in/excludes
for(AL.item = AL.idx.begin(); AL.item != AL.idx.end(); AL.item++) {
gstrarray::iterator i;
// Check scan in/excludes
for(i = CFG->areascan.begin(); i != CFG->areascan.end(); i++) {
if(strwild((*AL.item)->echoid(), i->c_str())) {
(*AL.item)->set_scan(true);
break;
}
}
for(i = CFG->areascanexcl.begin(); i != CFG->areascanexcl.end(); i++) {
if(strwild((*AL.item)->echoid(), i->c_str())) {
(*AL.item)->set_scanexcl(true);
break;
}
}
for(i = CFG->areascanincl.begin(); i != CFG->areascanincl.end(); i++) {
if(strwild((*AL.item)->echoid(), i->c_str())) {
(*AL.item)->set_scanincl(true);
break;
}
}
// Check pmscan in/excludes
for(i = CFG->areapmscan.begin(); i != CFG->areapmscan.end(); i++) {
if(strwild((*AL.item)->echoid(), i->c_str())) {
(*AL.item)->set_pmscan(true);
break;
}
}
for(i = CFG->areapmscanexcl.begin(); i != CFG->areapmscanexcl.end(); i++) {
if(strwild((*AL.item)->echoid(), i->c_str())) {
(*AL.item)->set_pmscanexcl(true);
break;
}
}
for(i = CFG->areapmscanincl.begin(); i != CFG->areapmscanincl.end(); i++) {
if(strwild((*AL.item)->echoid(), i->c_str())) {
(*AL.item)->set_pmscanincl(true);
break;
}
}
}
// Release lists memory
CFG->areaexcl.clear();
CFG->areaincl.clear();
CFG->areaisemail.clear();
CFG->areaisnews.clear();
CFG->areascan.clear();
CFG->areascanexcl.clear();
CFG->areascanincl.clear();
CFG->arearename.clear();
CFG->areapmscan.clear();
CFG->areapmscanexcl.clear();
CFG->areapmscanincl.clear();
}
// ------------------------------------------------------------------
static int EnterString(char* prompt, char* string, uint length) {
cout << prompt << endl << "> " << flush;
*string = NUL;
char* ptr = string;
uint pos = 0;
gkey k;
while(1) {
k = kbxget();
if(k == Key_BS) {
if(pos) {
cout << "\b \b" << flush;
pos--;
*(--ptr) = NUL;
}
}
else if(k == Key_Esc) {
cout << endl;
*string = NUL;
return -1;
}
else if(k == Key_Ent) {
cout << endl;
*ptr = NUL;
break;
}
else {
if(pos < length) {
char c = (char)k;
if(c) {
cout << c << flush;
*ptr++ = c;
pos++;
}
}
}
}
if(*string == NUL)
return 1;
return 0;
}
// ------------------------------------------------------------------
struct AF_entry {
char* env;
char* configname;
char* name;
};
struct AF_entry idetect[] = {
{ "DUTCHIE", "dutchie.are", "Dutchie" },
{ "EZY", "constant.ezy", "Ezycom" },
{ "FASTECHO", "fastecho.cfg", "Fastecho" },
{ "FIDOPCB", "fidopcb.cfg", "FidoPCB" },
{ "FMAIL", "fmail.cfg", "FMail" },
{ "IMAIL", "imail.cf", "IMAIL" },
{ "PCBOARD", "pcboard.dat", "PCBoard" },
{ "POPCMDLINE", "portal.are", "Portal" },
{ "RA", "config.pro", "ProBoard" },
{ "QFRONT", "qechos.dat", "QFront" },
{ "RAECHO", "areas.rae", "RA-ECHO" },
{ "RA", "config.ra", "RemoteAccess" },
{ "TIMED", "timed.cfg", "timEd" },
{ "TM", "tm.cfg", "Termail" },
{ "WMAIL", "wmail.prm", "WMail" },
{ "XM", "xmail.cfg", "XMail" },
{ "FD", "areafile.fd", "TosScan" },
{ "GE", "setup.ge", "GEcho" },
{ "FD", "setup.fd", "FrontDoor" },
{ "FD", "fd.sys", "FrontDoor" },
{ "OPUS", "sysmsg.dat", "Opus" },
{ "LORA", "sysmsg.dat", "LoraBBS" },
{ "LORABBS", "sysmsg.dat", "LoraBBS" },
{ "FIDOCONFIG", "", "Fidoconfig" },
{ "DB", "dbridge.prm", "D\'Bridge" },
{ "DBRIDGE", "dbridge.prm", "D\'Bridge" },
{ "SUPERBBS", "sconfig.bbs", "SuperBBS" },
{ "SBBS", "sconfig.bbs", "SuperBBS" },
{ "QUICKBBS", "quickcfg.dat", "QuickBBS" },
{ "QBBS", "quickcfg.dat", "QuickBBS" },
{ "QUICKBBS", "config.bbs", "QuickBBS" },
{ "QBBS", "config.bbs", "QuickBBS" },
{ "SQUISH", "squish.cfg", "Squish" }
};
void InstallDetect(char* path) {
// Create GOLDED.BAK file if there is an existing GOLDED.CFG
if(fexist(CFG->goldcfg)) {
Path cmdlinecfgbak;
replaceextension(cmdlinecfgbak, CFG->goldcfg, ".bak");
if(fexist(cmdlinecfgbak))
remove(cmdlinecfgbak);
rename(CFG->goldcfg, cmdlinecfgbak);
cout << "WARNING: Existing config backed up to " << cmdlinecfgbak << "!!!" << endl;
}
cout << "Please wait while GoldED+ is detecting your software." << endl;
FILE* fp = fopen(CFG->goldcfg, "wt");
if(fp) {
if(*path) {
PathCopy(CFG->areapath, path);
fprintf(fp, "AREAPATH %s\n", path);
}
Path pth;
char* ptr;
bool gotareasbbs = false;
bool gotsquish = false;
bool detected = false;
// simple detection
for(uint i = 0; i < sizeof(idetect)/sizeof(struct AF_entry); i++) {
strcpy(pth, CFG->areapath);
ptr = getenv(idetect[i].env);
if(ptr) {
PathCopy(pth, ptr);
// skip additional information
ptr = strchr(pth, ' ');
if(ptr)
*ptr = NUL;
}
if(fexist(AddPath(pth, idetect[i].configname))) {
fprintf(fp, "AREAFILE %s %s\n", idetect[i].name, pth);
cout << "Found " << idetect[i].name << (ptr ? "." : " (unreliable).") << endl;
if(streql(idetect[i].name, "Squish"))
gotsquish = true;
detected = true;
}
}
// Detect InterMail
strcpy(pth, CFG->areapath);
ptr = getenv("IM");
if(ptr)
PathCopy(pth, ptr);
if(fexist(AddPath(pth, "im.exe")) or fexist(AddPath(pth, "intrecho.exe"))) {
fprintf(fp, "AREAFILE InterMail %s\n", pth);
cout << "Found InterMail and/or InterEcho." << endl;
detected = true;
}
// Detect Maximus
strcpy(pth, CFG->areapath);
ptr = getenv("MAXIMUS");
if(ptr) {
if(is_dir(ptr))
PathCopy(pth, ptr);
else
extractdirname(pth, pth);
}
if(fexist(AddPath(pth, "max.prm"))) {
fprintf(fp, "AREAFILE Maximus %s\n", pth);
cout << "Found Maximus." << endl;
detected = true;
}
if(not gotsquish and fexist(AddPath(pth, "squish.cfg"))) {
fprintf(fp, "AREAFILE Squish %s\n", pth);
cout << "Found Squish." << endl;
detected = true;
}
// Detect ME2
strcpy(pth, CFG->areapath);
if(fexist(AddPath(pth, "areadesc.me2"))) {
fprintf(fp, "AREAFILE ME2 %sareadesc.me2 %sareas.bbs\n", pth, pth);
cout << "Found ME2." << endl;
gotareasbbs = true;
detected = true;
}
// Detect AREAS.BBS
if(not gotareasbbs) {
strcpy(pth, CFG->areapath);
if(fexist(AddPath(pth, "areas.bbs"))) {
fprintf(fp, "AREAFILE AreasBBS %sareas.bbs\n", pth);
cout << "Found AREAS.BBS." << endl;
detected = true;
}
}
if(not detected)
cout << "Sorry, could not find any supported software. Try another path." << endl;
fclose(fp);
}
}
// ------------------------------------------------------------------
int InstallFinish() {
FILE* fp = fopen(CFG->goldcfg, "at");
if(fp) {
char buf[77];
// Check what we have
if(CFG->username.empty()) {
if(EnterString("Please enter your name:", buf, sizeof(buf)))
goto install_terminated;
fprintf(fp, "USERNAME %s\n", buf);
CfgUsername(buf);
}
if(CFG->aka.empty()) {
if(EnterString("Please enter your FidoNet address:", buf, sizeof(buf)))
goto install_terminated;
fprintf(fp, "ADDRESS %s\n", buf);
CfgAddress(buf);
}
if(AL.msgbases == 0) {
if(EnterString("Please enter the path to your *.msg netmail area:", buf, sizeof(buf)))
return -1;
fprintf(fp, "AREADEF NETMAIL \"Netmail\" 0 Net Opus %s\n", buf);
AreaCfg aa;
aa.reset();
aa.setdesc("Netmail");
aa.setechoid("NETMAIL");
aa.msgbase = MT_OPUS;
aa.type = AT_NET;
aa.setpath(buf);
aa.attr = CFG->attribsnet;
AL.AddNewArea(&aa);
if(EnterString("Please enter the path *and* filename of your areas.bbs file:", buf, sizeof(buf)))
goto install_terminated;
fprintf(fp, "AREAFILE AreasBBS %s\n", buf);
char buf2[200]="AreasBBS ";
strcat(buf2, buf);
AL.GetAreafile(buf2);
}
#ifndef GMB_NOHUDS
if((AL.msgbases & MT_HUDSON) and (*CFG->hudsonpath == NUL)) {
if(EnterString("Please enter the path to your Hudson msgbase files:", buf, sizeof(buf)))
goto install_terminated;
fprintf(fp, "HUDSONPATH %s\n", buf);
PathCopy(CFG->hudsonpath, buf);
}
#endif
#ifndef GMB_NOGOLD
if((AL.msgbases & MT_GOLDBASE) and (*CFG->goldbasepath == NUL)) {
if(EnterString("Please enter the path to your Goldbase msgbase files:", buf, sizeof(buf)))
goto install_terminated;
fprintf(fp, "GOLDBASEPATH %s\n", buf);
PathCopy(CFG->goldbasepath, buf);
}
#endif
#ifndef GMB_NOJAM
if((AL.msgbases & MT_JAM) and (*CFG->jampath == NUL)) {
if(EnterString("Please enter the path where net/echomail.jam can be placed:", buf, sizeof(buf)))
goto install_terminated;
fprintf(fp, "JAMPATH %s\n", buf);
PathCopy(CFG->jampath, buf);
}
#endif
#ifndef GMB_NOPCB
if((AL.msgbases & MT_PCBOARD) and (*CFG->pcboardpath == NUL)) {
if(EnterString("Please enter the path to PCBoard:", buf, sizeof(buf)))
goto install_terminated;
fprintf(fp, "PCBOARDPATH %s\n", buf);
PathCopy(CFG->pcboardpath, buf);
}
#endif
fclose(fp);
return 0;
}
install_terminated:
fclose(fp);
return -1;
}
// ------------------------------------------------------------------
GoldedCfgEdit::GoldedCfgEdit() {
memset(&cfg, 0, sizeof(cfg));
// Set Boolean values
AutoAttach(true);
AutoSave(30);
ChangeDate(true);
CharPara(' ');
CharSpace(' ');
FieldClear(true);
HardLines(true);
HdrNamePos(8);
HdrNameLen(36);
HdrNodePos(44);
HdrNodeLen(36);
HeaderAttrs(true);
HeaderFirst(EDITHEADERFIRST_YES);
Internal(true);
Menu(true);
MsgSize(512000L);
QuoteMargin(75);
SaveMenu(true);
UnDelete(50);
str.push_back(""); cfg.external = str.size()-1;
str.push_back("golded.msg"); cfg.file = str.size()-1;
str.push_back("<<"); cfg.hardline = str.size()-1;
str.push_back(""); cfg.spellchecker = str.size()-1;
}
// ------------------------------------------------------------------
CfgGed::CfgGed() {
// pathes
strcpy(goldcfg, "golded.cfg");
strcpy(helpcfg.fn, "goldhelp.cfg"); helpcfg.ft = 0;
replaceextension(helpged, helpcfg.fn, __gver_cfgext__);
strcpy(keyscfg, "goldkeys.cfg");
strcpy(langcfg, "goldlang.cfg");
strcpy(goldlast, "goldlast.lst");
strcpy(golduser, "golduser.lst");
strcpy(confirmfile, "golded.cfm");
strxmerge(xlatged, sizeof(xlatged), "goldxlat", __gver_cfgext__, NULL);
strcpy(fidolastread, "lastread");
strcpy(logfile, "golded.log");
strcpy(namesfile, "names.fd");
strcpy(userlistfile, "golded.lst");
*adeptxbbspath = 0;
*areapath = 0;
*attachpath = 0;
*cookiepath = 0;
*ezycom.msgbasepath = 0;
*ezycom.userbasepath = 0;
*fidouserlist = 0;
*goldbasepath = 0;
*goldbasesyspath = 0;
*goldpath = 0;
*hudsonpath = 0;
*hudsonsyspath = 0;
*inboundpath = 0;
*inputfile = 0;
*jampath = 0;
*loadlanguage = 0;
*nodepath = 0;
*nodepathfd = 0;
*nodepathv7 = 0;
*outboundpath = 0;
*outputfile = 0;
*pathreportfile = 0;
*pcboardpath = 0;
*quotebuffile = 0;
*soundpath = 0;
*soupexportpath = 0;
*soupimportpath = 0;
*soupnewsrcfile = 0;
*soupreplylinker = 0;
*souptosslog = 0;
*squishuserpath = 0;
*templatepath = 0;
*temppath = 0;
*uudecodepath = 0;
*xlatpath = 0;
// vectors
// cmdkey.clear();
// macro.clear();
// addressmacro.clear();
// aka.clear();
// akamatch.clear();
// areaexcl.clear();
// areaincl.clear();
// areaisemail.clear();
// areaisnews.clear();
// areapmscan.clear();
// areapmscanexcl.clear();
// areapmscanincl.clear();
// arearename.clear();
// areascan.clear();
// areascanexcl.clear();
// areascanincl.clear();
// event.clear();
// externutil.clear();
// filealias.clear();
// frqext.clear();
// frqnodemap.clear();
// kludge.clear();
// mailinglist.clear();
// mappath.clear();
// origin.clear();
// robotname.clear();
// tagline.clear();
// tpl.clear();
// twitname.clear();
// twitsubj.clear();
// username.clear();
// xlatcharset.clear();
// xlatescset.clear();
// echotags
*areacfmreplyto = 0;
*areacopyto = 0;
*areafreqto = 0;
*areareplyto = 0;
*areastart = 0;
*areayouwroteto = 0;
*soupbadmsgs = 0;
*soupemail = 0;
*soupreplyto = 0;
// strings
strcpy(arealistformat, "AM D CPUN E G ");
strcpy(arealistsort, "FYTUE");
strcpy(areascansort, "XZBE");
strcpy(importbegin, "=== Cut ===");
*importend = 0;
*internetaddress = 0;
*internetdomain = 0;
*keybstack = 0;
*nickname = 0;
*organization = 0;
#ifdef __UNIX__
strcpy(printdevice, "/usr/bin/lpr > /dev/null 2>&1");
#else
strcpy(printdevice, "PRN");
#endif
*printinit = 0;
*printreset = 0;
*quotechars = 0;
strcpy(quotestring, " FL> ");
*searchfor = 0;
strcpy(stylecodepunct, " !?\"$%&()+,.:;<=>@[\\]^`{|}~\n\r\t");
*stylecodestops = 0;
sprintf(tasktitle, "%s%s%s%s", __gver_prename__, __gver_name__,
__gver_postname__, __gver_platform__);
strcpy(tearline, "@longpid @version");
strcpy(whoto, "All");
*xlatexport = 0;
*xlatimport = 0;
#ifdef __UNIX__
strcpy(xlatlocalset, "LATIN-1");
#else
strcpy(xlatlocalset, "IBMPC");
#endif
// variables & switches
adeptxbbsuserno = 0;
addressbookadd = YES;
addresslookupfirst = false;
areaautoid = AUTOID_VERBOSE;
areacopydirect = false;
areacopyaddid = false;
areaforwarddirect = false;
areafilegroups = YES;
areafreqdirect = false;
arealistechomax = 0;
arealisttype = AL_TOTNEW;
areareadonly = READONLY_SOFT;
areareplydirect = false;
beepfactor = 1000;
beepyourmail = true;
carboncopylist = CC_NAMES;
cfgdispmargin = NO;
cfgeditquotemargin = 75;
cfgquotemargin = 70;
confirmresponse = ASK;
crosspost = ASK;
crosspostlist = CC_NAMES;
ctrlinfoecho = CI_TAGL|CI_TEAR|CI_ORIG;
ctrlinfoemail = 0;
ctrlinfolocal = CI_TAGL;
ctrlinfonet = CI_TAGL|CI_TEAR;
ctrlinfonews = 0;
dispareano = true;
dispattachsize = ATTACH_KBYTES;
displistcursor = NO;
dispmargin = NO;
dispmsgsize = DISPMSGSIZE_BYTES;
disptabsize = 4;
encodeemailheaders = true;
externoptions = EXTUTIL_CLS | EXTUTIL_SWAP | EXTUTIL_CURSOR | EXTUTIL_RELOAD | EXTUTIL_PAUSEONERROR | EXTUTIL_KEEPCTRL;
ezycomuserno = 0;
fidomsgtype = MT_OPUS;
fidouserno = 0;
forcetemplate = false;
frqoptions = FREQ_FROMTOP;
gedhandshake = true;
goldbaseuserno = 0;
happybirthday = 0;
hidestylies = true;
hudsonsizewarn = 16000000L;
hudsonuserno = 0;
ignorecharset = false;
intensecolors = false;
internetmsgid = false;
internetrfcbody = false;
keybmode = KEYB_POLL;
logformat = 0;
menumarked = MODE_DONT;
msglistdate = MSGLISTDATE_WRITTEN;
msglistfast = true;
msglistfirst = false;
msglistheader = false;
msglistwidesubj = false;
originno = 0;
pcboarduserno = 0;
personalmail = 0;
printlength = 60;
printmargin = 80;
quotebufmode = QBUF_ASK;
quotectrl = CI_TEAR|CI_ORIG;
quotemargin = 70;
quotewraphard = true;
ra2usersbbs = 0;
replylink = 0;
replylinklist = 0;
screenblanker = 180;
screenblankertype = BLANK_SLIDEWIN;
screenmaxcol = 0;
screenmaxrow = 0;
screensize = 0;
sharemode = cmdlinesharemode;
showdeleted = false;
soupexportmargin = 76;
squishscan = 2; // SQS_QUICK
squishuserno = 0;
statuslinehelp = 0;
taglineno = 0;
taglinechar = '.';
taglinesupport = true;
titlestatus = true;
tplno = 0;
templatematch = false;
timeout = 0;
twitmode = TWIT_BLANK;
usecharset = true;
usefwd = false;
useintl = true;
usepid = true;
usernameno = 0;
usestylies = true;
usetzutc = false;
viewhidden = false;
viewkludge = false;
viewquote = true;
wildcatuserno = 0;
zonegating = ASK;
// classes
attribsattach.loc1();
attribscc.loc1();
attribscfm.loc1();
attribsecho.loc1();
// attribsemail.reset();
attribsfrq.loc1();
attribslocal.loc1();
attribsnet.loc1();
// attribsnews.reset();
switches.set(akamatchnet, true);
switches.set(areaautonext, true);
switches.set(areacatchupread, true);
switches.set(areakeeplast, true);
switches.set(arealistgroupid, true);
switches.set(arealistpagebar, true);
switches.set(askdelorig, true);
switches.set(beepcomment, true);
switches.set(beepnoises, true);
switches.set(dispautonext, true);
switches.set(displocalhigh, true);
switches.set(disppagebar, true);
switches.set(dispstatusline, true);
switches.set(dosprompt, true);
switches.set(filelistpagebar, true);
switches.set(internetreply, true);
switches.set(keybdefaults, true);
switches.set(keybext, true);
switches.set(kludgechrs, true);
switches.set(lookupnet, true);
switches.set(msglistpagebar, true);
switches.set(msglistviewsubj, true);
switches.set(nodelistwarn, true);
switches.set(printformfeed, true);
switches.set(screenshadows, true);
switches.set(statuslineclock, true);
switches.set(timeoutsavemsg, true);
switches.set(useflags, true);
switches.set(usemsgid, true);
switches.set(rcvdisablescfm, true);
// screen configuration
disphdrdateset.len = 20;
disphdrdateset.pos = -20;
disphdrnameset.len = 36;
disphdrnameset.pos = 8;
disphdrnodeset.len = 16;
disphdrnodeset.pos = 44;
// unsorted structures
areatypeorder[AT_NET] = 1;
areatypeorder[AT_NET|AT_EMAIL] = 2;
areatypeorder[AT_ECHO] = 3;
areatypeorder[AT_ECHO|AT_NEWSGROUP] = 4;
areatypeorder[AT_LOCAL] = 5;
if(gvid->adapter & V_MONO)
memcpy(color, gold_mono1, sizeof(color));
else
memcpy(color, gold_color1, sizeof(color));
*internetgate.name = 0;
// internetgate.addr.reset();
*internetserver.nntp.server = 0;
*internetserver.smtp.server = 0;
*internetserver.pop3.server = 0;
*internetserver.pop3.username = 0;
*internetserver.pop3.password = 0;
invalidate.origin.first = " * Origin: ";
invalidate.origin.second = " + Origin: ";
invalidate.seenby.first = "SEEN-BY";
invalidate.seenby.second = "SEEN+BY";
invalidate.tearline.first = "---";
invalidate.tearline.second = "-+-";
invalidate.cc.first = "CC:";
invalidate.cc.second = "!CC:";
invalidate.xc.first = "XC:";
invalidate.xc.second = "!XC:";
invalidate.xp.first = "XP:";
invalidate.xp.second = "!XP:";
play.type = 0;
play.effectno = 0;
*play.file = 0;
for(int n=0; n<16; n++)
screenpalette[n] = -1;
*semaphore.netscan = 0;
*semaphore.echoscan = 0;
*semaphore.exportlist = 0;
*semaphore.importlist = 0;
*semaphore.scanall = 0;
*semaphore.scanthis = 0;
*semaphore.scannetmail = 0;
*semaphore.pmscanall = 0;
*semaphore.pmscanthis = 0;
*semaphore.pmscannetmail = 0;
*semaphore.qwkimport = 0;
*semaphore.qwkexport = 0;
*semaphore.soupimport = 0;
*semaphore.soupexport = 0;
*semaphore.exitnow = 0;
semaphore.idletime = 0;
}
// ------------------------------------------------------------------
CfgGed::~CfgGed() {
}
// ------------------------------------------------------------------

395
golded3/gccfgg.h Normal file
View File

@ -0,0 +1,395 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// CRC16 values for all standard configuration keywords.
// ------------------------------------------------------------------
// ------------------------------------------------------------------
const word CRC_ADDRESS = 0xFDD6;
const word CRC_ADDRESSBOOKADD = 0xFF55;
const word CRC_ADDRESSLOOKUPFIRST=0x2137;
const word CRC_ADDRESSMACRO = 0xDA5F;
const word CRC_ADEPTXBBSPATH = 0x25D6;
const word CRC_ADEPTXBBSUSERNO = 0x0E98;
const word CRC_AKA = 0x13A4;
const word CRC_AKAMATCH = 0xF237;
const word CRC_AKAMATCHECHO = 0xF0C1;
const word CRC_AKAMATCHING = 0x869A;
const word CRC_AKAMATCHLOCAL = 0x4AC4;
const word CRC_AKAMATCHNET = 0xFD6E;
const word CRC_AREA = 0x010B;
const word CRC_AREAAUTOID = 0x365D;
const word CRC_AREAAUTONEXT = 0xF589;
const word CRC_AREACATCHUPREAD = 0xDAFF;
const word CRC_AREACFMREPLYTO = 0x0755;
const word CRC_AREACOPYADDID = 0xAE1E;
const word CRC_AREACOPYDIRECT = 0xDB3D;
const word CRC_AREACOPYTO = 0xFCAF;
const word CRC_AREADEF = 0xA6CC;
const word CRC_AREADESC = 0x0C6F;
const word CRC_AREAEXCL = 0xECCD;
const word CRC_AREAFILE = 0xB487;
const word CRC_AREAFILEGROUPS = 0xF0E7;
const word CRC_AREAFORWARDDIRECT= 0x1E6C;
const word CRC_AREAFREQDIRECT = 0x155A;
const word CRC_AREAFREQTO = 0x3C56;
const word CRC_AREAINCL = 0xDB57;
const word CRC_AREAISEMAIL = 0xB054;
const word CRC_AREAISNEWS = 0x52DB;
const word CRC_AREAKEEPLAST = 0x5876;
const word CRC_AREALISTECHOMAX = 0x944D;
const word CRC_AREALISTFORMAT = 0x9080;
const word CRC_AREALISTGROUPID = 0x1F75;
const word CRC_AREALISTNOS = 0x5FD7;
const word CRC_AREALISTPAGEBAR = 0x6C37;
const word CRC_AREALISTSCAN = 0xDAF7;
const word CRC_AREALISTSORT = 0x0861;
const word CRC_AREALISTTYPE = 0xE110;
const word CRC_AREAPATH = 0x8457;
const word CRC_AREAPMSCAN = 0xE19D;
const word CRC_AREAPMSCANEXCL = 0xA2BE;
const word CRC_AREAPMSCANINCL = 0x9524;
const word CRC_AREAREADONLY = 0xE4F3;
const word CRC_AREARENAME = 0xFC32;
const word CRC_AREAREPLYDIRECT = 0x7570;
const word CRC_AREAREPLYTO = 0x7157;
const word CRC_AREASCAN = 0xE440;
const word CRC_AREASCANEXCL = 0x393E;
const word CRC_AREASCANINCL = 0x0EA4;
const word CRC_AREASCANSORT = 0xE325;
const word CRC_AREASEP = 0xC40C;
const word CRC_AREASTART = 0x7B1A;
const word CRC_AREATYPEORDER = 0xFD13;
const word CRC_AREAYOUWROTETO = 0xC87F;
const word CRC_ASKDELORIG = 0x26DD;
const word CRC_ASSIGNTO = 0xD095;
const word CRC_ATTACHPATH = 0x1400;
const word CRC_ATTRIBSATTACH = 0xAC4F;
const word CRC_ATTRIBSCC = 0xD698;
const word CRC_ATTRIBSCFM = 0x36F6;
const word CRC_ATTRIBSECHO = 0x5FD9;
const word CRC_ATTRIBSEMAIL = 0xC670;
const word CRC_ATTRIBSFRQ = 0x724F;
const word CRC_ATTRIBSLOCAL = 0x16C1;
const word CRC_ATTRIBSNET = 0xE442;
const word CRC_ATTRIBSNEWS = 0xFCF9;
const word CRC_ATTRIBUTES = 0xFD98;
const word CRC_BEEPCOMMENT = 0xC49E;
const word CRC_BEEPFACTOR = 0x8F3A;
const word CRC_BEEPLOCALMSG = 0x984C;
const word CRC_BEEPNOISES = 0x84D5;
const word CRC_BEEPYOURMAIL = 0x0F72;
const word CRC_CARBONCOPYLIST = 0x8290;
const word CRC_COLOR = 0x9F15;
const word CRC_COLORSET = 0x874C;
const word CRC_CONFIRMFILE = 0x1963;
const word CRC_CONFIRMRESPONSE = 0x3D82;
const word CRC_COOKIEPATH = 0x5280;
const word CRC_CROSSPOST = 0x8792;
const word CRC_CROSSPOSTLIST = 0x5854;
const word CRC_CTRLINFO = 0x904A;
const word CRC_CTRLINFOECHO = 0xDE22;
const word CRC_CTRLINFOEMAIL = 0xBCD9;
const word CRC_CTRLINFOLOCAL = 0x6C68;
const word CRC_CTRLINFONET = 0x7660;
const word CRC_CTRLINFONEWS = 0x7D02;
const word CRC_CTRLSEARCH = 0x471F;
const word CRC_DISPAREANO = 0x68CE;
const word CRC_DISPATTACHSIZE = 0x7BB4;
const word CRC_DISPAUTONEXT = 0x52D9;
const word CRC_DISPHDRDATESET = 0x65A5;
const word CRC_DISPHDRNAMESET = 0xFEF9;
const word CRC_DISPHDRNODESET = 0xC232;
const word CRC_DISPLISTCURSOR = 0x8B82;
const word CRC_DISPLISTWRAP = 0xB36D;
const word CRC_DISPLOCALHIGH = 0x1D8B;
const word CRC_DISPMARGIN = 0xC0EC;
const word CRC_DISPMSGSIZE = 0xB0E2;
const word CRC_DISPPAGEBAR = 0x60A4;
const word CRC_DISPREALMSGNO = 0xE30F;
const word CRC_DISPREPLIESMODE = 0x0099;
const word CRC_DISPSOFTCR = 0x85E9;
const word CRC_DISPSTATUSLINE = 0x3FCF;
const word CRC_DISPTABSIZE = 0x01FB;
const word CRC_DOSPROMPT = 0xD983;
const word CRC_EDITAUTOATTACH = 0x62C8;
const word CRC_EDITAUTOSAVE = 0x351B;
const word CRC_EDITCHANGEDATE = 0x847F;
const word CRC_EDITCHARPARA = 0x6CFC;
const word CRC_EDITCHARSPACE = 0x182F;
const word CRC_EDITCOMMENT = 0x662C;
const word CRC_EDITCOMPLETION = 0xDA45;
const word CRC_EDITCRLFTERM = 0x0461;
const word CRC_EDITFIELDCLEAR = 0xC3C4;
const word CRC_EDITHARDLINE = 0xAD88;
const word CRC_EDITHARDLINES = 0xEC14;
const word CRC_EDITHARDTERM = 0xFAD6;
const word CRC_EDITHDRNAMESET = 0x4AB4;
const word CRC_EDITHDRNODESET = 0x767F;
const word CRC_EDITHEADERATTRS = 0x74FD;
const word CRC_EDITHEADERFIRST = 0xE583;
const word CRC_EDITINTERNAL = 0xC2EA;
const word CRC_EDITMENU = 0x833E;
const word CRC_EDITMIXCASE = 0x5814;
const word CRC_EDITMSGSIZE = 0xCF31;
const word CRC_EDITOR = 0xF1C3;
const word CRC_EDITORFILE = 0xA49C;
const word CRC_EDITQUOTEMARGIN = 0xACC7;
const word CRC_EDITREPLYRE = 0x5D23;
const word CRC_EDITSAVEMENU = 0x7BC2;
const word CRC_EDITSAVEUTIL = 0xF411;
const word CRC_EDITSOFTCRXLAT = 0xA49A;
const word CRC_EDITSPELLCHECK = 0xE167;
const word CRC_EDITUNDELETE = 0x4C34;
const word CRC_EMPTYTEARLINE = 0x8D0A;
const word CRC_ENCODEEMAILHEADERS=0xA843;
const word CRC_ENDGROUP = 0x4F27;
const word CRC_EVENT = 0x0471;
const word CRC_EXCLUDENODES = 0x0BFF;
const word CRC_EXTERNOPTIONS = 0xECF5;
const word CRC_EXTERNUTIL = 0xBFD6;
const word CRC_EZYCOMMSGBASE = 0x1A58;
const word CRC_EZYCOMUSERBASE = 0x23D3;
const word CRC_EZYCOMUSERNO = 0x53F6;
const word CRC_FIDOHWMARKS = 0x7E07;
const word CRC_FIDOLASTREAD = 0xB5C3;
const word CRC_FIDOLASTREADNO = 0x4698;
const word CRC_FIDOMSGTYPE = 0x069B;
const word CRC_FIDONULLFIX = 0x4F38;
const word CRC_FIDOUSERLIST = 0xDA02;
const word CRC_FIDOUSERNO = 0x903A;
const word CRC_FILEALIAS = 0xEC23;
const word CRC_FILELISTPAGEBAR = 0x58AA;
const word CRC_FORCETEMPLATE = 0xC8FB;
const word CRC_FORMFEEDSEPARATOR= 0xDBD6;
const word CRC_FREEAREA = 0x93CF;
const word CRC_FRQEXT = 0x0410;
const word CRC_FRQNODEMAP = 0x4684;
const word CRC_FRQOPTIONS = 0x0AD3;
const word CRC_FRQWAZOO = 0xE49C;
const word CRC_GEDHANDSHAKE = 0x344F;
const word CRC_GERMANKEYBOARD = 0x0604;
const word CRC_GOLDBASEPATH = 0x12E1;
const word CRC_GOLDBASESYSPATH = 0x7DD1;
const word CRC_GOLDBASEUSERNO = 0xD42E;
const word CRC_GOLDHELP = 0xE657;
const word CRC_GOLDLANG = 0x6800;
const word CRC_GOLDPATH = 0x3411;
const word CRC_GOLDXLAT = 0x7909;
const word CRC_GROUP = 0x1C9B;
const word CRC_HAPPYBIRTHDAY = 0x7279;
const word CRC_HIGHLIGHTUNREAD = 0x45DA;
const word CRC_HUDSONPATH = 0x52A7;
const word CRC_HUDSONSIZEWARN = 0x111A;
const word CRC_HUDSONSYSPATH = 0xC716;
const word CRC_HUDSONUSERNO = 0xF1E0;
const word CRC_IGNORE = 0xC07B;
const word CRC_IGNORECHARSET = 0x894C;
const word CRC_IMPORTBEGIN = 0x66D7;
const word CRC_IMPORTEND = 0xD9C3;
const word CRC_INBOUNDPATH = 0xDE04;
const word CRC_INCLUDE = 0x379B;
const word CRC_INCLUDENODES = 0xE5F7;
const word CRC_INPUTFILE = 0x7013;
const word CRC_INTENSECOLORS = 0x5F70;
const word CRC_INTERNETADDRESS = 0xA4D3;
const word CRC_INTERNETDOMAIN = 0x50d7;
const word CRC_INTERNETGATE = 0xF6C0;
const word CRC_INTERNETLOOKUP = 0x0E22;
const word CRC_INTERNETMSGID = 0xC31F;
const word CRC_INTERNETREPLY = 0x6253;
const word CRC_INTERNETRFCBODY = 0x9390;
const word CRC_INTERNETSERVER = 0xA01B;
const word CRC_INVALIDATE = 0x69CB;
const word CRC_JAMHARDDELETE = 0xE2D5;
const word CRC_JAMPATH = 0x1200;
const word CRC_KEYBCLEAR = 0xD407;
const word CRC_KEYBDEFAULTS = 0x9FAE;
const word CRC_KEYBEXT = 0xC48A;
const word CRC_KEYBMODE = 0xE8F2;
const word CRC_KEYBSTACK = 0x5F23;
const word CRC_KLUDGE = 0xA600;
const word CRC_KLUDGECHRS = 0x0EEF;
const word CRC_LOADLANGUAGE = 0x9F1B;
const word CRC_LOGFILE = 0x8ACE;
const word CRC_LOGFORMAT = 0x9E51;
const word CRC_LOGLEVEL = 0xCF59;
const word CRC_LOOKUPECHO = 0xB787;
const word CRC_LOOKUPLOCAL = 0x34E7;
const word CRC_LOOKUPNET = 0x7359;
const word CRC_LOOKUPUSERBASE = 0x5852;
const word CRC_MAILINGLIST = 0x08CD;
const word CRC_MAILTOSS = 0x424E;
const word CRC_MAPPATH = 0x74E6;
const word CRC_MEMBER = 0xF703;
const word CRC_MENUDROPMSG = 0x9645;
const word CRC_MENUMARKED = 0x7198;
const word CRC_MOUSE = 0x1B1B;
const word CRC_MSGLISTDATE = 0xBFF5;
const word CRC_MSGLISTFAST = 0xDE86;
const word CRC_MSGLISTFIRST = 0x326F;
const word CRC_MSGLISTHEADER = 0x8B8E;
const word CRC_MSGLISTPAGEBAR = 0x8041;
const word CRC_MSGLISTVIEWSUBJ = 0xED92;
const word CRC_MSGLISTWIDESUBJ = 0xF385;
const word CRC_NAMESFILE = 0x1743;
const word CRC_NICKNAME = 0x70D8;
const word CRC_NODELIST = 0x0E0A;
const word CRC_NODELISTWARN = 0xF818;
const word CRC_NODEPATH = 0xCE00;
const word CRC_NODEPATHFD = 0x731F;
const word CRC_NODEPATHIM = 0x7C16;
const word CRC_NODEPATHV7 = 0x636C;
const word CRC_NODEV7FLAGS = 0x6BEE;
const word CRC_NODEV7MODEM = 0x9CF7;
const word CRC_ORGANIZATION = 0x8ADC;
const word CRC_ORIGIN = 0x4CE5;
const word CRC_OUTBOUNDPATH = 0xB089;
const word CRC_OUTPUTFILE = 0xA697;
const word CRC_PATHREPORTFILE = 0x8700;
const word CRC_PCBOARDPATH = 0xC08B;
const word CRC_PCBOARDUSERNO = 0x6A87;
const word CRC_PERSONALMAIL = 0xD340;
const word CRC_PLAY = 0xC6AE;
const word CRC_PRINTDEVICE = 0xA4C3;
const word CRC_PRINTFORMFEED = 0x59FB;
const word CRC_PRINTINIT = 0xB195;
const word CRC_PRINTLENGTH = 0x5D19;
const word CRC_PRINTMARGIN = 0xAC75;
const word CRC_PRINTRESET = 0xEFBD;
const word CRC_QUOTEBLANK = 0xD3BB;
const word CRC_QUOTEBUFFILE = 0xDE2A;
const word CRC_QUOTEBUFMODE = 0x6A16;
const word CRC_QUOTECHARS = 0x3457;
const word CRC_QUOTECTRL = 0x4CC7;
const word CRC_QUOTEMARGIN = 0x13E6;
const word CRC_QUOTESPACING = 0xB403;
const word CRC_QUOTESTRING = 0xE44F;
const word CRC_QUOTEWRAPHARD = 0x6BD4;
const word CRC_QWKBADMSGS = 0x0C2D;
const word CRC_QWKCONFMAP = 0xEAE1;
const word CRC_QWKEXPORTPATH = 0xB3AB;
const word CRC_QWKIMPORTPATH = 0xECC0;
const word CRC_QWKOPTIONS = 0x155E;
const word CRC_QWKREPLYLINKER = 0x2A06;
const word CRC_QWKTOSSLOG = 0x6AED;
const word CRC_RA2USERSBBS = 0x1916;
const word CRC_RCVDISABLESCFM = 0xD3B2;
const word CRC_REGISTERKEY = 0xF428;
const word CRC_REGISTERNAME = 0x2CAF;
const word CRC_REPLYLINK = 0x88A1;
const word CRC_REPLYLINKLIST = 0x104F;
const word CRC_ROBOTNAME = 0x7393;
const word CRC_SCREENBLANKER = 0x5CF7;
const word CRC_SCREENMAXCOL = 0xFFFC;
const word CRC_SCREENMAXROW = 0xFDF7;
const word CRC_SCREENPALETTE = 0x49CA;
const word CRC_SCREENSHADOWS = 0x8543;
const word CRC_SCREENSIZE = 0xC3A5;
const word CRC_SCREENUSEANSI = 0x7A70;
const word CRC_SCREENUSEBIOS = 0x43DE;
const word CRC_SEARCHFOR = 0x9FA6;
const word CRC_SEMAPHORE = 0x02FB;
const word CRC_SERIALNO = 0x6EDE;
const word CRC_SHAREMODE = 0x068E;
const word CRC_SHOWDELETED = 0xA9CE;
const word CRC_SOUNDDEVICE = 0x831D;
const word CRC_SOUNDPATH = 0xA4DA;
const word CRC_SOUPBADMSGS = 0x372E;
const word CRC_SOUPEMAIL = 0x423C;
const word CRC_SOUPEXPORTMARGIN = 0x0434;
const word CRC_SOUPEXPORTPATH = 0xD3AC;
const word CRC_SOUPIMPORTPATH = 0x8CC7;
const word CRC_SOUPNEWSRCFILE = 0x6961;
const word CRC_SOUPREPLYLINKER = 0x41A0;
const word CRC_SOUPREPLYTO = 0xE741;
const word CRC_SOUPTOSSLOG = 0x51EE;
const word CRC_SQUISHDIRECT = 0x7C35;
const word CRC_SQUISHSCAN = 0xE388;
const word CRC_SQUISHUSERNO = 0x60AD;
const word CRC_SQUISHUSERPATH = 0xFA97;
const word CRC_STATUSLINECLOCK = 0x9C8A;
const word CRC_STATUSLINEHELP = 0xA150;
const word CRC_STYLECODES = 0x4CB0;
const word CRC_STYLECODEPUNCT = 0x9D15;
const word CRC_STYLECODESTOPS = 0xF452;
const word CRC_TAGLINE = 0xC328;
const word CRC_TAGLINECHAR = 0xD71E;
const word CRC_TAGLINEINTERNAL = 0x0B41;
const word CRC_TAGLINESUPPORT = 0x1F4D;
const word CRC_TASKTITLE = 0xECEC;
const word CRC_TEARLINE = 0xB385;
const word CRC_TEMPLATE = 0x09DF;
const word CRC_TEMPLATEMATCH = 0xECA9;
const word CRC_TEMPLATEPATH = 0xB8C0;
const word CRC_TEMPPATH = 0x4FCC;
const word CRC_TIMEOUT = 0x4065;
const word CRC_TIMEOUTSAVEMSG = 0xF644;
const word CRC_TIMESLICE = 0x3EFF;
const word CRC_TIMESREAD = 0xDD0E;
const word CRC_TITLESTATUS = 0x5ABA;
const word CRC_TWITMODE = 0x9DC8;
const word CRC_TWITNAME = 0x2055;
const word CRC_TWITSUBJ = 0x08C0;
const word CRC_TWITTO = 0x9DFE;
const word CRC_USECHARSET = 0xE1B9;
const word CRC_USEFLAGS = 0xE2B6;
const word CRC_USEFWD = 0x439F;
const word CRC_USEINTL = 0x64CD;
const word CRC_USEMSGID = 0x6FDB;
const word CRC_USEPID = 0x2F68;
const word CRC_USERLIST = 0xE81A;
const word CRC_USERLISTFILE = 0xB749;
const word CRC_USERNAME = 0x1161;
const word CRC_USETZUTC = 0x27C5;
const word CRC_UUDECODEPATH = 0x82A2;
const word CRC_VIEWHIDDEN = 0x021D;
const word CRC_VIEWKLUDGE = 0x4078;
const word CRC_VIEWQUOTE = 0x0AB3;
const word CRC_WHOTO = 0xB25F;
const word CRC_WILDCATUSERNO = 0xC2FE;
const word CRC_XLATCHARSET = 0xA860;
const word CRC_XLATESCSET = 0x4BA7;
const word CRC_XLATEXPORT = 0x29CB;
const word CRC_XLATIMPORT = 0xCE6A;
const word CRC_XLATLOCALSET = 0x7180;
const word CRC_XLATPATH = 0x7FA1;
const word CRC_ZONEGATING = 0x956C;
const word CRC_IF = 0x4946;
const word CRC_ELIF = 0x3237;
const word CRC_ELSE = 0x2834;
const word CRC_ELSEIF = 0xB0DE;
const word CRC_ENDIF = 0x9998;
const word CRC_REM = 0x3FFA;
// ------------------------------------------------------------------
const word CRC_LAST_CRC = 0xFFFF;
// ------------------------------------------------------------------

869
golded3/gccfgg0.cpp Normal file
View File

@ -0,0 +1,869 @@
// ------------------------------------------------------------------
// GoldED+
// Copyright (C) 1998-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$
// ------------------------------------------------------------------
// Configuration functions, part 0.
// ------------------------------------------------------------------
#include <golded.h>
#include <gccfgg.h>
#include <gcprot.h>
// ------------------------------------------------------------------
bool cfgingroup = false;
char* val;
// ------------------------------------------------------------------
struct tglobalbool {
word crc_token;
};
// it must be sorted by value
tglobalbool globalbool[gswitches_last] = {
{ CRC_INTERNETLOOKUP }, // 0x0E22;
{ CRC_KLUDGECHRS }, // 0x0EEF;
{ CRC_MOUSE }, // 0x1B1B;
{ CRC_DISPLOCALHIGH }, // 0x1D8B;
{ CRC_AREALISTGROUPID }, // 0x1F75;
{ CRC_ASKDELORIG }, // 0x26DD;
{ CRC_LOOKUPLOCAL }, // 0x34E7;
{ CRC_DISPSTATUSLINE }, // 0x3FCF;
{ CRC_SCREENUSEBIOS }, // 0x43DE;
{ CRC_HIGHLIGHTUNREAD }, // 0x45DA;
{ CRC_AKAMATCHLOCAL }, // 0x4AC4;
{ CRC_FIDONULLFIX }, // 0x4F38;
{ CRC_DISPAUTONEXT }, // 0x52D9;
{ CRC_LOOKUPUSERBASE }, // 0x5852;
{ CRC_AREAKEEPLAST }, // 0x5876;
{ CRC_FILELISTPAGEBAR }, // 0x58AA;
{ CRC_PRINTFORMFEED }, // 0x59FB;
{ CRC_AREALISTNOS }, // 0x5FD7;
{ CRC_DISPPAGEBAR }, // 0x60A4;
{ CRC_INTERNETREPLY }, // 0x6253;
{ CRC_AREALISTPAGEBAR }, // 0x6C37;
{ CRC_USEMSGID }, // 0x6FDB;
{ CRC_LOOKUPNET }, // 0x7359;
{ CRC_SQUISHDIRECT }, // 0x7C35;
{ CRC_FIDOHWMARKS }, // 0x7E07;
{ CRC_MSGLISTPAGEBAR }, // 0x8041;
{ CRC_BEEPNOISES }, // 0x84D5;
{ CRC_SCREENSHADOWS }, // 0x8543;
{ CRC_DISPSOFTCR }, // 0x85E9;
{ CRC_EMPTYTEARLINE }, // 0x8D0A;
{ CRC_MENUDROPMSG }, // 0x9645;
{ CRC_BEEPLOCALMSG }, // 0x984C;
{ CRC_STATUSLINECLOCK }, // 0x9C8A;
{ CRC_TWITTO }, // 0x9DFE;
{ CRC_KEYBDEFAULTS }, // 0x9FAE;
{ CRC_DISPLISTWRAP }, // 0xB36D;
{ CRC_QUOTESPACING }, // 0xB403;
{ CRC_LOOKUPECHO }, // 0xB787;
{ CRC_KEYBEXT }, // 0xC48A;
{ CRC_BEEPCOMMENT }, // 0xC49E;
{ CRC_RCVDISABLESCFM }, // 0xD3B2;
{ CRC_QUOTEBLANK }, // 0xD3BB;
{ CRC_KEYBCLEAR }, // 0xD407;
{ CRC_DOSPROMPT }, // 0xD983;
{ CRC_AREACATCHUPREAD }, // 0xDAFF;
{ CRC_FORMFEEDSEPARATOR }, // 0xDBD6;
{ CRC_USEFLAGS }, // 0xE2B6;
{ CRC_JAMHARDDELETE }, // 0xE2D5;
{ CRC_DISPREALMSGNO }, // 0xE30F;
{ CRC_FRQWAZOO }, // 0xE49C;
{ CRC_MSGLISTVIEWSUBJ }, // 0xED92;
{ CRC_AKAMATCHECHO }, // 0xF0C1;
{ CRC_AREAFILEGROUPS }, // 0xF0E7;
{ CRC_AREAAUTONEXT }, // 0xF589;
{ CRC_TIMEOUTSAVEMSG }, // 0xF644;
{ CRC_NODELISTWARN }, // 0xF818;
{ CRC_AKAMATCHNET }, // 0xFD6E;
};
bool gswitches::handle(word crc, const char* value) {
uint left,right,middle;
word cur;
left = 0;
right = gswitches_last - 1;
if((crc < globalbool[left].crc_token) or (crc > globalbool[right].crc_token))
return false;
do {
middle = (left + right)/2;
cur = globalbool[middle].crc_token;
if(crc < cur) {
right = middle - 1;
} else if(crc > cur) {
left = middle + 1;
}
else {
cfg[middle] = GetYesno(value);
return true;
}
} while(left <= right);
return false;
}
// ------------------------------------------------------------------
int SwitchCfg(word crc, char k, char* v) {
val = v;
bool found = true;
if(CFG->switches.handle(crc,v))
return true;
// Switch the first letter of the keyword
switch(toupper(k)) {
case 'A': goto SwitchA;
case 'B': goto SwitchB;
case 'C': goto SwitchC;
case 'D': goto SwitchD;
case 'E': goto SwitchE;
case 'F': goto SwitchF;
case 'G': goto SwitchG;
case 'H': goto SwitchH;
case 'I': goto SwitchI;
case 'J': goto SwitchJ;
case 'K': goto SwitchK;
case 'L': goto SwitchL;
case 'M': goto SwitchM;
case 'N': goto SwitchN;
case 'O': goto SwitchO;
case 'P': goto SwitchP;
case 'Q': goto SwitchQ;
case 'R': goto SwitchR;
case 'S': goto SwitchS;
case 'T': goto SwitchT;
case 'U': goto SwitchU;
case 'V': goto SwitchV;
case 'W': goto SwitchW;
case 'X': goto SwitchX;
case 'Y': goto SwitchY;
case 'Z': goto SwitchZ;
default: found = false;
}
goto End;
SwitchA:
switch(crc) {
case CRC_ADDRESS : CfgAddress (); break;
case CRC_ADDRESSBOOKADD : CfgAddressbookadd (); break;
case CRC_ADDRESSLOOKUPFIRST: CfgAddresslookupfirst(); break;
case CRC_ADDRESSMACRO : CfgAddressmacro (); break;
case CRC_ADEPTXBBSPATH : CfgAdeptxbbspath (); break;
case CRC_ADEPTXBBSUSERNO : CfgAdeptxbbsuserno (); break;
case CRC_AKA : CfgAddress (); break;
case CRC_AKAMATCH : CfgAkamatch (); break;
case CRC_AKAMATCHING : CfgAkamatching (); break;
case CRC_AREA : CfgArea (); break;
case CRC_AREAAUTOID : CfgAreaautoid (); break;
case CRC_AREACFMREPLYTO : CfgAreacfmreplyto (); break;
case CRC_AREACOPYADDID : CfgAreacopyaddid (); break;
case CRC_AREACOPYDIRECT : CfgAreacopydirect (); break;
case CRC_AREACOPYTO : CfgAreacopyto (); break;
case CRC_AREADEF : CfgAreadef (); break;
case CRC_AREADESC : CfgAreadesc (); break;
case CRC_AREAEXCL : CfgAreaexcl (); break;
case CRC_AREAFORWARDDIRECT: CfgAreaforwarddirect(); break;
case CRC_AREAFREQDIRECT : CfgAreafreqdirect (); break;
case CRC_AREAFREQTO : CfgAreafreqto (); break;
case CRC_AREAINCL : CfgAreaincl (); break;
case CRC_AREAISEMAIL : CfgAreaisemail (); break;
case CRC_AREAISNEWS : CfgAreaisnews (); break;
case CRC_AREALISTECHOMAX : CfgArealistechomax (); break;
case CRC_AREALISTFORMAT : CfgArealistformat (); break;
case CRC_AREALISTSCAN : CfgArealistscan (); break;
case CRC_AREALISTSORT : CfgArealistsort (); break;
case CRC_AREALISTTYPE : CfgArealisttype (); break;
case CRC_AREAPATH : CfgAreapath (); break;
case CRC_AREAPMSCAN : CfgAreapmscan (); break;
case CRC_AREAPMSCANEXCL : CfgAreapmscanexcl (); break;
case CRC_AREAPMSCANINCL : CfgAreapmscanincl (); break;
case CRC_AREAREADONLY : CfgAreareadonly (); break;
case CRC_AREARENAME : CfgArearename (); break;
case CRC_AREAREPLYDIRECT : CfgAreareplydirect (); break;
case CRC_AREAREPLYTO : CfgAreareplyto (); break;
case CRC_AREASCAN : CfgAreascan (); break;
case CRC_AREASCANEXCL : CfgAreascanexcl (); break;
case CRC_AREASCANINCL : CfgAreascanincl (); break;
case CRC_AREASCANSORT : CfgAreascansort (); break;
case CRC_AREASEP : CfgAreasep (); break;
case CRC_AREASTART : CfgAreastart (); break;
case CRC_AREATYPEORDER : CfgAreatypeorder (); break;
case CRC_AREAYOUWROTETO : CfgAreayouwroteto (); break;
case CRC_ATTACHPATH : CfgAttachpath (); break;
case CRC_ATTRIBSATTACH : CfgAttribsattach (); break;
case CRC_ATTRIBSCC : CfgAttribscc (); break;
case CRC_ATTRIBSCFM : CfgAttribscfm (); break;
case CRC_ATTRIBSECHO : CfgAttribsecho (); break;
case CRC_ATTRIBSEMAIL : CfgAttribsemail (); break;
case CRC_ATTRIBSFRQ : CfgAttribsfrq (); break;
case CRC_ATTRIBSLOCAL : CfgAttribslocal (); break;
case CRC_ATTRIBSNET : CfgAttribsnet (); break;
case CRC_ATTRIBSNEWS : CfgAttribsnews (); break;
case CRC_ATTRIBUTES : CfgAttributes (); break;
default : found = false;
}
goto End;
SwitchB:
switch(crc) {
case CRC_BEEPFACTOR : CfgBeepfactor (); break;
case CRC_BEEPYOURMAIL : CfgBeepyourmail (); break;
default : found = false;
}
goto End;
SwitchC:
switch(crc) {
case CRC_CARBONCOPYLIST : CfgCarboncopylist (); break;
case CRC_COLOR : CfgColor (); break;
case CRC_COLORSET : CfgColorset (); break;
case CRC_CONFIRMFILE : CfgConfirmfile (); break;
case CRC_CONFIRMRESPONSE : CfgConfirmresponse (); break;
case CRC_COOKIEPATH : CfgCookiepath (); break;
case CRC_CROSSPOST : CfgCrosspost (); break;
case CRC_CROSSPOSTLIST : CfgCrosspostlist (); break;
case CRC_CTRLINFO : CfgCtrlinfo (); break;
case CRC_CTRLINFOECHO : CfgCtrlinfoecho (); break;
case CRC_CTRLINFOEMAIL : CfgCtrlinfoemail (); break;
case CRC_CTRLINFOLOCAL : CfgCtrlinfolocal (); break;
case CRC_CTRLINFONET : CfgCtrlinfonet (); break;
case CRC_CTRLINFONEWS : CfgCtrlinfonews (); break;
default : found = false;
}
goto End;
SwitchD:
switch(crc) {
case CRC_DISPAREANO : CfgDispareano (); break;
case CRC_DISPATTACHSIZE : CfgDispattachsize (); break;
case CRC_DISPHDRDATESET : CfgDisphdrdateset (); break;
case CRC_DISPHDRNAMESET : CfgDisphdrnameset (); break;
case CRC_DISPHDRNODESET : CfgDisphdrnodeset (); break;
case CRC_DISPLISTCURSOR : CfgDisplistcursor (); break;
case CRC_DISPMARGIN : CfgDispmargin (); break;
case CRC_DISPMSGSIZE : CfgDispmsgsize (); break;
case CRC_DISPTABSIZE : CfgDisptabsize (); break;
default : found = false;
}
goto End;
SwitchE:
switch(crc) {
case CRC_EDITAUTOATTACH : CfgEditautoattach (); break;
case CRC_EDITAUTOSAVE : CfgEditautosave (); break;
case CRC_EDITCHANGEDATE : CfgEditchangedate (); break;
case CRC_EDITCHARPARA : CfgEditcharpara (); break;
case CRC_EDITCHARSPACE : CfgEditcharspace (); break;
case CRC_EDITCOMMENT : CfgEditcomment (); break;
case CRC_EDITCOMPLETION : CfgEditcompletion (); break;
case CRC_EDITCRLFTERM : CfgEditcrlfterm (); break;
case CRC_EDITFIELDCLEAR : CfgEditfieldclear (); break;
case CRC_EDITHARDLINE : CfgEdithardline (); break;
case CRC_EDITHARDLINES : CfgEdithardlines (); break;
case CRC_EDITHARDTERM : CfgEdithardterm (); break;
case CRC_EDITHDRNAMESET : CfgEdithdrnameset (); break;
case CRC_EDITHDRNODESET : CfgEdithdrnodeset (); break;
case CRC_EDITHEADERATTRS : CfgEditheaderattrs (); break;
case CRC_EDITHEADERFIRST : CfgEditheaderfirst (); break;
case CRC_EDITINTERNAL : CfgEditinternal (); break;
case CRC_EDITMENU : CfgEditmenu (); break;
case CRC_EDITMIXCASE : CfgEditmixcase (); break;
case CRC_EDITMSGSIZE : CfgEditmsgsize (); break;
case CRC_EDITOR : CfgEditor (); break;
case CRC_EDITORFILE : CfgEditorfile (); break;
case CRC_EDITQUOTEMARGIN : CfgEditquotemargin (); break;
case CRC_EDITREPLYRE : CfgEditreplyre (); break;
case CRC_EDITSAVEMENU : CfgEditsavemenu (); break;
case CRC_EDITSAVEUTIL : CfgEditsaveutil (); break;
case CRC_EDITSOFTCRXLAT : CfgEditsoftcrxlat (); break;
case CRC_EDITSPELLCHECK : CfgEditspellcheck (); break;
case CRC_EDITUNDELETE : CfgEditundelete (); break;
case CRC_ENDGROUP : CfgEndgroup (); break;
case CRC_ENCODEEMAILHEADERS: CfgEncodeemailheaders(); break;
case CRC_EVENT : CfgEvent (); break;
case CRC_EXCLUDENODES : CfgExcludenodes (); break;
case CRC_EXTERNOPTIONS : CfgExternoptions (); break;
case CRC_EXTERNUTIL : CfgExternutil (); break;
case CRC_EZYCOMMSGBASE : CfgEzycommsgbase (); break;
case CRC_EZYCOMUSERBASE : CfgEzycomuserbase (); break;
case CRC_EZYCOMUSERNO : CfgEzycomuserno (); break;
default : found = false;
}
goto End;
SwitchF:
switch(crc) {
case CRC_FIDOLASTREAD : CfgFidolastread (); break;
case CRC_FIDOMSGTYPE : CfgFidomsgtype (); break;
case CRC_FIDOUSERLIST : CfgFidouserlist (); break;
case CRC_FIDOUSERNO : CfgFidouserno (); break;
case CRC_FILEALIAS : CfgFilealias (); break;
case CRC_FORCETEMPLATE : CfgForcetemplate (); break;
case CRC_FRQEXT : CfgFrqext (); break;
case CRC_FRQNODEMAP : CfgFrqnodemap (); break;
case CRC_FRQOPTIONS : CfgFrqoptions (); break;
default : found = false;
}
goto End;
SwitchG:
switch(crc) {
case CRC_GEDHANDSHAKE : CfgGedhandshake (); break;
case CRC_GERMANKEYBOARD : CfgGermankeyboard (); break;
case CRC_GOLDBASEPATH : CfgGoldbasepath (); break;
case CRC_GOLDBASESYSPATH : CfgGoldbasesyspath (); break;
case CRC_GOLDBASEUSERNO : CfgGoldbaseuserno (); break;
case CRC_GOLDPATH : CfgGoldpath (); break;
case CRC_GROUP : CfgGroup (); break;
default : found = false;
}
goto End;
SwitchH:
switch(crc) {
case CRC_HAPPYBIRTHDAY : CfgHappybirthday (); break;
case CRC_HUDSONPATH : CfgHudsonpath (); break;
case CRC_HUDSONSIZEWARN : CfgHudsonsizewarn (); break;
case CRC_HUDSONSYSPATH : CfgHudsonsyspath (); break;
case CRC_HUDSONUSERNO : CfgHudsonuserno (); break;
default : found = false;
}
goto End;
SwitchI:
switch(crc) {
case CRC_IGNORECHARSET : CfgIgnorecharset (); break;
case CRC_IMPORTBEGIN : CfgImportbegin (); break;
case CRC_IMPORTEND : CfgImportend (); break;
case CRC_INBOUNDPATH : CfgInboundpath (); break;
case CRC_INCLUDENODES : CfgIncludenodes (); break;
case CRC_INPUTFILE : CfgInputfile (); break;
case CRC_INTENSECOLORS : CfgIntensecolors (); break;
case CRC_INTERNETADDRESS : CfgInternetaddress (); break;
case CRC_INTERNETDOMAIN : CfgInternetdomain (); break;
case CRC_INTERNETGATE : CfgInternetgate (); break;
case CRC_INTERNETMSGID : CfgInternetmsgid (); break;
case CRC_INTERNETRFCBODY : CfgInternetrfcbody (); break;
case CRC_INTERNETSERVER : CfgInternetserver (); break;
case CRC_INVALIDATE : CfgInvalidate (); break;
default : found = false;
}
goto End;
SwitchJ:
switch(crc) {
case CRC_JAMPATH : CfgJampath (); break;
default : found = false;
}
goto End;
SwitchK:
switch(crc) {
case CRC_KEYBMODE : CfgKeybmode (); break;
case CRC_KEYBSTACK : CfgKeybstack (); break;
case CRC_KLUDGE : CfgKludge (); break;
default : found = false;
}
goto End;
SwitchL:
switch(crc) {
case CRC_LOADLANGUAGE : CfgLoadlanguage (); break;
case CRC_LOGFILE : CfgLogfile (); break;
case CRC_LOGFORMAT : CfgLogformat (); break;
default : found = false;
}
goto End;
SwitchM:
switch(crc) {
case CRC_MAILINGLIST : CfgMailinglist (); break;
case CRC_MAILTOSS : CfgMailtoss (); break;
case CRC_MAPPATH : CfgMappath (); break;
case CRC_MEMBER : CfgMember (); break;
case CRC_MENUMARKED : CfgMenumarked (); break;
case CRC_MSGLISTDATE : CfgMsglistdate (); break;
case CRC_MSGLISTFAST : CfgMsglistfast (); break;
case CRC_MSGLISTFIRST : CfgMsglistfirst (); break;
case CRC_MSGLISTHEADER : CfgMsglistheader (); break;
case CRC_MSGLISTWIDESUBJ : CfgMsglistwidesubj (); break;
default : found = false;
}
goto End;
SwitchN:
switch(crc) {
case CRC_NAMESFILE : CfgNamesfile (); break;
case CRC_NICKNAME : CfgNickname (); break;
case CRC_NODELIST : CfgNodelist (); break;
case CRC_NODEPATH : CfgNodepath (); break;
case CRC_NODEPATHFD : CfgNodepathfd (); break;
case CRC_NODEPATHIM : CfgNodepathfd (); break;
case CRC_NODEPATHV7 : CfgNodepathv7 (); break;
case CRC_NODEV7FLAGS : CfgNodev7flags (); break;
case CRC_NODEV7MODEM : CfgNodev7modem (); break;
default : found = false;
}
goto End;
SwitchO:
switch(crc) {
case CRC_ORGANIZATION : CfgOrganization (); break;
case CRC_ORIGIN : CfgOrigin (); break;
case CRC_OUTBOUNDPATH : CfgOutboundpath (); break;
case CRC_OUTPUTFILE : CfgOutputfile (); break;
default : found = false;
}
goto End;
SwitchP:
switch(crc) {
case CRC_PCBOARDPATH : CfgPcboardpath (); break;
case CRC_PCBOARDUSERNO : CfgPcboarduserno (); break;
case CRC_PERSONALMAIL : CfgPersonalmail (); break;
case CRC_PLAY : CfgPlay (); break;
case CRC_PRINTDEVICE : CfgPrintdevice (); break;
case CRC_PRINTINIT : CfgPrintinit (); break;
case CRC_PRINTLENGTH : CfgPrintlength (); break;
case CRC_PRINTMARGIN : CfgPrintmargin (); break;
case CRC_PRINTRESET : CfgPrintreset (); break;
default : found = false;
}
goto End;
SwitchQ:
switch(crc) {
case CRC_QUOTEBUFFILE : CfgQuotebuffile (); break;
case CRC_QUOTEBUFMODE : CfgQuotebufmode (); break;
case CRC_QUOTECHARS : CfgQuotechars (); break;
case CRC_QUOTECTRL : CfgQuotectrl (); break;
case CRC_QUOTEMARGIN : CfgQuotemargin (); break;
case CRC_QUOTESTRING : CfgQuotestring (); break;
case CRC_QUOTEWRAPHARD : CfgQuotewraphard (); break;
case CRC_QWKBADMSGS : CfgQwkbadmsgs (); break;
case CRC_QWKCONFMAP : CfgQwkconfmap (); break;
case CRC_QWKEXPORTPATH : CfgQwkexportpath (); break;
case CRC_QWKIMPORTPATH : CfgQwkimportpath (); break;
case CRC_QWKOPTIONS : CfgQwkoptions (); break;
case CRC_QWKREPLYLINKER : CfgQwkreplylinker (); break;
case CRC_QWKTOSSLOG : CfgQwktosslog (); break;
default : found = false;
}
goto End;
SwitchR:
switch(crc) {
case CRC_RA2USERSBBS : CfgRa2usersbbs (); break;
case CRC_REGISTERKEY : break;
case CRC_REGISTERNAME : break;
case CRC_REPLYLINK : CfgReplylink (); break;
case CRC_REPLYLINKLIST : CfgReplylinklist (); break;
case CRC_ROBOTNAME : CfgRobotname (); break;
default : found = false;
}
goto End;
SwitchS:
switch(crc) {
case CRC_SCREENBLANKER : CfgScreenblanker (); break;
case CRC_SCREENMAXCOL : CfgScreenmaxcol (); break;
case CRC_SCREENMAXROW : CfgScreenmaxrow (); break;
case CRC_SCREENPALETTE : CfgScreenpalette (); break;
case CRC_SCREENSIZE : CfgScreensize (); break;
case CRC_SEARCHFOR : CfgSearchfor (); break;
case CRC_SEMAPHORE : CfgSemaphore (); break;
case CRC_SERIALNO : break;
case CRC_SHAREMODE : CfgSharemode (); break;
case CRC_SHOWDELETED : CfgShowdeleted (); break;
case CRC_SOUNDPATH : CfgSoundpath (); break;
case CRC_SOUPBADMSGS : CfgSoupbadmsgs (); break;
case CRC_SOUPEMAIL : CfgSoupemail (); break;
case CRC_SOUPEXPORTMARGIN : CfgSoupexportmargin (); break;
case CRC_SOUPEXPORTPATH : CfgSoupexportpath (); break;
case CRC_SOUPIMPORTPATH : CfgSoupimportpath (); break;
case CRC_SOUPNEWSRCFILE : CfgSoupnewsrcfile (); break;
case CRC_SOUPREPLYLINKER : CfgSoupreplylinker (); break;
case CRC_SOUPREPLYTO : CfgSoupreplyto (); break;
case CRC_SOUPTOSSLOG : CfgSouptosslog (); break;
case CRC_SQUISHSCAN : CfgSquishscan (); break;
case CRC_SQUISHUSERNO : CfgSquishuserno (); break;
case CRC_SQUISHUSERPATH : CfgSquishuserpath (); break;
case CRC_STATUSLINEHELP : CfgStatuslinehelp (); break;
case CRC_STYLECODEPUNCT : CfgStylecodepunct (); break;
case CRC_STYLECODES : CfgStylecodes (); break;
case CRC_STYLECODESTOPS : CfgStylecodestops (); break;
default : found = false;
}
goto End;
SwitchT:
switch(crc) {
case CRC_TAGLINE : CfgTagline (); break;
case CRC_TAGLINECHAR : CfgTaglinechar (); break;
case CRC_TAGLINESUPPORT : CfgTaglinesupport (); break;
case CRC_TASKTITLE : CfgTasktitle (); break;
case CRC_TEARLINE : CfgTearline (); break;
case CRC_TEMPLATE : CfgTemplate (); break;
case CRC_TEMPLATEMATCH : CfgTemplatematch (); break;
case CRC_TEMPLATEPATH : CfgTemplatepath (); break;
case CRC_TEMPPATH : CfgTemppath (); break;
case CRC_TIMEOUT : CfgTimeout (); break;
case CRC_TITLESTATUS : CfgTitlestatus (); break;
case CRC_TWITMODE : CfgTwitmode (); break;
case CRC_TWITNAME : CfgTwitname (); break;
case CRC_TWITSUBJ : CfgTwitsubj (); break;
default : found = false;
}
goto End;
SwitchU:
switch(crc) {
case CRC_USECHARSET : CfgUsecharset (); break;
case CRC_USEFWD : CfgUsefwd (); break;
case CRC_USEINTL : CfgUseintl (); break;
case CRC_USEPID : CfgUsepid (); break;
case CRC_USERLIST : CfgUserlist (); break;
case CRC_USERLISTFILE : CfgUserlistfile (); break;
case CRC_USERNAME : CfgUsername (); break;
case CRC_USETZUTC : CfgUsetzutc (); break;
case CRC_UUDECODEPATH : CfgUudecodepath (); break;
default : found = false;
}
goto End;
SwitchV:
switch(crc) {
case CRC_VIEWHIDDEN : CfgViewhidden (); break;
case CRC_VIEWKLUDGE : CfgViewkludge (); break;
case CRC_VIEWQUOTE : CfgViewquote (); break;
default : found = false;
}
goto End;
SwitchW:
switch(crc) {
case CRC_WHOTO : CfgWhoto (); break;
case CRC_WILDCATUSERNO : CfgWildcatuserno (); break;
default : found = false;
}
goto End;
SwitchX:
switch(crc) {
case CRC_XLATCHARSET : CfgXlatcharset (); break;
case CRC_XLATESCSET : CfgXlatescset (); break;
case CRC_XLATEXPORT : CfgXlatexport (); break;
case CRC_XLATIMPORT : CfgXlatimport (); break;
case CRC_XLATLOCALSET : CfgXlatlocalset (); break;
case CRC_XLATPATH : CfgXlatpath (); break;
default : found = false;
}
goto End;
SwitchY:
switch(crc) {
default : found = false;
}
goto End;
SwitchZ:
switch(crc) {
case CRC_ZONEGATING : CfgZonegating (); break;
default : found = false;
}
goto End;
End:
if(found)
return true;
// if(cmdlineoldkeyw == false)
return false;
}
// ------------------------------------------------------------------
static int do_if(char* val) {
if(strieql(val, "OS/2") or strieql(val, "OS2")) {
#ifdef __OS2__
return true;
#else
return false;
#endif
}
else if(strieql(val, "NT") or strieql(val, "W32") or strieql(val, "WIN32")) {
#ifdef __WIN32__
return true;
#else
return false;
#endif
}
else if(strieql(val, "386") or strieql(val, "DOS")) {
#ifdef __MSDOS__
return true;
#else
return false;
#endif
}
else if(strieql(val, "LINUX") or strieql(val, "UNIX")) {
#ifdef __UNIX__
return true;
#else
return false;
#endif
}
else if(strieql(val, "FIREBIRD"))
return true;
else if(strieql(val, "ASA") or strieql(val, "PLUS"))
return true;
else if(strieql(val, "YES") or strieql(val, "TRUE") or strieql(val, "ON"))
return true;
return !!atoi(val);
}
// ------------------------------------------------------------------
// Compile a GoldED text config file
int ReadCfg(const char* cfgfile, int ignoreunknown) {
const word CRC_APP = 0x08B5;
FILE* fp;
Path cfg;
char buf[1024];
static int inuse = 0;
static int in_if = false;
static int in_else = false;
static int if_status = false;
char* val;
char* key;
char* cfgname;
word crc;
int cfgignore=NO, line=0;
// Open the file
strcpy(cfg, cfgfile);
MakePathname(cfg, CFG->goldpath, cfg);
fp = fsopen(cfg, "rt", CFG->sharemode);
if(fp) {
cfgname = strrchr(cfg, '\\');
cfgname = cfgname ? cfgname+1 : cfg;
inuse++;
if(not quiet)
cout << "* Reading " << cfg << endl;
// Assign file buffer
setvbuf(fp, NULL, _IOFBF, 8192);
// Read each line
while(fgets((val=buf), sizeof(buf), fp)) {
line++;
// Replace TABs with SPACEs
strchg(val, '\t', ' ');
val = strskip_wht(val);
if(isalpha(*val)) {
// Extract key and val
crc = getkeyvalcrc(&key, &val);
int _gotcond = true;
switch(crc) {
case CRC_IF:
if(in_if) {
cout << "* " << cfgname << ": Misplaced IF at line " << line << ". IF's cannot be nested." << endl;
cfgerrors++;
}
in_if = true;
if_status = do_if(val);
cfgignore = not if_status;
break;
case CRC_ELIF:
case CRC_ELSEIF:
if(not in_if or in_else) {
cout << "* " << cfgname << ": Misplaced ELIF/ELSEIF at line " << line << "." << endl;
cfgerrors++;
}
if(if_status)
cfgignore = true;
else {
if_status = do_if(val);
cfgignore = not if_status;
}
break;
case CRC_ELSE:
if(not in_if or in_else) {
cout << "* " << cfgname << ": Misplaced ELSE at line " << line << "." << endl;
cfgerrors++;
}
in_else = true;
if_status ^= true;
cfgignore = not if_status;
break;
case CRC_ENDIF:
if(not in_if) {
cout << "* " << cfgname << ": Misplaced ENDIF at line " << line << "." << endl;
cfgerrors++;
}
cfgignore = false;
in_if = in_else = false;
break;
case CRC_IGNORE:
cfgignore ^= true;
break;
default:
_gotcond = false;
}
// Tell the world what we found
if(veryverbose)
cout << " " << (cfgignore ? '-' : '+') << setw(4) << setfill('0') << line << setfill(' ') << ": " << key << " " << val << endl;
// Call switch function to act on the key
if(not cfgignore) {
if(not _gotcond) {
switch(crc) {
case CRC_INCLUDE:
if(not quiet)
cout << "* Including " << val << endl;
ReadCfg(val); // NOTE! This is a recursive call!
if(not quiet)
cout << "* Resuming " << cfg << endl;
break;
case CRC_AREAFILE:
if(not quiet)
cout << "* Handling " << key << " " << val << endl;
AL.GetAreafile(val);
if(not quiet)
cout << "* Resuming " << cfg << endl;
break;
case CRC_APP:
// Ignore 3rd party application lines
break;
case CRC_REM:
// Ignore remark lines
break;
default:
if(not SwitchCfg(crc, *key, val)) {
if(not ignoreunknown) {
cout << "* " << cfgname << ": Unknown keyword \"" << key << "\" at line " << line << "." << endl;
SayBibi();
cfgerrors++;
}
}
}
}
}
}
}
// Close and return all OK
fclose(fp);
inuse--;
// When the final cfg is compiled
if(inuse == 0) {
// Mark all areas listed in the NEWSRC file as newsgroups
gfile gfp;
gfp.fopen(CFG->soupnewsrcfile, "rt");
if(gfp.isopen()) {
char buf2[512];
while(gfp.fgets(buf2, sizeof(buf2))) {
char* ptr = strpbrk(buf2, ":! ");
if(ptr) {
*ptr = NUL;
Area* ap = AL.AreaEchoToPtr(buf2);
if(ap)
ap->set_type(ap->isnet() ? AT_SOUP|AT_EMAIL|AT_NET : AT_SOUP|AT_NEWSGROUP|AT_ECHO);
}
}
gfp.fclose();
}
if(*CFG->soupemail) {
Area* ap = AL.AreaEchoToPtr(buf);
if(ap)
ap->set_type(AT_SOUP|AT_EMAIL|AT_NET);
}
vector<MailList>::iterator z;
for(z = CFG->mailinglist.begin(); z != CFG->mailinglist.end(); z++) {
Area* ap = AL.AreaEchoToPtr(z->echoid);
if(ap)
ap->set_type(AT_SOUP|AT_EMAIL|AT_NET);
}
// Mark all QWK areas
if(QWK->FirstBBS()) {
do {
if(QWK->FirstConf()) {
do {
Area* ap = AL.AreaEchoToPtr(buf);
if(ap)
ap->set_type(ap->type() | AT_QWK);
} while(QWK->NextConf());
}
} while(QWK->NextBBS());
}
}
return 1;
}
else {
LOG.ErrOpen();
LOG.printf("! Unable to open configuration file.");
LOG.printf(": %s", cfg);
LOG.ErrOSInfo();
OpenErrorExit();
}
// Error opening file
return 0;
}
// ------------------------------------------------------------------

406
golded3/gccfgg1.cpp Normal file
View File

@ -0,0 +1,406 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Configuration functions, part 1.
// ------------------------------------------------------------------
#include <golded.h>
#include <gcprot.h>
// ------------------------------------------------------------------
extern char* val;
// ------------------------------------------------------------------
void CfgAddress() { CfgAddress(val); }
void CfgAddress(char* v) {
if(not strblank(v)) {
if(veryverbose)
cout << " CfgAddress(" << v << ")" << endl;
gaka aka;
aka.domain[0] = NUL;
aka.pointnet = 0;
char* ptr = strchr(v, ',');
if(ptr) {
aka.pointnet = atow(ptr+1);
*ptr = NUL;
}
if(not CFG->aka.empty()) {
aka.addr = CFG->aka[0].addr;
strcpy(aka.domain, CFG->aka[0].domain);
}
aka.addr.set(v, aka.domain);
if(cfgingroup)
CFG->grp.AddItm(GRP_AKA, &aka, sizeof(gaka));
int gotaka = GetAkaNo(aka.addr);
if(gotaka == -1)
CFG->aka.push_back(aka);
}
}
// ------------------------------------------------------------------
void CfgAddressbookadd() {
CFG->addressbookadd = GetYesno(val);
}
// ------------------------------------------------------------------
void CfgAddresslookupfirst(){
if(strieql(val, "MSGID"))
CFG->addresslookupfirst = YES;
else
CFG->addresslookupfirst = NO;
}
// ------------------------------------------------------------------
void CfgAddressmacro(char* v) { val = v; CfgAddressmacro(); }
void CfgAddressmacro() {
AddrMacro tmp;
tmp.attr.reset();
int subjwasquoted = NO;
char* ptr = val;
char* ptr2 = strchr(ptr, ','); // macro^,name,address,subj,attribs
if(ptr2) {
// Got macroname
*ptr2++ = NUL;
strxcpy(tmp.macro, ptr, 20);
ptr = strskip_wht(ptr2);
ptr2 = strchr(ptr, ','); // macro,name^,address,subj,attribs
if(ptr2) {
// Got real name
*ptr2++ = NUL;
strxcpy(tmp.name, ptr, sizeof(IAdr));
ptr = strskip_wht(ptr2);
ptr2 = strchr(ptr, ','); // macro,name,address^,subj,attribs
if(ptr2)
*ptr2++ = NUL;
// Got address
if(not CFG->aka.empty())
tmp.addr = CFG->aka[0].addr;
tmp.addr.set(ptr);
if(ptr2) {
// Got subject
ptr = strskip_wht(ptr2);
if((*ptr == '\"') or (*ptr == '\'')) {
ptr2 = strchr(ptr+1, *ptr);
if(ptr2) {
subjwasquoted = YES;
*ptr2++ = NUL;
ptr++;
}
}
strxcpy(tmp.subj, ptr, sizeof(Subj));
// Got quoted subj, so look for attribs
if(subjwasquoted) {
ptr2 = strchr(ptr2, ','); // macro,name,address,subj^,attribs
if(ptr2)
GetAttribstr(&tmp.attr, ptr2+1);
}
}
else
tmp.subj[0] = NUL;
CFG->addressmacro.push_back(tmp);
}
}
}
// ------------------------------------------------------------------
void CfgAdeptxbbspath() {
PathCopy(CFG->adeptxbbspath, val);
}
// ------------------------------------------------------------------
void CfgAdeptxbbsuserno() {
CFG->adeptxbbsuserno = atoi(val);
}
// ------------------------------------------------------------------
void CfgAkamatch() {
char* key;
getkeyval(&key, &val);
AkaMatchG akamatchg;
akamatchg.mask.set_all(GFTN_ALL);
akamatchg.mask.set(key);
akamatchg.aka.reset(val);
CFG->akamatch.push_back(akamatchg);
}
// ------------------------------------------------------------------
void CfgAkamatching() {
if(cfgingroup) {
bool flag = GetYesno(val);
CFG->grp.AddItm(GRP_AKAMATCHING, flag);
}
}
// ------------------------------------------------------------------
void CfgArea() {
AL.GetArea(val);
}
// ------------------------------------------------------------------
void CfgAreaautoid() {
if(striinc("VERBOSE", val))
CFG->areaautoid = AUTOID_VERBOSE;
else if(striinc("SHORT", val))
CFG->areaautoid = AUTOID_SHORT;
else if(striinc("LONG", val))
CFG->areaautoid = AUTOID_LONG;
}
// ------------------------------------------------------------------
void CfgAreacfmreplyto() {
strxcpy(CFG->areacfmreplyto, val, sizeof(Echo));
}
// ------------------------------------------------------------------
void CfgAreacopydirect() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_AREACOPYDIRECT, flag);
else
CFG->areacopydirect = flag;
}
// ------------------------------------------------------------------
void CfgAreacopyto() {
Echo buf;
strxcpy(buf, val, sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_AREACOPYTO, buf, strlen(buf)+1);
else
strcpy(CFG->areacopyto, buf);
}
// ------------------------------------------------------------------
void CfgAreacopyaddid() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_AREACOPYADDID, flag);
else
CFG->areacopyaddid = flag;
}
// ------------------------------------------------------------------
void CfgAreadef() {
AL.GetAreaDef(val);
}
// ------------------------------------------------------------------
void CfgAreadesc() {
AL.GetAreaDesc(val);
}
// ------------------------------------------------------------------
void CfgAreaexcl() {
tokenize(CFG->areaexcl, val);
}
// ------------------------------------------------------------------
void CfgAreaforwarddirect() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_AREAFORWARDDIRECT, flag);
else
CFG->areaforwarddirect = flag;
}
// ------------------------------------------------------------------
void CfgAreafreqdirect() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_AREAFREQDIRECT, flag);
else
CFG->areafreqdirect = flag;
}
// ------------------------------------------------------------------
void CfgAreafreqto() {
Echo buf;
strxcpy(buf, val, sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_AREAFREQTO, buf, strlen(buf)+1);
else
strcpy(CFG->areafreqto, buf);
}
// ------------------------------------------------------------------
void CfgAreaincl() {
tokenize(CFG->areaincl, val);
}
// ------------------------------------------------------------------
void CfgAreaisemail() {
tokenize(CFG->areaisemail, val);
}
// ------------------------------------------------------------------
void CfgAreaisnews() {
tokenize(CFG->areaisnews, val);
}
// ------------------------------------------------------------------
void CfgArealistechomax() {
CFG->arealistechomax = atoi(val);
}
// ------------------------------------------------------------------
void CfgArealistformat() {
strcpy(CFG->arealistformat, StripQuotes(val));
}
// ------------------------------------------------------------------
void CfgArealistscan() {
char* _key;
getkeyval(&_key, &val);
AL.ListScan.Add(pair<string, string>(StripQuotes(_key), val));
}
// ------------------------------------------------------------------
void CfgArealistsort() {
strupr(strxcpy(CFG->arealistsort, val, sizeof(CFG->arealistsort)));
}
// ------------------------------------------------------------------
void CfgArealisttype() {
if(strieql(val, "New"))
CFG->arealisttype = AL_TOTNEW;
else if(strieql(val, "Last"))
CFG->arealisttype = AL_TOTLST;
}
// ------------------------------------------------------------------
void CfgAreapath() {
PathCopy(CFG->areapath, val);
}
// ------------------------------------------------------------------
void CfgAreapmscan() {
tokenize(CFG->areapmscan, val);
}
// ------------------------------------------------------------------
void CfgAreapmscanexcl() {
tokenize(CFG->areapmscanexcl, val);
}
// ------------------------------------------------------------------
void CfgAreapmscanincl() {
tokenize(CFG->areapmscanincl, val);
}
// ------------------------------------------------------------------
void CfgAreareadonly() {
if(strieql(val, "Soft"))
CFG->areareadonly = READONLY_SOFT;
else if(strieql(val, "Hard"))
CFG->areareadonly = READONLY_HARD;
}
// ------------------------------------------------------------------
void CfgArearename() {
char* key;
getkeyval(&key, &val);
CFG->arearename.push_back(EchoRen(key, strtrim(val)));
}
// ------------------------------------------------------------------

489
golded3/gccfgg2.cpp Normal file
View File

@ -0,0 +1,489 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Configuration functions, part 2.
// ------------------------------------------------------------------
#include <golded.h>
#include <gcprot.h>
// ------------------------------------------------------------------
extern char* val;
// ------------------------------------------------------------------
void CfgAreareplydirect() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_AREAREPLYDIRECT, flag);
else
CFG->areareplydirect = flag;
}
// ------------------------------------------------------------------
void CfgAreareplyto() {
Echo buf;
strxcpy(buf, val, sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_AREAREPLYTO, buf, strlen(buf)+1);
else
strcpy(CFG->areareplyto, buf);
}
// ------------------------------------------------------------------
void CfgAreascan() {
tokenize(CFG->areascan, val);
}
// ------------------------------------------------------------------
void CfgAreascanexcl() {
tokenize(CFG->areascanexcl, val);
}
// ------------------------------------------------------------------
void CfgAreascanincl() {
tokenize(CFG->areascanincl, val);
}
// ------------------------------------------------------------------
void CfgAreascansort() {
strupr(strxcpy(CFG->areascansort, val, sizeof(CFG->areascansort)));
}
// ------------------------------------------------------------------
void CfgAreasep() {
AL.GetAreaSep(val);
}
// ------------------------------------------------------------------
void CfgAreastart() {
strupr(strxcpy(CFG->areastart, val, sizeof(Echo)));
}
// ------------------------------------------------------------------
void CfgAreatypeorder() {
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;
GTok t;
int order = 1;
if(t.First(val)) {
do {
switch(strCrc16(t.Token())) {
case CRC_NET: CFG->areatypeorder[AT_NET] = order; break;
case CRC_EMAIL: CFG->areatypeorder[AT_NET|AT_EMAIL] = order; break;
case CRC_ECHO: CFG->areatypeorder[AT_ECHO] = order; break;
case CRC_NEWS: CFG->areatypeorder[AT_ECHO|AT_NEWSGROUP] = order; break;
case CRC_LOCAL: CFG->areatypeorder[AT_LOCAL] = order; break;
}
order++;
} while(t.Next());
}
}
// ------------------------------------------------------------------
void CfgAreayouwroteto() {
Echo buf;
strxcpy(buf, val, sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_AREAYOUWROTETO, buf, strlen(buf)+1);
else
strcpy(CFG->areayouwroteto, buf);
}
// ------------------------------------------------------------------
void CfgAttachpath() {
PathCopy(CFG->attachpath, val);
}
// ------------------------------------------------------------------
void CfgAttribsattach() {
GetAttribstr(&CFG->attribsattach, val);
}
// ------------------------------------------------------------------
void CfgAttribscc() {
GetAttribstr(&CFG->attribscc, val);
}
// ------------------------------------------------------------------
void CfgAttribscfm() {
GetAttribstr(&CFG->attribscfm, val);
}
// ------------------------------------------------------------------
void CfgAttribsecho() {
GetAttribstr(&CFG->attribsecho, val);
}
// ------------------------------------------------------------------
void CfgAttribsemail() {
GetAttribstr(&CFG->attribsemail, val);
}
// ------------------------------------------------------------------
void CfgAttribsfrq() {
GetAttribstr(&CFG->attribsfrq, val);
}
// ------------------------------------------------------------------
void CfgAttribslocal() {
GetAttribstr(&CFG->attribslocal, val);
}
// ------------------------------------------------------------------
void CfgAttribsnet() {
GetAttribstr(&CFG->attribsnet, val);
}
// ------------------------------------------------------------------
void CfgAttribsnews() {
GetAttribstr(&CFG->attribsnews, val);
}
// ------------------------------------------------------------------
void CfgAttributes() {
char buf[256];
strxcpy(buf, val, 256);
if(cfgingroup)
CFG->grp.AddItm(GRP_ATTRIBUTES, buf, strlen(buf)+1);
}
// ------------------------------------------------------------------
void CfgBeepfactor() {
CFG->beepfactor = atoi(val);
}
// ------------------------------------------------------------------
void CfgBeepyourmail() {
CFG->beepyourmail = GetYesno(val);
}
// ------------------------------------------------------------------
#define CRC_REMOVE 0xFAF0
#define CRC_HIDDEN 0xE465
#define CRC_VISIBLE 0xD155
#define CRC_NAMES 0xE46B
#define CRC_KEEP 0x8C07
void CfgCarboncopylist() {
switch(strCrc16(val)) {
case CRC_REMOVE: CFG->carboncopylist = CC_REMOVE; break;
case CRC_HIDDEN: CFG->carboncopylist = CC_HIDDEN; break;
case CRC_VISIBLE: CFG->carboncopylist = CC_VISIBLE; break;
case CRC_NAMES: CFG->carboncopylist = CC_NAMES; break;
case CRC_KEEP: CFG->carboncopylist = CC_KEEP; break;
default:
CFG->carboncopylist = GetYesno(val) ? CC_KEEP : CC_REMOVE;
}
}
// ------------------------------------------------------------------
void CfgColor() {
GetColors(val);
}
// ------------------------------------------------------------------
void CfgColorset() {
if(strieql(val, "Normal")) {
memcpy(CFG->color, gold_color1, sizeof(Win)*16);
}
else if(strieql(val, "Intense")) {
CFG->intensecolors = true;
memcpy(CFG->color, gold_color2, sizeof(Win)*16);
}
else if(strieql(val, "Mono")) {
memcpy(CFG->color, gold_mono1, sizeof(Win)*16);
}
}
// ------------------------------------------------------------------
void CfgConfirmresponse() {
CFG->confirmresponse = GetYesno(val);
}
// ------------------------------------------------------------------
void CfgConfirmfile() {
strcpy(CFG->confirmfile, val);
}
// ------------------------------------------------------------------
void CfgCookiepath() {
PathCopy(CFG->cookiepath, val);
}
// ------------------------------------------------------------------
void CfgCrosspost() {
CFG->crosspost = GetYesno(val);
}
// ------------------------------------------------------------------
#define CRC_NONE 0xD9AD
#define CRC_RAW 0x3BE0
#define CRC_VERBOSE 0xBB00
void CfgCrosspostlist() {
switch(strCrc16(val)) {
case CRC_NONE: CFG->crosspostlist = CC_REMOVE; break;
case CRC_VERBOSE: CFG->crosspostlist = CC_NAMES; break;
case CRC_RAW: CFG->crosspostlist = CC_KEEP; break;
default:
CFG->crosspostlist = GetYesno(val) ? CC_VISIBLE : CC_REMOVE;
}
}
// ------------------------------------------------------------------
void CfgCtrlinfo() {
if(cfgingroup) {
int ctrlinfo = CI_NONE;
if(striinc("NO", val))
ctrlinfo = CI_NONE;
else if(striinc("YES", val))
ctrlinfo = CI_TEAR|CI_ORIG;
else {
if(striinc("TEARLINE", val))
ctrlinfo |= CI_TEAR;
if(striinc("ORIGIN", val))
ctrlinfo |= CI_ORIG;
}
CFG->grp.AddItm(GRP_CTRLINFO, ctrlinfo);
}
}
// ------------------------------------------------------------------
void CfgCtrlinfoecho() {
CFG->ctrlinfoecho = CI_NONE;
if(striinc("NO", val))
CFG->ctrlinfoecho = CI_NONE;
else if(striinc("YES", val))
CFG->ctrlinfoecho = CI_TEAR|CI_ORIG;
else {
if(striinc("TEARLINE", val))
CFG->ctrlinfoecho |= CI_TEAR;
if(striinc("ORIGIN", val))
CFG->ctrlinfoecho |= CI_ORIG;
}
}
// ------------------------------------------------------------------
void CfgCtrlinfoemail() {
CFG->ctrlinfoemail = CI_NONE;
if(striinc("NO", val))
CFG->ctrlinfoemail = CI_NONE;
else if(striinc("YES", val))
CFG->ctrlinfoemail = CI_TEAR|CI_ORIG;
else {
if(striinc("TEARLINE", val))
CFG->ctrlinfoemail |= CI_TEAR;
if(striinc("ORIGIN", val))
CFG->ctrlinfoemail |= CI_ORIG;
}
}
// ------------------------------------------------------------------
void CfgCtrlinfolocal() {
CFG->ctrlinfolocal = CI_NONE;
if(striinc("NO", val))
CFG->ctrlinfolocal = CI_NONE;
else if(striinc("YES", val))
CFG->ctrlinfolocal = CI_TEAR|CI_ORIG;
else {
if(striinc("TEARLINE", val))
CFG->ctrlinfolocal |= CI_TEAR;
if(striinc("ORIGIN", val))
CFG->ctrlinfolocal |= CI_ORIG;
}
}
// ------------------------------------------------------------------
void CfgCtrlinfonet() {
CFG->ctrlinfonet = CI_NONE;
if(striinc("NO", val))
CFG->ctrlinfonet &= ~CI_ORIG;
else if(striinc("YES", val))
CFG->ctrlinfonet = CI_TEAR|CI_ORIG;
else {
if(striinc("TEARLINE", val))
CFG->ctrlinfonet |= CI_TEAR;
if(striinc("ORIGIN", val))
CFG->ctrlinfonet |= CI_ORIG;
}
}
// ------------------------------------------------------------------
void CfgCtrlinfonews() {
CFG->ctrlinfonews = CI_NONE;
if(striinc("NO", val))
CFG->ctrlinfonews = CI_NONE;
else if(striinc("YES", val))
CFG->ctrlinfonews = CI_TEAR|CI_ORIG;
else {
if(striinc("TEARLINE", val))
CFG->ctrlinfonews |= CI_TEAR;
if(striinc("ORIGIN", val))
CFG->ctrlinfonews |= CI_ORIG;
}
}
// ------------------------------------------------------------------
void CfgDispattachsize() {
if(strieql("NO", val))
CFG->dispattachsize = NO;
else if(strieql("BYTES", val))
CFG->dispattachsize = ATTACH_BYTES;
else if(strieql("KBYTES", val))
CFG->dispattachsize = ATTACH_KBYTES;
}
// ------------------------------------------------------------------
void CfgDisphdrdateset() {
char* key;
getkeyval(&key, &val);
CFG->disphdrdateset.pos = atoi(key);
getkeyval(&key, &val);
CFG->disphdrdateset.len = atoi(key);
}
// ------------------------------------------------------------------
void CfgDisphdrnameset() {
char* key;
getkeyval(&key, &val);
CFG->disphdrnameset.pos = atoi(key);
getkeyval(&key, &val);
CFG->disphdrnameset.len = atoi(key);
}
// ------------------------------------------------------------------
void CfgDisphdrnodeset() {
char* key;
getkeyval(&key, &val);
CFG->disphdrnodeset.pos = atoi(key);
getkeyval(&key, &val);
CFG->disphdrnodeset.len = atoi(key);
}
// ------------------------------------------------------------------
void CfgDisplistcursor() {
if(strieql(val, "TOP"))
CFG->displistcursor = LIST_TOP;
else if(strieql(val, "NEARTOP"))
CFG->displistcursor = LIST_NEARTOP;
else if(strieql(val, "MIDDLE"))
CFG->displistcursor = LIST_MIDDLE;
else if(strieql(val, "NEARBOTTOM"))
CFG->displistcursor = LIST_NEARBOTTOM;
else if(strieql(val, "BOTTOM"))
CFG->displistcursor = LIST_BOTTOM;
}
// ------------------------------------------------------------------

372
golded3/gccfgg3.cpp Normal file
View File

@ -0,0 +1,372 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Configuration functions, part 3.
// ------------------------------------------------------------------
#include <golded.h>
#include <gcprot.h>
// ------------------------------------------------------------------
extern char* val;
// ------------------------------------------------------------------
void CfgDispmargin() {
CFG->cfgdispmargin = atoi(val);
CFG->dispmargin = CFG->cfgdispmargin;
}
// ------------------------------------------------------------------
void CfgDispmsgsize() {
if(strieql("NO", val))
CFG->dispmsgsize = NO;
else if(strieql("BYTES", val))
CFG->dispmsgsize = DISPMSGSIZE_BYTES;
else if(strieql("KBYTES", val))
CFG->dispmsgsize = DISPMSGSIZE_KBYTES;
else if(strieql("LINES", val))
CFG->dispmsgsize = DISPMSGSIZE_KBYTES+1;
}
// ------------------------------------------------------------------
void CfgDispareano() {
CFG->dispareano = GetYesno(val);
}
// ------------------------------------------------------------------
void CfgDisptabsize() {
CFG->disptabsize = atoi(val);
}
// ------------------------------------------------------------------
void CfgEditautoattach() {
EDIT->AutoAttach(GetYesno(val));
}
// ------------------------------------------------------------------
void CfgEditautosave() {
EDIT->AutoSave(atoi(val));
}
// ------------------------------------------------------------------
void CfgEditchangedate() {
EDIT->ChangeDate(GetYesno(val));
}
// ------------------------------------------------------------------
void CfgEditcharpara() {
char ch = *StripQuotes(val);
if(ch)
EDIT->CharPara(ch);
}
// ------------------------------------------------------------------
void CfgEditcharspace() {
char ch = *StripQuotes(val);
if(ch)
EDIT->CharSpace(ch);
}
// ------------------------------------------------------------------
void CfgEditcomment() {
char* key;
getkeyval(&key, &val);
StripQuotes(key);
StripQuotes(val);
EDIT->Comment.Add(key, val);
}
// ------------------------------------------------------------------
void CfgEditcompletion() {
char* key;
getkeyval(&key, &val);
StripQuotes(key);
StripQuotes(val);
EDIT->Completion.Add(key, val);
}
// ------------------------------------------------------------------
void CfgEditcrlfterm() {
EDIT->CrLfTerm(GetYesno(val));
}
// ------------------------------------------------------------------
void CfgEditfieldclear() {
EDIT->FieldClear(GetYesno(val));
}
// ------------------------------------------------------------------
void CfgEdithardline() {
EDIT->HardLine(StripQuotes(val));
}
// ------------------------------------------------------------------
void CfgEdithardlines() {
EDIT->HardLines(GetYesno(val));
}
// ------------------------------------------------------------------
void CfgEdithardterm() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_EDITHARDTERM, flag);
else
EDIT->HardTerm(flag);
}
// ------------------------------------------------------------------
void CfgEdithdrnameset() {
char* key;
getkeyval(&key, &val);
EDIT->HdrNamePos(atoi(key));
EDIT->HdrNameLen(atoi(val));
}
// ------------------------------------------------------------------
void CfgEdithdrnodeset() {
char* key;
getkeyval(&key, &val);
EDIT->HdrNodePos(atoi(key));
EDIT->HdrNodeLen(atoi(val));
}
// ------------------------------------------------------------------
void CfgEditheaderattrs() {
EDIT->HeaderAttrs(GetYesno(val));
}
// ------------------------------------------------------------------
void CfgEditheaderfirst() {
int v = EDITHEADERFIRST_NO;
GTok t;
if(t.First(val)) {
do {
if(strieql("NEW", t.Token()))
v |= EDITHEADERFIRST_NEW;
else if(strieql("CHANGES", t.Token()))
v |= EDITHEADERFIRST_CHANGES;
else if(strieql("REPLIES", t.Token()))
v |= EDITHEADERFIRST_REPLIES;
else if(strieql("FORWARDS", t.Token()))
v |= EDITHEADERFIRST_FORWARDS;
else
v = GetYesno(t.Token()) ? EDITHEADERFIRST_YES : EDITHEADERFIRST_NO;
} while(t.Next());
}
EDIT->HeaderFirst(v);
}
// ------------------------------------------------------------------
void CfgEditinternal() {
EDIT->Internal(GetYesno(val));
}
// ------------------------------------------------------------------
void CfgEditmenu() {
EDIT->Menu(GetYesno(val));
}
// ------------------------------------------------------------------
void CfgEditmixcase() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_EDITMIXCASE, flag);
else
EDIT->MixCase(flag);
}
// ------------------------------------------------------------------
void CfgEditmsgsize() {
EDIT->MsgSize(atol(val));
}
// ------------------------------------------------------------------
void CfgEditor() {
EDIT->External(val);
}
// ------------------------------------------------------------------
void CfgEditorfile() {
EDIT->File(val);
}
// ------------------------------------------------------------------
void CfgEditquotemargin() {
EDIT->QuoteMargin(atoi(val));
}
// ------------------------------------------------------------------
void CfgEditreplyre() {
int replyre;
if(strieql(val, "NUMERIC"))
replyre = REPLYRE_NUMERIC;
else
replyre = GetYesno(val) ? REPLYRE_YES : REPLYRE_NO;
if(cfgingroup)
CFG->grp.AddItm(GRP_EDITREPLYRE, replyre);
else
EDIT->ReplyRe(replyre);
}
// ------------------------------------------------------------------
void CfgEditsavemenu() {
EDIT->SaveMenu(GetYesno(val));
}
// ------------------------------------------------------------------
void CfgEditsaveutil() {
char* _key;
getkeyval(&_key, &val);
int n = atoi(_key);
EDIT->SaveUtil.Add(n, StripQuotes(val));
}
// ------------------------------------------------------------------
void CfgEditsoftcrxlat() {
EDIT->SoftCrXlat(*val);
}
// ------------------------------------------------------------------
void CfgEditspellcheck() {
EDIT->SpellChecker(val);
}
// ------------------------------------------------------------------
void CfgEditundelete() {
EDIT->UnDelete(atoi(val));
}
// ------------------------------------------------------------------
void CfgEncodeemailheaders() {
CFG->encodeemailheaders = GetYesno(val);
}
// ------------------------------------------------------------------
void CfgEndgroup() {
cfgingroup = false;
}
// ------------------------------------------------------------------
void CfgEvent(char* v) { val = v; CfgEvent(); }
void CfgEvent() {
char* key;
word x;
vector<GEvent>::iterator n;
GEvent tmp;
x = getkeyvalcrc(&key, &val);
for(n = CFG->event.begin(); n != CFG->event.end(); n++)
if(x == n->type)
break;
tmp.type = x;
getkeyval(&key, &val);
if(strieql(key, "PLAY")) {
tmp.command = EVTC_PLAY;
FileToGPlay(&tmp.play, val);
}
if(n == CFG->event.end())
CFG->event.push_back(tmp);
else
*n = tmp;
}
// ------------------------------------------------------------------

348
golded3/gccfgg4.cpp Normal file
View File

@ -0,0 +1,348 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Configuration functions, part 4.
// ------------------------------------------------------------------
#include <golded.h>
#include <gcprot.h>
// ------------------------------------------------------------------
extern char* val;
// ------------------------------------------------------------------
void CfgExcludenodes() {
// Only used by GoldNODE
}
// ------------------------------------------------------------------
void CfgExternoptions() {
const word CRC_CLS = 0x34F4;
const word CRC_CURSOR = 0x0D67;
const word CRC_RELOAD = 0xDEC0;
const word CRC_PAUSE = 0x3926;
const word CRC_PAUSEONERROR = 0xD99A;
const word CRC_WIPE = 0x1E80;
const word CRC_KEEPCTRL = 0x0738;
const word CRC_NOCLS = 0x2FAA;
const word CRC_NOCURSOR = 0x9345;
const word CRC_NORELOAD = 0x40E2;
const word CRC_NOPAUSE = 0x5D94;
const word CRC_NOPAUSEONERROR = 0xDBAA;
const word CRC_NOWIPE = 0xE3DA;
const word CRC_NOKEEPCTRL = 0x38FC;
// Handle options
while(*val) {
if(*val == '-')
val++;
char* _key;
word _crc = getkeyvalcrc(&_key, &val);
switch(_crc) {
case CRC_CLS:
CFG->externoptions |= EXTUTIL_CLS;
break;
case CRC_CURSOR:
CFG->externoptions |= EXTUTIL_CURSOR;
break;
case CRC_RELOAD:
CFG->externoptions |= EXTUTIL_RELOAD;
break;
case CRC_PAUSE:
CFG->externoptions |= EXTUTIL_PAUSE;
break;
case CRC_PAUSEONERROR:
CFG->externoptions |= EXTUTIL_PAUSEONERROR;
break;
case CRC_WIPE:
CFG->externoptions |= EXTUTIL_WIPE;
break;
case CRC_KEEPCTRL:
CFG->externoptions |= EXTUTIL_KEEPCTRL;
break;
case CRC_NOCLS:
CFG->externoptions &= ~EXTUTIL_CLS;
break;
case CRC_NOCURSOR:
CFG->externoptions &= ~EXTUTIL_CURSOR;
break;
case CRC_NORELOAD:
CFG->externoptions &= ~EXTUTIL_RELOAD;
break;
case CRC_NOPAUSE:
CFG->externoptions &= ~EXTUTIL_PAUSE;
break;
case CRC_NOPAUSEONERROR:
CFG->externoptions &= ~EXTUTIL_PAUSEONERROR;
break;
case CRC_NOWIPE:
CFG->externoptions &= ~EXTUTIL_WIPE;
break;
case CRC_NOKEEPCTRL:
CFG->externoptions &= ~EXTUTIL_KEEPCTRL;
break;
}
}
}
// ------------------------------------------------------------------
void CfgExternutil() {
ExtUtil extutil;
// Get util number
char* _key;
char* _val = val;
getkeyval(&_key, &_val);
extutil.utilno = atoi(_key);
// Get options
int _optbak = CFG->externoptions;
while(strchr("-", *_val)) {
getkeyval(&_key, &_val);
val = _key;
CfgExternoptions();
}
extutil.options = CFG->externoptions;
CFG->externoptions = _optbak;
// Get commandline
strxcpy(extutil.cmdline, _val, sizeof(extutil.cmdline));
// Count it
CFG->externutil.push_back(extutil);
}
// ------------------------------------------------------------------
void CfgEzycommsgbase() {
PathCopy(CFG->ezycom.msgbasepath, val);
}
// ------------------------------------------------------------------
void CfgEzycomuserbase() {
PathCopy(CFG->ezycom.userbasepath, val);
}
// ------------------------------------------------------------------
void CfgEzycomuserno() {
CFG->ezycomuserno = atoi(val);
}
// ------------------------------------------------------------------
void CfgFidolastread() {
strcpy(CFG->fidolastread, val);
}
// ------------------------------------------------------------------
void CfgFidomsgtype() {
if(striinc("FTS", val))
CFG->fidomsgtype = MT_FTS1;
else
CFG->fidomsgtype = MT_OPUS;
}
// ------------------------------------------------------------------
void CfgFidouserlist() {
strcpy(CFG->fidouserlist, val);
}
// ------------------------------------------------------------------
void CfgFidouserno() {
CFG->fidouserno = atoi(val);
}
// ------------------------------------------------------------------
void CfgFilealias() {
char* ptr = strskip_txt(val);
if(*ptr) {
*ptr++ = NUL;
ptr = strskip_wht(ptr);
FileAlias tmp;
strxcpy(tmp.alias, val, sizeof(tmp.alias));
strxcpy(tmp.file, ptr, sizeof(Path));
CFG->filealias.push_back(tmp);
}
}
// ------------------------------------------------------------------
void CfgForcetemplate() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_FORCETEMPLATE, flag);
else
CFG->forcetemplate = flag;
}
// ------------------------------------------------------------------
void CfgFrqext(const char* v) {
char* ptr = val = throw_strdup(v);
CfgFrqext();
throw_free(ptr);
}
void CfgFrqext() {
tokenize(CFG->frqext, val);
}
// ------------------------------------------------------------------
void CfgFrqnodemap() {
char* key;
FrqNodeMap fnm;
getkeyval(&key, &val);
fnm.to.reset(key);
getkeyval(&key, &val);
fnm.from.reset(key);
CFG->frqnodemap.push_back(fnm);
}
// ------------------------------------------------------------------
void CfgFrqoptions() {
if(striinc("SORT", val))
CFG->frqoptions |= FREQ_SORT;
if(striinc("FROMTOP", val))
CFG->frqoptions |= FREQ_FROMTOP;
if(striinc("NOFILES", val))
CFG->frqoptions |= FREQ_NOFILES;
if(striinc("FAST", val))
CFG->frqoptions |= FREQ_FAST;
if(striinc("NOWAZOOMSG", val))
CFG->frqoptions |= FREQ_NOWAZOOMSG;
if(striinc("NOTFROMTOP", val))
CFG->frqoptions &= ~FREQ_FROMTOP;
}
// ------------------------------------------------------------------
void CfgGedhandshake() {
CFG->gedhandshake = GetYesno(val);
}
// ------------------------------------------------------------------
void CfgGermankeyboard() {
right_alt_same_as_left = not GetYesno(val);
}
// ------------------------------------------------------------------
void CfgGoldbasepath() {
PathCopy(CFG->goldbasepath, val);
}
// ------------------------------------------------------------------
void CfgGoldbasesyspath() {
PathCopy(CFG->goldbasesyspath, val);
}
// ------------------------------------------------------------------
void CfgGoldbaseuserno() {
CFG->goldbaseuserno = atoi(val);
}
// ------------------------------------------------------------------
void CfgGoldhelp() {
strxcpy(CFG->helpcfg.fn, val, sizeof(Path));
replaceextension(CFG->helpged, CFG->helpcfg.fn, __gver_cfgext__);
}
// ------------------------------------------------------------------
void CfgGoldlang() {
strxcpy(CFG->langcfg, val, sizeof(Path));
}
// ------------------------------------------------------------------
void CfgGoldpath() {
PathCopy(CFG->goldpath, val);
}
// ------------------------------------------------------------------
void CfgGoldxlat() {
replaceextension(CFG->xlatged, val, __gver_cfgext__);
}
// ------------------------------------------------------------------
void CfgGroup() {
char* _key;
getkeyval(&_key, &val);
CFG->grp.AddGrp(_key);
cfgingroup = true;
}
// ------------------------------------------------------------------

442
golded3/gccfgg5.cpp Normal file
View File

@ -0,0 +1,442 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Configuration functions, part 5.
// ------------------------------------------------------------------
#include <golded.h>
#include <gccfgg.h>
#include <gcprot.h>
// ------------------------------------------------------------------
extern char* val;
// ------------------------------------------------------------------
void CfgHappybirthday() {
if(strieql(val, "FRIEND"))
CFG->happybirthday = true;
}
// ------------------------------------------------------------------
void CfgHudsonpath() {
PathCopy(CFG->hudsonpath, val);
}
// ------------------------------------------------------------------
void CfgHudsonsizewarn() {
CFG->hudsonsizewarn = atol(val);
}
// ------------------------------------------------------------------
void CfgHudsonsyspath() {
PathCopy(CFG->hudsonsyspath, val);
}
// ------------------------------------------------------------------
void CfgHudsonuserno() {
CFG->hudsonuserno = atoi(val);
}
// ------------------------------------------------------------------
void CfgIgnorecharset() {
CFG->ignorecharset = GetYesno(val);
}
// ------------------------------------------------------------------
void CfgImportbegin() {
strxcpy(CFG->importbegin, StripQuotes(val), sizeof(CFG->importbegin));
}
// ------------------------------------------------------------------
void CfgImportend() {
strxcpy(CFG->importend, StripQuotes(val), sizeof(CFG->importend));
}
// ------------------------------------------------------------------
void CfgInboundpath() {
PathCopy(CFG->inboundpath, val);
}
// ------------------------------------------------------------------
void CfgIncludenodes() {
// Only used by GoldNODE
}
// ------------------------------------------------------------------
void CfgInputfile() {
Path buf;
strxcpy(buf, val, sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_INPUTFILE, buf, strlen(buf)+1);
else
strcpy(CFG->inputfile, buf);
}
// ------------------------------------------------------------------
void CfgIntensecolors() {
CFG->intensecolors = GetYesno(val);
if(CFG->intensecolors)
memcpy(CFG->color, gold_color2, sizeof(CFG->color));
}
// ------------------------------------------------------------------
void CfgInternetaddress() {
IAdr buf;
strxcpy(buf, val, sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_INTERNETADDRESS, buf, strlen(buf)+1);
else
strcpy(CFG->internetaddress, buf);
}
// ------------------------------------------------------------------
void CfgInternetdomain() {
strxcpy(CFG->internetdomain, val, sizeof(CFG->internetdomain));
}
// ------------------------------------------------------------------
void CfgInternetgate() {
Node tmp;
char* ptr = strchr(val, ',');
if(ptr) {
*ptr++ = NUL;
strxcpy(tmp.name, strtrim(val), sizeof(Name));
}
else {
ptr = val;
tmp.name[0] = NUL;
}
if(not CFG->aka.empty())
tmp.addr = CFG->aka[0].addr;
tmp.addr.set(strskip_wht(ptr));
if(cfgingroup)
CFG->grp.AddItm(GRP_INTERNETGATE, &tmp, sizeof(Node));
else
CFG->internetgate = tmp;
}
// ------------------------------------------------------------------
void CfgInternetmsgid() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_INTERNETMSGID, flag);
else
CFG->internetmsgid = flag;
}
// ------------------------------------------------------------------
void CfgInternetrfcbody() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_INTERNETRFCBODY, flag);
else
CFG->internetrfcbody = flag;
}
// ------------------------------------------------------------------
void CfgInternetserver() {
GTok t;
if(t.First(val)) {
int server = 0;
if(strieql(t.Token(), "NNTP"))
server = 1;
else if(strieql(t.Token(), "SMTP"))
server = 2;
else if(strieql(t.Token(), "POP3"))
server = 3;
int parameter = 1;
while(t.Next()) {
if(server == 1)
strxcpy(CFG->internetserver.nntp.server, t.Token(), sizeof(CFG->internetserver.nntp.server));
else if(server == 2)
strxcpy(CFG->internetserver.smtp.server, t.Token(), sizeof(CFG->internetserver.smtp.server));
else if(server == 3) {
if(parameter == 1)
strxcpy(CFG->internetserver.pop3.server, t.Token(), sizeof(CFG->internetserver.pop3.server));
else if(parameter == 2)
strxcpy(CFG->internetserver.pop3.username, t.Token(), sizeof(CFG->internetserver.pop3.username));
else if(parameter == 3)
strxcpy(CFG->internetserver.pop3.password, t.Token(), sizeof(CFG->internetserver.pop3.password));
}
parameter++;
}
}
}
// ------------------------------------------------------------------
void CfgInvalidate() {
const word CRC_SEENBY = 0x01D0;
const word CRC_CC = 0x4343;
const word CRC_XC = 0x5843;
const word CRC_XP = 0x5850;
char* key;
switch(getkeyvalcrc(&key, &val)) {
case CRC_TEARLINE:
getkeyval(&key, &val);
CFG->invalidate.tearline.first = StripQuotes(key);
CFG->invalidate.tearline.second = StripQuotes(val);
break;
case CRC_ORIGIN:
getkeyval(&key, &val);
CFG->invalidate.origin.first = StripQuotes(key);
CFG->invalidate.origin.second = StripQuotes(val);
break;
case CRC_SEENBY:
getkeyval(&key, &val);
CFG->invalidate.seenby.first = StripQuotes(key);
CFG->invalidate.seenby.second = StripQuotes(val);
break;
case CRC_CC:
getkeyval(&key, &val);
CFG->invalidate.cc.first = StripQuotes(key);
CFG->invalidate.cc.second = StripQuotes(val);
break;
case CRC_XC:
getkeyval(&key, &val);
CFG->invalidate.xc.first = StripQuotes(key);
CFG->invalidate.xc.second = StripQuotes(val);
break;
case CRC_XP:
getkeyval(&key, &val);
CFG->invalidate.xp.first = StripQuotes(key);
CFG->invalidate.xp.second = StripQuotes(val);
break;
}
}
// ------------------------------------------------------------------
void CfgJampath() {
PathCopy(CFG->jampath, val);
}
// ------------------------------------------------------------------
void CfgKeybmode() {
if(strnieql(val, "Poll", 4))
CFG->keybmode = KEYB_POLL;
else if(strnieql(val, "Block", 5))
CFG->keybmode = KEYB_BLOCK;
}
// ------------------------------------------------------------------
void CfgKeybstack() {
strcat(CFG->keybstack, val);
}
// ------------------------------------------------------------------
void CfgKludge() {
StripQuotes(val);
if(*val == CTRL_A)
val++;
CFG->kludge.push_back(val);
}
// ------------------------------------------------------------------
void CfgLoadlanguage() {
Path buf;
strxcpy(buf, val, sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_LOADLANGUAGE, buf, strlen(buf)+1);
else
strcpy(CFG->loadlanguage, buf);
}
// ------------------------------------------------------------------
void CfgLogfile() {
strcpy(CFG->logfile, val);
}
// ------------------------------------------------------------------
void CfgLogformat() {
if(strieql(val, "FD"))
CFG->logformat = GLOG_FD;
else if(strieql(val, "MAX"))
CFG->logformat = GLOG_MAX;
else if(strieql(val, "BINK"))
CFG->logformat = GLOG_BINK;
else if(strieql(val, "QBBS"))
CFG->logformat = GLOG_QBBS;
else if(strieql(val, "DB"))
CFG->logformat = GLOG_DB;
}
// ------------------------------------------------------------------
void CfgMailinglist() {
char* key;
MailList mlst;
mlst.sender_is_pattern = false;
getkeyval(&key, &val);
strxcpy(mlst.echoid, key, sizeof(Echo));
getkeyval(&key, &val);
strxcpy(mlst.sender, key, sizeof(IAdr));
getkeyval(&key, &val);
strxcpy(mlst.contribution, key, sizeof(IAdr));
CFG->mailinglist.push_back(mlst);
}
// ------------------------------------------------------------------
void CfgMailtoss() {
char* key;
MailList mlst;
mlst.sender_is_pattern = true;
getkeyval(&key, &val);
strxcpy(mlst.echoid, key, sizeof(Echo));
getkeyval(&key, &val);
strxcpy(mlst.contribution, key, sizeof(IAdr));
strxcpy(mlst.sender, val, sizeof(IAdr));
CFG->mailinglist.push_back(mlst);
}
// ------------------------------------------------------------------
void CfgMappath() {
char* key;
pair<string, string> mapentry;
getkeyval(&key, &val);
mapentry.first = key;
mapentry.second = val;
CFG->mappath.push_back(mapentry);
}
// ------------------------------------------------------------------
void CfgMember() {
if(cfgingroup) {
val = strtok(val, ", \t");
while(val) {
CFG->grp.AddMbr(val);
val = strtok(NULL, ", \t");
}
}
}
// ------------------------------------------------------------------
void CfgMenumarked() {
if(strieql(val, "Marked"))
CFG->menumarked = MODE_MARKED;
else if(strieql(val, "Current"))
CFG->menumarked = MODE_CURRENT;
else if(strieql(val, "Previous"))
CFG->menumarked = MODE_PREVIOUS;
else
CFG->menumarked = MODE_DONT;
}
// ------------------------------------------------------------------
void CfgMsglistdate() {
int flag;
if(strieql(val, "Written"))
flag = MSGLISTDATE_WRITTEN;
else if(strieql(val, "Arrived"))
flag = MSGLISTDATE_ARRIVED;
else if(strieql(val, "Received"))
flag = MSGLISTDATE_RECEIVED;
else
flag = GetYesno(val) ? MSGLISTDATE_WRITTEN : MSGLISTDATE_NONE;
if(cfgingroup)
CFG->grp.AddItm(GRP_MSGLISTDATE, flag);
else
CFG->msglistdate = flag;
}
// ------------------------------------------------------------------
void CfgMsglistfast() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_MSGLISTFAST, flag);
else
CFG->msglistfast = flag;
}
// ------------------------------------------------------------------

373
golded3/gccfgg6.cpp Normal file
View File

@ -0,0 +1,373 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Configuration functions, part 6.
// ------------------------------------------------------------------
#include <golded.h>
#include <gcprot.h>
// ------------------------------------------------------------------
extern char* val;
// ------------------------------------------------------------------
void CfgMsglistfirst() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_MSGLISTFIRST, flag);
else
CFG->msglistfirst = flag;
}
// ------------------------------------------------------------------
void CfgMsglistheader() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_MSGLISTHEADER, flag);
else
CFG->msglistheader = flag;
}
// ------------------------------------------------------------------
void CfgMsglistwidesubj() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_MSGLISTWIDESUBJ, flag);
else
CFG->msglistwidesubj = flag;
}
// ------------------------------------------------------------------
void CfgNamesfile() {
strcpy(CFG->namesfile, val);
}
// ------------------------------------------------------------------
void CfgNickname() {
Name buf;
strxcpy(buf, val, sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_NICKNAME, buf, strlen(buf)+1);
else
strcpy(CFG->nickname, buf);
}
// ------------------------------------------------------------------
void CfgNodelist() {
// Only used by GoldNODE
}
// ------------------------------------------------------------------
void CfgNodepath() {
PathCopy(CFG->nodepath, val);
}
// ------------------------------------------------------------------
void CfgNodepathfd() {
PathCopy(CFG->nodepathfd, val);
}
// ------------------------------------------------------------------
void CfgNodepathv7() {
PathCopy(CFG->nodepathv7, val);
}
// ------------------------------------------------------------------
extern char v7nodeflags[16][9];
void CfgNodev7flags() {
GTok t;
char* flagstring = t.First(val);
char* flagvals = t.Next();
uint flagval;
if(tolower(*flagvals) == 'b')
flagval = atoi(flagvals+1);
else {
flagval = atoi(flagvals);
switch(flagval) {
case 32: flagval = 5; break;
case 64: flagval = 6; break;
case 128: flagval = 7; break;
case 256: flagval = 8; break;
case 512: flagval = 9; break;
case 1024: flagval = 10; break;
case 2048: flagval = 11; break;
case 8192: flagval = 13; break;
case 16384: flagval = 14; break;
default: flagval = 0;
}
}
if(flagval)
strcpy(stpcpy(v7nodeflags[flagval], flagstring), ",");
}
// ------------------------------------------------------------------
extern char v7modemtype[8][9];
void CfgNodev7modem() {
GTok t;
char* modemstring = t.First(val);
char* modemvals = t.Next();
int modemval;
if(tolower(*modemvals) == 'b')
modemval = atoi(modemvals+1);
else {
modemval = atoi(modemvals);
switch(modemval) {
case 1: modemval = 0; break;
case 2: modemval = 1; break;
case 4: modemval = 2; break;
case 8: modemval = 3; break;
case 16: modemval = 4; break;
case 32: modemval = 5; break;
case 64: modemval = 6; break;
case 128: modemval = 7; break;
default: modemval = -1;
}
}
if(modemval >= 0)
strcat(stpcpy(v7modemtype[modemval], modemstring), ",");
}
// ------------------------------------------------------------------
void CfgOrganization() {
INam buf;
strxcpy(buf, val, sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_ORGANIZATION, buf, strlen(buf)+1);
else
strcpy(CFG->organization, buf);
}
// ------------------------------------------------------------------
void CfgOrigin(const char* v) { char buf[256]; val = strxcpy(buf, v, sizeof(buf)); CfgOrigin(); }
void CfgOrigin() {
if(not strblank(val)) {
StripQuotes(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_ORIGIN, val, strlen(val)+1);
else
CFG->origin.push_back(val);
}
}
// ------------------------------------------------------------------
void CfgOutboundpath() {
PathCopy(CFG->outboundpath, val);
}
// ------------------------------------------------------------------
void CfgOutputfile() {
Path buf;
strxcpy(buf, val, sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_OUTPUTFILE, buf, strlen(buf)+1);
else
strcpy(CFG->outputfile, buf);
}
void CfgPathreportfile() {
PathCopy(CFG->pathreportfile, val);
}
// ------------------------------------------------------------------
void CfgPcboardpath() {
PathCopy(CFG->pcboardpath, val);
}
// ------------------------------------------------------------------
void CfgPcboarduserno() {
CFG->pcboarduserno = atoi(val);
}
// ------------------------------------------------------------------
void CfgPersonalmail() {
if(striinc("STARTUP", val))
CFG->personalmail |= PM_STARTUP;
if(striinc("NOTSTARTUP", val))
CFG->personalmail &= ~PM_STARTUP;
if(striinc("ALLNAMES", val))
CFG->personalmail |= PM_ALLNAMES;
if(striinc("NOTALLNAMES", val))
CFG->personalmail &= ~PM_ALLNAMES;
if(striinc("LISTONLY", val))
CFG->personalmail |= PM_LISTONLY;
if(striinc("NOTLISTONLY", val))
CFG->personalmail &= ~PM_LISTONLY;
}
// ------------------------------------------------------------------
void CfgPlay() {
Path buf;
strxcpy(buf, val, sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_PLAY, buf, strlen(buf)+1);
else
FileToGPlay(&CFG->play, buf);
}
// ------------------------------------------------------------------
void CfgPrintdevice() {
strcpy(CFG->printdevice, val);
}
// ------------------------------------------------------------------
void CfgPrintinit() {
CvtPrnstr(CFG->printinit, val);
}
// ------------------------------------------------------------------
void CfgPrintlength() {
CFG->printlength = atoi(val);
}
// ------------------------------------------------------------------
void CfgPrintmargin() {
CFG->printmargin = atoi(val);
}
// ------------------------------------------------------------------
void CfgPrintreset() {
CvtPrnstr(CFG->printreset, val);
}
// ------------------------------------------------------------------
void CfgQuotebuffile() {
Path buf;
strxcpy(buf, val, sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_QUOTEBUFFILE, buf, strlen(buf)+1);
else
strcpy(CFG->quotebuffile, buf);
}
// ------------------------------------------------------------------
void CfgQuotebufmode() {
if(strieql(val, "ASK"))
CFG->quotebufmode = QBUF_ASK;
else if(strieql(val, "APPEND"))
CFG->quotebufmode = QBUF_APPEND;
else if(strieql(val, "OVERWRITE"))
CFG->quotebufmode = QBUF_OVERWRITE;
}
// ------------------------------------------------------------------
void CfgQuotechars() {
char buf[11];
strxcpy(buf, StripQuotes(val), sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_QUOTECHARS, buf, strlen(buf)+1);
else
strcpy(CFG->quotechars, buf);
}
// ------------------------------------------------------------------
void CfgQuotectrl() {
int ctrlinfo = CI_NONE;
if(striinc("NO", val))
ctrlinfo = CI_NONE;
else if(striinc("YES", val))
ctrlinfo = CI_TEAR|CI_ORIG;
else {
if(striinc("TEARLINE", val))
ctrlinfo |= CI_TEAR;
if(striinc("ORIGIN", val))
ctrlinfo |= CI_ORIG;
}
if(cfgingroup)
CFG->grp.AddItm(GRP_QUOTECTRL, ctrlinfo);
else
CFG->quotectrl = ctrlinfo;
}
// ------------------------------------------------------------------
void CfgQuotemargin() {
CFG->cfgquotemargin = atoi(val);
CFG->quotemargin = CFG->cfgquotemargin;
}
// ------------------------------------------------------------------

428
golded3/gccfgg7.cpp Normal file
View File

@ -0,0 +1,428 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Configuration functions, part 7.
// ------------------------------------------------------------------
#include <golded.h>
#include <gcprot.h>
// ------------------------------------------------------------------
extern char* val;
// ------------------------------------------------------------------
void CfgQuotestring() {
char buf[10];
strxcpy(buf, StripQuotes(val), sizeof(buf));
if(*buf == NUL)
strcpy(buf, " > ");
else {
if(buf[strlen(buf)-1] != ' ')
strcat(buf, " ");
}
if(cfgingroup)
CFG->grp.AddItm(GRP_QUOTESTRING, buf, strlen(buf)+1);
else
strcpy(CFG->quotestring, buf);
}
// ------------------------------------------------------------------
void CfgQuotewraphard() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_QUOTEWRAPHARD, flag);
else
CFG->quotewraphard = flag;
}
// ------------------------------------------------------------------
void CfgQwkbadmsgs() {
QWK->BadMsgs(val);
}
// ------------------------------------------------------------------
void CfgQwkconfmap() {
char* bbsid;
getkeyval(&bbsid, &val);
char* confname;
getkeyval(&confname, &val);
strtrim(StripQuotes(confname));
char* echoid;
getkeyval(&echoid, &val);
QWK->AddMap(bbsid, echoid, confname);
}
// ------------------------------------------------------------------
void CfgQwkexportpath() {
QWK->ExportPath(val);
}
// ------------------------------------------------------------------
void CfgQwkimportpath() {
QWK->ImportPath(val);
}
// ------------------------------------------------------------------
void CfgQwkoptions() {
char* bbsid;
getkeyval(&bbsid, &val);
QWK->FindAddBBS(bbsid);
val = strtok(val, ", \t");
while(val) {
if(strieql(val, "KLUDGES"))
QWK->KludgesAllowed(true);
else if(strieql(val, "NOKLUDGES"))
QWK->KludgesAllowed(false);
else if(strieql(val, "MIXCASE"))
QWK->MixCaseAllowed(true);
else if(strieql(val, "NOMIXCASE"))
QWK->MixCaseAllowed(false);
else if(strieql(val, "RECEIPT"))
QWK->ReceiptAllowed(true);
else if(strieql(val, "NORECEIPT"))
QWK->ReceiptAllowed(false);
else if(strnieql(val, "MAXLINES=", 9))
QWK->MaxLines(atoi(val+9));
val = strtok(NULL, ", \t");
}
}
// ------------------------------------------------------------------
void CfgQwkreplylinker() {
QWK->ReplyLinker(val);
}
// ------------------------------------------------------------------
void CfgQwktosslog() {
QWK->TossLog(val);
}
// ------------------------------------------------------------------
void CfgRa2usersbbs() {
CFG->ra2usersbbs = GetYesno(val) ? 2 : 1;
}
// ------------------------------------------------------------------
void CfgReplylink() {
if(strieql(val, "Chain"))
CFG->replylink = REPLYLINK_CHAIN;
else if(strieql(val, "Direct"))
CFG->replylink = REPLYLINK_DIRECT;
}
// ------------------------------------------------------------------
void CfgReplylinklist() {
if(strieql(val, "Fast"))
CFG->replylinklist = REPLYLINKLIST_FAST;
else if(strieql(val, "Full"))
CFG->replylinklist = REPLYLINKLIST_FULL;
}
// ------------------------------------------------------------------
void CfgRobotname(const char* v) {
char* ptr = val = throw_strdup(v);
CfgRobotname();
throw_free(ptr);
}
void CfgRobotname() {
tokenize(CFG->robotname, val);
}
// ------------------------------------------------------------------
void CfgScreenblanker() {
GTok t;
if(t.First(val)) {
do {
val = t.Token();
if(isdigit(*val))
CFG->screenblanker = atoi(val);
else if(striinc("BLACK", val))
CFG->screenblankertype = BLANK_ALLBLACK;
} while(t.Next());
}
}
// ------------------------------------------------------------------
void CfgScreenmaxcol() {
CFG->screenmaxcol = atoi(val);
}
// ------------------------------------------------------------------
void CfgScreenmaxrow() {
CFG->screenmaxrow = atoi(val);
}
// ------------------------------------------------------------------
void CfgScreenpalette() {
// Syntax:
//
// SCREENPALETTE <reg> <val> or
// SCREENPALETTE <reg> (red green blue)
char* key;
getkeyval(&key, &val);
int palreg = atoi(key);
if(palreg >= 0 and palreg <= 15) {
if(*val != '(')
CFG->screenpalette[palreg] = atoi(val);
else {
val = strskip_wht(val+1);
int redval = atoi(val); // 0 .. 3
val = strskip_wht(strskip_txt(val));
int greenval = atoi(val); // 0 .. 3
val = strskip_wht(strskip_txt(val));
int blueval = atoi(val); // 0 .. 3
// Construct the rgbRGB color val (nuts!)
CFG->screenpalette[palreg] =
((redval & 2) ? 0x04 : 0x00)|
((redval & 1) ? 0x20 : 0x00)|
((greenval & 2) ? 0x02 : 0x00)|
((greenval & 1) ? 0x10 : 0x00)|
((blueval & 2) ? 0x01 : 0x00)|
((blueval & 1) ? 0x08 : 0x00);
}
CFG->screenpalette[16] = true; // Indicate that changes were made
}
}
// ------------------------------------------------------------------
void CfgScreensize() {
CFG->screensize = atoi(val);
if(CFG->screensize == 4350) {
CFG->screensize = 50;
}
else if(CFG->screensize == 0) {
if(strnieql(val, "Mode", 4)) {
sscanf(val+4, " %x", &CFG->screensize);
CFG->screensize <<= 8;
}
}
}
// ------------------------------------------------------------------
void CfgSearchfor() {
INam buf;
strxcpy(buf, StripQuotes(val), sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_SEARCHFOR, buf, strlen(buf)+1);
else
strcpy(CFG->searchfor, buf);
}
// ------------------------------------------------------------------
#define CRC_NETSCAN 0xEC12
#define CRC_ECHOSCAN 0x6E6D
#define CRC_EXPORTLIST 0x1B14
#define CRC_IMPORTLIST 0x447F
#define CRC_SCANALL 0x1E57
#define CRC_SCANTHIS 0x1DAE
#define CRC_SCANNETMAIL 0x74D6
#define CRC_PMSCANALL 0xD093
#define CRC_PMSCANTHIS 0xE12C
#define CRC_PMSCANNETMAIL 0x9F1F
#define CRC_QWKIMPORT 0x3063
#define CRC_QWKEXPORT 0xD7C2
#define CRC_SOUPIMPORT 0x5564
#define CRC_SOUPEXPORT 0xB2C5
#define CRC_EXITNOW 0x65DD
#define CRC_IDLETIME 0x3BBC
void CfgSemaphore() {
char* key;
word crc = getkeyvalcrc(&key, &val);
switch(crc) {
case CRC_NETSCAN: strcpy(CFG->semaphore.netscan, val); break;
case CRC_ECHOSCAN: strcpy(CFG->semaphore.echoscan, val); break;
case CRC_EXPORTLIST: strcpy(CFG->semaphore.exportlist, val); break;
case CRC_IMPORTLIST: strcpy(CFG->semaphore.importlist, val); break;
case CRC_SCANALL: strcpy(CFG->semaphore.scanall, val); break;
case CRC_SCANTHIS: strcpy(CFG->semaphore.scanthis, val); break;
case CRC_SCANNETMAIL: strcpy(CFG->semaphore.scannetmail, val); break;
case CRC_PMSCANALL: strcpy(CFG->semaphore.pmscanall, val); break;
case CRC_PMSCANTHIS: strcpy(CFG->semaphore.pmscanthis, val); break;
case CRC_PMSCANNETMAIL: strcpy(CFG->semaphore.pmscannetmail, val); break;
case CRC_QWKIMPORT: strcpy(CFG->semaphore.qwkimport, val); break;
case CRC_QWKEXPORT: strcpy(CFG->semaphore.qwkexport, val); break;
case CRC_SOUPIMPORT: strcpy(CFG->semaphore.soupimport, val); break;
case CRC_SOUPEXPORT: strcpy(CFG->semaphore.soupexport, val); break;
case CRC_EXITNOW: strcpy(CFG->semaphore.exitnow, val); break;
case CRC_IDLETIME: CFG->semaphore.idletime = atoi(val); break;
default:
return;
}
}
// ------------------------------------------------------------------
void CfgSharemode() {
if(atoi(val))
CFG->sharemode = atoi(val);
else
CFG->sharemode = GetYesno(val) ? SH_DENYNO : SH_COMPAT;
}
// ------------------------------------------------------------------
void CfgShowdeleted() {
CFG->showdeleted = GetYesno(val);
}
// ------------------------------------------------------------------
void CfgSoundpath() {
PathCopy(CFG->soundpath, val);
}
// ------------------------------------------------------------------
void CfgSoupbadmsgs() {
strupr(strxcpy(CFG->soupbadmsgs, val, sizeof(Echo)));
}
// ------------------------------------------------------------------
void CfgSoupemail() {
strupr(strxcpy(CFG->soupemail, val, sizeof(Echo)));
}
// ------------------------------------------------------------------
void CfgSoupexportmargin() {
CFG->soupexportmargin = atoi(val);
}
// ------------------------------------------------------------------
void CfgSoupexportpath() {
PathCopy(CFG->soupexportpath, val);
}
// ------------------------------------------------------------------
void CfgSoupimportpath() {
PathCopy(CFG->soupimportpath, val);
}
// ------------------------------------------------------------------
void CfgSoupnewsrcfile() {
strcpy(CFG->soupnewsrcfile, val);
}
// ------------------------------------------------------------------
void CfgSoupreplylinker() {
strcpy(CFG->soupreplylinker, val);
}
// ------------------------------------------------------------------
void CfgSoupreplyto() {
strxcpy(CFG->soupreplyto, val, sizeof(CFG->soupreplyto));
}
// ------------------------------------------------------------------
void CfgSouptosslog() {
strcpy(CFG->souptosslog, val);
}
// ------------------------------------------------------------------
void CfgSquishscan() {
const int SQS_API = 1;
const int SQS_QUICK = 2;
if(strieql(val, "API"))
CFG->squishscan = SQS_API;
else if(strieql(val, "QUICK"))
CFG->squishscan = SQS_QUICK;
}
// ------------------------------------------------------------------

528
golded3/gccfgg8.cpp Normal file
View File

@ -0,0 +1,528 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Configuration functions, part 8.
// ------------------------------------------------------------------
#include <golded.h>
#include <gcprot.h>
// ------------------------------------------------------------------
extern char* val;
// ------------------------------------------------------------------
void CfgSquishuserno() {
CFG->squishuserno = atoi(val);
}
// ------------------------------------------------------------------
void CfgSquishuserpath() {
PathCopy(CFG->squishuserpath, val);
}
// ------------------------------------------------------------------
void CfgStatuslinehelp() {
CFG->statuslinehelp = strieql(val, "NOLOGO") ? -1 : GetYesno(val);
}
// ------------------------------------------------------------------
void CfgStylecodepunct() {
char* key;
getkeyval(&key, &val);
strxcpy(CFG->stylecodepunct, strcvtc(key), sizeof(CFG->stylecodepunct));
}
// ------------------------------------------------------------------
void CfgStylecodes() {
if(strieql(val, "HIDE")) {
CFG->hidestylies = true;
CFG->usestylies = true;
}
else {
CFG->hidestylies = false;
CFG->usestylies = GetYesno(val);
}
}
// ------------------------------------------------------------------
void CfgStylecodestops() {
char* key;
getkeyval(&key, &val);
strxcpy(CFG->stylecodestops, strcvtc(key), sizeof(CFG->stylecodestops));
}
// ------------------------------------------------------------------
void CfgTagline() {
char buf[76];
strxcpy(buf, val, sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_TAGLINE, buf, strlen(buf)+1);
else
CFG->tagline.push_back(buf);
}
// ------------------------------------------------------------------
void CfgTaglinechar() {
StripQuotes(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_TAGLINECHAR, *val);
else
CFG->taglinechar = *val;
}
// ------------------------------------------------------------------
void CfgTaglinesupport() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_TAGLINESUPPORT, flag);
else
CFG->taglinesupport = flag;
}
// ------------------------------------------------------------------
void CfgTasktitle(){
strxcpy(CFG->tasktitle, val,sizeof(CFG->tasktitle));
}
// ------------------------------------------------------------------
void CfgTearline() {
StripQuotes(val);
Tear buf;
strxcpy(buf, val, sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_TEARLINE, buf, strlen(buf)+1);
else
strcpy(CFG->tearline, buf);
}
// ------------------------------------------------------------------
void CfgTemplate() {
if(cfgingroup) {
Path buf;
strxcpy(buf, val, sizeof(buf));
CFG->grp.AddItm(GRP_TEMPLATE, buf, strlen(buf)+1);
}
else {
char* key;
Tpl tp;
*tp.name = NUL;
tp.match.reset();
getkeyval(&key, &val);
strcpy(tp.file, key);
if((*val == '\'') or (*val == '\"')) {
getkeyval(&key, &val);
strcpy(tp.name, key);
if(*val)
tp.match.set(val);
}
else if(*val)
tp.match.set(val);
if(not *tp.name)
strcpy(tp.name, tp.file);
CFG->tpl.push_back(tp);
}
}
// ------------------------------------------------------------------
void CfgTemplatematch() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_TEMPLATEMATCH, flag);
else
CFG->templatematch = flag;
}
// ------------------------------------------------------------------
void CfgTemplatepath() {
PathCopy(CFG->templatepath, val);
}
// ------------------------------------------------------------------
void CfgTemppath() {
PathCopy(CFG->temppath, val);
}
// ------------------------------------------------------------------
void CfgTimeout() {
CFG->timeout = atoi(val);
}
// ------------------------------------------------------------------
void CfgTitlestatus(){
CFG->titlestatus = GetYesno(val);
}
// ------------------------------------------------------------------
void CfgTwitmode() {
int tmp = TWIT_SHOW;
if(strieql(val, "Skip")) tmp = TWIT_SKIP;
else if(strieql(val, "Blank")) tmp = TWIT_BLANK;
else if(strieql(val, "Show")) tmp = TWIT_SHOW;
else if(strieql(val, "Ignore")) tmp = TWIT_IGNORE;
else if(strieql(val, "Kill")) tmp = TWIT_KILL;
else tmp = GetYesno(val) ? TWIT_SHOW : TWIT_BLANK;
if(cfgingroup)
CFG->grp.AddItm(GRP_TWITMODE, tmp);
else
CFG->twitmode = tmp;
}
// ------------------------------------------------------------------
void CfgTwitname() {
Node tn;
tn.addr.zone = GFTN_ALL;
tn.addr.net = GFTN_ALL;
tn.addr.node = GFTN_ALL;
tn.addr.point = GFTN_ALL;
char* ptr = strrchr(val, ' ');
if(ptr == NULL)
ptr = val;
ptr = strskip_wht(ptr);
if(isdigit(*ptr)) {
if(not CFG->aka.empty())
tn.addr = CFG->aka[0].addr;
tn.addr.set(ptr);
if(tn.addr.net) {
// Address was given
*ptr = NUL;
strbtrim(val);
}
}
strcpy(tn.name, val);
CFG->twitname.push_back(tn);
}
// ------------------------------------------------------------------
void CfgTwitsubj() {
CFG->twitsubj.push_back(StripQuotes(val));
}
// ------------------------------------------------------------------
void CfgUsecharset() {
CFG->usecharset = GetYesno(val);
}
// ------------------------------------------------------------------
void CfgUsefwd() {
int flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_USEFWD, flag);
else
CFG->usefwd = flag;
}
// ------------------------------------------------------------------
void CfgUseintl() {
CFG->useintl = GetYesno(val);
}
// ------------------------------------------------------------------
void CfgUsepid() {
CFG->usepid = GetYesno(val);
}
// ------------------------------------------------------------------
void CfgUserlist() {
// Only used by GoldNODE
}
// ------------------------------------------------------------------
void CfgUserlistfile() {
strcpy(CFG->userlistfile, val);
}
// ------------------------------------------------------------------
void CfgUsername(char* v) { val = v; CfgUsername(); }
void CfgUsername() {
StripQuotes(val);
if(not strblank(val)) {
if(cfgingroup) {
char buf[256];
strxcpy(buf, val, sizeof(buf));
CFG->grp.AddItm(GRP_USERNAME, buf, strlen(buf)+1);
}
else {
Node tmp;
char* aptr = strrchr(val, ',');
if(not aptr)
aptr = strrchr(val, ' ');
if(aptr) {
char* p = strskip_wht(aptr+1);
tmp.addr.reset(p);
if(not tmp.addr.valid())
aptr = NULL;
else {
*aptr = NUL;
aptr = p;
}
}
tmp.addr.set_all(GFTN_ALL);
if(aptr) {
if(not CFG->aka.empty())
tmp.addr = CFG->aka[0].addr;
tmp.addr.set(aptr);
if(CFG->aka.empty() and tmp.addr.zone != GFTN_ALL
and tmp.addr.net != GFTN_ALL
and tmp.addr.node != GFTN_ALL
and tmp.addr.point != GFTN_ALL)
CfgAddress(tmp.addr.make_string(tmp.name)); // tmp.name is temp-var
}
strxcpy(tmp.name, strbtrim(val), sizeof(Name));
// Check if we have it already
vector<Node>::iterator u;
for(u = CFG->username.begin(); u != CFG->username.end(); u++)
if(strieql(tmp.name, u->name))
return;
CFG->username.push_back(tmp);
}
}
}
// ------------------------------------------------------------------
void CfgUsetzutc() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_USETZUTC, flag);
else
CFG->usetzutc = flag;
}
// ------------------------------------------------------------------
void CfgUudecodepath() {
PathCopy(CFG->uudecodepath, val);
}
// ------------------------------------------------------------------
void CfgViewhidden() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_VIEWHIDDEN, flag);
else
CFG->viewhidden = flag;
}
// ------------------------------------------------------------------
void CfgViewkludge() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_VIEWKLUDGE, flag);
else
CFG->viewkludge = flag;
}
// ------------------------------------------------------------------
void CfgViewquote() {
bool flag = GetYesno(val);
if(cfgingroup)
CFG->grp.AddItm(GRP_VIEWQUOTE, flag);
else
CFG->viewquote = flag;
}
// ------------------------------------------------------------------
void CfgWhoto() {
Name buf;
strxcpy(buf, val, sizeof(buf));
if(cfgingroup)
CFG->grp.AddItm(GRP_WHOTO, buf, strlen(buf)+1);
else
strcpy(CFG->whoto, buf);
}
// ------------------------------------------------------------------
void CfgWildcatuserno() {
CFG->wildcatuserno = atoi(val);
}
// ------------------------------------------------------------------
void CfgXlatcharset() {
Map xlt;
char* ptr = strtok(val, " \t\n\r");
if(ptr) {
strchg(strupr(strcpy(xlt.imp, ptr)), '_', ' ');
ptr = strtok(NULL, " \t\n\r");
if(ptr) {
strchg(strupr(strcpy(xlt.exp, ptr)), '_', ' ');
ptr = strtok(NULL, " \t\n\r");
if(ptr) {
if(*CFG->xlatpath == NUL)
strcpy(CFG->xlatpath, CFG->goldpath);
MakePathname(ptr, CFG->xlatpath, ptr);
xlt.mapfile = throw_strdup(ptr);
CFG->xlatcharset.push_back(xlt);
}
}
}
}
// ------------------------------------------------------------------
void CfgXlatescset() {
Map xlt;
char* ptr = strtok(val, " \t\n\r");
if(ptr) {
strchg(strupr(strcpy(xlt.imp, ptr)), '_', ' ');
ptr = strtok(NULL, " \t\n\r");
if(ptr) {
strchg(strupr(strcpy(xlt.exp, ptr)), '_', ' ');
ptr = strtok(NULL, " \t\n\r");
if(ptr) {
if(*CFG->xlatpath == NUL)
strcpy(CFG->xlatpath, CFG->goldpath);
MakePathname(ptr, CFG->xlatpath, ptr);
xlt.mapfile = throw_strdup(ptr);
CFG->xlatescset.push_back(xlt);
}
}
}
}
// ------------------------------------------------------------------
void CfgXlatexport() {
XlatName buf;
strchg(strupr(strxcpy(buf, val, sizeof(buf))), '_', ' ');
if(cfgingroup)
CFG->grp.AddItm(GRP_XLATEXPORT, buf, strlen(buf)+1);
else
strcpy(CFG->xlatexport, buf);
}
// ------------------------------------------------------------------
void CfgXlatimport() {
XlatName buf;
strchg(strupr(strxcpy(buf, val, sizeof(buf))), '_', ' ');
if(cfgingroup)
CFG->grp.AddItm(GRP_XLATIMPORT, buf, strlen(buf)+1);
else
strcpy(CFG->xlatimport, buf);
}
// ------------------------------------------------------------------
void CfgXlatlocalset() {
strupr(strxcpy(CFG->xlatlocalset, val, sizeof(CFG->xlatlocalset)));
}
// ------------------------------------------------------------------
void CfgXlatpath() {
PathCopy(CFG->xlatpath, val);
}
// ------------------------------------------------------------------
void CfgZonegating() {
CFG->zonegating = GetYesno(val);
}
// ------------------------------------------------------------------

1060
golded3/gckeys.cpp Normal file

File diff suppressed because it is too large Load Diff

486
golded3/gckeys.h Normal file
View File

@ -0,0 +1,486 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// CRC16 value for keyboard definitions.
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// CRC16 value for keyboard definitions
const word CRC_AREAABORT = 0x1E02;
const word CRC_AREAASKEXIT = 0xA3D1;
const word CRC_AREABOARDNOS = 0x96EA;
const word CRC_AREACATCHUP = 0xDA5C;
const word CRC_AREADOSSHELL = 0x2DED;
const word CRC_AREADROPMSGMARKS = 0xB90C;
const word CRC_AREAGOTOFIRST = 0x41CB;
const word CRC_AREAGOTOLAST = 0x177A;
const word CRC_AREAGOTONEXT = 0x3A9C;
const word CRC_AREAGOTOPREV = 0x6534;
const word CRC_AREAHEAT = 0x5B15;
const word CRC_AREAINFO = 0xDE54;
const word CRC_AREAJUMP = 0x2342;
const word CRC_AREAJUMPNEXTMATCH = 0xA556;
const word CRC_AREAMACRO = 0xFFA7;
const word CRC_AREAMENU = 0xABE1;
const word CRC_AREAQUITNOW = 0xAAC4;
const word CRC_AREASCAN = 0xE440;
const word CRC_AREASCANPM = 0xC4FF;
const word CRC_AREASELECT = 0xA271;
const word CRC_AREASELECTMARKS = 0x0AC3;
const word CRC_AREASOUNDKILL = 0xDFD3;
const word CRC_AREATOGGLE = 0xC734;
const word CRC_AREATOUCHNETSCAN = 0x58C1;
const word CRC_AREAUNDEFINE = 0x835B;
const word CRC_AREAWRITEGOLDLAST = 0xD353;
const word CRC_AREAZAP = 0x5125;
const word CRC_AREASHOWDEL = 0x80C4;
const word CRC_EDITABORT = 0x6468;
const word CRC_EDITANCHOR = 0xDC07;
const word CRC_EDITASKEXIT = 0x89AF;
const word CRC_EDITBLOCKDOWN = 0xD4E4;
const word CRC_EDITBLOCKEND = 0xF55B;
const word CRC_EDITBLOCKHOME = 0x8B82;
const word CRC_EDITBLOCKLEFT = 0xED1D;
const word CRC_EDITBLOCKPGUP = 0x9845;
const word CRC_EDITBLOCKPGDN = 0x895B;
const word CRC_EDITBLOCKRIGHT = 0x20F9;
const word CRC_EDITBLOCKUP = 0xE004;
const word CRC_EDITCLEARDELETEBUF = 0xF8DE;
const word CRC_EDITCLEARPASTEBUF = 0xE8E4;
const word CRC_EDITCOPY = 0x1F77;
const word CRC_EDITCOPYABOVECHAR = 0x380C;
const word CRC_EDITCUT = 0xFAE6;
const word CRC_EDITDELCHAR = 0xA3C7;
const word CRC_EDITDELETE = 0x4A37;
const word CRC_EDITDELETEEOL = 0x1143;
const word CRC_EDITDELLEFT = 0x6552;
const word CRC_EDITDELLINE = 0xACCF;
const word CRC_EDITDELLTWORD = 0x3B67;
const word CRC_EDITDELRTWORD = 0x829A;
const word CRC_EDITDOSSHELL = 0xD6C5;
const word CRC_EDITDUPLINE = 0x816A;
const word CRC_EDITEXITMSG = 0x1813;
const word CRC_EDITEXPORTTEXT = 0x5AED;
const word CRC_EDITGOBEGLINE = 0xE045;
const word CRC_EDITGOBOTLINE = 0x92DD;
const word CRC_EDITGOBOTMSG = 0x9B29;
const word CRC_EDITGODOWN = 0x3DC2;
const word CRC_EDITGOEOL = 0x1CC6;
const word CRC_EDITGOLEFT = 0x043B;
const word CRC_EDITGOPGDN = 0x607D;
const word CRC_EDITGOPGUP = 0x7163;
const word CRC_EDITGORIGHT = 0x6AFE;
const word CRC_EDITGOTOPLINE = 0x87C2;
const word CRC_EDITGOTOPMSG = 0x6BD3;
const word CRC_EDITGOUP = 0xD6BA;
const word CRC_EDITGOWORDLEFT = 0xE48C;
const word CRC_EDITGOWORDRIGHT = 0x20D0;
const word CRC_EDITHEADER = 0x726F;
const word CRC_EDITIMPORTQUOTEBUF = 0xF797;
const word CRC_EDITIMPORTTEXT = 0x0586;
const word CRC_EDITKILLQUOTES = 0xD821;
const word CRC_EDITLOADFILE = 0x0931;
const word CRC_EDITLOOKUPCURSOR = 0xB7CC;
const word CRC_EDITLOOKUPDEST = 0xFEC4;
const word CRC_EDITLOOKUPORIG = 0x5AFB;
const word CRC_EDITMACRO = 0x85CD;
const word CRC_EDITMAINMENU = 0xDE5D;
const word CRC_EDITMENU = 0x833E;
const word CRC_EDITNEWLINE = 0x59F3;
const word CRC_EDITPASTE = 0x90C4;
const word CRC_EDITQUITNOW = 0x80BA;
const word CRC_EDITREFLOW = 0x13F9;
const word CRC_EDITSAVEFILE = 0x64A4;
const word CRC_EDITSAVEMSG = 0x660C;
const word CRC_EDITSOUNDKILL = 0xA9A7;
const word CRC_EDITSPELLCHECK = 0xE167;
const word CRC_EDITTAB = 0x8C26;
const word CRC_EDITTABREVERSE = 0xF5B6;
const word CRC_EDITTOGGLECASE = 0xC282;
const word CRC_EDITTOGGLEINSERT = 0xD732;
const word CRC_EDITTOLOWER = 0x6D85;
const word CRC_EDITTOUPPER = 0xD3DD;
const word CRC_EDITUNDEFINE = 0x7873;
const word CRC_EDITUNDELETE = 0x4C34;
const word CRC_EDITUNDO = 0xB295;
const word CRC_EDITZAPQUOTEBELOW = 0x814F;
const word CRC_FILEABORT = 0xBCED;
const word CRC_FILEASKEXIT = 0xD40C;
const word CRC_FILEDOSSHELL = 0xFE9D;
const word CRC_FILEGOTOFIRST = 0xCAD5;
const word CRC_FILEGOTOLAST = 0xC40A;
const word CRC_FILEGOTONEXT = 0xE9EC;
const word CRC_FILEGOTOPREV = 0xB644;
const word CRC_FILEMACRO = 0x5D48;
const word CRC_FILEMARK = 0xF828;
const word CRC_FILEMARKALL = 0xD115;
const word CRC_FILEMENU = 0xA4B2;
const word CRC_FILEQUITNOW = 0xDD19;
const word CRC_FILESELECT = 0xD8D9;
const word CRC_FILETOGGLEMARK = 0xB431;
const word CRC_FILEUNDEFINE = 0x502B;
const word CRC_FILEUNMARK = 0x6D1B;
const word CRC_FILEUNMARKALL = 0x121A;
const word CRC_LISTABORT = 0x4313;
const word CRC_LISTASKEXIT = 0xD922;
const word CRC_LISTDOSSHELL = 0x0130;
const word CRC_LISTGOTOBOOKMARK = 0x0F08;
const word CRC_LISTGOTOFIRST = 0x7925;
const word CRC_LISTGOTOLAST = 0x3BA7;
const word CRC_LISTGOTONEXT = 0x1641;
const word CRC_LISTGOTOPREV = 0x49E9;
const word CRC_LISTMACRO = 0xA2B6;
const word CRC_LISTMARKINGOPTIONS = 0x8138;
const word CRC_LISTMENU = 0x99AA;
const word CRC_LISTQUITNOW = 0xD037;
const word CRC_LISTSELECT = 0x3829;
const word CRC_LISTTOGGLEBOOKMARK = 0xCFA0;
const word CRC_LISTTOGGLEDATE = 0x6F1F;
const word CRC_LISTTOGGLEMARK = 0xD389;
const word CRC_LISTTOGGLEWIDESUBJ = 0x3C76;
const word CRC_LISTUNDEFINE = 0xAF86;
const word CRC_EXTERNUTIL01 = 0x95B9;
const word CRC_EXTERNUTIL02 = 0x95BA;
const word CRC_EXTERNUTIL03 = 0x95BB;
const word CRC_EXTERNUTIL04 = 0x95BC;
const word CRC_EXTERNUTIL05 = 0x95BD;
const word CRC_EXTERNUTIL06 = 0x95BE;
const word CRC_EXTERNUTIL07 = 0x95BF;
const word CRC_EXTERNUTIL08 = 0x95B0;
const word CRC_EXTERNUTIL09 = 0x95B1;
const word CRC_EXTERNUTIL10 = 0x94B8;
const word CRC_EXTERNUTIL11 = 0x94B9;
const word CRC_EXTERNUTIL12 = 0x94BA;
const word CRC_EXTERNUTIL13 = 0x94BB;
const word CRC_EXTERNUTIL14 = 0x94BC;
const word CRC_EXTERNUTIL15 = 0x94BD;
const word CRC_EXTERNUTIL16 = 0x94BE;
const word CRC_EXTERNUTIL17 = 0x94BF;
const word CRC_EXTERNUTIL18 = 0x94B0;
const word CRC_EXTERNUTIL19 = 0x94B1;
const word CRC_EXTERNUTIL20 = 0x97B8;
const word CRC_EXTERNUTIL21 = 0x97B9;
const word CRC_EXTERNUTIL22 = 0x97BA;
const word CRC_EXTERNUTIL23 = 0x97BB;
const word CRC_EXTERNUTIL24 = 0x97BC;
const word CRC_NODEABORT = 0xA08C;
const word CRC_NODEASKEXIT = 0xEE95;
const word CRC_NODEDOSSHELL = 0xF084;
const word CRC_NODEGOTOFIRST = 0x321B;
const word CRC_NODEGOTOLAST = 0xCA13;
const word CRC_NODEGOTONEXT = 0xE7F5;
const word CRC_NODEGOTOPREV = 0xB85D;
const word CRC_NODEMACRO = 0x4129;
const word CRC_NODEMAINMENU = 0xF81C;
const word CRC_NODEMENU = 0xE1B6;
const word CRC_NODEQUITNOW = 0xE780;
const word CRC_NODESELECT = 0x6A64;
const word CRC_NODEUNDEFINE = 0x5E32;
const word CRC_READADDRESSBOOKADD = 0x00FA;
const word CRC_READASKEXIT = 0xA500;
const word CRC_READCHANGEAKA = 0x2015;
const word CRC_READCHANGEATTRS = 0x47F8;
const word CRC_READCHANGECHARSIN = 0x0B87;
const word CRC_READCHANGECHARSOUT = 0x4DF9;
const word CRC_READCHANGEMSG = 0xF99F;
const word CRC_READCHANGEORIGIN = 0xFD2C;
const word CRC_READCHANGETAGLINE = 0xBDD2;
const word CRC_READCHANGETEMPLATE = 0x6C86;
const word CRC_READCHANGEUSERNAME = 0x7438;
const word CRC_READCHANGEXLATIMPORT = 0xF169;
const word CRC_READCOMMENTMSG = 0x5E89;
const word CRC_READCOPYMOVEFORWARD = 0xBFAF;
const word CRC_READDECREASEMARGIN = 0xD8EA;
const word CRC_READDELETEMSG = 0x8BCE;
const word CRC_READDOSSHELL = 0x9C2B;
const word CRC_READEXTERNUTILMENU = 0x2000;
const word CRC_READFIDORENUMBER = 0x1E7C;
const word CRC_READFILEREQUEST = 0x0A07;
const word CRC_READFINDALL = 0xEF19;
const word CRC_READFINDHEADER = 0x6343;
const word CRC_READGOTOBOOKMARK = 0x4383;
const word CRC_READGOTOFIRSTMSG = 0x392F;
const word CRC_READGOTOLASTMSG = 0x9E72;
const word CRC_READGOTOMSGNO = 0x73F7;
const word CRC_READGOTONEXTAREA = 0x5B23;
const word CRC_READGOTONEXTMSG = 0xE0F1;
const word CRC_READGOTONEXTUNREAD = 0xBA34;
const word CRC_READGOTOPREVAREA = 0xEECB;
const word CRC_READGOTOPREVMSG = 0x06D9;
const word CRC_READGOTOPREVUNREAD = 0x27EA;
const word CRC_READGOTOREPLIES = 0x1A6B;
const word CRC_READGOTOREPLY1ST = 0xE54F;
const word CRC_READGOTOREPLYNEXT = 0x844F;
const word CRC_READGOTOREPLYPREV = 0xDBE7;
const word CRC_READINCREASEMARGIN = 0x1797;
const word CRC_READLOOKUPDEST = 0x0023;
const word CRC_READLOOKUPORIG = 0xA41C;
const word CRC_READMACRO = 0xF7D8;
const word CRC_READMAINMENU = 0x94B3;
const word CRC_READMAKEUSERLIST = 0xE8C6;
const word CRC_READMAKEPATHREPORT = 0x4AA6;
const word CRC_READMARKINGOPTIONS = 0xE97A;
const word CRC_READMENU = 0x3D0A;
const word CRC_READMESSAGELIST = 0xD5D8;
const word CRC_READMOVECOMMENTMSG = 0xE4E7;
const word CRC_READMOVEQUOTEMSG = 0x1B41;
const word CRC_READMSGCONTINUE = 0x4511;
const word CRC_READMSGEND = 0xC5AD;
const word CRC_READMSGHOME = 0x4BD1;
const word CRC_READMSGLINEDOWN = 0x5DB2;
const word CRC_READMSGLINEUP = 0x7238;
const word CRC_READMSGPGDN = 0x4908;
const word CRC_READMSGPGUP = 0x5816;
const word CRC_READNEWAREA = 0xAB5E;
const word CRC_READNEWMSG = 0x30CA;
const word CRC_READQUITNOW = 0xAC15;
const word CRC_READQUOTEBUF = 0x49EE;
const word CRC_READQUOTEMSG = 0xBE00;
const word CRC_READREPLYMSG = 0x172F;
const word CRC_READSEARCH = 0x48EF;
const word CRC_READSOUNDKILL = 0xAE29;
const word CRC_READSTEALTAGLINE = 0x7480;
const word CRC_READTHREADTREE = 0x9827;
const word CRC_READTOGGLEBOOKMARK = 0xA7E2;
const word CRC_READTOGGLEHEXDUMP = 0xE6D5;
const word CRC_READTOGGLEHIDDEN = 0x04CE;
const word CRC_READTOGGLEHIDDKLUD = 0xA24F;
const word CRC_READTOGGLESTYLES = 0xF47E;
const word CRC_READTOGGLEKLUDGE = 0x46AB;
const word CRC_READTOGGLEMARK = 0x1E64;
const word CRC_READTOGGLEMARKREAD = 0xCFAE;
const word CRC_READTOGGLEPAGEBAR = 0x18E4;
const word CRC_READTOGGLEQUOTE = 0xB293;
const word CRC_READTOGGLEREALMSGNO = 0x2A3B;
const word CRC_READTOGGLEROT13 = 0xC157;
const word CRC_READTOGGLETWITS = 0x5FD1;
const word CRC_READTOUCHNETSCAN = 0x4BF3;
const word CRC_READTOUCHSEMAPHORE = 0x6B1D;
const word CRC_READUNDEFINE = 0x329D;
const word CRC_READUSERBASE = 0xF736;
const word CRC_READUUDECODE = 0x4F0B;
const word CRC_READWRITEMSG = 0x73AC;
const word CRC_K_F1 = 0x4631;
const word CRC_K_F2 = 0x4632;
const word CRC_K_F3 = 0x4633;
const word CRC_K_F4 = 0x4634;
const word CRC_K_F5 = 0x4635;
const word CRC_K_F6 = 0x4636;
const word CRC_K_F7 = 0x4637;
const word CRC_K_F8 = 0x4638;
const word CRC_K_F9 = 0x4639;
const word CRC_K_F10 = 0x1932;
const word CRC_K_F11 = 0x1933;
const word CRC_K_F12 = 0x1930;
const word CRC_K_SF1 = 0x5230;
const word CRC_K_SF2 = 0x5233;
const word CRC_K_SF3 = 0x5232;
const word CRC_K_SF4 = 0x5235;
const word CRC_K_SF5 = 0x5234;
const word CRC_K_SF6 = 0x5237;
const word CRC_K_SF7 = 0x5236;
const word CRC_K_SF8 = 0x5239;
const word CRC_K_SF9 = 0x5238;
const word CRC_K_SF10 = 0x4A87;
const word CRC_K_SF11 = 0x4A86;
const word CRC_K_SF12 = 0x4A85;
const word CRC_K_AF1 = 0x0EF5;
const word CRC_K_AF2 = 0x0EF6;
const word CRC_K_AF3 = 0x0EF7;
const word CRC_K_AF4 = 0x0EF0;
const word CRC_K_AF5 = 0x0EF1;
const word CRC_K_AF6 = 0x0EF2;
const word CRC_K_AF7 = 0x0EF3;
const word CRC_K_AF8 = 0x0EFC;
const word CRC_K_AF9 = 0x0EFD;
const word CRC_K_AF10 = 0x14FE;
const word CRC_K_AF11 = 0x14FF;
const word CRC_K_AF12 = 0x14FC;
const word CRC_K_CF1 = 0xFD0A;
const word CRC_K_CF2 = 0xFD09;
const word CRC_K_CF3 = 0xFD08;
const word CRC_K_CF4 = 0xFD0F;
const word CRC_K_CF5 = 0xFD0E;
const word CRC_K_CF6 = 0xFD0D;
const word CRC_K_CF7 = 0xFD0C;
const word CRC_K_CF8 = 0xFD03;
const word CRC_K_CF9 = 0xFD02;
const word CRC_K_CF10 = 0x3482;
const word CRC_K_CF11 = 0x3483;
const word CRC_K_CF12 = 0x3480;
const word CRC_K_A0 = 0x4030;
const word CRC_K_A1 = 0x4031;
const word CRC_K_A2 = 0x4032;
const word CRC_K_A3 = 0x4033;
const word CRC_K_A4 = 0x4034;
const word CRC_K_A5 = 0x4035;
const word CRC_K_A6 = 0x4036;
const word CRC_K_A7 = 0x4037;
const word CRC_K_A8 = 0x4038;
const word CRC_K_A9 = 0x4039;
const word CRC_K_AA = 0x4041;
const word CRC_K_AB = 0x4042;
const word CRC_K_AC = 0x4043;
const word CRC_K_AD = 0x4044;
const word CRC_K_AE = 0x4045;
const word CRC_K_AF = 0x4046;
const word CRC_K_AG = 0x4047;
const word CRC_K_AH = 0x4048;
const word CRC_K_AI = 0x4049;
const word CRC_K_AJ = 0x404A;
const word CRC_K_AK = 0x404B;
const word CRC_K_AL = 0x404C;
const word CRC_K_AM = 0x404D;
const word CRC_K_AN = 0x404E;
const word CRC_K_AO = 0x404F;
const word CRC_K_AP = 0x4050;
const word CRC_K_AQ = 0x4051;
const word CRC_K_AR = 0x4052;
const word CRC_K_AS = 0x4053;
const word CRC_K_AT = 0x4054;
const word CRC_K_AU = 0x4055;
const word CRC_K_AV = 0x4056;
const word CRC_K_AW = 0x4057;
const word CRC_K_AX = 0x4058;
const word CRC_K_AY = 0x4059;
const word CRC_K_AZ = 0x405A;
const word CRC_K_CA = 0x5E41;
const word CRC_K_CB = 0x5E42;
const word CRC_K_CC = 0x5E43;
const word CRC_K_CD = 0x5E44;
const word CRC_K_CE = 0x5E45;
const word CRC_K_CF = 0x5E46;
const word CRC_K_CG = 0x5E47;
const word CRC_K_CH = 0x5E48;
const word CRC_K_CI = 0x5E49;
const word CRC_K_CJ = 0x5E4A;
const word CRC_K_CK = 0x5E4B;
const word CRC_K_CL = 0x5E4C;
const word CRC_K_CM = 0x5E4D;
const word CRC_K_CN = 0x5E4E;
const word CRC_K_CO = 0x5E4F;
const word CRC_K_CP = 0x5E50;
const word CRC_K_CQ = 0x5E51;
const word CRC_K_CR = 0x5E52;
const word CRC_K_CS = 0x5E53;
const word CRC_K_CT = 0x5E54;
const word CRC_K_CU = 0x5E55;
const word CRC_K_CV = 0x5E56;
const word CRC_K_CW = 0x5E57;
const word CRC_K_CX = 0x5E58;
const word CRC_K_CY = 0x5E59;
const word CRC_K_CZ = 0x5E5A;
const word CRC_K_CMINUS = 0x5E2D;
const word CRC_K_ESC = 0x4B22;
const word CRC_K_TAB = 0x5B33;
const word CRC_K_STAB = 0x0886;
const word CRC_K_ATAB = 0x56FF;
const word CRC_K_BSPACE = 0x0F07;
const word CRC_K_ABSPACE = 0xF9D7;
const word CRC_K_CBSPACE = 0x5A72;
const word CRC_K_ENTER = 0x87BD;
const word CRC_K_AENTER = 0xE921;
const word CRC_K_CENTER = 0x50DC;
const word CRC_K_INS = 0x97BE;
const word CRC_K_CINS = 0xBA0E;
const word CRC_K_AINS = 0x9A72;
const word CRC_K_DEL = 0x4D0C;
const word CRC_K_CDEL = 0x60BC;
const word CRC_K_ADEL = 0x40C0;
const word CRC_K_HOME = 0x700B;
const word CRC_K_CHOME = 0x35C4;
const word CRC_K_AHOME = 0x6DA6;
const word CRC_K_END = 0x5625;
const word CRC_K_CEND = 0x7B95;
const word CRC_K_AEND = 0x5BE9;
const word CRC_K_PGUP = 0x63CC;
const word CRC_K_CPGUP = 0x2603;
const word CRC_K_APGUP = 0x7E61;
const word CRC_K_PGDN = 0x72D2;
const word CRC_K_CPGDN = 0x371D;
const word CRC_K_APGDN = 0x6F7F;
const word CRC_K_LEFT = 0x1694;
const word CRC_K_CLEFT = 0x535B;
const word CRC_K_ALEFT = 0x0B39;
const word CRC_K_RIGHT = 0xF78D;
const word CRC_K_CRIGHT = 0x20EC;
const word CRC_K_ARIGHT = 0x9911;
const word CRC_K_UP = 0x5550;
const word CRC_K_CUP = 0xEE6B;
const word CRC_K_AUP = 0x1D94;
const word CRC_K_DOWN = 0x2F6D;
const word CRC_K_CDOWN = 0x6AA2;
const word CRC_K_ADOWN = 0x32C0;
const word CRC_K_CGMUL = 0x66CA;
const word CRC_K_KEY5 = 0x9062;
const word CRC_K_SPACE = 0x1281;
const word CRC_KK_MACRO = 0x4BE9;
const word CRC_KK_AUTO = 0x60E2;
#if not defined(__UNIX__) or defined(__USE_NCURSES__)
const word CRC_K_SINS = 0xC40B;
const word CRC_K_SDEL = 0x1EB9;
const word CRC_K_SHOME = 0xAF9D;
const word CRC_K_SEND = 0x0590;
const word CRC_K_SPGUP = 0xBC5A;
const word CRC_K_SPGDN = 0xAD44;
const word CRC_K_SLEFT = 0xC902;
const word CRC_K_SRIGHT = 0x5B1F;
const word CRC_K_SUP = 0x4151;
const word CRC_K_SDOWN = 0xF0FB;
#endif
// ------------------------------------------------------------------

722
golded3/gclang.cpp Normal file
View File

@ -0,0 +1,722 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Language compiler
// ------------------------------------------------------------------
#include <golded.h>
#include <gclang.h>
// ------------------------------------------------------------------
// Structure of language crc list
struct LangCrc {
word crc;
char** langptr;
char* langdef;
};
// ------------------------------------------------------------------
// Language CRC16/Pointer/Default list
static LangCrc LangCrcs[] = {
{ CRC_MS_SWSUN , NULL , "Sun" },
{ CRC_MS_SWMON , NULL , "Mon" },
{ CRC_MS_SWTUE , NULL , "Tue" },
{ CRC_MS_SWWED , NULL , "Wed" },
{ CRC_MS_SWTHU , NULL , "Thu" },
{ CRC_MS_SWFRI , NULL , "Fri" },
{ CRC_MS_SWSAT , NULL , "Sat" },
{ CRC_MS_LWSUNDAY , NULL , "Sunday" },
{ CRC_MS_LWMONDAY , NULL , "Monday" },
{ CRC_MS_LWTUESDAY , NULL , "Tuesday" },
{ CRC_MS_LWWEDNESDAY , NULL , "Wednesday" },
{ CRC_MS_LWTHURSDAY , NULL , "Thursday" },
{ CRC_MS_LWFRIDAY , NULL , "Friday" },
{ CRC_MS_LWSATURDAY , NULL , "Saturday" },
{ CRC_MS_SMJAN , NULL , "Jan" },
{ CRC_MS_SMFEB , NULL , "Feb" },
{ CRC_MS_SMMAR , NULL , "Mar" },
{ CRC_MS_SMAPR , NULL , "Apr" },
{ CRC_MS_SMMAY , NULL , "May" },
{ CRC_MS_SMJUN , NULL , "Jun" },
{ CRC_MS_SMJUL , NULL , "Jul" },
{ CRC_MS_SMAUG , NULL , "Aug" },
{ CRC_MS_SMSEP , NULL , "Sep" },
{ CRC_MS_SMOCT , NULL , "Oct" },
{ CRC_MS_SMNOV , NULL , "Nov" },
{ CRC_MS_SMDEC , NULL , "Dec" },
{ CRC_MS_LMJANUARY , NULL , "January" },
{ CRC_MS_LMFEBRUARY , NULL , "February" },
{ CRC_MS_LMMARCH , NULL , "March" },
{ CRC_MS_LMAPRIL , NULL , "April" },
{ CRC_MS_LMMAY , NULL , "May" },
{ CRC_MS_LMJUNE , NULL , "June" },
{ CRC_MS_LMJULY , NULL , "July" },
{ CRC_MS_LMAUGUST , NULL , "August" },
{ CRC_MS_LMSEPTEMBER , NULL , "September" },
{ CRC_MS_LMOCTOBER , NULL , "October" },
{ CRC_MS_LMNOVEMBER , NULL , "November" },
{ CRC_MS_LMDECEMBER , NULL , "December" },
{ CRC_ST_IMPORTFILE , NULL , "Import File" },
{ CRC_WT_IMPORTWHICHFILE , NULL , " Import which file? " },
{ CRC_WT_IMPORTPICK , NULL , " Import " },
{ CRC_WT_IMPORTTXT , NULL , " Import " },
{ CRC_MI_IMPORTTXTTEXT , NULL , "T File as Text " },
{ CRC_MI_IMPORTTXTQUOTE , NULL , "Q File as Quote " },
{ CRC_MI_IMPORTTXTUUE , NULL , "U Binary as UUE " },
{ CRC_MI_IMPORTTXTMIME , NULL , "M Binary as MIME " },
{ CRC_MI_IMPORTTXTCLIP , NULL , "C From Clipboard " },
{ CRC_MI_IMPORTTXTXLAT , NULL , "s Use Charset.. " },
{ CRC_MI_IMPORTTXTQUIT , NULL , "N Nothing / Quit " },
{ CRC_ST_IMPORTSTATUS , NULL , "Importing from %s" },
{ CRC_ST_EXPORTFILE , NULL , "Export File" },
{ CRC_WT_EXPORTWHATFILE , NULL , " Export to what file? " },
{ CRC_ST_EXPORTSTATUS , NULL , "Exporting to %s" },
{ CRC_ST_EDITSTATUS , NULL , "Edit %i,%i. %s" },
{ CRC_ST_SELECTFILES , NULL , "Select Files" },
{ CRC_WL_SELECTEDFILES , NULL , "Selected Files " },
{ CRC_WL_SELECTEDBYTES , NULL , " Bytes " },
{ CRC_WL_TOTALFILES , NULL , "Total Files " },
{ CRC_WL_TOTALBYTES , NULL , " Bytes " },
{ CRC_WL_SCANNINGDIRECTORY , NULL , " Scanning Directory " },
{ CRC_WL_NOFILESFOUND , NULL , " * NO FILES FOUND * " },
{ CRC_ST_FILESPRESSKEY , NULL , "Press any key to continue" },
{ CRC_WT_AREA , NULL , "Area" },
{ CRC_WT_DESCRIPTION , NULL , "Description" },
{ CRC_WT_MSGS , NULL , "Msgs" },
{ CRC_WT_LAST , NULL , "Last" },
{ CRC_WT_ECHOID , NULL , "EchoID" },
{ CRC_ST_UNREAD , NULL , "unread" },
{ CRC_WT_SCANAREAS , NULL , " Scan Areas " },
{ CRC_MI_SCANALL , NULL , "A Scan All " },
{ CRC_MI_SCANMARKED , NULL , "M Scan Marked " },
{ CRC_MI_SCANCURRENT , NULL , "C Scan Current " },
{ CRC_MI_SCANMATCHING , NULL , "t Scan Matching " },
{ CRC_MI_SCANUNSCANNED , NULL , "U Scan Unscanned " },
{ CRC_MI_NOSCAN , NULL , "N No Scan / ESC " },
{ CRC_WT_HEATAREAS , NULL , " Heat Areas " },
{ CRC_MI_HEATALL , NULL , "A Heat All " },
{ CRC_MI_HEATMARKED , NULL , "M Heat Marked " },
{ CRC_MI_HEATCURRENT , NULL , "C Heat Current " },
{ CRC_MI_NOHEAT , NULL , "N No Heat / ESC " },
{ CRC_WT_ZAPAREAS , NULL , " Zap Areas " },
{ CRC_MI_ZAPALL , NULL , "A Zap All " },
{ CRC_MI_ZAPMARKED , NULL , "M Zap Marked " },
{ CRC_MI_ZAPCURRENT , NULL , "C Zap Current " },
{ CRC_MI_NOZAP , NULL , "N No Zap / ESC " },
{ CRC_MS_DOS_SHELL , NULL , "GoldED Shell. Type EXIT To Return." },
{ CRC_IL_SCANNINGAREA , NULL , " Scanning Area:" },
{ CRC_IL_SEARCHINGFOR , NULL , " Searching for" },
{ CRC_ST_READINGMSG , NULL , "Reading Msg %u of %u" },
{ CRC_ER_OUTOFMEM , NULL , "Out of memory!" },
{ CRC_MS_HEXDUMPHEAD , NULL , "Hexdump of message header:" },
{ CRC_MS_HEXDUMPTEXT , NULL , "Hexdump of message text:" },
{ CRC_ST_RENUMBERING , NULL , "Renumbering" },
{ CRC_ST_LOCKED , NULL , " (locked)" },
{ CRC_ST_RENUMBERED , NULL , "Messages Renumbered - Press Key" },
{ CRC_WL_BLANKMSG , NULL , "" },
{ CRC_WL_WAIT , NULL , " Wait " },
{ CRC_IL_GENHEXDUMP , NULL , " Generating Hexdump - Please Wait " },
{ CRC_ST_PROCESSCC , NULL , "Processing Carbon Copies" },
{ CRC_ST_STATUSCC , NULL , "CC: %s of %s" },
{ CRC_ST_DESTINATIONCC , NULL , "Select Carbon Copy Destination" },
{ CRC_MS_LISTCC , NULL , "%s %s" },
{ CRC_WT_DELORIG , NULL , " Delete Original? " },
{ CRC_MI_DELORIGYES , NULL , "Y Yes Please. " },
{ CRC_MI_DELORIGNO , NULL , "N No! " },
{ CRC_WT_DROPMSG , NULL , " Drop This Msg? " },
{ CRC_MI_DROPMSGYES , NULL , "Y Yes Please. " },
{ CRC_MI_DROPMSGNO , NULL , "N No! " },
{ CRC_WT_ZONEGATE , NULL , " Send via ZoneGate? " },
{ CRC_MI_ZONEGATEYES , NULL , "Y Yes Please. " },
{ CRC_MI_ZONEGATENO , NULL , "N No! " },
{ CRC_ST_QUOTEPCT , NULL , "Your Msg Contains %i%% Quotes%s" },
{ CRC_WT_SAVEMSG , NULL , " Save these %i lines? " },
{ CRC_MI_YESGREAT , NULL , "Y Yes, it's great stuff " },
{ CRC_MI_KICKIT , NULL , "N No, drop it.. / ESC " },
{ CRC_MI_CONTINUE , NULL , "C Continue writing " },
{ CRC_MI_ROT13 , NULL , "R ROT13 Crypting " },
{ CRC_MI_ATTRS , NULL , "A Change Attributes " },
{ CRC_MI_ORIGS , NULL , "O Change Origin " },
{ CRC_MI_VIEW , NULL , "V View the message " },
{ CRC_ST_SELECTDESTNODE , NULL , "Select Destination Node" },
{ CRC_WT_ATTACHFILES , NULL , " Attach Files " },
{ CRC_WT_UPDREQFILES , NULL , " Update Request Files " },
{ CRC_ST_EDITHEADER , NULL , "Edit Header Data" },
{ CRC_WT_EDITING , NULL , " Editing " },
{ CRC_MI_INTERNALED , NULL , "I Internal Editor " },
{ CRC_MI_EXTERNALED , NULL , "E External Editor " },
{ CRC_MI_SAVEMESSAGE , NULL , "S Save Message " },
{ CRC_MI_ATTRO , NULL , "A Attributes " },
{ CRC_MI_TEMPLATE , NULL , "T Templates " },
{ CRC_MI_ORIGIN , NULL , "O Origins " },
{ CRC_MI_QUITMESSAGE , NULL , "Q Quit / ESC " },
{ CRC_ST_TEMPLATES , NULL , " Templates " },
{ CRC_WT_CHANGETEMPLATES , NULL , "Change Default Template" },
{ CRC_WT_CARBONCOPY , NULL , " Carbon Copy " },
{ CRC_MI_CCPROCESS , NULL , "P Process CC's " },
{ CRC_MI_CCIGNORE , NULL , "I Ignore CC's " },
{ CRC_MI_CCATTRIBS , NULL , "C Change Attrs " },
{ CRC_MI_CCLISTFMT , NULL , "L List Format " },
{ CRC_WT_CCLIST , NULL , " CC List " },
{ CRC_MI_CCLISTKEEP , NULL , "K Keep " },
{ CRC_MI_CCLISTNAMES , NULL , "N Names only " },
{ CRC_MI_CCLISTVISIBLE , NULL , "V Visible " },
{ CRC_MI_CCLISTHIDDEN , NULL , "H Hidden " },
{ CRC_MI_CCLISTREMOVE , NULL , "R Remove " },
{ CRC_WT_ATTRTITLE , NULL , " Attributes " },
{ CRC_MI_ATTR01 , NULL , " Private <Alt-P> Archive/Sent <Alt-B> " },
{ CRC_MI_ATTR02 , NULL , " Crash <Alt-C> Direct <Alt-D> " },
{ CRC_MI_ATTR03 , NULL , " Received <Alt-R> Zonegate <Alt-G> " },
{ CRC_MI_ATTR04 , NULL , " Sent <Alt-S> Hub/Host-Route <Alt-V> " },
{ CRC_MI_ATTR05 , NULL , " File Attach <Alt-A> Immediate <Alt-I> " },
{ CRC_MI_ATTR06 , NULL , " Transit <Alt-J> Xmail <Alt-X> " },
{ CRC_MI_ATTR07 , NULL , " Orphan <Alt-O> Erase File/Sent <Alt-E> " },
{ CRC_MI_ATTR08 , NULL , " Kill/Sent <Alt-K> Trunc File/Sent <Alt-T> " },
{ CRC_MI_ATTR09 , NULL , " Local <Alt-W> Locked <Alt-L> " },
{ CRC_MI_ATTR10 , NULL , " Hold <Alt-H> Confirm Rcpt Request <Alt-Y> " },
{ CRC_MI_ATTR11 , NULL , " File Request <Alt-F> FTS1 Reserved <Alt-1> " },
{ CRC_MI_ATTR12 , NULL , " Return Rcpt Request <Alt-M> QBBS Reserved, Net <Alt-2> " },
{ CRC_MI_ATTR13 , NULL , " Return Rcpt <Alt-N> QBBS Reserved, Echo <Alt-3> " },
{ CRC_MI_ATTR14 , NULL , " Audit Request <Alt-Q> Squish Scanned <Alt-4> " },
{ CRC_MI_ATTR15 , NULL , " File Update Request <Alt-U> Zap all attribs <Alt-Z> " },
{ CRC_HD_FROM , NULL , " From : " },
{ CRC_HD_TO , NULL , " To : " },
{ CRC_HD_SUBJ , NULL , " Subj : " },
{ CRC_HD_FILE , NULL , " File : " },
{ CRC_MS_EMPTYMSG , NULL , "\r" },
{ CRC_MS_AUTOATTACHMSG , NULL , "\r" },
{ CRC_MS_AUTOREQUESTMSG , NULL , "\r" },
{ CRC_MS_AUTOUPDREQMSG , NULL , "\r" },
{ CRC_WT_FILEATTACH , NULL , " File Attach " },
{ CRC_WT_FILEREQUEST , NULL , " File Request " },
{ CRC_WT_FILEUPDREQ , NULL , " Update Request " },
{ CRC_ST_FILEATTACHING , NULL , "File Attaching [%i/%i] to %u:%u/%u.%u" },
{ CRC_ST_FILEREQUESTING , NULL , "File Requesting [%i/%i] from %u:%u/%u.%u" },
{ CRC_ST_FILEUPDREQING , NULL , "Update Requesting [%i/%i] from %u:%u/%u.%u" },
{ CRC_ST_READMARKED , NULL , "Read Marked - Msg %u of %u (%u left)" },
{ CRC_ST_READALL , NULL , "Read All - Msg %u of %u (%u left)" },
{ CRC_ST_NOQRENUM , NULL , "This area cannot be renumbered" },
{ CRC_MS_HIDINGTWIT , NULL , "This is a Twit Message - Press <Home> to read."},
{ CRC_HD_VIA , NULL , "via" },
{ CRC_WT_CHANGEATTRS , NULL , "Change Message Attributes" },
{ CRC_WT_HEADERTEXT , NULL , " Enter Searchstring (Header+Text) " },
{ CRC_WT_HEADERONLY , NULL , " Enter Searchstring (Header Only) " },
{ CRC_WT_NEWAREA , NULL , ">>Pick New Area: " },
{ CRC_WT_REPLYAREA , NULL , ">>Answer In Area: " },
{ CRC_WT_COPYAREA , NULL , ">>Copy To Area: " },
{ CRC_WT_MOVEAREA , NULL , ">>Move To Area: " },
{ CRC_WT_FORWARDAREA , NULL , ">>Forward To Area: " },
{ CRC_WT_FREQAREA , NULL , ">>Filerequest In Area: " },
{ CRC_WT_FREQMENUTITLE , NULL , "Requestable files" },
{ CRC_ST_FREQSTAT , NULL , "Pick files to request" },
{ CRC_IL_FREQINFONOFILES , NULL , " No requestable files were found in this msg! " },
{ CRC_WT_COPY , NULL , " Copy " },
{ CRC_WT_MOVE , NULL , " Move " },
{ CRC_WT_COPYING , NULL , " Copying " },
{ CRC_WT_MOVING , NULL , " Moving " },
{ CRC_ST_COPYINGMSG , NULL , "Copying Msg %u of %u to %s" },
{ CRC_ST_MOVINGMSG , NULL , "Moving Msg %u of %u to %s" },
{ CRC_WT_DELETE , NULL , " Delete " },
{ CRC_WT_DELETING , NULL , " Deleting " },
{ CRC_ST_DELETINGMSG , NULL , "Deleting Msg %u of %u" },
{ CRC_WT_WRITE , NULL , " Write " },
{ CRC_WT_WRITEMSGS , NULL , " Write Msg(s) to File " },
{ CRC_WT_WRITING , NULL , " Writing " },
{ CRC_ST_WRITINGMSG , NULL , "Writing Msg %u of %u" },
{ CRC_WT_WRITINGFILE , NULL , " Writing Msg(s) to File %s " },
{ CRC_WT_WRITINGPRN , NULL , " Writing Msg(s) to Print Device " },
{ CRC_IL_READONLYWARN , NULL , " This area is READ ONLY! " },
{ CRC_WT_ISREADONLY , NULL , " Write msg anyway? " },
{ CRC_MI_READONLYYES , NULL , "Y Yes Please. " },
{ CRC_MI_READONLYNO , NULL , "N No! " },
{ CRC_IL_CHANGEWARN , NULL , " This msg is NOT from you! " },
{ CRC_WT_CHANGE , NULL , " Change this msg? " },
{ CRC_MI_CHANGEYES , NULL , "Y Yes Please. " },
{ CRC_MI_CHANGENO , NULL , "N No! " },
{ CRC_WT_DELETETHIS , NULL , " Delete this msg? " },
{ CRC_MI_DELETEYES , NULL , "Y Yes Please. " },
{ CRC_MI_DELETENO , NULL , "N No! " },
{ CRC_MI_DELETENOASK , NULL , "D Don't ask.. " },
{ CRC_WT_GOTONEXT , NULL , " Goto Next Area? " },
{ CRC_MI_GOTONEXTYES , NULL , "Y Yes Please. " },
{ CRC_MI_GOTONEXTNO , NULL , "N No! " },
{ CRC_MI_GOTONEXTNEW , NULL , "U Yes, Next Unread Area. " },
{ CRC_WT_FORWARD , NULL , " Use FWD kludges? " },
{ CRC_MI_FORWARDYES , NULL , "Y Yes Please. " },
{ CRC_MI_FORWARDNO , NULL , "N No! " },
{ CRC_WT_MSG , NULL , "Msg" },
{ CRC_WT_MSGREAL , NULL , "Msg#" },
{ CRC_WT_FROML , NULL , "From" },
{ CRC_WT_TOL , NULL , "To" },
{ CRC_WT_SUBJL , NULL , "Subj" },
{ CRC_ST_MSGLISTER , NULL , "Lister - Msg %u of %u (%u left)" },
{ CRC_ST_COPYMOVEFORWARD , NULL , "Copy, Move or Forward this message" },
{ CRC_WT_SELECTACTION , NULL , " Action " },
{ CRC_MI_FORWARDMESSAGE , NULL , "F Forward Msg " },
{ CRC_MI_MOVEMESSAGE , NULL , "M Move Msg " },
{ CRC_MI_COPYMESSAGE , NULL , "C Copy Msg " },
{ CRC_MI_QUITCMF , NULL , "Q Quit / ESC " },
{ CRC_ST_ARE , NULL , "messages are" },
{ CRC_ST_IS , NULL , "message is" },
{ CRC_ST_MARKED , NULL , "marked" },
{ CRC_MI_MARKEDMSG , NULL , "M Marked Msgs " },
{ CRC_MI_CURRENTMSG , NULL , "C Current Msg " },
{ CRC_MI_QUITMSGS , NULL , "Q Quit / ESC " },
{ CRC_ST_WRITEMSGSTO , NULL , "Write Msg(s) to File or Printer" },
{ CRC_WT_WRITETO , NULL , " Write To: " },
{ CRC_MI_DISKFILE , NULL , "D Disk File " },
{ CRC_MI_PRINTER , NULL , "P Print device " },
{ CRC_MI_QUITWRITE , NULL , "Q Quit / ESC " },
{ CRC_ST_MARKINGOPTIONS , NULL , "Message Marking" },
{ CRC_WT_MARKWHAT , NULL , " Mark What? " },
{ CRC_MI_YOURMAIL , NULL , "Y Your personal mail " },
{ CRC_MI_FROMTOSUBJ , NULL , "H Header (From/To/Subj) " },
{ CRC_MI_TEXTHDR , NULL , "T Text and header " },
{ CRC_MI_THREAD , NULL , "R Reply thread " },
{ CRC_MI_NEWMSGS , NULL , "N New msgs >current " },
{ CRC_MI_OLDMSGS , NULL , "O Old msgs <current " },
{ CRC_MI_ALLMSGS , NULL , "A All msgs " },
{ CRC_MI_UNMARK , NULL , "U Unmark all msgs " },
{ CRC_MI_RANGE , NULL , "M Msg range (bookm-curr) " },
{ CRC_MI_MARKSTOGGLE , NULL , "g Toggle all marks " },
{ CRC_MI_QUITMARKS , NULL , "Q Quit / ESC " },
{ CRC_WT_ENTERMARKSTRING , NULL , " Enter Marking String " },
{ CRC_ST_SEARCHINGMSG , NULL , "Searching Msg %u of %u. Marked: %u" },
{ CRC_WT_USERLISTNAME , NULL , " Userlist filename? " },
{ CRC_IL_GENUSERLIST , NULL , " Generating Userlist " },
{ CRC_WT_FILEEXISTS , NULL , " File Exists! " },
{ CRC_MI_APPEND , NULL , "A Append to end of file " },
{ CRC_MI_OVERWRITE , NULL , "O Overwrite the file " },
{ CRC_MI_QUITEXIST , NULL , "R Re-enter filename / ESC " },
{ CRC_IL_WARNUNSENT , NULL , " WARNING! This message is NOT sent! " },
{ CRC_IL_WARNLOCKED , NULL , " WARNING! This message is LOcKed! "},
{ CRC_ST_CHANGEORIGIN , NULL , "Change Default Origin" },
{ CRC_WT_ORIGINS , NULL , " Origins " },
{ CRC_ST_CHANGEUSERNAME , NULL , "Change Default Username" },
{ CRC_WT_USERNAMES , NULL , " Usernames " },
{ CRC_ST_CHANGEAKA , NULL , "Change Default Address AKA" },
{ CRC_WT_AKAS , NULL , " AKA's " },
{ CRC_WT_LOOKUP , NULL , " Lookup: %s " },
{ CRC_WL_PHONE , NULL , "Phone" },
{ CRC_WT_QUITGOLDED , NULL , " Quit GoldED? " },
{ CRC_MI_QUITYES , NULL , "Y Yes Please. " },
{ CRC_MI_QUITNO , NULL , "N No! " },
{ CRC_MS_EDITCMD , NULL , "Editor: %s" },
{ CRC_IL_NOORIGDEFINED , NULL , " No origins defined. Press key " },
{ CRC_IL_NOUSERDEFINED , NULL , " No usernames defined. Press key " },
{ CRC_IL_NOAKADEFINED , NULL , " No AKA's defined. Press key " },
{ CRC_IL_NOTPLDEFINED , NULL , " No templates defined. Press key " },
{ CRC_IL_NOTHREADLIST , NULL , " Sorry, no thread available. Press key "},
{ CRC_MS_SKIPPINGTWIT , NULL , "Skipping Twit Message..." },
{ CRC_MS_KILLINGTWIT , NULL , "Killing Twit Message..." },
{ CRC_IL_WRITINGCFG , NULL , " Writing Configuration " },
{ CRC_IL_COULDNOTOPEN , NULL , " Couldn't open %s " },
{ CRC_MS_PROMPT , NULL , "Enter the command \"EXIT\" to return to GoldED.\r\n" },
{ CRC_IL_UNFINISHEDMSG , NULL , " Unfinished message found! " },
{ CRC_ST_LOADUNFINISHED , NULL , "Press any key to load it or <ESC> to ignore" },
{ CRC_IL_READINGECHOLIST , NULL , "Reading Echolist Files" },
{ CRC_IL_READINGADDRMACROS , NULL , "Reading Address Macros" },
{ CRC_IL_CHECKINGNODELISTS , NULL , "Checking Nodelists" },
{ CRC_ST_CROSSPOSTING , NULL , "Crossposting in %s" },
{ CRC_IL_TWITBLANKED , NULL , " Twit Msgs Blanked " },
{ CRC_IL_TWITSKIPPED , NULL , " Twit Msgs Skipped " },
{ CRC_IL_TWITIGNORESKIP , NULL , " Twit Msgs Ignored and Skipped " },
{ CRC_IL_TWITDISPLAYED , NULL , " Twit Msgs Displayed " },
{ CRC_IL_TWITKILLED , NULL , " Twit Msgs Killed " },
{ CRC_IL_STYLECODESNO , NULL , " Stylecodes disabled " },
{ CRC_IL_STYLECODESYES , NULL , " Stylecodes enabled " },
{ CRC_IL_STYLECODESHIDE , NULL , " Stylecodes enabled and stripped " },
{ CRC_ST_GENCFMRECEIPT , NULL , "Generating Confirmation Receipt" },
{ CRC_WT_NEW , NULL , "New" },
{ CRC_ST_LOOKUPINFO , NULL , "Nodelist Lookup Information" },
{ CRC_MS_DATETIMEFMT , NULL , "%d %b %y %H:%M:%S" },
{ CRC_MS_DATEFMT , NULL , "%d %b %y" },
{ CRC_MS_TIMEFMT , NULL , "%H:%M" },
{ CRC_MS_ORIGINALLYIN , NULL , "* Originally in %s" },
{ CRC_MS_CROSSPOSTEDIN , NULL , "* Crossposted in %s" },
{ CRC_MS_CCTO , NULL , "* Carbon copied to %s" },
{ CRC_ST_STATUSLINEHELP , NULL , "F1 Help" },
{ CRC_HD_OF , NULL , "of" },
{ CRC_MS_ROBOTMSG , NULL , "\r--- @longpid @version\r" },
{ CRC_ST_STATUSLINETIMEFMT , NULL , "%H:%M:%S" },
{ CRC_WT_REPLIES , NULL , " Replies " },
{ CRC_ST_SELECTREPLY , NULL , "Select the reply you want to see" },
{ CRC_IL_WAITOREXIT , NULL , " At this point you must either wait or exit GoldED entirely - Sorry! " },
{ CRC_WT_REALLYEXIT , NULL , " Really exit? " },
{ CRC_MI_TAGLINES , NULL , "T Change Tagline" },
{ CRC_MI_HEADEREDIT , NULL , "H Edit Header" },
{ CRC_MI_SCANGROUP , NULL , "G Scan Group" },
{ CRC_WT_QWKPACKET , NULL , " QWK Packet " },
{ CRC_MI_SCANQWK , NULL , "Q QWK Packet" },
{ CRC_WT_SOUPPACKET , NULL , " SOUP Packet " },
{ CRC_MI_SCANSOUP , NULL , "S SOUP Packet" },
{ CRC_MI_SCANIMPORT , NULL , "I Import" },
{ CRC_MI_SCANEXPORT , NULL , "E Export" },
{ CRC_WT_SCANPM , NULL , " Scan PM " },
{ CRC_MI_TAGLINE , NULL , "g Taglines" },
{ CRC_WT_CONFIRM , NULL , " Honor receipt request? " },
{ CRC_MI_CONFIRMYES , NULL , "Y Yes, send a receipt msg " },
{ CRC_MI_CONFIRMNO , NULL , "N No, ignore the request " },
{ CRC_IL_CONFIRMINFO , NULL , " The sender of this message requests confirmation of receipt (CFM) " },
{ CRC_ST_MSG , NULL , "msg" },
{ CRC_ST_MSGS , NULL , "msgs" },
{ CRC_ST_PERSONAL , NULL , "personal" },
{ CRC_WT_GRP , NULL , "Grp" },
{ CRC_IL_FOUNDPERSONAL , NULL , " Found %u personal mail%s in %u area%s " },
{ CRC_IL_NOPERSONAL , NULL , " No personal mail found " },
{ CRC_ST_ESCORCONTINUE , NULL , "ESC exits. Other keys: Tries to continue" },
{ CRC_MS_SPELLCHECKER , NULL , "SpellChecker: %s" },
{ CRC_WT_INS , NULL , " Ins " },
{ CRC_MI_FILELISTFROM , NULL , "Filelist from %s" },
{ CRC_ST_INITIALIZING , NULL , "Initializing ..." },
{ CRC_ST_CHECKING , NULL , "Checking" },
{ CRC_ST_LOCKSHARECAP , NULL , "%s Lock/Share Capability" },
{ CRC_WT_ATTRTURNOFF , NULL , " Press Alt-F1 to turn off this window " },
{ CRC_WT_TAGLINES , NULL , " Taglines " },
{ CRC_ST_CHANGETAGLINE , NULL , "Change Default Tagline" },
{ CRC_IL_NOTAGLINE , NULL , " No taglines defined. Press key " },
{ CRC_WT_CHARSETS , NULL , " Charsets " },
{ CRC_ST_CHANGEXLATIMP , NULL , "Change Default Import Charset" },
{ CRC_MI_CHARSETAUTO , NULL , "Auto" },
{ CRC_IL_NOXLATIMPORT , NULL , " No XLATIMPORT's defined. Press key " },
{ CRC_WT_N_A , NULL , "n/a" },
{ CRC_WT_WRITTEN , NULL , "Written" },
{ CRC_WT_ARRIVED , NULL , "Arrived" },
{ CRC_WT_RECEIVED , NULL , "Received" },
{ CRC_IL_NONODELIST , NULL , " Unable to access the nodelist or index files " },
{ CRC_IL_NODELISTMISSING , NULL , "Nodelist missing:" },
{ CRC_IL_NODELISTOUTDATED , NULL , "Nodelist out of date:" },
{ CRC_MS_REPLYLINKER , NULL , "Replylinker: %s" },
{ CRC_WT_ENTERMSGNO , NULL , " Enter msgno " },
{ CRC_IL_WAITUUDECODING , NULL , " Wait - uudecoding " },
{ CRC_IL_COMPLETEDUUDECODE , NULL , " Completed uudecode of %s " },
{ CRC_IL_NOTUUENCODED , NULL , " Could not find anything to uudecode " },
{ CRC_IL_UUEINVALIDPATH , NULL , " Invalid path for uudecoding - file not written " },
{ CRC_IL_PATHREPORT , NULL , " Generating PATH report " },
{ CRC_IL_ERRORINSOUP , NULL , " Error in SOUP file %s " },
{ CRC_IL_WARNALREADYSENT , NULL , " WARNING: This message is already sent! " },
{ CRC_IL_WAITLOCKED , NULL , " Wait: %s is locked " },
{ CRC_ST_RETRYORESC , NULL , "%s retry (%lu). Press ESC to exit GoldED." },
{ CRC_ST_RETRYLOCK , NULL , "Lock" },
{ CRC_ST_RETRYOPEN , NULL , "Open" },
{ CRC_WT_TOUCHSEMAPHORE , NULL , " Enter name of semaphore file to touch " },
{ CRC_MI_WRITETOHDRNO , NULL , "H Use Header: NO " },
{ CRC_MI_WRITETOHDRYES , NULL , "H Use Header: YES "},
{ CRC_MI_WRITETOHDRONLY , NULL , "H Use Header: ONLY "},
{ CRC_MI_CLIPBOARD , NULL , "C Clipboard "},
{ CRC_WT_SELECTMARKS , NULL , " Select Mark " },
{ CRC_WT_SELECTMARKSEDIT , NULL , " Edit Mark Description " },
{ CRC_IL_DROPMARKSINFO , NULL , " %s Messages Are Marked " },
{ CRC_WT_DROPMARKS , NULL , " Drop Msg Marks " },
{ CRC_MI_DROPALL , NULL , "A Drop All " },
{ CRC_MI_DROPMARKED , NULL , "M Drop Marked " },
{ CRC_MI_DROPCURRENT , NULL , "C Drop Current " },
{ CRC_MI_NODROP , NULL , "N No Drop / ESC " },
{ CRC_WT_CATCHAREAS , NULL , " Catch-Up Areas " },
{ CRC_MI_CATCHALL , NULL , "A Catch All " },
{ CRC_MI_CATCHMARKED , NULL , "M Catch Marked " },
{ CRC_MI_CATCHCURRENT , NULL , "C Catch Current " },
{ CRC_MI_NOCATCH , NULL , "N No Catch / ESC " },
{ CRC_WT_CROSSPOST , NULL , " Crosspost " },
{ CRC_MI_XCPROCESS , NULL , "P Process XC's " },
{ CRC_MI_XCIGNORE , NULL , "I Ignore XC's " },
{ CRC_MI_XCLISTFMT , NULL , "L List Format " },
{ CRC_WT_XCLIST , NULL , " XC List " },
{ CRC_MI_XCLISTRAW , NULL , "K Keep " },
{ CRC_MI_XCLISTVERBOSE , NULL , "V Verbose " },
{ CRC_MI_XCLISTLINE , NULL , "L Line " },
{ CRC_MI_XCLISTREMOVE , NULL , "R Remove " },
{ CRC_WT_ADDRESSBOOK , NULL , " Addressbook " },
{ CRC_WT_ADVANCEDSEARCH , NULL , " Advanced Search " },
{ CRC_IL_NOMOREMATCHES , NULL , " No more matches found " },
{ CRC_WT_HEADEREDITHELP1 , NULL , " #F10: Nodelist " },
{ CRC_WT_HEADEREDITHELP2 , NULL , " F10: Addressbook " },
{ CRC_WT_THREADLISTTITLE , NULL , " Message Thread List " },
{ CRC_WT_ADVANCEDMARKING , NULL , " Advanced Marking " },
{ CRC_ST_USERSTATUSLINE , NULL , "GoldED's Address Book - %d of %d (%d left)" },
{ CRC_WT_USERHEADERNAME , NULL , "Name" },
{ CRC_WT_USERHEADERORG , NULL , "Organization" },
{ CRC_WT_USERHEADERAKA , NULL , "Address" },
{ CRC_IL_USERWAIT , NULL , " Wait - Browsing Address Book... " },
{ CRC_MI_ALSELECTIONS1 , NULL , "Mark Areas with New Mail" },
{ CRC_MI_ALSELECTIONS2 , NULL , "(unused)" },
{ CRC_IL_DECODE , NULL , "Decode" },
{ CRC_IL_PREPARING , NULL , "Preparing" },
{ CRC_LAST_CRC , NULL , NULL }
};
// ------------------------------------------------------------------
// Compare two crcs
static int CmpLangCrc(LangCrc* a, LangCrc* b) {
return((a->crc > b->crc) ? 1 : ((a->crc < b->crc) ? -1 : 0));
}
// ------------------------------------------------------------------
// Call the function matching the keyword
static bool SwitchLanguage(word crc, char* str) {
LangCrc* lptr;
LangCrc lkey;
lkey.crc = crc;
lptr = (LangCrc*)bsearch(&lkey, LangCrcs, sizeof(LangCrcs)/sizeof(LangCrc), sizeof(LangCrc), (StdCmpCP)CmpLangCrc);
if(lptr != NULL) {
if(lptr->langptr != NULL) {
throw_xfree(*(lptr->langptr));
*(lptr->langptr) = throw_strdup(StripQuotes(str));
}
return 0;
} else
return -1;
}
// ------------------------------------------------------------------
// Unallocate all language strings
static void LangReset(void) {
LangCrc* lngptr = LangCrcs;
for(; lngptr->crc < CRC_LAST_CRC; lngptr++)
if(lngptr->langptr != NULL)
throw_xfree(*(lngptr->langptr));
throw_release(LNG);
int n;
for(n=0; n<7; n++)
gsweekday[n] = NULL;
for(n=0; n<7; n++)
glweekday[n] = NULL;
for(n=0; n<12; n++)
gsmonth[n] = NULL;
for(n=0; n<12; n++)
glmonth[n] = NULL;
}
// ------------------------------------------------------------------
// Initialize language
void LangInit() {
LNG = (LangGed*)throw_calloc(1, sizeof(LangGed));
LNG->Outofmem = throw_strdup("Out of memory!");
// Init LangCrc pointers to LNG
char** lptr = (char**)LNG;
for(LangCrc* lngptr = LangCrcs; lngptr->crc != CRC_LAST_CRC; lngptr++, lptr++)
lngptr->langptr = lptr;
// Sort the crc list
qsort(LangCrcs, sizeof(LangCrcs)/sizeof(LangCrc), sizeof(LangCrc), (StdCmpCP)CmpLangCrc);
atexit(LangReset);
}
// ------------------------------------------------------------------
// Assign weekday/month names
void AssignDateNames() {
gsweekday[0] = LNG->SWSun;
gsweekday[1] = LNG->SWMon;
gsweekday[2] = LNG->SWTue;
gsweekday[3] = LNG->SWWed;
gsweekday[4] = LNG->SWThu;
gsweekday[5] = LNG->SWFri;
gsweekday[6] = LNG->SWSat;
glweekday[0] = LNG->LWSunday;
glweekday[1] = LNG->LWMonday;
glweekday[2] = LNG->LWTuesday;
glweekday[3] = LNG->LWWednesday;
glweekday[4] = LNG->LWThursday;
glweekday[5] = LNG->LWFriday;
glweekday[6] = LNG->LWSaturday;
gsmonth[0] = LNG->SMJan;
gsmonth[1] = LNG->SMFeb;
gsmonth[2] = LNG->SMMar;
gsmonth[3] = LNG->SMApr;
gsmonth[4] = LNG->SMMay;
gsmonth[5] = LNG->SMJun;
gsmonth[6] = LNG->SMJul;
gsmonth[7] = LNG->SMAug;
gsmonth[8] = LNG->SMSep;
gsmonth[9] = LNG->SMOct;
gsmonth[10] = LNG->SMNov;
gsmonth[11] = LNG->SMDec;
glmonth[0] = LNG->LMJanuary;
glmonth[1] = LNG->LMFebruary;
glmonth[2] = LNG->LMMarch;
glmonth[3] = LNG->LMApril;
glmonth[4] = LNG->LMMay;
glmonth[5] = LNG->LMJune;
glmonth[6] = LNG->LMJuly;
glmonth[7] = LNG->LMAugust;
glmonth[8] = LNG->LMSeptember;
glmonth[9] = LNG->LMOctober;
glmonth[10] = LNG->LMNovember;
glmonth[11] = LNG->LMDecember;
}
// ------------------------------------------------------------------
// Load a GoldED language file
void LoadLanguage(const char* file) {
FILE* fp;
char* ptr;
char* str;
int line = 0;
char buf[256];
fp = fsopen(AddPath(CFG->goldpath, file), "rt", CFG->sharemode);
if(fp) {
setvbuf(fp, NULL, _IOFBF, 8192);
while(fgets((ptr=buf), sizeof(buf), fp)) {
line++;
ptr = strskip_wht(ptr);
if(isalpha(*ptr)) {
str = ptr;
strtrim(str);
str = strskip_txt(str);
if(*str) {
*str++ = NUL;
str = strskip_wht(str);
strschg(str, "\\n", "\n");
strschg(str, "\\r", "\r");
strschg(str, "\\\"", "\"");
}
if(SwitchLanguage(strCrc16(strupr(ptr)), str)) {
if(cmdlineoldkeyw == false) {
w_infof(" %s line %u: \"%s\" is obsolete or unknown ", file, line, ptr);
SayBibi();
waitkeyt(10000);
w_info(NULL);
cfgerrors++;
}
}
}
}
fclose(fp);
// Assign weekday/month names
AssignDateNames();
}
}
// ------------------------------------------------------------------
// Read the main language definition file
bool ReadLangCfg(int force) {
FILE *fpi;
char* ptr;
char* str;
long size;
char buf[1024];
LangCrc* lngptr;
int line = 0;
// Read the GOLDLANG.CFG if there is one
const char* cfgname = AddPath(CFG->goldpath, CFG->langcfg);
fpi = fsopen(cfgname, "rt", CFG->sharemode);
if(fpi) {
setvbuf(fpi, NULL, _IOFBF, 8192);
if(not quiet)
cout << "* Reading " << cfgname << endl;
cfgname = CleanFilename(cfgname);
while(fgets((ptr=buf), sizeof(buf), fpi)) {
line++;
ptr = strskip_wht(ptr);
if(isalpha(*ptr)) {
str = ptr;
strtrim(str);
str = strskip_txt(str);
if(*str) {
*str++ = NUL;
str = strskip_wht(str);
strschg(str, "\\n", "\n");
strschg(str, "\\r", "\r");
strschg(str, "\\\"", "\"");
}
if(SwitchLanguage(strCrc16(strupr(ptr)), str)) {
if(cmdlineoldkeyw == false) {
cout << "* " << cfgname << " line " << line << ": \"" << ptr << "\" is obsolete or unknown." << endl;
SayBibi();
cfgerrors++;
}
}
}
}
fclose(fpi);
}
// Fill in the defaults if there are "holes"
size = 0;
lngptr = LangCrcs;
for(; lngptr->crc < CRC_LAST_CRC; lngptr++) {
if(lngptr->langptr != NULL) {
if(*(lngptr->langptr) == NULL)
*(lngptr->langptr) = throw_strdup(lngptr->langdef);
size += strlen(*(lngptr->langptr)) + 1;
}
}
AssignDateNames();
return true;
}
// ------------------------------------------------------------------

494
golded3/gclang.h Normal file
View File

@ -0,0 +1,494 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// CRC values for language items.
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// CRC values for language items
const word CRC_MS_SWSUN = 0xD108;
const word CRC_MS_SWMON = 0x38F7;
const word CRC_MS_SWTUE = 0xA1E4;
const word CRC_MS_SWWED = 0x8186;
const word CRC_MS_SWTHU = 0xBCF4;
const word CRC_MS_SWFRI = 0x949B;
const word CRC_MS_SWSAT = 0xC512;
const word CRC_MS_LWSUNDAY = 0x4D93;
const word CRC_MS_LWMONDAY = 0x70CC;
const word CRC_MS_LWTUESDAY = 0x4F54;
const word CRC_MS_LWWEDNESDAY = 0x9D11;
const word CRC_MS_LWTHURSDAY = 0x3684;
const word CRC_MS_LWFRIDAY = 0xF676;
const word CRC_MS_LWSATURDAY = 0x96AC;
const word CRC_MS_SMJAN = 0xAAA8;
const word CRC_MS_SMFEB = 0x6F28;
const word CRC_MS_SMMAR = 0xDA53;
const word CRC_MS_SMAPR = 0x0ADF;
const word CRC_MS_SMMAY = 0xDA58;
const word CRC_MS_SMJUN = 0xBEA8;
const word CRC_MS_SMJUL = 0xBEAA;
const word CRC_MS_SMAUG = 0x0FCA;
const word CRC_MS_SMSEP = 0x2DAE;
const word CRC_MS_SMOCT = 0xF817;
const word CRC_MS_SMNOV = 0xE434;
const word CRC_MS_SMDEC = 0x4F6B;
const word CRC_MS_LMJANUARY = 0xD084;
const word CRC_MS_LMFEBRUARY = 0xE186;
const word CRC_MS_LMMARCH = 0xB291;
const word CRC_MS_LMAPRIL = 0xFDB6;
const word CRC_MS_LMMAY = 0xB50A;
const word CRC_MS_LMJUNE = 0x2119;
const word CRC_MS_LMJULY = 0x2305;
const word CRC_MS_LMAUGUST = 0x532D;
const word CRC_MS_LMSEPTEMBER = 0x4AFE;
const word CRC_MS_LMOCTOBER = 0x51C9;
const word CRC_MS_LMNOVEMBER = 0x107D;
const word CRC_MS_LMDECEMBER = 0x7733;
const word CRC_ST_IMPORTFILE = 0x027D;
const word CRC_WT_IMPORTWHICHFILE = 0xF718;
const word CRC_WT_IMPORTTXT = 0xB5DB;
const word CRC_MI_IMPORTTXTTEXT = 0xDCC1;
const word CRC_MI_IMPORTTXTQUOTE = 0x41E1;
const word CRC_MI_IMPORTTXTUUE = 0x36B6;
const word CRC_MI_IMPORTTXTMIME = 0xB1B7;
const word CRC_MI_IMPORTTXTCLIP = 0xC608;
const word CRC_MI_IMPORTTXTXLAT = 0x1185;
const word CRC_MI_IMPORTTXTQUIT = 0x2005;
const word CRC_WT_IMPORTPICK = 0xF5E1;
const word CRC_ST_IMPORTSTATUS = 0x4E97;
const word CRC_ST_EXPORTFILE = 0x5D16;
const word CRC_WT_EXPORTWHATFILE = 0xACAE;
const word CRC_ST_EXPORTSTATUS = 0x8DDB;
const word CRC_ST_EDITSTATUS = 0xB76C;
const word CRC_ST_SELECTFILES = 0xB2B4;
const word CRC_WL_SELECTEDFILES = 0x8C0E;
const word CRC_WL_SELECTEDBYTES = 0xC084;
const word CRC_WL_TOTALFILES = 0x92AE;
const word CRC_WL_TOTALBYTES = 0xDE24;
const word CRC_WL_SCANNINGDIRECTORY = 0xED57;
const word CRC_WL_NOFILESFOUND = 0x9013;
const word CRC_ST_FILESPRESSKEY = 0x472E;
const word CRC_WT_AREA = 0xBED8;
const word CRC_WT_DESCRIPTION = 0x3F38;
const word CRC_WT_MSGS = 0xE986;
const word CRC_WT_LAST = 0xFCC3;
const word CRC_WT_ECHOID = 0x1703;
const word CRC_ST_MESSAGE = 0x3CCE;
const word CRC_ST_MESSAGES = 0x398C;
const word CRC_ST_UNREAD = 0xCAC1;
const word CRC_WT_SCANAREAS = 0x8270;
const word CRC_MI_SCANALL = 0xFD54;
const word CRC_MI_SCANMARKED = 0xF28C;
const word CRC_MI_SCANCURRENT = 0xEE1C;
const word CRC_MI_SCANMATCHING = 0x4229;
const word CRC_MI_SCANUNSCANNED = 0x42C5;
const word CRC_MI_NOSCAN = 0xFA80;
const word CRC_WT_HEATAREAS = 0x00C9;
const word CRC_MI_HEATALL = 0xDED0;
const word CRC_MI_HEATMARKED = 0xFA46;
const word CRC_MI_HEATCURRENT = 0xA514;
const word CRC_MI_HEATMATCHING = 0xB386;
const word CRC_MI_NOHEAT = 0x45D5;
const word CRC_WT_ZAPAREAS = 0x3A1D;
const word CRC_MI_ZAPALL = 0x48C4;
const word CRC_MI_ZAPMARKED = 0xFF68;
const word CRC_MI_ZAPCURRENT = 0xDBB1;
const word CRC_MI_ZAPMATCHING = 0x89DF;
const word CRC_MI_NOZAP = 0x9D23;
const word CRC_MS_DOS_SHELL = 0xF73E;
const word CRC_IL_SCANNINGAREA = 0x38E0;
const word CRC_IL_SEARCHINGFOR = 0xDED6;
const word CRC_ST_READINGMSG = 0x24BD;
const word CRC_ER_OUTOFMEM = 0x60C7;
const word CRC_MS_HEXDUMPF = 0x3E18;
const word CRC_MS_HEXDUMPHEAD = 0x2E54;
const word CRC_MS_HEXDUMPTEXT = 0x715A;
const word CRC_ST_RENUMBERING = 0x0D0E;
const word CRC_ST_LOCKED = 0xC0AD;
const word CRC_ST_RENUMBERED = 0x639A;
const word CRC_WL_BLANKMSG = 0x441A;
const word CRC_WL_WAIT = 0xA72E;
const word CRC_IL_GENHEXDUMP = 0xF0CE;
const word CRC_ST_PROCESSCC = 0xC1DB;
const word CRC_ST_STATUSCC = 0xE5ED;
const word CRC_ST_DESTINATIONCC = 0xFCA4;
const word CRC_MS_LISTCC = 0x5915;
const word CRC_WT_DELORIG = 0x9EC3;
const word CRC_MI_DELORIGYES = 0xE51D;
const word CRC_MI_DELORIGNO = 0x911E;
const word CRC_WT_DROPMSG = 0x678A;
const word CRC_MI_DROPMSGYES = 0x2F8A;
const word CRC_MI_DROPMSGNO = 0xE1AA;
const word CRC_WT_ZONEGATE = 0x399C;
const word CRC_MI_ZONEGATEYES = 0xDC92;
const word CRC_MI_ZONEGATENO = 0xF8DA;
const word CRC_ST_QUOTEPCT = 0x55A1;
const word CRC_WT_SAVEMSG = 0xA50B;
const word CRC_MI_YESGREAT = 0x8336;
const word CRC_MI_KICKIT = 0x7E04;
const word CRC_MI_CONTINUE = 0x1BFF;
const word CRC_MI_ROT13 = 0x3A8C;
const word CRC_MI_ATTRS = 0x9C56;
const word CRC_MI_ORIGS = 0xFB6D;
const word CRC_MI_VIEW = 0xE7A5;
const word CRC_ST_SELECTDESTNODE = 0x7166;
const word CRC_WT_ATTACHFILES = 0xA67C;
const word CRC_WT_UPDREQFILES = 0xA04A;
const word CRC_ST_EDITHEADER = 0xC4B7;
const word CRC_WT_EDITING = 0xD205;
const word CRC_MI_INTERNALED = 0xC48B;
const word CRC_MI_EXTERNALED = 0x4362;
const word CRC_MI_SAVEMESSAGE = 0x15BC;
const word CRC_MI_ATTRO = 0x9C4A;
const word CRC_MI_TEMPLATE = 0xC792;
const word CRC_MI_ORIGIN = 0x293A;
const word CRC_MI_QUITMESSAGE = 0x03B4;
const word CRC_ST_TEMPLATES = 0x9B57;
const word CRC_WT_CHANGETEMPLATES = 0xD420;
const word CRC_WT_CARBONCOPY = 0x1FBB;
const word CRC_MI_CCPROCESS = 0x7B4C;
const word CRC_MI_CCIGNORE = 0x557C;
const word CRC_MI_CCATTRIBS = 0xA182;
const word CRC_MI_CCLISTFMT = 0x7307;
const word CRC_WT_CCLIST = 0x8688;
const word CRC_MI_CCLISTKEEP = 0xAFF0;
const word CRC_MI_CCLISTNAMES = 0x076A;
const word CRC_MI_CCLISTVISIBLE = 0x8495;
const word CRC_MI_CCLISTHIDDEN = 0x2828;
const word CRC_MI_CCLISTREMOVE = 0x36BD;
const word CRC_WT_ATTRTITLE = 0x0CA9;
const word CRC_MI_ATTR01 = 0x7704;
const word CRC_MI_ATTR02 = 0x7707;
const word CRC_MI_ATTR03 = 0x7706;
const word CRC_MI_ATTR04 = 0x7701;
const word CRC_MI_ATTR05 = 0x7700;
const word CRC_MI_ATTR06 = 0x7703;
const word CRC_MI_ATTR07 = 0x7702;
const word CRC_MI_ATTR08 = 0x770D;
const word CRC_MI_ATTR09 = 0x770C;
const word CRC_MI_ATTR10 = 0x7605;
const word CRC_MI_ATTR11 = 0x7604;
const word CRC_MI_ATTR12 = 0x7607;
const word CRC_MI_ATTR13 = 0x7606;
const word CRC_MI_ATTR14 = 0x7601;
const word CRC_MI_ATTR15 = 0x7600;
const word CRC_HD_MSGNO = 0x2C95;
const word CRC_HD_MSGNUM = 0x6AA3;
const word CRC_HD_MSGNOS = 0x70BD;
const word CRC_HD_MSGNUMS = 0x6EBF;
const word CRC_HD_FROM = 0x5747;
const word CRC_HD_TO = 0x8A51;
const word CRC_HD_SUBJ = 0xD621;
const word CRC_HD_FILE = 0xF715;
const word CRC_MS_EMPTYMSG = 0xF2BA;
const word CRC_MS_TEMPLATE = 0x6B5A;
const word CRC_MS_AUTOATTACHMSG = 0xA68A;
const word CRC_MS_AUTOREQUESTMSG = 0x21F2;
const word CRC_MS_AUTOUPDREQMSG = 0xD9FC;
const word CRC_WT_FILEATTACH = 0x7798;
const word CRC_WT_FILEREQUEST = 0x4E3E;
const word CRC_WT_FILEUPDREQ = 0x5D36;
const word CRC_ST_FILEATTACHING = 0xA6D5;
const word CRC_ST_FILEREQUESTING = 0x2C2E;
const word CRC_ST_FILEUPDREQING = 0xD9A3;
const word CRC_ER_NOTOPENQ = 0x4452;
const word CRC_ER_NOUSER = 0x0C80;
const word CRC_ER_NOLRQUSER = 0x9D9B;
const word CRC_ST_SCANBASE = 0xBA50;
const word CRC_MS_HEXDUMPQ = 0x3E0F;
const word CRC_ST_REBUILDMSGINFO = 0xBE11;
const word CRC_ST_READMARKED = 0x483E;
const word CRC_ST_READALL = 0xE183;
const word CRC_ST_NOQRENUM = 0x2669;
const word CRC_MS_HIDINGTWIT = 0x922C;
const word CRC_HD_VIA = 0x47C1;
const word CRC_WT_CHANGEATTRS = 0x03C1;
const word CRC_WT_HEADERTEXT = 0x7C39;
const word CRC_WT_HEADERONLY = 0x06D6;
const word CRC_WT_NEWAREA = 0x44F6;
const word CRC_WT_REPLYAREA = 0x2EB5;
const word CRC_WT_COPYAREA = 0x7DF5;
const word CRC_WT_MOVEAREA = 0xECCD;
const word CRC_WT_FORWARDAREA = 0xE927;
const word CRC_WT_FREQAREA = 0x1597;
const word CRC_WT_FREQMENUTITLE = 0x6ED6;
const word CRC_ST_FREQSTAT = 0x88BA;
const word CRC_IL_FREQINFONOFILES = 0x3EEF;
const word CRC_WT_COPY = 0x0E3E;
const word CRC_WT_MOVE = 0x2B2D;
const word CRC_WT_COPYING = 0xAA31;
const word CRC_WT_MOVING = 0xA018;
const word CRC_ST_COPYINGMSG = 0xD790;
const word CRC_ST_MOVINGMSG = 0x505D;
const word CRC_WT_DELETE = 0xA398;
const word CRC_WT_DELETING = 0xC557;
const word CRC_ST_DELETINGMSG = 0x9DD5;
const word CRC_WT_WRITE = 0xBB1F;
const word CRC_WT_WRITEMSGS = 0xD6C9;
const word CRC_WT_WRITING = 0xAEE2;
const word CRC_ST_WRITINGMSG = 0x4B24;
const word CRC_WT_WRITINGFILE = 0xB4BF;
const word CRC_WT_WRITINGPRN = 0xD8F6;
const word CRC_IL_READONLYWARN = 0xF595;
const word CRC_WT_ISREADONLY = 0x925C;
const word CRC_MI_READONLYYES = 0xD147;
const word CRC_MI_READONLYNO = 0x8A89;
const word CRC_IL_CHANGEWARN = 0xEAFE;
const word CRC_WT_CHANGE = 0x64D3;
const word CRC_MI_CHANGEYES = 0x84CA;
const word CRC_MI_CHANGENO = 0xA509;
const word CRC_WT_DELETETHIS = 0xE2D6;
const word CRC_MI_DELETEYES = 0xF69B;
const word CRC_MI_DELETENO = 0xD365;
const word CRC_MI_DELETENOASK = 0xC3B5;
const word CRC_WT_GOTONEXT = 0x2F9B;
const word CRC_MI_GOTONEXTYES = 0xB4C6;
const word CRC_MI_GOTONEXTNO = 0x21E8;
const word CRC_WT_MSG = 0x72B7;
const word CRC_WT_MSGREAL = 0xE582;
const word CRC_WT_FROML = 0xB683;
const word CRC_WT_TOL = 0xEDA4;
const word CRC_WT_SUBJL = 0x512A;
const word CRC_WT_DATEL = 0x2599;
const word CRC_ST_MSGLISTER = 0x8C5E;
const word CRC_ST_COPYMOVEFORWARD = 0xC024;
const word CRC_WT_SELECTACTION = 0xF7C0;
const word CRC_MI_FORWARDMESSAGE = 0x644C;
const word CRC_MI_MOVEMESSAGE = 0xAB24;
const word CRC_MI_COPYMESSAGE = 0x6811;
const word CRC_MI_QUITCMF = 0xE1B8;
const word CRC_ST_ARE = 0x78C8;
const word CRC_ST_IS = 0x27AC;
const word CRC_ST_MARKED = 0x9D5A;
const word CRC_MI_MARKEDMSG = 0xB19D;
const word CRC_MI_CURRENTMSG = 0x77E2;
const word CRC_MI_QUITMSGS = 0x84AC;
const word CRC_ST_WRITEMSGSTO = 0xAE7F;
const word CRC_WT_WRITETO = 0x7566;
const word CRC_MI_DISKFILE = 0x2A91;
const word CRC_MI_PRINTER = 0x9CBE;
const word CRC_MI_QUITWRITE = 0x2C14;
const word CRC_ST_MARKINGOPTIONS = 0x0CA8;
const word CRC_WT_MARKWHAT = 0xEC2E;
const word CRC_MI_YOURMAIL = 0x1143;
const word CRC_MI_FROMTOSUBJ = 0x52FC;
const word CRC_MI_TEXTHDR = 0x1564;
const word CRC_MI_THREAD = 0x5FE1;
const word CRC_MI_NEWMSGS = 0x6211;
const word CRC_MI_OLDMSGS = 0x2104;
const word CRC_MI_ALLMSGS = 0x470D;
const word CRC_MI_UNMARK = 0xDB33;
const word CRC_MI_RANGE = 0xDC8E;
const word CRC_MI_MARKSTOGGLE = 0x40C2;
const word CRC_MI_QUITMARKS = 0x42DA;
const word CRC_WT_ENTERMARKSTRING = 0xF300;
const word CRC_ST_SEARCHINGMSG = 0xC878;
const word CRC_WT_USERLISTNAME = 0x459B;
const word CRC_IL_GENUSERLIST = 0x95DE;
const word CRC_WT_FILEEXISTS = 0x984F;
const word CRC_MI_APPEND = 0x7BA3;
const word CRC_MI_OVERWRITE = 0x4BB5;
const word CRC_MI_QUITEXIST = 0xE9CD;
const word CRC_WT_UNSENT = 0x3726;
const word CRC_IL_WARNUNSENT = 0xB1EB;
const word CRC_ST_CHANGEORIGIN = 0xC9C1;
const word CRC_WT_ORIGINS = 0xFEA1;
const word CRC_ST_CHANGEUSERNAME = 0x91EA;
const word CRC_WT_USERNAMES = 0x1B5B;
const word CRC_ST_CHANGEAKA = 0xB94E;
const word CRC_WT_AKAS = 0x39D2;
const word CRC_WT_LOOKUP = 0x5412;
const word CRC_WL_PHONE = 0xAE86;
const word CRC_WT_QUITGOLDED = 0x4D56;
const word CRC_MI_QUITYES = 0x5AD6;
const word CRC_MI_QUITNO = 0x3004;
const word CRC_MS_EDITCMD = 0xC5C0;
const word CRC_IL_NOORIGDEFINED = 0x4CFB;
const word CRC_IL_NOUSERDEFINED = 0xBCA0;
const word CRC_IL_NOAKADEFINED = 0x7FBD;
const word CRC_IL_NOTPLDEFINED = 0x38A0;
const word CRC_MS_SKIPPINGTWIT = 0x1139;
const word CRC_MS_KILLINGTWIT = 0x477B;
const word CRC_IL_WRITINGCFG = 0x3637;
const word CRC_IL_COULDNOTOPEN = 0xC54F;
const word CRC_MS_PROMPT = 0x6803;
const word CRC_IL_UNFINISHEDMSG = 0x4FB3;
const word CRC_ST_LOADUNFINISHED = 0x6A0B;
const word CRC_IL_READINGECHOLIST = 0x7CBE;
const word CRC_ER_NOAREAS = 0xFE4D;
const word CRC_IL_READINGADDRMACROS = 0xC038;
const word CRC_IL_CHECKINGNODELISTS = 0x6412;
const word CRC_ST_CROSSPOSTING = 0xA937;
const word CRC_IL_ACCESSWAIT = 0x7247;
const word CRC_ST_ACCESSRETRY = 0x2685;
const word CRC_IL_NEWMSGSCAN = 0x6F97;
const word CRC_IL_NEWMSGSSCANNED = 0x771B;
const word CRC_IL_BASEIDXMISMATCH = 0x5413;
const word CRC_IL_BASETOIDXMISMATCH = 0xC555;
const word CRC_ST_REBUILDINGMSGBASE = 0xE64B;
const word CRC_IL_TWITBLANKED = 0x12ED;
const word CRC_IL_TWITSKIPPED = 0xC74C;
const word CRC_IL_TWITIGNORESKIP = 0x7BF4;
const word CRC_IL_TWITDISPLAYED = 0x9D1E;
const word CRC_IL_TWITKILLED = 0xC10B;
const word CRC_ST_GENCFMRECEIPT = 0xFB57;
const word CRC_WT_NEW = 0x54C4;
const word CRC_ST_LOOKUPINFO = 0x9B9F;
const word CRC_MS_HEXDUMPSQ = 0xDACC;
const word CRC_MS_DATETIMEFMT = 0xA85F;
const word CRC_MS_DATEFMT = 0xB211;
const word CRC_MS_TIMEFMT = 0xEE7A;
const word CRC_MS_ORIGINALLYIN = 0xA76F;
const word CRC_MS_CROSSPOSTEDIN = 0x1559;
const word CRC_MS_CCTO = 0xD87D;
const word CRC_ST_STATUSLINEHELP = 0xBB2D;
const word CRC_HD_OF = 0x9158;
const word CRC_MS_ROBOTMSG = 0x57FD;
const word CRC_ST_STATUSLINETIMEFMT = 0x1017;
const word CRC_WT_REPLIES = 0x9B03;
const word CRC_ST_SELECTREPLY = 0xB2CD;
const word CRC_IL_WAITOREXIT = 0x027E;
const word CRC_WT_REALLYEXIT = 0x3384;
const word CRC_MI_TAGLINES = 0x0F31;
const word CRC_MI_HEADEREDIT = 0x06F7;
const word CRC_MI_SCANGROUP = 0x8803;
const word CRC_WT_QWKPACKET = 0xD46E;
const word CRC_MI_SCANQWK = 0xF462;
const word CRC_WT_SOUPPACKET = 0x2EEE;
const word CRC_MI_SCANSOUP = 0x2690;
const word CRC_MI_SCANIMPORT = 0x7CEA;
const word CRC_MI_SCANEXPORT = 0x9B4B;
const word CRC_WT_SCANPM = 0x988D;
const word CRC_MI_TAGLINE = 0x202B;
const word CRC_WT_CONFIRM = 0xFD14;
const word CRC_MI_CONFIRMYES = 0xAB96;
const word CRC_MI_CONFIRMNO = 0x74FD;
const word CRC_IL_CONFIRMINFO = 0xB10C;
const word CRC_ST_MSG = 0xB846;
const word CRC_ST_MSGS = 0x6080;
const word CRC_ST_PERSONAL = 0xADC6;
const word CRC_WT_GRP = 0xD2EA;
const word CRC_IL_FOUNDPERSONAL = 0xA039;
const word CRC_IL_NOPERSONAL = 0x2813;
const word CRC_ST_ESCORCONTINUE = 0x4800;
const word CRC_MS_SPELLCHECKER = 0x69B4;
const word CRC_WT_INS = 0x2F27;
const word CRC_MI_FILELISTFROM = 0xB710;
const word CRC_ST_INITIALIZING = 0x4C6B;
const word CRC_ST_CHECKING = 0xE219;
const word CRC_ST_LOCKSHARECAP = 0x4A28;
const word CRC_WT_ATTRTURNOFF = 0x06F5;
const word CRC_WT_TAGLINES = 0xD887;
const word CRC_ST_CHANGETAGLINE = 0x2605;
const word CRC_IL_NOTAGLINE = 0x2C24;
const word CRC_WT_CHARSETS = 0x9116;
const word CRC_ST_CHANGEXLATIMP = 0xAFC7;
const word CRC_MI_CHARSETAUTO = 0x897D;
const word CRC_IL_NOXLATIMPORT = 0x0707;
const word CRC_WT_N_A = 0x4ED2;
const word CRC_WT_WRITTEN = 0x6677;
const word CRC_WT_ARRIVED = 0x495D;
const word CRC_WT_RECEIVED = 0x1B2E;
const word CRC_IL_NONODELIST = 0x0ECB;
const word CRC_IL_NODELISTMISSING = 0x07F9;
const word CRC_IL_NODELISTOUTDATED = 0x229E;
const word CRC_MS_REPLYLINKER = 0x63CE;
const word CRC_WT_ENTERMSGNO = 0x18B0;
const word CRC_IL_WAITUUDECODING = 0x76F6;
const word CRC_IL_COMPLETEDUUDECODE = 0xD504;
const word CRC_IL_NOTUUENCODED = 0x4733;
const word CRC_IL_ERRORINSOUP = 0xF66D;
const word CRC_IL_WARNALREADYSENT = 0x5594;
const word CRC_IL_WAITLOCKED = 0x1C74;
const word CRC_ST_RETRYORESC = 0xE5FA;
const word CRC_ST_RETRYLOCK = 0x00B1;
const word CRC_ST_RETRYOPEN = 0xB039;
const word CRC_WT_TOUCHSEMAPHORE = 0x157D;
const word CRC_MI_WRITETOHDRNO = 0xB417;
const word CRC_MI_WRITETOHDRYES = 0x98DA;
const word CRC_MI_WRITETOHDRONLY = 0xDF56;
const word CRC_MI_CLIPBOARD = 0xB9AE;
const word CRC_MI_GOTONEXTNEW = 0xD614;
const word CRC_WT_FORWARD = 0x5902;
const word CRC_MI_FORWARDYES = 0x631F;
const word CRC_MI_FORWARDNO = 0xD7B0;
const word CRC_IL_UUEINVALIDPATH = 0x8aDB;
const word CRC_IL_PATHREPORT = 0x7F52;
const word CRC_IL_STYLECODESNO = 0xE43B;
const word CRC_IL_STYLECODESYES = 0xEE2F;
const word CRC_IL_STYLECODESHIDE = 0xD56B;
const word CRC_IL_WARNLOCKED = 0x87A6;
const word CRC_IL_NOTHREADLIST = 0x9193;
const word CRC_WT_SELECTMARKS = 0x3BC7;
const word CRC_WT_SELECTMARKSEDIT = 0x22BC;
const word CRC_IL_DROPMARKSINFO = 0x51F7;
const word CRC_WT_DROPMARKS = 0xCEA9;
const word CRC_MI_DROPALL = 0xC8B4;
const word CRC_MI_DROPMARKED = 0xCC6B;
const word CRC_MI_DROPCURRENT = 0xDE81;
const word CRC_MI_NODROP = 0x6C6A;
const word CRC_WT_CATCHAREAS = 0xC515;
const word CRC_MI_CATCHALL = 0xBA7F;
const word CRC_MI_CATCHMARKED = 0xB0AD;
const word CRC_MI_CATCHCURRENT = 0xA79A;
const word CRC_MI_NOCATCH = 0xA488;
const word CRC_WT_CROSSPOST = 0xFF8A;
const word CRC_MI_XCPROCESS = 0x0718;
const word CRC_MI_XCIGNORE = 0x8C5A;
const word CRC_MI_XCLISTFMT = 0x0F53;
const word CRC_WT_XCLIST = 0x8330;
const word CRC_MI_XCLISTRAW = 0x51E5;
const word CRC_MI_XCLISTVERBOSE = 0x6189;
const word CRC_MI_XCLISTLINE = 0x17E5;
const word CRC_MI_XCLISTREMOVE = 0x59AF;
const word CRC_WT_ADDRESSBOOK = 0xFEF8;
const word CRC_WT_ADVANCEDSEARCH = 0xA8C9;
const word CRC_IL_NOMOREMATCHES = 0xD6CC;
const word CRC_WT_HEADEREDITHELP1 = 0x27A8;
const word CRC_WT_HEADEREDITHELP2 = 0x27AB;
const word CRC_WT_THREADLISTTITLE = 0x07CF;
const word CRC_WT_ADVANCEDMARKING = 0xF834;
const word CRC_ST_USERSTATUSLINE = 0x67D9;
const word CRC_WT_USERHEADERNAME = 0x54CD;
const word CRC_WT_USERHEADERORG = 0x83EE;
const word CRC_WT_USERHEADERAKA = 0x7B26;
const word CRC_IL_USERWAIT = 0xB687;
const word CRC_MI_ALSELECTIONS1 = 0xBFEC;
const word CRC_MI_ALSELECTIONS2 = 0xBFEF;
const word CRC_IL_DECODE = 0x10D9;
const word CRC_IL_PREPARING = 0x2CD6;
const word CRC_LAST_CRC = 0xFFFF;
// ------------------------------------------------------------------

820
golded3/gcmisc.cpp Normal file
View File

@ -0,0 +1,820 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Compilers for help, screen and xlat.
// ------------------------------------------------------------------
#include <golded.h>
// ------------------------------------------------------------------
int ReadHelpCfg(int force) {
char* ptr;
long offset;
char buf[1024];
FILE* ifp;
FILE* ofp;
Hlpr* HlpL;
int count;
int counter;
int comment;
if((force > 1) or (FiletimeCmp(CFG->helpcfg.fn, CFG->helpged) > 0)) {
ifp = fsopen(AddPath(CFG->goldpath, CFG->helpcfg.fn), "rb", CFG->sharemode);
if(ifp) {
setvbuf(ifp, NULL, _IOFBF, 8192);
ofp = fsopen(AddPath(CFG->goldpath, CFG->helpged), "wb", CFG->sharemode);
if(ofp) {
offset = 0L;
CFG->helpcfg.ft = GetFiletime(AddPath(CFG->goldpath, CFG->helpcfg.fn));
if(not quiet)
cout << "* Reading " << AddPath(CFG->goldpath, CFG->helpcfg.fn) << endl;
setvbuf(ofp, NULL, _IOFBF, 8192);
count = 0;
rewind(ifp);
while(fgets(buf, sizeof(buf), ifp)) {
if(strnieql(buf, "*B ", 3))
count++;
}
HlpL = (Hlpr*)throw_calloc(count+2, sizeof(Hlpr));
rewind(ifp);
fputs("*I\r\n", ofp);
fwrite(HlpL, count+1, sizeof(Hlpr), ofp);
fputs("\r\n\r\n", ofp);
offset += 4 + ((count+1)*sizeof(Hlpr)) + 4;
counter = 0;
comment = YES;
while(fgets(buf, sizeof(buf), ifp)) {
if(strnieql(buf, "*B ", 3)) {
comment = NO;
HlpL[counter].help = atow(buf+3);
ptr = strchr(buf, ',');
strbtrim(strcpy(HlpL[counter].category, ptr ? ptr+1 : ""));
HlpL[counter].offset = offset + strlen(buf);
counter++;
}
if(not comment) {
fputs(buf, ofp);
offset += strlen(buf);
}
if(strnieql(buf, "*E", 2))
comment = YES;
}
HlpL[counter].offset = -1L;
fseek(ofp, 0L, SEEK_SET);
fputs("*I\r\n", ofp);
fwrite(HlpL, count+1, sizeof(Hlpr), ofp);
throw_free(HlpL);
fclose(ofp);
}
fclose(ifp);
}
}
// Init the help system
whelpdef(CFG->helpged, Key_F1, C_HELPB, C_HELPW, C_HELPQ, C_HELPS, NULL);
whelpwin(0, 0, MAXROW-2, MAXCOL-1, W_BHELP, NO);
whelpcat(H_General);
return 0;
}
// ------------------------------------------------------------------
// Window parts
const word CRC_BLOCK = 0xC10C;
const word CRC_BORDER = 0x97A7;
const word CRC_BTYPE = 0x2A2F;
const word CRC_CURSOR = 0x0D67;
const word CRC_EDIT = 0xB32D;
const word CRC_HEADER = 0x6EED;
const word CRC_HIGHLIGHT = 0x5EBF;
const word CRC_INPUT = 0xA25E;
const word CRC_KLUDHIDD = 0x222E;
const word CRC_NOSELECT = 0x950C;
const word CRC_QUOTE = 0x75DA;
const word CRC_SELECTOR = 0x5604;
const word CRC_STATUS = 0x1D36;
const word CRC_TEARORIG = 0x428E;
const word CRC_TITLE = 0x636E;
const word CRC_WINDOW = 0xCEFE;
const word CRC_FROM = 0x9290;
const word CRC_TO = 0x544F;
const word CRC_SUBJECT = 0xF861;
const word CRC_KLUDGE = 0xA600;
const word CRC_HIDDEN = 0xE465;
const word CRC_TAGLINE = 0xC328;
const word CRC_TEARLINE = 0xB385;
const word CRC_ORIGIN = 0x4CE5;
const word CRC_PAGEBAR = 0x4ECA;
const word CRC_UNREAD = 0xFE2A;
const word CRC_UNSENT = 0xC20B;
const word CRC_UNREADHIGH = 0x66D0;
const word CRC_UNSENTHIGH = 0xB4FD;
const word CRC_QUOTE2 = 0xF400;
const word CRC_SIGNATURE = 0x1A6E;
const word CRC_B = 0x0042;
const word CRC_I = 0x0049;
const word CRC_BI = 0x4249;
const word CRC_U = 0x0055;
const word CRC_BU = 0x4255;
const word CRC_IU = 0x4955;
const word CRC_BIU = 0x21D3;
const word CRC_R = 0x0052;
const word CRC_RB = 0x5242;
const word CRC_RI = 0x5249;
const word CRC_RBI = 0x38FE;
const word CRC_RU = 0x5255;
const word CRC_RBU = 0x38E2;
const word CRC_RIU = 0x33E2;
const word CRC_RBIU = 0x490E;
const word CRC_ALL = 0x14A9;
// ------------------------------------------------------------------
// Colors
const word CRC_BLACK = 0x20C2;
const word CRC_BLUE = 0xB7A3;
const word CRC_BROWN = 0xF575;
const word CRC_CYAN = 0xD20D;
const word CRC_DARKGRAY = 0x0D32;
const word CRC_DARKGREY = 0x0932;
const word CRC_DGRAY = 0x6ED8;
const word CRC_DGREY = 0x6AD8;
const word CRC_GREEN = 0xADCF;
const word CRC_LBLUE = 0xDF6F;
const word CRC_LCYAN = 0xBAC1;
const word CRC_LGRAY = 0xC779;
const word CRC_LGREEN = 0x8C61;
const word CRC_LGREY = 0xC379;
const word CRC_LIGHTBLUE = 0x053B;
const word CRC_LIGHTCYAN = 0x6095;
const word CRC_LIGHTGRAY = 0x1D2D;
const word CRC_LIGHTGREEN = 0xB256;
const word CRC_LIGHTGREY = 0x192D;
const word CRC_LIGHTMAGENTA = 0xBEA8;
const word CRC_LIGHTRED = 0xAED2;
const word CRC_LMAGENTA = 0xDE86;
const word CRC_LRED = 0x7752;
const word CRC_MAGENTA = 0xBF75;
const word CRC_NORMAL = 0x4DA2;
const word CRC_RED = 0x3FF3;
const word CRC_REVERSE = 0xB4CD;
const word CRC_UNDERLINE = 0xDC93;
const word CRC_WHITE = 0xD293;
const word CRC_YELLOW = 0xFEAF;
// ------------------------------------------------------------------
// Window areas
const word CRC_AREA = 0x010B;
const word CRC_ASK = 0x0BAE;
const word CRC_BACKGROUND = 0x1365;
const word CRC_BRAG = 0x505E;
const word CRC_HELP = 0xD054;
const word CRC_INFO = 0x5811;
const word CRC_MENU = 0x2DA4;
const word CRC_READER = 0x1DE1;
const word CRC_SHADOW = 0x2301;
const word CRC_STYLECODE = 0x8B6C;
const word CRC_STYLECODES = 0x4CB0;
// ------------------------------------------------------------------
// Get color value
int GetColor(char* ink) {
word crc;
int color=0;
crc = strCrc16(strupr(ink));
switch(crc) {
// Black is the default
case CRC_BLACK:
color = 0;
break;
case CRC_BLUE:
color = 1;
break;
case CRC_GREEN:
color = 2;
break;
case CRC_CYAN:
color = 3;
break;
case CRC_RED:
color = 4;
break;
case CRC_MAGENTA:
color = 5;
break;
case CRC_BROWN:
color = 6;
break;
case CRC_LGRAY:
case CRC_LGREY:
case CRC_LIGHTGRAY:
case CRC_LIGHTGREY:
color = 7;
break;
case CRC_DGRAY:
case CRC_DGREY:
case CRC_DARKGRAY:
case CRC_DARKGREY:
color = 8;
break;
case CRC_LBLUE:
case CRC_LIGHTBLUE:
color = 9;
break;
case CRC_LGREEN:
case CRC_LIGHTGREEN:
color = 10;
break;
case CRC_LCYAN:
case CRC_LIGHTCYAN:
color = 11;
break;
case CRC_LRED:
case CRC_LIGHTRED:
color = 12;
break;
case CRC_LMAGENTA:
case CRC_LIGHTMAGENTA:
color = 13;
break;
case CRC_YELLOW:
color = 14;
break;
case CRC_WHITE:
color = 15;
break;
case CRC_UNDERLINE:
color = UNDERLINE;
break;
case CRC_NORMAL:
color = NORMAL;
break;
case CRC_HIGHLIGHT:
color = HIGHLIGHT;
break;
case CRC_REVERSE:
color = REVERSE;
break;
}
return(color);
}
// ------------------------------------------------------------------
// Evaluates a color string
int MakeColor(char* colors) {
static int paper=0;
int ink=0, blink;
char* ink_;
char* paper_;
#if defined(__UNIX__) or defined(__USE_NCURSES__)
blink = 0;
#else
blink = (stridela("blinking", colors) ? 128 : 0);
#endif
ink_ = strtok(colors, " \t"); // Get the Ink color
if(ink_) {
ink = GetColor(ink_);
paper_ = strtok(NULL, " \t"); // Skip the "On"
if(paper_) {
paper_ = strtok(NULL, " \t"); // Get the Paper color
if(paper_)
paper = GetColor(paper_);
}
}
if(paper > 7)
CFG->intensecolors = true;
return ink | paper*16 | blink;
}
// ------------------------------------------------------------------
// Get color values
void GetColors(char* value) {
word crc;
Win* wptr;
int attr;
char buf[256];
char* win;
char* colors;
char* part=NULL;
*buf = NUL;
if((win = strtok(value, " \t")) == NULL)
return;
if(stricmp(win, "shadow")) {
part = strtok(NULL, " \t");
if(part == NULL)
return;
}
do {
colors = strtok(NULL, " \t\n");
if(colors != NULL) {
strcat(buf, colors);
strcat(buf, " ");
}
} while(colors != NULL);
crc = strCrc16(strupr(win));
attr = MakeColor(buf);
switch(crc) {
case CRC_SHADOW:
C_SHADOW = attr;
return;
case CRC_BACKGROUND:
wptr = &GC_BACK_;
break;
case CRC_STATUS:
wptr = &GC_STAT_;
break;
case CRC_BRAG:
wptr = &GC_BRAG_;
break;
case CRC_AREA:
wptr = &GC_AREA_;
break;
case CRC_READER:
wptr = &GC_READ_;
break;
case CRC_HEADER:
wptr = &GC_HEAD_;
break;
case CRC_ASK:
wptr = &GC_ASK__;
break;
case CRC_MENU:
wptr = &GC_MENU_;
break;
case CRC_HELP:
wptr = &GC_HELP_;
break;
case CRC_INFO:
wptr = &GC_INFO_;
break;
case CRC_STYLECODE:
case CRC_STYLECODES:
wptr = &GC_STYLE_;
break;
default:
return;
}
crc = strCrc16(strupr(part));
switch(crc) {
case CRC_WINDOW:
wptr->_Window = attr;
if(wptr == &GC_HEAD_) {
wptr->_From = attr;
wptr->_To = attr;
wptr->_Subject = attr;
}
if(wptr == &GC_READ_) {
wptr->_Tagline = attr;
GC_STYLE_._Bold = attr;
GC_STYLE_._Italic = attr;
GC_STYLE_._BoldItalic = attr;
GC_STYLE_._Underscore = attr;
GC_STYLE_._BoldUnderscore = attr;
GC_STYLE_._ItalicUnderscore = attr;
GC_STYLE_._BoldItalicUnderscore = attr;
GC_STYLE_._Reverse = attr;
GC_STYLE_._ReverseBold = attr;
GC_STYLE_._ReverseItalic = attr;
GC_STYLE_._ReverseBoldItalic = attr;
GC_STYLE_._ReverseUnderscore = attr;
GC_STYLE_._ReverseBoldUnderscore = attr;
GC_STYLE_._ReverseItalicUnderscore = attr;
GC_STYLE_._ReverseBoldItalicUnderscore = attr;
}
break;
case CRC_BORDER:
wptr->_Border = attr;
wptr->_Pagebar = attr;
break;
case CRC_BTYPE:
wptr->btype = atoi(buf);
break;
case CRC_TITLE:
wptr->_Title = attr;
break;
case CRC_SELECTOR:
wptr->_Selector = attr;
break;
case CRC_HIGHLIGHT:
wptr->_Highlight = attr;
break;
case CRC_NOSELECT:
wptr->_Noselect = attr;
break;
case CRC_QUOTE:
wptr->_Quote = attr;
break;
case CRC_CURSOR:
wptr->_Cursor = attr;
break;
case CRC_KLUDHIDD:
wptr->_Kludge = attr;
wptr->_Hidden = attr;
break;
case CRC_TEARORIG:
wptr->_Tearline = attr;
wptr->_Origin = attr;
break;
case CRC_EDIT:
wptr->_Edit = attr;
break;
case CRC_BLOCK:
wptr->_Block = attr;
break;
case CRC_INPUT:
wptr->_Input = attr;
break;
case CRC_FROM:
wptr->_From = attr;
break;
case CRC_TO:
wptr->_To = attr;
break;
case CRC_SUBJECT:
wptr->_Subject = attr;
break;
case CRC_KLUDGE:
wptr->_Kludge = attr;
break;
case CRC_HIDDEN:
wptr->_Hidden = attr;
break;
case CRC_TAGLINE:
wptr->_Tagline = attr;
break;
case CRC_TEARLINE:
wptr->_Tearline = attr;
break;
case CRC_ORIGIN:
wptr->_Origin = attr;
break;
case CRC_PAGEBAR:
wptr->_Pagebar = attr;
break;
case CRC_UNREAD:
wptr->_WindowUnread = attr;
break;
case CRC_UNSENT:
wptr->_WindowUnsent = attr;
break;
case CRC_UNREADHIGH:
wptr->_HighlightUnread = attr;
break;
case CRC_QUOTE2:
if(wptr == &GC_READ_)
GC_READ2_._Quote2 = attr;
break;
case CRC_SIGNATURE:
if(wptr == &GC_READ_)
GC_READ2_._Signature = attr;
break;
case CRC_UNSENTHIGH:
wptr->_HighlightUnsent = attr;
break;
case CRC_B: wptr->_Bold = attr; break;
case CRC_I: wptr->_Italic = attr; break;
case CRC_BI: wptr->_BoldItalic = attr; break;
case CRC_U: wptr->_Underscore = attr; break;
case CRC_BU: wptr->_BoldUnderscore = attr; break;
case CRC_IU: wptr->_ItalicUnderscore = attr; break;
case CRC_BIU: wptr->_BoldItalicUnderscore = attr; break;
case CRC_R: wptr->_Reverse = attr; break;
case CRC_RB: wptr->_ReverseBold = attr; break;
case CRC_RI: wptr->_ReverseItalic = attr; break;
case CRC_RBI: wptr->_ReverseBoldItalic = attr; break;
case CRC_RU: wptr->_ReverseUnderscore = attr; break;
case CRC_RBU: wptr->_ReverseBoldUnderscore = attr; break;
case CRC_RIU: wptr->_ReverseItalicUnderscore = attr; break;
case CRC_RBIU: wptr->_ReverseBoldItalicUnderscore = attr; break;
case CRC_ALL:
if(wptr == &GC_STYLE_) {
wptr->_Bold = attr;
wptr->_Italic = attr;
wptr->_BoldItalic = attr;
wptr->_Underscore = attr;
wptr->_BoldUnderscore = attr;
wptr->_ItalicUnderscore = attr;
wptr->_BoldItalicUnderscore = attr;
wptr->_Reverse = attr;
wptr->_ReverseBold = attr;
wptr->_ReverseItalic = attr;
wptr->_ReverseBoldItalic = attr;
wptr->_ReverseUnderscore = attr;
wptr->_ReverseBoldUnderscore = attr;
wptr->_ReverseItalicUnderscore = attr;
wptr->_ReverseBoldItalicUnderscore = attr;
}
break;
default:
return;
}
}
// ------------------------------------------------------------------
// Compare escape table items
static int CmpEsc(const char* a, const char* b) {
return strncmp(a, b, 5);
}
// ------------------------------------------------------------------
// Read the translation tables
void ReadXlatTables() {
if(not CFG->xlatcharset.empty() or not CFG->xlatescset.empty()) {
Esc EscTable;
Chs ChsTable;
char buf[256];
char* ptr;
char* ptr2;
FILE *ifp, *ofp;
int line, n, x, y, ch=0;
ofp = fsopen(AddPath(CFG->goldpath, CFG->xlatged), "wb", CFG->sharemode);
if(ofp) {
// Compile CHARSET tables
vector<Map>::iterator xlt;
for(xlt = CFG->xlatcharset.begin(); xlt != CFG->xlatcharset.end(); xlt++) {
// Assign table defaults
memset(&ChsTable, 0, sizeof(Chs));
for(n=0; n<256; n++) {
ChsTable.t[n][0] = 1;
ChsTable.t[n][1] = (unsigned char)n; // The character
}
strcpy(buf, AddPath(CFG->xlatpath, xlt->mapfile));
ifp = fsopen(buf, "rb", CFG->sharemode);
if(ifp) {
if(not quiet)
cout << "* Reading " << buf << endl;
// Read the definition file
line = 1;
while(fgets(buf, sizeof(buf), ifp)) {
ptr = buf;
if(*ptr != ';' and not strblank(ptr)) {
if((ptr2 = strchr(ptr+2, ';')) != NULL)
*ptr2 = NUL;
strtrim(ptr);
if(line < 6) {
switch(line) {
case 1:
ChsTable.id = atol(ptr);
break;
case 2:
ChsTable.version = atoi(ptr);
break;
case 3:
ChsTable.level = atoi(ptr);
if((ChsTable.level == 1) or (ChsTable.id > 65535L))
ch = 0;
else
ch = 128;
break;
case 4:
strcpy(ChsTable.imp, strbtrim(ptr));
break;
case 5:
if(ChsTable.level)
sprintf(ChsTable.exp, "%s %d", strbtrim(ptr), ChsTable.level);
else
strcpy(ChsTable.exp, strbtrim(ptr));
break;
}
}
else {
ptr = strskip_wht(ptr);
if(ch > 255 or strieql(ptr, "END")) // End of table reached
break;
x = 0;
ChsTable.t[ch][0] = (byte)x;
while(*ptr and x < 3) {
if(*ptr == '\\') {
ptr++;
switch(*ptr) {
case '\\':
ChsTable.t[ch][++x] = (byte)'\\';
ChsTable.t[ch][0] = (byte)x;
ptr = strskip_txt(ptr);
break;
case 'd':
y = (unsigned char)atoi(ptr+1);
ChsTable.t[ch][++x] = (byte)y;
ChsTable.t[ch][0] = (byte)x;
ptr = strskip_txt(ptr);
break;
case 'x':
y = (unsigned char)atox(ptr+1);
ChsTable.t[ch][++x] = (byte)y;
ChsTable.t[ch][0] = (byte)x;
ptr = strskip_txt(ptr);
break;
case '0':
ptr = strskip_txt(ptr);
break;
}
}
else {
ChsTable.t[ch][++x] = (byte)*ptr++;
ChsTable.t[ch][0] = (byte)x;
}
ptr = strskip_wht(ptr);
}
ch++;
}
line++;
}
}
fclose(ifp);
}
fwrite(&ChsTable, sizeof(Chs), 1, ofp);
}
// Compile ESCSET tables
for(xlt = CFG->xlatescset.begin(); xlt != CFG->xlatescset.end(); xlt++) {
// Assign defaults
memset(&EscTable, 0, sizeof(Esc));
strcpy(buf, AddPath(CFG->xlatpath, xlt->mapfile));
ifp = fsopen(buf, "rb", CFG->sharemode);
if(ifp) {
if(not quiet)
cout << "* Reading " << buf << endl;
// Read the definition file
line = 1;
while(fgets(buf, sizeof(buf), ifp)) {
ptr = buf;
if(*ptr != ';' and not strblank(ptr)) {
if((ptr2 = strchr(ptr+2, ';')) != NULL)
*ptr2 = NUL;
strtrim(ptr);
if(line < 2) {
switch(line) {
case 1:
strcpy(EscTable.exp, strbtrim(ptr));
break;
}
}
else {
n = EscTable.size;
if(n > 255 or strieql(ptr, "END")) // End of table reached
break;
EscTable.t[n][0] = ptr[0];
EscTable.t[n][1] = ptr[1];
x = 2;
ptr += 2;
ptr = strskip_wht(ptr);
while(*ptr and x < 5) {
if(*ptr == '\\') {
ptr++;
switch(*ptr) {
case '\\':
EscTable.t[n][x++] = '\\';
ptr = strskip_txt(ptr);
break;
case 'd':
EscTable.t[n][x++] = (unsigned char)atoi(ptr+1);
ptr = strskip_txt(ptr);
break;
case 'x':
EscTable.t[n][x++] = (unsigned char)atox(ptr+1);
ptr = strskip_txt(ptr);
break;
case '0':
EscTable.t[n][x++] = NUL;
ptr = strskip_txt(ptr);
break;
}
}
else {
EscTable.t[n][x++] = *ptr++;
}
ptr = strskip_wht(ptr);
}
EscTable.size++;
}
line++;
}
}
qsort(EscTable.t, EscTable.size, 5, (StdCmpCP)CmpEsc);
fclose(ifp);
}
fwrite(&EscTable, sizeof(Esc), 1, ofp);
}
fclose(ofp);
}
}
}
// ------------------------------------------------------------------
void CookieIndex(char* textfile, char* indexfile) {
FILE* ifp = fsopen(textfile, "rb", CFG->sharemode);
if(ifp) {
setvbuf(ifp, NULL, _IOFBF, 32000);
FILE* ofp = fsopen(indexfile, "wb", CFG->sharemode);
if(ofp) {
setvbuf(ofp, NULL, _IOFBF, 16000);
char buf[256];
long fpos = 0;
long tpos = 0;
bool was_blank = false;
while(fgets(buf, sizeof(buf), ifp)) {
if(strblank(buf)) {
fwrite(&fpos, sizeof(long), 1, ofp);
fpos = tpos + strlen(buf);
was_blank = true;
}
else {
was_blank = false;
}
tpos += strlen(buf);
}
if(not was_blank)
fwrite(&fpos, sizeof(long), 1, ofp);
fclose(ofp);
}
fclose(ifp);
}
}
// ------------------------------------------------------------------

371
golded3/gcprot.h Normal file
View File

@ -0,0 +1,371 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Prototypes for the configuration keyword functions.
// ------------------------------------------------------------------
#ifndef __GCPROT_H
#define __GCPROT_H
// ------------------------------------------------------------------
void CfgAddress ();
void CfgAddressbookadd ();
void CfgAddresslookupfirst();
void CfgAddressmacro ();
void CfgAdeptxbbspath ();
void CfgAdeptxbbsuserno ();
void CfgAkamatch ();
void CfgAkamatchecho ();
void CfgAkamatching ();
void CfgAkamatchlocal ();
void CfgAkamatchnet ();
void CfgArea ();
void CfgAreaautoid ();
void CfgAreaautonext ();
void CfgAreacfmreplyto ();
void CfgAreacopyaddid ();
void CfgAreacopydirect ();
void CfgAreacopyto ();
void CfgAreadef ();
void CfgAreadesc ();
void CfgAreaexcl ();
void CfgAreafilegroups ();
void CfgAreaforwarddirect();
void CfgAreafreqdirect ();
void CfgAreafreqto ();
void CfgAreaincl ();
void CfgAreaisemail ();
void CfgAreaisnews ();
void CfgAreakeeplast ();
void CfgArealistechomax ();
void CfgArealistformat ();
void CfgArealistgroupid ();
void CfgArealistnos ();
void CfgArealistpagebar ();
void CfgArealistscan ();
void CfgArealistsort ();
void CfgArealisttype ();
void CfgAreapath ();
void CfgAreapmscan ();
void CfgAreapmscanexcl ();
void CfgAreapmscanincl ();
void CfgAreareadonly ();
void CfgArearename ();
void CfgAreareplydirect ();
void CfgAreareplyto ();
void CfgAreascan ();
void CfgAreascanexcl ();
void CfgAreascanincl ();
void CfgAreascansort ();
void CfgAreasep ();
void CfgAreastart ();
void CfgAreatypeorder ();
void CfgAreayouwroteto ();
void CfgAskdelorig ();
void CfgAttachpath ();
void CfgAttribsattach ();
void CfgAttribscc ();
void CfgAttribscfm ();
void CfgAttribsecho ();
void CfgAttribsemail ();
void CfgAttribsfrq ();
void CfgAttribslocal ();
void CfgAttribsnet ();
void CfgAttribsnews ();
void CfgAttributes ();
void CfgBeepcomment ();
void CfgBeeplocalmsg ();
void CfgBeepnoises ();
void CfgBeepfactor ();
void CfgBeepyourmail ();
void CfgCarboncopylist ();
void CfgColor ();
void CfgColorset ();
void CfgColor ();
void CfgConfirmfile ();
void CfgConfirmresponse ();
void CfgCookiepath ();
void CfgCrosspost ();
void CfgCrosspostlist ();
void CfgCtrlinfo ();
void CfgCtrlinfoecho ();
void CfgCtrlinfoemail ();
void CfgCtrlinfolocal ();
void CfgCtrlinfonet ();
void CfgCtrlinfonews ();
void CfgDispareano ();
void CfgDispattachsize ();
void CfgDispautonext ();
void CfgDisphdrdateset ();
void CfgDisphdrnameset ();
void CfgDisphdrnodeset ();
void CfgDisplistcursor ();
void CfgDisplistwrap ();
void CfgDisplocalhigh ();
void CfgDispmargin ();
void CfgDispmsgsize ();
void CfgDisppagebar ();
void CfgDisprealmsgno ();
void CfgDispsoftcr ();
void CfgDispstatusline ();
void CfgDisptabsize ();
void CfgDosprompt ();
void CfgEditautoattach ();
void CfgEditautosave ();
void CfgEditchangedate ();
void CfgEditcharpara ();
void CfgEditcharspace ();
void CfgEditcomment ();
void CfgEditcompletion ();
void CfgEditcrlfterm ();
void CfgEditfieldclear ();
void CfgEdithardline ();
void CfgEdithardlines ();
void CfgEdithardterm ();
void CfgEdithdrnameset ();
void CfgEdithdrnodeset ();
void CfgEditheaderattrs ();
void CfgEditheaderfirst ();
void CfgEditinternal ();
void CfgEditmenu ();
void CfgEditmixcase ();
void CfgEditmsgsize ();
void CfgEditor ();
void CfgEditorfile ();
void CfgEditquotemargin ();
void CfgEditreplyre ();
void CfgEditsavemenu ();
void CfgEditsaveutil ();
void CfgEditsoftcrxlat ();
void CfgEditspellcheck ();
void CfgEditundelete ();
void CfgEmptytearline ();
void CfgEncodeemailheaders();
void CfgEndgroup ();
void CfgEvent ();
void CfgExcludenodes ();
void CfgExternoptions ();
void CfgExternutil ();
void CfgEzycommsgbase ();
void CfgEzycomuserbase ();
void CfgEzycomuserno ();
void CfgFidohwmarks ();
void CfgFidolastread ();
void CfgFidomsgtype ();
void CfgFidonullfix ();
void CfgFidouserlist ();
void CfgFidouserno ();
void CfgFilealias ();
void CfgFilelistpagebar ();
void CfgFollowupto ();
void CfgForcetemplate ();
void CfgFrqext ();
void CfgFrqnodemap ();
void CfgFrqoptions ();
void CfgFrqwazoo ();
void CfgGedhandshake ();
void CfgGermankeyboard ();
void CfgGoldbasepath ();
void CfgGoldbasesyspath ();
void CfgGoldbaseuserno ();
void CfgGoldpath ();
void CfgGroup ();
void CfgHappybirthday ();
void CfgHighlightunread ();
void CfgHudsonpath ();
void CfgHudsonsizewarn ();
void CfgHudsonsyspath ();
void CfgHudsonuserno ();
void CfgIgnorecharset ();
void CfgImportbegin ();
void CfgImportend ();
void CfgInboundpath ();
void CfgIncludenodes ();
void CfgInputfile ();
void CfgIntensecolors ();
void CfgInternetaddress ();
void CfgInternetdomain ();
void CfgInternetgate ();
void CfgInternetlookup ();
void CfgInternetmsgid ();
void CfgInternetreply ();
void CfgInternetrfcbody ();
void CfgInternetserver ();
void CfgInvalidate ();
void CfgJamharddelete ();
void CfgJampath ();
void CfgKeybclear ();
void CfgKeybdefaults ();
void CfgKeybext ();
void CfgKeybmode ();
void CfgKeybstack ();
void CfgKludge ();
void CfgKludgechrs ();
void CfgLoadlanguage ();
void CfgLogfile ();
void CfgLogformat ();
void CfgLookupecho ();
void CfgLookuplocal ();
void CfgLookupnet ();
void CfgLookupuserbase ();
void CfgMailinglist ();
void CfgMailtoss ();
void CfgMappath ();
void CfgMember ();
void CfgMenudropmsg ();
void CfgMenumarked ();
void CfgMouse ();
void CfgMsglistdate ();
void CfgMsglistfast ();
void CfgMsglistfirst ();
void CfgMsglistheader ();
void CfgMsglistpagebar ();
void CfgMsglistviewsubj ();
void CfgMsglistwidesubj ();
void CfgNamesfile ();
void CfgNewsgroups ();
void CfgNickname ();
void CfgNodelist ();
void CfgNodelistwarn ();
void CfgNodepath ();
void CfgNodepathfd ();
void CfgNodepathfd ();
void CfgNodepathv7 ();
void CfgNodev7flags ();
void CfgNodev7modem ();
void CfgOrganization ();
void CfgOrigin ();
void CfgOutboundpath ();
void CfgOutputfile ();
void CfgPathreportfile ();
void CfgPcboardpath ();
void CfgPcboarduserno ();
void CfgPersonalmail ();
void CfgPlay ();
void CfgPrintdevice ();
void CfgPrintinit ();
void CfgPrintlength ();
void CfgPrintmargin ();
void CfgPrintreset ();
void CfgQuoteblank ();
void CfgQuotectrl ();
void CfgQuotebuffile ();
void CfgQuotebufmode ();
void CfgQuotechars ();
void CfgQuotemargin ();
void CfgQuotespacing ();
void CfgQuotestring ();
void CfgQuotewraphard ();
void CfgQwkbadmsgs ();
void CfgQwkconfmap ();
void CfgQwkexportpath ();
void CfgQwkimportpath ();
void CfgQwkoptions ();
void CfgQwkreplylinker ();
void CfgQwktosslog ();
void CfgRa2usersbbs ();
void CfgReplylink ();
void CfgReplylinklist ();
void CfgReplyto ();
void CfgRobotname ();
void CfgScreenblanker ();
void CfgScreenmaxcol ();
void CfgScreenmaxrow ();
void CfgScreenpalette ();
void CfgScreenshadows ();
void CfgScreensize ();
void CfgScreenusebios ();
void CfgSearchfor ();
void CfgSemaphore ();
void CfgSharemode ();
void CfgShowdeleted ();
void CfgSounddevice ();
void CfgSoundpath ();
void CfgSoupbadmsgs ();
void CfgSoupemail ();
void CfgSoupexportmargin ();
void CfgSoupexportpath ();
void CfgSoupimportpath ();
void CfgSoupnewsrcfile ();
void CfgSoupreplylinker ();
void CfgSoupreplyto ();
void CfgSouptosslog ();
void CfgSquishdirect ();
void CfgSquishscan ();
void CfgSquishuserno ();
void CfgSquishuserpath ();
void CfgStatuslineclock ();
void CfgStatuslinehelp ();
void CfgStylecodes ();
void CfgStylecodepunct ();
void CfgStylecodestops ();
void CfgTagline ();
void CfgTaglinechar ();
void CfgTaglinesupport ();
void CfgTasktitle ();
void CfgTearline ();
void CfgTemplate ();
void CfgTemplatematch ();
void CfgTemplatepath ();
void CfgTemppath ();
void CfgTimeout ();
void CfgTimeoutsavemsg ();
void CfgTitlestatus ();
void CfgTwitmode ();
void CfgTwitname ();
void CfgTwitsubj ();
void CfgTwitto ();
void CfgUsecharset ();
void CfgUseflags ();
void CfgUsefwd ();
void CfgUseintl ();
void CfgUsemsgid ();
void CfgUsepid ();
void CfgUserlist ();
void CfgUserlistfile ();
void CfgUsername ();
void CfgUsetzutc ();
void CfgUudecodepath ();
void CfgViewhidden ();
void CfgViewkludge ();
void CfgViewquote ();
void CfgWhoto ();
void CfgWildcatuserno ();
void CfgXlatcharset ();
void CfgXlatescset ();
void CfgXlatexport ();
void CfgXlatimport ();
void CfgXlatlocalset ();
void CfgXlatpath ();
void CfgZonegating ();
// ------------------------------------------------------------------
#endif
// ------------------------------------------------------------------

1052
golded3/geall.h Normal file

File diff suppressed because it is too large Load Diff

403
golded3/gealst.cpp Normal file
View File

@ -0,0 +1,403 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Arealist functions.
// ------------------------------------------------------------------
#include <golded.h>
// ------------------------------------------------------------------
AreaList AL;
int AreaTypeOrder[17] = {
0,
1, // AT_NET
2, // AT_EMAIL
3, // AT_NET | AT_EMAIL
4, // AT_ECHO
5,
6,
7,
8, // AT_NEWSGROUP
9,
10,
11,
12, // AT_ECHO | AT_NEWSGROUP
13,
14,
15,
16 // AT_LOCAL
};
// ------------------------------------------------------------------
// Arealist compare
extern "C" int AreaListCmp(const Area** __a, const Area** __b) {
const Area* a = *__a;
const Area* b = *__b;
const Area* A = a;
const Area* B = b;
int cmp = 0;
int aunread;
int bunread;
bool rev = false;
char* ptr = AL.sortspec;
while(*ptr) {
switch(toupper(*ptr)) {
case '-':
rev = true;
A = b; B = a;
break;
case '+':
rev = false;
A = a; B = b;
break;
case 'A':
if((cmp = A->aka().compare(B->aka())) != 0)
return cmp;
break;
case 'B':
if((cmp = compare_two(A->board(), B->board())) != 0)
return cmp;
break;
case 'D':
if((cmp = stricmp(A->desc(), B->desc())) != 0)
return cmp;
break;
case 'E':
if((cmp = stricmp(A->echoid(), B->echoid())) != 0)
return cmp;
break;
case 'F':
if(*area_maybe) {
if(striinc(area_maybe, A->echoid()) and not striinc(area_maybe, B->echoid()))
return -1;
if(striinc(area_maybe, B->echoid()) and not striinc(area_maybe, A->echoid()))
return 1;
}
break;
case 'G':
{
int ga = A->groupid();
int gb = B->groupid();
char* p = strpbrk(AL.sortspec, "tT");
bool groupfirst = p > ptr;
bool ignoretype = p == NULL or groupfirst;
if(ga == 0 and ((not A->isseparator()^rev) or ignoretype))
ga = INT_MAX;
if(gb == 0 and ((not B->isseparator()^rev) or ignoretype))
gb = INT_MAX;
if((A->isseparator() or B->isseparator()) and ga == gb) {
if(groupfirst and (cmp = compare_two(CFG->areatypeorder[A->type()&0xFF], CFG->areatypeorder[B->type()&0xFF])) != 0)
return cmp;
if((cmp = compare_two(b->isseparator(), a->isseparator())) != 0)
return cmp;
}
else {
if((cmp = compare_two(ga, gb)) != 0)
return cmp;
}
}
break;
case 'M':
if(A->ismarked() and not B->ismarked())
return -1;
if(B->ismarked() and not A->ismarked())
return 1;
break;
case 'P':
if((cmp = compare_two(B->PMrk.Count()?1:0, A->PMrk.Count()?1:0)) != 0)
return cmp;
break;
case 'O':
if((cmp = compare_two(A->areaid(), B->areaid())) != 0)
return cmp;
break;
case 'T':
if((cmp = compare_two(CFG->areatypeorder[A->type()&0xFF], CFG->areatypeorder[B->type()&0xFF])) != 0)
return cmp;
break;
case 'U':
aunread = A->Msgn.Count() - A->lastread();
bunread = B->Msgn.Count() - B->lastread();
if(rev)
cmp = compare_two(aunread, bunread);
else
cmp = compare_two(aunread ? aunread : INT_MAX, bunread ? bunread : INT_MAX);
if(cmp != 0)
return cmp;
break;
case 'X':
if((cmp = compare_two(A->msgbase(), A->msgbase())) != 0)
return cmp;
break;
case 'Y':
aunread = A->Msgn.Count() - A->lastread();
bunread = B->Msgn.Count() - B->lastread();
if(aunread and not bunread)
return -1;
if(bunread and not aunread)
return 1;
break;
case 'Z':
if((cmp = stricmp(A->path(), B->path())) != 0)
return cmp;
break;
}
ptr++;
}
return cmp;
}
// ------------------------------------------------------------------
// Arealist sort areas
void AreaList::Sort(const char* specs, int first, int last) {
if(specs)
strcpy(sortspec, specs);
else
strcpy(sortspec, CFG->arealistsort);
if(last == -1)
last = idx.size();
if(*sortspec)
qsort(&idx[first], last-first, sizeof(Area *), (StdCmpCP)AreaListCmp);
}
// ------------------------------------------------------------------
int AreaList::AreaEchoToNo(const char* echoid) {
for(uint n=0; n<idx.size(); n++)
if(strieql(echoid, idx[n]->echoid()))
return n;
return -1;
}
// ------------------------------------------------------------------
Area* AreaList::AreaEchoToPtr(const char* echoid) {
for(uint n=0; n<idx.size(); n++)
if(strieql(echoid, idx[n]->echoid()))
return idx[n];
return NULL;
}
// ------------------------------------------------------------------
int AreaList::AreaNoToId(int __areano) {
if(in_range(__areano, 0, int(idx.size()-1)))
return idx[__areano]->areaid();
else {
LOG.ErrIndex();
LOG.printf("! Arealist index out of bounds.");
LOG.printf(": Tried to access record %i, but the range was only 0 - %u.", __areano, (uint)(idx.size()-1));
LOG.printf("+ Advice: Report this to the author.");
IndexErrorExit();
return 0;
}
}
// ------------------------------------------------------------------
Area* AreaList::AreaNoToPtr(int __areano) {
if(in_range(__areano, 0, int(idx.size()-1)))
return idx[__areano];
else {
LOG.ErrIndex();
LOG.printf("! Arealist index out of bounds.");
LOG.printf(": Tried to access record %i, but the range was only 0 - %u.", __areano, (uint)(idx.size()-1));
LOG.printf("+ Advice: Report this to the author.");
IndexErrorExit();
return 0;
}
}
// ------------------------------------------------------------------
int AreaList::AreaIdToNo(int __areaid) {
uint _areano = 0;
while(_areano < idx.size()) {
if(idx[_areano]->areaid() == __areaid)
return _areano;
_areano++;
}
return -1;
}
// ------------------------------------------------------------------
Area* AreaList::AreaIdToPtr(int __areaid) {
int _areano = AreaIdToNo(__areaid);
if(_areano != -1)
return idx[_areano];
return NULL;
}
// ------------------------------------------------------------------
int AreaList::SetActiveAreaId(int __areaid) {
int _areano = AreaIdToNo(__areaid);
SetActiveAreaNo(_areano);
return _areano; // Return the areano
}
// ------------------------------------------------------------------
class SelMaskPick : public gwinpick {
gwindow window;
void open(); // Called after window is opened
void close(); // Called after window is closed
void print_line(uint idx, uint pos, bool isbar);
bool handle_key(); // Handles keypress
public:
void Run();
};
void SelMaskPick::open() {
window.openxy(ypos, xpos, ylen+2, xlen+2, btype, battr, 7);
window.title(title, tattr);
window.shadow(C_SHADOW);
update();
}
void SelMaskPick::close() {
window.close();
}
void SelMaskPick::print_line(uint idx, uint pos, bool isbar) {
char buf[sizeof(Desc)+3];
*buf = ' '; strcpy(buf+1, AL.alistselections[idx]);
window.printns(pos, 0, isbar ? sattr : wattr, buf, xlen);
}
bool SelMaskPick::handle_key() {
switch(key) {
case Key_Esc:
aborted = true;
/// Drop through
case Key_Ent:
return false;
case Key_Tick:
break;
default:
if(key < KK_Commands) {
kbput(key);
edit_string(AL.alistselections[index], sizeof(Desc)-1, LNG->SelectMarksEdit, H_SelectMarks);
display_bar();
}
break;
}
return true;
}
void SelMaskPick::Run() {
ypos = (MAXROW-18)/2;
xpos = (MAXCOL-sizeof(Desc)-4)/2-1;
ylen = 16;
xlen = sizeof(Desc)+2;
btype = W_BMENU;
battr = C_MENUB;
wattr = C_MENUW;
tattr = C_MENUT;
sattr = C_MENUS;
hattr = C_MENUQ;
title = LNG->SelectMarks;
helpcat = H_SelectMarks;
listwrap = true;
maximum_index = 15;
maximum_position = 16;
index = position = AL.mask;
run_picker();
if(not aborted)
AL.mask = (byte)index;
};
void AreaList::Select_Mask() {
SelMaskPick& SelMask = *new SelMaskPick;
throw_new(&SelMask);
SelMask.Run();
extern bool in_arealist;
extern GPickArealist* PickArealist;
if(in_arealist) {
PickArealist->update();
PickArealist->do_delayed();
}
delete &SelMask;
}
// ------------------------------------------------------------------

915
golded3/gearea.cpp Normal file
View File

@ -0,0 +1,915 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Arealister and other area-specific code
// ------------------------------------------------------------------
#include <golded.h>
#include <gutlos.h>
// ------------------------------------------------------------------
extern int arealistnumgrps;
bool in_arealist = false;
GPickArealist* PickArealist;
Echo area_maybe;
int areaswithgroupid = 0;
uint* areanumbers = NULL;
// 111111111122222222223333333333444444444455555555556666666666777777777
// 0123456789012345678901234567890123456789012345678901234567890123456789012345678
// ÚÄAreaÄDescriptionÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄMsgsÄÄÄNewÄÄEchoIDÄÄÄÄÄÄÄÄÄÄÄÄÄÄGrpÄ¿
// ³ 1> NET FidoNet Z3/4/5/6 118+ 3* NET.FIDOZX A ³
// AREALISTFORMAT "AM D CPUN E G"
int area_pos = -1;
int area_width = 4;
int marked_pos = -1;
int marked_width = 1;
const char marked_char = MMRK_MARK;
int desc_pos = -1;
int desc_width = -1;
int count_pos = -1;
int count_width = 6;
int pmark_pos = -1;
int pmark_width = 1;
const char pmark_char = '+';
int unread_pos = -1;
int unread_width = 6;
int changed_pos = -1;
int changed_width = 1;
const char changed_char = '*';
int echoid_pos = -1;
int echoid_width = 0;
int groupid_pos = -1;
int groupid_width = 0;
// ------------------------------------------------------------------
GPickArealist::GPickArealist() {
areawin1 = 0;
areawin2 = 0;
tempwin1 = 0;
tempwin2 = 0;
pmails = 0;
pmareas = 0;
pmscan = false;
area_fuzidx = 0;
};
// ------------------------------------------------------------------
void GPickArealist::AreasRenumber() {
for(int n=0,a=1,t=AL.size(); n<t; n++)
areanumbers[n] = AL[n]->isseparator() ? 0 : a++;
}
// ------------------------------------------------------------------
bool GPickArealist::is_selectable(uint idx) {
Area* area = AL.AreaNoToPtr(idx);
return (not area->isseparator());
}
// ------------------------------------------------------------------
void GPickArealist::do_delayed() {
Area* area = AL.AreaNoToPtr(index);
char buf[256], tmp[200];
strcpy(tmp, area->echoid());
update_statuslinef("%s: %u %s, %u %s, %u %s", tmp, area->Msgn.Count(), (area->Msgn.Count() == 1 ? LNG->msg : LNG->msgs), area->unread, LNG->unread, area->PMrk.Count(), LNG->personal);
strcpy(stpcpy(buf, title), area_maybe);
strsetsz(strcpy(tmp, buf), MAXCOL);
wwprintstr(tempwin, 0, 0, wattr, tmp);
if(CFG->switches.get(arealistpagebar))
wscrollbar(W_VERT, maximum_index+1, maximum_index, index);
}
// ------------------------------------------------------------------
void GPickArealist::close_all() {
if(areawin1)
wunlink(areawin1);
if(areawin2)
wunlink(areawin2);
if(tempwin1)
wunlink(tempwin1);
if(tempwin2)
wunlink(tempwin2);
}
// ------------------------------------------------------------------
void GPickArealist::dispbuf(char* buf, int areano) {
Area* area = AL.AreaNoToPtr(areano);
memset(buf, ' ', MAXCOL-2);
buf[MAXCOL-2] = NUL;
char areabuf[33];
sprintf(areabuf, "%u", CFG->switches.get(arealistnos) ? area->board() : areanumbers[areano]);
int areawidth = strlen(areabuf);
char markedbuf[2] = { " " };
*markedbuf = area->ismarked() ? marked_char : ' ';
int markedwidth = 1;
char descbuf[100];
int descwidth = strlen(strcpy(descbuf, area->desc()));
char countbuf[33];
if(area->isscanned)
sprintf(countbuf, "%u", (uint)area->Msgn.Count());
else
strcpy(countbuf, "-");
int countwidth = strlen(countbuf);
char pmarkbuf[2] = { " " };
*pmarkbuf = area->PMrk.Count() ? pmark_char : ' ';
int pmarkwidth = 1;
char unreadbuf[33];
if(area->isscanned)
sprintf(unreadbuf, "%u", (uint)(CFG->arealisttype ? area->unread : area->lastread()));
else
strcpy(unreadbuf, "-");
int unreadwidth = strlen(unreadbuf);
char changedbuf[2] = { " " };
*changedbuf = area->isunreadchg ? changed_char : ' ';
int changedwidth = 1;
char echoidbuf[100];
int echoidwidth = strlen(strcpy(echoidbuf, area->echoid()));
char groupidbuf[10] = { "" };
if(groupid_width) {
if(area->groupid() & 0x8000u) {
if(groupid_width > 2)
sprintf(groupidbuf, "%u", area->groupid()&0x7FFF);
}
else if(isupper(area->groupid()))
sprintf(groupidbuf, "%c", (char)area->groupid());
}
int groupidwidth = strlen(groupidbuf);
areawidth = MinV(areawidth, area_width);
markedwidth = MinV(markedwidth, marked_width);
descwidth = MinV(descwidth, desc_width);
countwidth = MinV(countwidth, count_width);
pmarkwidth = MinV(pmarkwidth, pmark_width);
unreadwidth = MinV(unreadwidth, unread_width);
changedwidth = MinV(changedwidth, changed_width);
echoidwidth = MinV(echoidwidth, echoid_width);
groupidwidth = MinV(groupidwidth, groupid_width);
memcpy(buf+area_pos+area_width-areawidth, areabuf, areawidth);
memcpy(buf+marked_pos, markedbuf, markedwidth);
memcpy(buf+desc_pos, descbuf, descwidth);
memcpy(buf+count_pos+count_width-countwidth, countbuf, countwidth);
memcpy(buf+pmark_pos, pmarkbuf, pmarkwidth);
memcpy(buf+unread_pos+unread_width-unreadwidth, unreadbuf, unreadwidth);
memcpy(buf+changed_pos, changedbuf, changedwidth);
memcpy(buf+echoid_pos, echoidbuf, echoidwidth);
memcpy(buf+groupid_pos+groupid_width-groupidwidth, groupidbuf, groupidwidth);
}
// ------------------------------------------------------------------
void GPickArealist::center() {
uint room, toproom, botroom;
toproom = index;
botroom = maximum_index - index;
if(toproom > maximum_position/2) {
if(botroom > maximum_position/2)
room = maximum_position/2;
else if(botroom)
room = maximum_position - botroom;
else
room = maximum_position;
}
else
room = toproom;
position = room;
display_page();
}
// ------------------------------------------------------------------
void GPickArealist::jump_to() {
uint n = index+1;
bool found = false;
// Search for next marked area, wrapping 'round if needed
for(; n<=maximum_index; n++) {
if(not AL[n]->isseparator() and AL[n]->ismarked()) {
found = true;
break;
}
}
if(not found) {
for(n = minimum_index; n <= index; n++) {
if(not AL[n]->isseparator() and AL[n]->ismarked())
break;
}
}
if(n > maximum_index)
n = minimum_index;
while(AL[n]->isseparator()) {
if((++n) > maximum_index)
n = minimum_index;
}
index = n;
center();
}
// ------------------------------------------------------------------
void GPickArealist::jumpmatch() {
uint n = index+1;
bool found = false;
// Search for next marked area, wrapping 'round if needed
for(; n<=maximum_index; n++) {
if(not AL[n]->isseparator() and (strnieql(area_maybe, AL[n]->echoid(), area_fuzidx) or striinc(area_maybe, AL[n]->echoid()))) {
found = true;
break;
}
}
if(not found) {
for(n = minimum_index; n <= index; n++) {
if(not AL[n]->isseparator() and (strnieql(area_maybe, AL[n]->echoid(), area_fuzidx) or striinc(area_maybe, AL[n]->echoid())))
break;
}
}
if(n > maximum_index)
n = minimum_index;
while(AL[n]->isseparator()) {
if((++n) > maximum_index)
n = minimum_index;
}
index = n;
center();
}
// ------------------------------------------------------------------
void GPickArealist::open() {
int active=NO;
#if defined(GUTLOS_FUNCS)
g_set_ostitle_name("Arealist",0);
#endif
if(ypos) {
if(tempwin1) {
tempwin = tempwin1;
areawin = areawin1;
active = YES;
}
}
else {
if(tempwin2) {
tempwin = tempwin2;
areawin = areawin2;
active = YES;
}
}
if(active) {
wunhide(tempwin);
wprints(0,0, wattr, title);
wunhide(areawin);
}
else {
tempwin = wopen_(ypos, xpos, 1, MAXCOL, 5, battr, wattr, sbattr);
wprints(0,0, wattr, title);
areawin = wopen_(ypos+1, xpos, ylen+2, MAXCOL, btype, battr, wattr, sbattr);
if(ypos) {
tempwin1 = tempwin;
areawin1 = areawin;
}
else {
tempwin2 = tempwin;
areawin2 = areawin;
}
if(area_width)
wmessage(LNG->Area, TP_BORD, 1+area_pos+(marked_pos==area_pos+area_width?1:0), tattr);
if(desc_width)
wmessage(LNG->Description, TP_BORD, 1+desc_pos, tattr);
if(count_width)
wmessage(LNG->Msgs, TP_BORD, 1+count_pos+count_width-strlen(LNG->Msgs), tattr);
if(unread_width) {
if(CFG->arealisttype == AL_TOTLST)
wmessage(LNG->Last, TP_BORD, 1+unread_pos+unread_width-strlen(LNG->Last), tattr);
else if(CFG->arealisttype == AL_TOTNEW)
wmessage(LNG->New, TP_BORD, 1+unread_pos+unread_width-strlen(LNG->New), tattr);
}
if(echoid_width)
wmessage(LNG->EchoID, TP_BORD, 1+echoid_pos, tattr);
if(groupid_width) {
char grpbuf[40];
if(groupid_width > 2)
strcpy(grpbuf, LNG->Grp);
else {
*grpbuf = *(LNG->Grp);
grpbuf[1] = NUL;
}
wmessage(grpbuf, TP_BORD, 1+groupid_pos, tattr);
}
}
if(CFG->switches.get(areaautonext) and ypos == 0 and index >= minimum_index and not AL[index]->ismarked()) {
jump_to();
}
else
center();
}
// ------------------------------------------------------------------
void GPickArealist::close() {
whide();
whide();
}
// ------------------------------------------------------------------
void GPickArealist::precursor() {
*area_maybe = 0;
area_fuzidx = 0;
}
// ------------------------------------------------------------------
void GPickArealist::print_line(uint idx, uint pos, bool isbar) {
vchar vbuf[256];
char buf[256];
if(AL[idx]->isseparator()) {
Area* area = AL.AreaNoToPtr(idx);
int sep_pos = (desc_pos != -1) ? desc_pos : echoid_pos;
for(int c = 0; c < sep_pos; c++)
vbuf[c] = _box_table(btype, 1);
vbuf[sep_pos] = NUL;
wprintvs(pos, 0, battr|ACSET, vbuf);
wprints(pos, sep_pos, tattr, area->desc());
int l = strlen(area->desc());
int n = MAXCOL-2-sep_pos-l;
for(int c = 0; c < n; c++)
vbuf[c] = _box_table(btype,1);
vbuf[n] = NUL;
wprintvs(pos, sep_pos+l, battr|ACSET, vbuf);
}
else {
dispbuf(buf, idx);
wprints(pos, 0, isbar ? sattr : wattr, buf);
if(AL[idx]->ismarked())
wprintc(pos, marked_pos, isbar ? sattr : hattr, marked_char);
}
}
// ------------------------------------------------------------------
void GPickArealist::AreaCatchUp(uint n) {
GMenuAreaCatchup MenuAreaCatchup;
GMsg* msg = (GMsg*)throw_calloc(1, sizeof(GMsg));
int mode = MenuAreaCatchup.Run();
if(mode != SCAN_QUIT) {
for(AL.item = AL.idx.begin(); AL.item != AL.idx.end(); AL.item++) {
if((mode == SCAN_MARKED and (*AL.item)->ismarked()) or mode == SCAN_ALL or (mode == SCAN_CURRENT and (*AL.item) == AL[n])) {
if((*AL.item)->isseparator())
continue;
update_statuslinef("%s ...", (*AL.item)->echoid());
AA = (*AL.item);
AA->Open();
if(CFG->switches.get(highlightunread) and CFG->switches.get(areacatchupread)) {
w_info(LNG->Wait);
for(uint i=AA->lastread()+1; i <= AA->Msgn.Count(); i++) {
AA->LoadHdr(msg, AA->Msgn.CvtReln(i));
if(msg->timesread++ == 0)
AA->UpdateTimesread(msg);
}
w_info(NULL);
}
AA->set_lastread(AA->Msgn.Count());
AA->isvalidchg = false;
AA->Close();
}
}
}
throw_free(msg);
}
// ------------------------------------------------------------------
void GPickArealist::AreaDropMsgMarks(uint n) {
GMenuAreaDropMarks MenuAreaDropMarks;
uint nummarks = 0;
for(AL.item = AL.idx.begin(); AL.item != AL.idx.end(); AL.item++)
nummarks += (*AL.item)->Mark.Count();
char buf[256];
sprintf(buf, LNG->DropMarksInfo, longdotstr(nummarks));
w_info(buf);
int mode = MenuAreaDropMarks.Run();
w_info(NULL);
if(mode != SCAN_QUIT) {
for(AL.item = AL.idx.begin(); AL.item != AL.idx.end(); AL.item++) {
if((mode == SCAN_MARKED and (*AL.item)->ismarked()) or mode == SCAN_ALL or (mode == SCAN_CURRENT and (*AL.item) == AL[n])) {
if((*AL.item)->isseparator())
continue;
(*AL.item)->Mark.ResetAll();
}
}
}
}
// ------------------------------------------------------------------
bool GPickArealist::handle_key() {
uint n;
uint x;
const char* adesc;
char buf[256], tmp[256];
int mode, changed, currno;
gkey kk;
if(key < KK_Commands) {
key = key_tolower(key);
if((key == Key_Esc) and esc_abort)
key = KK_AreaAbort;
else {
kk = SearchKey(key, AreaKey, AreaKeys);
if(kk)
key = kk;
}
}
switch(key) {
case KK_AreaDropMsgMarks:
AreaDropMsgMarks(index);
break;
case KK_AreaSelectMarks:
AL.Select_Mask();
break;
case KK_AreaAskExit:
{
GMenuQuit MenuQuit;
aborted = gkbd.quitall = (MenuQuit.Run()!=0);
if(gkbd.quitall) {
precursor();
return false;
}
}
break;
case KK_AreaAbort:
aborted = true;
// Drop Through
case KK_AreaSelect:
if(AL[index]->isseparator()) {
if(not PlayMacro(key, KT_A))
SayBibi();
break;
}
precursor();
return false;
case KK_AreaQuitNow:
aborted = gkbd.quitall = true;
precursor();
return false;
case KK_AreaToggle:
AL[index]->set_marked(not AL[index]->ismarked());
display_bar();
precursor();
cursor_down();
break;
case KK_AreaBoardnos:
CFG->switches.set(arealistnos, not CFG->switches.get(arealistnos));
update();
break;
case KK_AreaCatchUp:
AreaCatchUp(index);
update();
break;
case KK_AreaJumpNextMatch:
jumpmatch();
break;
case KK_AreaJump:
{
precursor();
jump_to();
}
break;
case KK_AreaDosShell:
DosShell();
break;
case KK_AreaGotoPrev: precursor(); cursor_up(); break;
case KK_AreaGotoNext: precursor(); cursor_down(); break;
case KK_AreaGotoFirst: precursor(); cursor_first(); break;
case KK_AreaGotoLast: precursor(); cursor_last(); break;
case KK_AreaSoundkill:
HandleGEvent(EVTT_STOPVOICE);
break;
case KK_AreaTouchNetscan:
TouchNetscan();
break;
case KK_AreaHeat:
{
GMenuAreaHeat MenuAreaHeat;
mode = MenuAreaHeat.Run();
if(mode != SCAN_QUIT) {
for(AL.item = AL.idx.begin(); AL.item != AL.idx.end(); AL.item++) {
if((mode == SCAN_MARKED and (*AL.item)->ismarked()) or mode == SCAN_ALL or (mode == SCAN_CURRENT and (*AL.item) == AL[index-1])) {
update_statuslinef("%s %s", 1+LNG->ScanningArea, (*AL.item)->echoid());
(*AL.item)->SetHighwaterMark();
}
}
}
}
break;
case KK_AreaZap:
{
GMenuAreaZap MenuAreaZap;
mode = MenuAreaZap.Run();
if(mode != SCAN_QUIT) {
for(AL.item = AL.idx.begin(); AL.item != AL.idx.end(); AL.item++) {
if((mode == SCAN_MARKED and (*AL.item)->ismarked()) or mode == SCAN_ALL or (mode == SCAN_CURRENT and (*AL.item) == AL[index-1])) {
update_statuslinef("%s %s", 1+LNG->ScanningArea, (*AL.item)->echoid());
(*AL.item)->ResetHighwaterMark();
}
}
}
}
break;
case KK_AreaScanPM:
pmscan = true;
pmails = 0;
pmareas = 0;
// DROP THROUGH //
case KK_AreaScan:
{
currno = index;
GMenuAreaScan MenuAreaScan;
mode = MenuAreaScan.Run(pmscan);
if(mode != SCAN_QUIT) {
w_info(LNG->Wait);
strcpy(stecho, AL[index]->echoid());
if(mode == SCAN_IMPORTQWK)
changed = ImportQWK();
else if(mode == SCAN_EXPORTQWK)
changed = ExportQWK();
else if(mode == SCAN_IMPORTSOUP)
changed = ImportSOUP();
else if(mode == SCAN_EXPORTSOUP)
changed = ExportSOUP();
else {
if(cmdlinedebughg)
LOG.printf("- AreaScan from arealist");
changed = AL.AreaScan(mode, currno, pmscan, pmails, pmareas);
}
w_info();
AL.SetActiveAreaNo(currno);
if(changed) {
AL.Sort();
AreasRenumber();
index = AL.AreaEchoToNo(stecho);
center();
}
if(pmscan) {
if(pmails) {
w_infof(LNG->FoundPersonal,
pmails, (pmails==1?"":"s"),
pmareas, (pmareas==1?"":"s")
);
}
else {
w_info(LNG->NoPersonal);
}
waitkeyt(10000);
w_info();
}
}
pmscan = false;
}
break;
case Key_Tick:
CheckTick(KK_AreaQuitNow);
break;
case KK_AreaUndefine:
break;
case KK_AreaWriteGoldlast:
w_info(LNG->Wait);
AL.WriteGoldLast();
w_info();
break;
default:
if(key < KK_Macro) {
n = toupper(key & 0xFF);
if((area_fuzidx < area_maxfuz) or key == Key_BS) {
// Incremental search in the echoids
if(not (n < ' ') or key == Key_BS) {
if(n == ' ')
n = '_';
if(key != Key_BS)
area_maybe[area_fuzidx++] = (char)n;
else if(area_fuzidx)
area_fuzidx--;
area_maybe[area_fuzidx] = NUL;
strcpy(stpcpy(buf, title), area_maybe);
strsetsz(strcpy(tmp, buf), MAXCOL);
wwprintstr(tempwin, 0, 0, wattr, tmp);
if(area_fuzidx) {
x = atoi(area_maybe);
if(x) {
if(CFG->switches.get(arealistnos) and (isdigit(area_maybe[1]) or (area_maybe[1] == NUL))) {
for(n=0; n<AL.size(); n++) {
if(AL[n]->board() == x) {
x = n;
goto RedrawAreas;
}
}
x = 0; // No match found
}
else {
for(n=0; n<area_fuzidx; n++) {
if(not isdigit(area_maybe[n])) {
x = 0;
break;
}
}
}
}
if(x >= 1 and x<=AL.size()) {
{
for(int a=0, at=AL.size(); a<at; a++) {
if(areanumbers[a] == x) {
x = a;
goto RedrawAreas;
}
}
}
x = (uint)-1;
RedrawAreas:
if(x == (uint)-1)
x = index;
while(AL[x]->isseparator()) {
x++;
if(x > maximum_index)
x = minimum_index;
}
if(x != index)
display_line();
#define _topidx (index-position) // Shorthand..
#define _botidx (index+(maximum_position-position)) // Shorthand..
if((_topidx <= x) and (x <= _botidx)) {
position += (x-index);
index = x;
display_page(); /////////// NEW
}
else {
index = x;
center();
}
break;
}
else {
// Regular search
for(n=0; n<AL.size(); n++) {
adesc = AL[n]->echoid();
if(strnicmp(area_maybe, adesc, area_fuzidx) == 0) {
AL.Sort();
AreasRenumber();
x = AL.AreaEchoToNo(adesc);
goto RedrawAreas;
}
}
// Search inside
for(n=0; n<AL.size(); n++) {
adesc = AL[n]->echoid();
if(striinc(area_maybe, adesc)) {
AL.Sort();
AreasRenumber();
x = AL.AreaEchoToNo(adesc);
goto RedrawAreas;
}
}
}
}
else {
adesc = AL[index]->echoid();
AL.Sort();
AreasRenumber();
index = AL.AreaEchoToNo(adesc);
center();
}
break;
}
}
}
if(not PlayMacro(key, KT_A))
SayBibi();
}
return true;
}
// ------------------------------------------------------------------
int GPickArealist::Run(const char* _title, int wpos, int& idx) {
HandleGEvent(EVTT_AREALIST);
xpos = 0; // Window starting coloumn
ypos = wpos; // Window starting row
xlen = MAXCOL-2; // Window ending coloumn
ylen = MAXROW-wpos-4; // Window ending row
title = _title; // Window title
btype = W_BAREA; // Window border type
battr = C_AREAB; // Window border attributes
wattr = C_AREAW; // Window Color
tattr = C_AREAT; // Window Title Color
sattr = C_AREAS; // Window Selection Bar Color
hattr = C_AREAQ; // Window Highlight Color
sbattr = C_AREAPB; // Window Scrollbar Color
helpcat = H_Area; // Window Help Category
maximum_index = AL.size() - 1; // List Entries - 1
maximum_position = MinV((size_t)ylen-1, AL.size()-1); // Display Pos
index = AL.AreaIdToNo(idx); // List Index
listwrap = CFG->switches.get(displistwrap); // True if wrap-around is supported
esc_abort = (wpos!=0);
area_maxfuz = MinV(sizeof(Echo), MAXCOL-strlen(title)-1);
goldmark = ' ';
areanumbers = (uint*)throw_calloc(AL.size(), sizeof(uint));
AreasRenumber();
run_picker();
throw_release(areanumbers);
if(not aborted)
return AL[index]->areaid();
idx = AL[index]->areaid();
return -1;
}
// ------------------------------------------------------------------
int AreaPick(char* title, int wpos, int* idx) {
GPickArealist p;
int new_area;
if(gkbd.quitall)
return -1;
PickArealist = &p;
in_arealist = true;
new_area = p.Run(title, wpos, *idx);
in_arealist = false;
PickArealist = NULL;
return new_area;
}
// ------------------------------------------------------------------

475
golded3/gecarb.cpp Normal file
View File

@ -0,0 +1,475 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Carbon Copy.
// ------------------------------------------------------------------
#include <golded.h>
// ------------------------------------------------------------------
void AddCCList(const char *ptr, bool cchide, GMsg* msg, GMsg** carbon, int &cc, Area* A, Area* AA, int &xc2to)
{
Addr addr;
char name[256];
addr.reset_fast();
strtrim(strcpy(name, strskip_wht(ptr)));
(*carbon) = (GMsg*)throw_realloc((*carbon), sizeof(GMsg)*(cc+2));
(*carbon)[cc] = *msg;
(*carbon)[cc].dest.reset_fast();
(*carbon)[cc].odest.reset_fast();
(*carbon)[cc].attr.nwm1();
if(strchr(name, ':')) {
char* d = strchr(name, '@');
if(d) *d = NUL;
}
if(strchr(name, '@')) {
ParseInternetAddr(name, (*carbon)[cc].realto, (*carbon)[cc].iaddr);
strxcpy((*carbon)[cc].to, (*carbon)[cc].iaddr, sizeof(Name));
}
else {
(*carbon)[cc].iaddr[0] = NUL;
strxcpy((*carbon)[cc].to, name, sizeof(Name));
}
HeaderView->Use(AA, &(*carbon)[cc]);
HeaderView->Paint();
if(AA->isnet()) {
gsetaddr toname, toaddr, fromaddr;
IAdr addr1, addr2;
addr = (*carbon)[cc].orig;
toname.buf = name; toname.update = false;
toaddr.buf = addr1; toaddr.update = false; *addr1 = NUL;
fromaddr.buf = addr2; fromaddr.update = false; *addr2 = NUL;
if(set_to_address(&(*carbon)[cc], &toname, &toaddr, &fromaddr, NULL, 6, LNG->DestinationCC, true))
addr.net = 0;
else
addr.set(addr1, (*carbon)[cc].odom);
}
else
addr = AA->Aka().addr;
update_statusline(LNG->ProcessCC);
if(addr.net or AA->islocal()) {
// Create a CC if either address or name is different than the original.
if(memcmp(&addr, &msg->dest, sizeof(Addr)) or stricmp(name, msg->to) or (A != AA and not xc2to++)) {
(*carbon)[cc].odest = addr;
(*carbon)[cc].dest = addr;
if(cchide)
(*carbon)[cc].attr.tou0();
else
(*carbon)[cc].attr.tou1();
strxcpy((*carbon)[cc].to, name, sizeof(Name));
cc++;
}
}
}
// ------------------------------------------------------------------
int DoCarboncopy(GMsg* msg, GMsg** carbon) {
int n, cc = 0;
char* ptr;
Attr attr;
bool cchide;
bool ignorecc = false;
char buf[256], buf2[256];
Line* line;
Line* newline;
Line* ccline = NULL;
int margintext;
if(AA->isinternet() and CFG->soupexportmargin <= CFG->dispmargin)
margintext = CFG->soupexportmargin;
else
margintext = CFG->dispmargin;
// Insert empty line at the top first for practical purposes
newline = (Line*)throw_xcalloc(1, sizeof(Line));
msg->lin = newline = line = InsertLine(newline, msg->lin, DIR_PREV);
// Deal with carbon copies
Area* A = AA;
if(AA->isecho()) {
AA = AL.AreaEchoToPtr(AA->Areareplyto());
if(AA and (AA != A)) {
AA->Open();
}
else
AA = A;
}
attr = msg->attr;
if(not AA->isecho() and line) {
bool ask = true;
int xc2to = 0;
do {
ptr = newline->text;
if(ptr and strnieql(ptr, "CC:", 3)) {
if(not ignorecc) {
if(ask) {
msg->attr.nwm1();
AttrAdd(&msg->attr, &CFG->attribscc);
HeaderView->Use(AA, msg);
HeaderView->Paint();
GMenuCarbon MenuCarbon;
ignorecc = MenuCarbon.Run(msg) ? false : true;
if(ignorecc) // Do not process carcon copies
break;
if(newline)
ccline = newline->prev; // Store the position of first line
else
ccline = NULL;
ask = false;
}
update_statusline(LNG->ProcessCC);
gstrarray xposts;
tokenize(xposts, ptr+3, ",");
for(int i=0; i < xposts.size(); i++) {
ptr = strskip_wht(strcpy(buf, xposts[i].c_str()));
if(*ptr == '#') {
++ptr;
cchide = true;
}
else
cchide = false;
if(*ptr == '@') {
FILE* fp = fsopen(AddPath(CFG->goldpath, ++ptr), "rt", CFG->sharemode);
if(fp) {
gstrarray fc;
while(fgets(buf, sizeof(buf), fp))
tokenize(fc, buf, ",\n");
fclose(fp);
for(int j = 0; j < fc.size(); j++)
if(fc[j][0] != '@') // we don't like nesting!
AddCCList(fc[j].c_str(), cchide, msg, carbon, cc, A, AA, xc2to);
}
}
else
AddCCList(ptr, cchide, msg, carbon, cc, A, AA, xc2to);
}
if(CFG->carboncopylist != CC_KEEP) {
newline = DeleteLine(newline); // Now at the next line
if(newline and newline->prev)
newline = newline->prev; // Go back one line
}
}
}
newline = newline->next;
} while(newline != NULL);
string temp;
// Fix the CC list in the message
if(cc and ccline) {
switch(CFG->carboncopylist) {
case CC_REMOVE:
// No list
break;
case CC_KEEP:
// Keep list as it was entered
break;
case CC_HIDDEN:
if(A == AA) {
sprintf(buf, "\001CC: %s %s", msg->To(), msg->dest.make_string(temp).c_str());
ccline = AddKludge(ccline, buf);
}
for(n=0; n<cc; n++) {
if((*carbon)[n].attr.tou()) {
sprintf(buf, "\001CC: %s %s", (*carbon)[n].To(), (*carbon)[n].dest.make_string(temp).c_str());
ccline = AddKludge(ccline, buf);
}
}
break;
case CC_VISIBLE:
sprintf(buf2, LNG->CCTo, LNG->ListCC);
if(A == AA) {
sprintf(buf, buf2, msg->To(), msg->dest.make_string(temp).c_str());
ccline = AddLine(ccline, buf);
}
for(n=0; n<cc; n++) {
if((*carbon)[n].attr.tou()) {
sprintf(buf, buf2, (*carbon)[n].To(), (*carbon)[n].dest.make_string(temp).c_str());
ccline = AddLine(ccline, buf);
}
}
break;
case CC_NAMES:
// Expand in line
{
string hline = "";
int line_items = 0;
if(A == AA) {
hline += msg->To();
++line_items;
}
for(n=0; n < cc; n++)
if((*carbon)[n].attr.tou()) {
const char *user = (*carbon)[n].To();
if((hline.length() + strlen(user) + 2 > margintext) and line_items) {
sprintf(buf, LNG->CCTo, hline.c_str());
ccline = AddLine(ccline, buf);
line_items = 0;
hline = "";
}
if(line_items != 0)
hline += ", ";
hline += user;
++line_items;
}
if(line_items) {
sprintf(buf, LNG->CCTo, hline.c_str());
ccline = AddLine(ccline, buf);
}
}
break;
}
}
}
// Reset line pointer
msg->lin = DeleteLine(msg->lin); // Delete the empty top line again
msg->attr = attr;
if(*carbon and not cc)
throw_release(*carbon);
if(A != AA) {
AA->Close();
AA = A;
}
return cc;
}
// ------------------------------------------------------------------
static bool AddXCAreas(const char* mask, bool attr, vector<int> &postareas, vector<bool> &postareas_attrs, int local_xps) {
bool rv = false;
for(int j=0; j < AL.size(); j++) {
if(not AL[j]->isseparator() and strwild(AL[j]->echoid(), mask)) {
if(strieql(AA->echoid(), AL[j]->echoid()))
rv = attr;
else {
int i;
// We don't want twice crossposting to same echo...
for(i=local_xps; i < postareas.size(); i++)
if(postareas[i] == j)
break;
if(i == postareas.size()) {
postareas.push_back(j);
postareas_attrs.push_back(attr);
}
}
}
}
return rv;
}
// ------------------------------------------------------------------
void DoCrosspost(GMsg* msg, vector<int> &postareas) {
if(CFG->crosspost == NO)
return;
char buf[256];
char *ptr;
bool ignorexc = false;
Line* newline;
Line* xcline = NULL;
int margintext;
bool xphide;
int local_xps = postareas.size();
vector<bool> postareas_attrs(local_xps);
bool hideoriginal = false;
// Insert empty line at the top first for practical purposes
newline = (Line*)throw_xcalloc(1, sizeof(Line));
msg->lin = newline = InsertLine(newline, msg->lin, DIR_PREV);
// Deal with carbon copies
if(AA->isinternet() and CFG->soupexportmargin <= CFG->dispmargin)
margintext = CFG->soupexportmargin;
else
margintext = CFG->dispmargin;
// Next line is invalid if someone uses format chars like %-20s
// but we couldn't predict everything...
margintext -= strlen(LNG->Crosspostedin) - 2;
if(newline) {
bool ask = true;
do {
if(not (newline->type & (GLINE_KLUDGE|GLINE_TEAR|GLINE_ORIG))) {
ptr = newline->text;
if(not ignorexc and ptr and (strnieql(ptr, "XC:", 3) or strnieql(ptr, "XP:", 3))) {
if(ask) {
GMenuCross MenuCross;
ignorexc = (CFG->crosspost != ASK) or MenuCross.Run(msg) ? false : true;
if(ignorexc) // Do not process crossposting
break;
if(newline)
xcline = newline->prev; // Store the position of first line
else
xcline = NULL;
ask = false;
}
gstrarray xposts;
tokenize(xposts, ptr+3);
for(int i=0; i < xposts.size(); i++) {
ptr = strcpy(buf, xposts[i].c_str());
if(*ptr == '#') {
++ptr;
xphide = true;
}
else
xphide = false;
if(*ptr == '@') {
FILE* fp = fsopen(AddPath(CFG->goldpath, ++ptr), "rt", CFG->sharemode);
if(fp) {
gstrarray fc;
while(fgets(buf, sizeof(buf), fp))
tokenize(fc, buf, ", \n");
fclose(fp);
for(int j = 0; j < fc.size(); j++)
if(fc[j][0] != '@') // we don't like nesting!
hideoriginal = AddXCAreas(fc[j].c_str(), xphide, postareas, postareas_attrs, local_xps) or hideoriginal;
}
}
else
hideoriginal = AddXCAreas(ptr, xphide, postareas, postareas_attrs, local_xps) or hideoriginal;
}
if(CFG->crosspostlist != CC_KEEP) {
newline = DeleteLine(newline); // Now at the next line
if(newline and newline->prev)
newline = newline->prev; // Go back one line
}
}
}
newline = newline->next;
} while(newline != NULL);
// Fix the XC list in the message, ignore crossposting to itself only
if((local_xps < postareas.size()+1) and xcline) {
switch(CFG->crosspostlist) {
case CC_REMOVE:
// No list
break;
case CC_KEEP:
// Keep list as it was entered
break;
case CC_VISIBLE:
// Expand in line
{
if(not hideoriginal) {
sprintf(buf, LNG->Originallyin, AA->echoid());
xcline = AddLine(xcline, buf);
}
string hline = "";
int line_items = 0;
for(int i=local_xps; i < postareas.size(); i++) {
const char *echoid = AL[postareas[i]]->echoid();
if(postareas_attrs[i] or strieql(AA->echoid(), echoid))
continue;
if((hline.length() + strlen(echoid) + 2 > margintext) and line_items) {
sprintf(buf, LNG->Crosspostedin, hline.c_str());
xcline = AddLine(xcline, buf);
line_items = 0;
hline = "";
}
if(line_items != 0)
hline += ", ";
hline += echoid;
++line_items;
}
if(line_items) {
sprintf(buf, LNG->Crosspostedin, hline.c_str());
xcline = AddLine(xcline, buf);
}
}
break;
case CC_NAMES:
// Expand in column
{
if(not hideoriginal) {
sprintf(buf, LNG->Originallyin, AA->echoid());
xcline = AddLine(xcline, buf);
}
for(int i=local_xps; i < postareas.size(); i++) {
const char *echoid = AL[postareas[i]]->echoid();
if(postareas_attrs[i] or strieql(AA->echoid(), echoid))
continue;
sprintf(buf, LNG->Crosspostedin, echoid);
xcline = AddLine(xcline, buf);
}
}
}
}
}
// Reset line pointer
msg->lin = DeleteLine(msg->lin); // Delete the empty top line again
}
// ------------------------------------------------------------------

527
golded3/gecfgg.h Normal file
View File

@ -0,0 +1,527 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// The main GoldED configuration structure.
// ------------------------------------------------------------------
#include <list>
// ------------------------------------------------------------------
enum en_gswitches {
internetlookup,
kludgechrs,
mouse,
displocalhigh,
arealistgroupid,
askdelorig,
lookuplocal,
dispstatusline,
screenusebios,
highlightunread,
akamatchlocal,
fidonullfix,
dispautonext,
lookupuserbase,
areakeeplast,
filelistpagebar,
printformfeed,
arealistnos,
disppagebar,
internetreply,
arealistpagebar,
usemsgid,
lookupnet,
squishdirect,
fidohwmarks,
msglistpagebar,
beepnoises,
screenshadows,
dispsoftcr,
emptytearline,
menudropmsg,
beeplocalmsg,
statuslineclock,
twitto,
keybdefaults,
displistwrap,
quotespacing,
lookupecho,
keybext,
beepcomment,
rcvdisablescfm,
quoteblank,
keybclear,
dosprompt,
areacatchupread,
formfeedseparator,
useflags,
jamharddelete,
disprealmsgno,
frqwazoo,
msglistviewsubj,
akamatchecho,
areafilegroups,
areaautonext,
timeoutsavemsg,
nodelistwarn,
akamatchnet,
gswitches_last
};
class gswitches {
public:
inline bool get(en_gswitches what) { return cfg[what]; }
inline void set(en_gswitches what, bool value) { cfg[what] = value; }
bool handle(word crc, const char* value);
gswitches() { for(uint i=0; i<gswitches_last; i++) {cfg[i] = false; } };
private:
bool cfg[gswitches_last];
};
// ------------------------------------------------------------------
class CfgGed {
public:
CfgGed();
~CfgGed();
Path goldcfg;
Stamp helpcfg;
Path helpged;
Path keyscfg;
Path langcfg;
Path xlatged;
Path goldlast;
Path golduser;
Grp grp;
int cfgdispmargin;
int cfgeditquotemargin;
int cfgquotemargin;
list<CmdKey> cmdkey;
vector<Macro> macro;
int addressbookadd;
int addresslookupfirst;
vector<AddrMacro> addressmacro;
Path adeptxbbspath;
int adeptxbbsuserno;
vector<gaka> aka;
vector<AkaMatchG> akamatch;
int areaautoid;
Echo areacfmreplyto;
bool areacopydirect;
Echo areacopyto;
bool areacopyaddid;
gstrarray areaexcl;
bool areaforwarddirect;
int areafilegroups; // areausegroups;
bool areafreqdirect;
Echo areafreqto;
gstrarray areaincl;
gstrarray areaisemail;
gstrarray areaisnews;
int arealistechomax;
char arealistformat[80];
char arealistsort[20]; // areasort[10];
int arealisttype;
Path areapath;
gstrarray areapmscan;
gstrarray areapmscanexcl;
gstrarray areapmscanincl;
int areareadonly;
vector<EchoRen> arearename;
bool areareplydirect;
Echo areareplyto;
gstrarray areascan;
gstrarray areascanexcl;
gstrarray areascanincl;
char areascansort[20];
Echo areastart; // startecho;
int areatypeorder[17];
Echo areayouwroteto;
Path attachpath;
Attr attribsattach;
Attr attribscc; // ccattrib;
Attr attribscfm; // cfmattrib;
Attr attribsecho; // echoattrib;
Attr attribsemail;
Attr attribsfrq;
Attr attribslocal; // localattrib;
Attr attribsnet; // netattrib;
Attr attribsnews;
int beepfactor;
int beepyourmail;
int carboncopylist; // cclist;
Win color[16];
Path confirmfile; // goldedcfm;
int confirmresponse;
Path cookiepath;
int crosspost;
int crosspostlist; // xplist;
int ctrlinfoecho;
int ctrlinfoemail;
int ctrlinfolocal;
int ctrlinfonet;
int ctrlinfonews;
int dispareano;
int dispattachsize;
PosLen disphdrdateset;
PosLen disphdrnameset;
PosLen disphdrnodeset;
int displistcursor;
int dispmargin; // rightmargin;
int dispmsgsize;
uint disptabsize; // tabsize;
bool encodeemailheaders;
vector<GEvent> event;
int externoptions;
vector<ExtUtil> externutil;
Ezycom ezycom;
int ezycomuserno;
Path fidolastread; // lastread;
int fidomsgtype;
Path fidouserlist;
int fidouserno; // lastreaduser;
vector<FileAlias> filealias;
bool forcetemplate;
gstrarray frqext;
vector<FrqNodeMap> frqnodemap;
int frqoptions;
bool gedhandshake;
Path goldbasepath;
Path goldbasesyspath;
int goldbaseuserno;
Path goldpath;
int happybirthday;
bool hidestylies;
Path hudsonpath;
long hudsonsizewarn;
Path hudsonsyspath;
int hudsonuserno;
bool ignorecharset;
char importbegin[80];
char importend[80];
Path inboundpath;
Path inputfile;
bool intensecolors;
IAdr internetaddress;
char internetdomain[96];
Node internetgate;
bool internetmsgid;
bool internetrfcbody;
InetServers internetserver;
Invalidate invalidate;
Path jampath;
int keybmode;
char keybstack[80]; // keybuf[80];
gstrarray kludge;
Path loadlanguage;
Path logfile; // goldedlog;
int logformat;
vector<MailList> mailinglist;
vector< pair<string, string> > mappath;
int menumarked;
int msglistdate;
bool msglistfast;
bool msglistfirst;
bool msglistheader;
bool msglistwidesubj;
Path namesfile;
Name nickname;
Path nodepath;
Path nodepathfd;
Path nodepathv7;
INam organization;
gstrarray origin;
int originno;
Path outboundpath;
Path outputfile;
Path pathreportfile;
Path pcboardpath;
int pcboarduserno;
int personalmail;
GPlay play;
Path printdevice; // p_device;
char printinit[80]; // p_init[80];
int printlength; // p_length;
int printmargin; // p_margin;
char printreset[80]; // p_reset[80];
Path quotebuffile;
int quotebufmode;
char quotechars[11];
uint quotectrl;
int quotemargin;
char quotestring[10];
bool quotewraphard;
int ra2usersbbs; // RA2;
int replylink;
int replylinklist;
gstrarray robotname;
int screenblanker; // blanktime;
int screenblankertype;
int screenmaxcol; // maxcols;
int screenmaxrow; // maxrows;
int screenpalette[17];
int screensize;
INam searchfor;
Semaphore semaphore;
int sharemode; // share;
bool showdeleted;
Path soundpath;
Echo soupbadmsgs;
Echo soupemail;
int soupexportmargin;
Path soupexportpath;
Path soupimportpath;
Path soupnewsrcfile;
Path soupreplylinker;
char soupreplyto[60];
Path souptosslog;
int squishscan;
int squishuserno;
Path squishuserpath;
int statuslinehelp;
char stylecodepunct[41];
char stylecodestops[41];
gstrarray tagline;
int taglineno;
char taglinechar;
bool taglinesupport;
char tasktitle[60];
Tear tearline;
bool titlestatus;
vector<Tpl> tpl;
int tplno;
bool templatematch;
Path templatepath;
Path temppath;
int timeout;
int twitmode; // showtwits;
vector<Node> twitname;
gstrarray twitsubj;
bool usecharset;
int usefwd;
bool useintl;
bool usepid;
Path userlistfile; // goldedlst;
vector<Node> username;
int usernameno;
bool usestylies;
bool usetzutc;
Path uudecodepath;
bool viewhidden;
bool viewkludge;
bool viewquote;
Name whoto;
int wildcatuserno;
vector<Map> xlatcharset;
vector<Map> xlatescset;
char xlatexport[17]; // exportcharset[17];
char xlatimport[17]; // localcharset[17];
char xlatlocalset[17];
Path xlatpath;
int zonegating;
gswitches switches;
};
// ------------------------------------------------------------------
class GSaveUtil : public GStrBag2 {
public:
void Add(int n, char* s) { GStrBag2::Add((void*)&n, sizeof(n), s); }
int Number() { return *(int*)Current1(); }
const char* Text() { return Current2(); }
int Number(int i) { return *(int*)Index1(i); }
const char* Text(int i) { return Index2(i); }
};
// ------------------------------------------------------------------
class GEditTrigger : public GStrBag2 {
public:
const char* Trigger() { return Current1(); }
const char* Text() { return Current2(); }
const char* Trigger(int i) { return Index1(i); }
const char* Text(int i) { return Index2(i); }
};
// ------------------------------------------------------------------
class GoldedCfgEdit {
protected:
// -----------------------------------------------------------------
// Configuration data
struct {
// Boolean values
uint autoattach : 1;
uint crlfterm : 1;
uint fieldclear : 1;
uint hardlines : 1;
uint hardterm : 1;
uint headerattrs : 1;
uint internal : 1;
uint menu : 1;
uint mixcase : 1;
uint savemenu : 1;
// Multi values
uint changedate;
int autosave;
char charpara;
char charspace;
int hdrnamepos;
int hdrnamelen;
int hdrnodepos;
int hdrnodelen;
int headerfirst;
long msgsize;
int quotemargin;
int replyre;
char softcrxlat;
int undelete;
// String handles
int external;
int file;
int hardline;
int spellchecker;
} cfg;
// -----------------------------------------------------------------
// String bag
gstrarray str;
public:
// -----------------------------------------------------------------
// Configuration data
GEditTrigger Comment;
GEditTrigger Completion;
GSaveUtil SaveUtil;
// -----------------------------------------------------------------
// Constructor/destructor
GoldedCfgEdit();
// -----------------------------------------------------------------
// Return values
bool AutoAttach() { return cfg.autoattach; }
int AutoSave() { return cfg.autosave; }
int ChangeDate() { return cfg.changedate; }
char CharPara() { return cfg.charpara; }
char CharSpace() { return cfg.charspace; }
bool CrLfTerm() { return cfg.crlfterm; }
const char* External() { return str[cfg.external].c_str(); }
bool FieldClear() { return cfg.fieldclear; }
const char* File() { return str[cfg.file].c_str(); }
const char* HardLine() { return str[cfg.hardline].c_str(); }
bool HardLines() { return cfg.hardlines; }
bool HardTerm() { return cfg.hardterm; }
int HdrNamePos() { return cfg.hdrnamepos; }
int HdrNameLen() { return cfg.hdrnamelen; }
int HdrNodePos() { return cfg.hdrnodepos; }
int HdrNodeLen() { return cfg.hdrnodelen; }
bool HeaderAttrs() { return cfg.headerattrs; }
int HeaderFirst() { return cfg.headerfirst; }
bool Internal() { return cfg.internal; }
bool Menu() { return cfg.menu; }
bool MixCase() { return cfg.mixcase; }
long MsgSize() { return cfg.msgsize; }
int QuoteMargin() { return cfg.quotemargin; }
int ReplyRe() { return cfg.replyre; }
bool SaveMenu() { return cfg.savemenu; }
char SoftCrXlat() { return cfg.softcrxlat; }
const char* SpellChecker() { return str[cfg.spellchecker].c_str(); }
int UnDelete() { return cfg.undelete; }
// -----------------------------------------------------------------
// Set values
void AutoAttach(bool s) { cfg.autoattach = s; }
void AutoSave(int s) { cfg.autosave = s; }
void ChangeDate(int s) { cfg.changedate = s; }
void CharPara(char s) { cfg.charpara = s; }
void CharSpace(char s) { cfg.charspace = s; }
void CrLfTerm(bool s) { cfg.crlfterm = s; }
void External(char* s) { str[cfg.external] = s; }
void FieldClear(bool s) { cfg.fieldclear = s; }
void File(char* s) { str[cfg.file] = s; }
void HardLine(char* s) { str[cfg.hardline] = s; }
void HardLines(bool s) { cfg.hardlines = s; }
void HardTerm(bool s) { cfg.hardterm = s; }
void HdrNamePos(int p) { cfg.hdrnamepos = p; }
void HdrNameLen(int l) { cfg.hdrnamelen = l; }
void HdrNodePos(int p) { cfg.hdrnodepos = p; }
void HdrNodeLen(int l) { cfg.hdrnodelen = l; }
void HeaderAttrs(bool s) { cfg.headerattrs = s; }
void HeaderFirst(int s) { cfg.headerfirst = s; }
void Internal(bool s) { cfg.internal = s; }
void Menu(bool s) { cfg.menu = s; }
void MixCase(bool s) { cfg.mixcase = s; }
void MsgSize(long s) { cfg.msgsize = s; }
void QuoteMargin(int s) { cfg.quotemargin = s; }
void ReplyRe(int s) { cfg.replyre = s; }
void SaveMenu(bool s) { cfg.savemenu = s; }
void SoftCrXlat(char s) { cfg.softcrxlat = s; }
void SpellChecker(char* s) { str[cfg.spellchecker] = s; }
void UnDelete(int s) { cfg.undelete = s; }
};
// ------------------------------------------------------------------

590
golded3/gecmfd.cpp Normal file
View File

@ -0,0 +1,590 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Copy, Move, Forward and Delete.
// ------------------------------------------------------------------
#include <golded.h>
// ------------------------------------------------------------------
// Global data from GEREAD
extern GMsg* reader_msg;
// ------------------------------------------------------------------
void Area::DeleteMsg(GMsg* msg, int direction) {
ulong replyto=0, reply1st=0, lread;
GMsg* uplink = (GMsg*)throw_calloc(1, sizeof(GMsg));
GMsg* downlink = (GMsg*)throw_calloc(1, sizeof(GMsg));
if(msg->msgno) {
// Fix the lastread pointer
lread = Msgn.CvtReln(lastread());
if(msg->msgno == lread) {
uint l = lastread();
if(direction == DIR_PREV) {
if(l-1) {
l--;
}
else if((l+1) <= Msgn.Count())
l++;
else
l = 0;
}
else {
if((l+1) <= Msgn.Count())
l++;
else if(l-1)
l--;
else
l = 0;
}
set_lastread(l);
lread = Msgn.CvtReln(lastread());
}
// Get reply links
if(Msgn.ToReln(msg->link.to())) {
replyto = msg->link.to();
}
if(Msgn.ToReln(msg->link.first())) {
reply1st = msg->link.first();
}
if(replyto) {
if(not LoadHdr(downlink, replyto))
downlink->link.first_set(0);
}
if(reply1st) {
if(not LoadHdr(uplink, reply1st))
uplink->link.to_set(0);
}
// --------------------------------------------------------------
// Diagram of splicing the links of a deleted msg
// --------------------------------------------------------------
// Reply1st Replyto
// ÚÄÄÄÄÄÄÄÄÄÄ¿
// Downlink --> Deleted --> Uplink
// ÀÄÄÄÄÄÄÄÄÄÄÄÙ
// Reply1st Replyto Confused ? :-)
// --------------------------------------------------------------
// Only update the up/downlinks if they are pointing to this msg
if(replyto) {
if(downlink->link.first() == msg->msgno) {
downlink->link.first_set(reply1st);
SaveHdr(GMSG_UPDATE, downlink);
}
else {
replyto = 0;
}
}
if(reply1st) {
if(uplink->link.to() == msg->msgno) {
uplink->link.to_set(replyto);
SaveHdr(GMSG_UPDATE, uplink);
}
}
// Delete the message
msg->attr.del1();
DelMsg(msg);
// Update scanning files
if(isnet() and isfido())
TouchNetscan(false);
// Remove message from internal table
Msgn.Del(msg->msgno);
// Update lastreads
if(Msgn.Count())
set_lastread(Msgn.ToReln(lread));
else
set_lastread(0);
msg->msgno = lread;
UpdateAreadata();
}
ResetMsg(downlink);
throw_free(downlink);
ResetMsg(uplink);
throw_free(uplink);
}
// ------------------------------------------------------------------
void Area::DelMsgs(GMsg* msg) {
GFTRK("DelMsgs");
uint n, x;
int topline=0;
bool delask=true, dellocked=false;
n = 0;
if(Mark.Count()) {
GMenuDomarks MenuDomarks;
n = MenuDomarks.Run(LNG->Delete);
if(n == 1) {
HandleGEvent(EVTT_MSGDELETING);
w_progress(MODE_NEW, C_INFOW, 0, Mark.Count(), LNG->Deleting);
Lock();
int escaped = false;
for(n=0; n<Mark.Count(); n++) {
x = n;
if(kbxhit()) {
if(kbxget() == Key_Esc) {
HandleGEvent(EVTT_JOBFAILED);
escaped = true;
break;
}
}
update_statuslinef(LNG->DeletingMsg, x+1, Mark.Count());
w_progress(MODE_UPDATE, C_INFOW, x+1, Mark.Count(), LNG->Deleting);
ulong msgno = Mark[x];
if(Msgn.ToReln(msgno)) {
if(LoadHdr(msg, msgno)) {
bool deletethis = false;
if(delask) {
if(msg->attr.uns() and not (msg->attr.rcv() or msg->attr.del())) {
AA->LoadMsg(msg, msgno, CFG->dispmargin-(int)CFG->switches.get(disppagebar));
w_progress(MODE_QUIT, 0, 0, 0, NULL);
HeaderView->Use(AA, msg);
HeaderView->Paint();
BodyView->Use(AA, msg, topline);
BodyView->Paint();
GMenuDelete MenuDelete;
switch(MenuDelete.Run(YES, msg)) {
case YES: // Yes, delete
deletethis = true;
break;
case NO: // No, dont delete
continue;
default: // Delete without asking
delask = false;
if(msg->attr.lok())
dellocked = true;
}
}
}
if(msg->attr.lok() and not dellocked and not deletethis) {
AA->LoadMsg(msg, msgno, CFG->dispmargin-(int)CFG->switches.get(disppagebar));
w_progress(MODE_QUIT, 0, 0, 0, NULL);
HeaderView->Use(AA, msg);
HeaderView->Paint();
BodyView->Use(AA, msg, topline);
BodyView->Paint();
GMenuDelete MenuDelete;
switch(MenuDelete.Run(YES, msg)) {
case YES: // Yes, delete
break;
case NO: // No, dont delete
continue;
default: // Delete without asking
dellocked = true;
}
}
DeleteMsg(msg, DIR_PREV);
PMrk.Del(msg->msgno);
}
}
}
Unlock();
if(not escaped) {
isreadmark = false;
Mark.ResetAll();
}
w_progress(MODE_QUIT, 0, 0, 0, NULL);
}
}
if(n == 0) {
Mark.Del(msg->msgno);
PMrk.Del(msg->msgno);
GMenuDelete MenuDelete;
if(Mark.Count() or MenuDelete.Run(NO, msg)) {
HandleGEvent(EVTT_MSGDELETING);
DeleteMsg(msg, reader_direction);
}
}
HandleGEvent(EVTT_BREAKLOOP);
GFTRK(NULL);
}
// ------------------------------------------------------------------
void TwitDeleteMsg(GMsg* msg) {
GFTRK("TwitDeleteMsg");
HandleGEvent(EVTT_MSGDELETING);
AA->Mark.Del(msg->msgno);
AA->PMrk.Del(msg->msgno);
AA->DeleteMsg(msg, reader_direction);
HandleGEvent(EVTT_BREAKLOOP);
GFTRK(NULL);
}
// ------------------------------------------------------------------
void Area::DelMsg() {
if(Msgn.Count())
DelMsgs(reader_msg);
}
// ------------------------------------------------------------------
void CmfMsgs(GMsg* msg) {
// Select action
GMenuCMF MenuCMF;
int cmf = MenuCMF.Run();
if(cmf == -1)
return;
// Set language strings
char* pickstr = NULL;
char* markstr = NULL;
char* progstr = NULL;
char* statstr = NULL;
int loadmode = GMSG_UNS_NOT_RCV;
switch(cmf) {
case MODE_COPY:
GFTRK("CopyMsgs");
pickstr = LNG->CopyArea;
markstr = LNG->Copy;
progstr = LNG->Copying;
statstr = LNG->CopyingMsg;
loadmode |= GMSG_COPY;
break;
case MODE_MOVE:
GFTRK("MoveMsgs");
pickstr = LNG->MoveArea;
markstr = LNG->Move;
progstr = LNG->Moving;
statstr = LNG->MovingMsg;
loadmode |= GMSG_MOVE;
break;
case MODE_FORWARD:
GFTRK("ForwardMsgs");
pickstr = LNG->ForwardArea;
break;
}
// Do with current or marked msgs?
int do_mode = MODE_CURRENT;
if(cmf != MODE_FORWARD) {
if(AA->Mark.Count()) {
GMenuDomarks MenuDomarks;
do_mode = MenuDomarks.Run(markstr);
if(do_mode == MODE_DONT) {
GFTRK(NULL);
return;
}
}
}
// Pick the destination area
int destarea = CurrArea;
const char* cmfptr = cmf == MODE_FORWARD ? AA->Areareplyto() : AA->Areacopyto();
if(*cmfptr) {
int a = AL.AreaEchoToNo(cmfptr);
if(a != -1)
destarea = AL.AreaNoToId(a);
}
if(cmf == MODE_FORWARD ? not AA->Areaforwarddirect() : not AA->Areacopydirect())
destarea = AreaPick(pickstr, 6, &destarea);
if(destarea == -1) {
GFTRK(NULL);
return;
}
AL.SetActiveAreaId(OrigArea);
AreaData* orig_adat = AA->adat;
AA->adat = (AreaData*)throw_calloc(1, sizeof(AreaData));
memcpy(AA->adat, orig_adat, sizeof(AreaData));
AL.SetActiveAreaId(destarea);
Area* AAdest = AA;
// Is it readonly?
if(AA->attr().r_o()) {
GMenuReadonly MenuReadonly;
if(not MenuReadonly.Run()) {
AL.SetActiveAreaId(OrigArea);
throw_free(AA->adat);
AA->adat = orig_adat;
GFTRK(NULL);
return;
}
}
// Handle a forward
if(cmf == MODE_FORWARD) {
extern int _use_fwd;
_use_fwd = orig_adat->usefwd;
if(_use_fwd == ASK) {
GMenuForward MenuForward;
_use_fwd = MenuForward.Run();
}
if(CurrArea != OrigArea)
AA->Open();
MakeMsg(MODE_FORWARD, msg);
AL.SetActiveAreaId(OrigArea);
throw_free(AA->adat);
AA->adat = orig_adat;
GFTRK(NULL);
return;
}
// Popup wait window
w_info(progstr);
// Open destination area and lock it
AA->Open();
AA->Lock();
AA->RandomizeData();
// Re-activeate original area and lock that too
AL.SetActiveAreaId(OrigArea);
AA->Lock();
// Setup some variables for the loop
Area* AAorig = AA;
const char* echoid = AAdest->echoid();
ulong loadmsgno = msg->msgno;
ulong* mrkp = AA->Mark.tag;
int mrks = AA->Mark.Count();
int mrk = 0;
// Copy/move loop
do {
// Check for escape key
if(kbxhit()) {
if(kbxget() == Key_Esc) {
HandleGEvent(EVTT_JOBFAILED);
break;
}
}
// Show progress and load the marked msg
if(do_mode == MODE_MARKED) {
update_statuslinef(statstr, mrk+1, mrks, echoid);
loadmsgno = *mrkp++;
}
int mode = 0;
ulong msgno = 0;
if(AA->LoadMsg(msg, loadmsgno, CFG->dispmargin-(int)CFG->switches.get(disppagebar), loadmode)) {
// Handle unsent msgs
mode = cmf;
if((cmf == MODE_MOVE) and (loadmode & GMSG_UNS_NOT_RCV) and (msg->attr.uns() and not msg->attr.rcv())) {
// Axe the popup wait window
w_info(NULL);
// Display header and message
int top = 0;
HeaderView->Use(AA, msg);
HeaderView->Paint();
BodyView->Use(AA, msg, top);
BodyView->Paint();
// Ask if it should be deleted
GMenuDelete MenuDelete;
switch(MenuDelete.Run(YES, msg)) {
case YES: break;
case NO: mode = MODE_COPY; break;
default: loadmode &= ~GMSG_UNS_NOT_RCV;
}
// Put up the wait window again
w_info(progstr);
}
// Switch to destination area
AA = AAdest;
// Change things in the header to match the destination area
msg->attr.del0(); // Allows deleted msgs to be undeleted
msg->board = AA->board();
msg->link.reset();
// Fake Scn-Attribute if copied to squisharea
if(AA->issquish() and not AAorig->issquish())
if(msg->attr.loc() and msg->attr.snt())
msg->attr.scn1();
if(AA->Areacopyaddid() and not AA->isnet()) {
char* ptr = msg->txt + (*msg->txt == CTRL_A);
if(not strnieql(ptr, "AREA:", 5)) {
uint elen = 6 + strlen(AAorig->echoid()) + 1;
uint mlen = strlen(msg->txt)+1;
msg->txt = (char*)throw_realloc(msg->txt, elen+mlen);
memmove(msg->txt+elen, msg->txt, mlen);
sprintf(msg->txt, "\001AREA:%s", AAorig->echoid());
msg->txt[elen-1] = CR;
}
}
bool need_netmail_kludges = not AAorig->isnet() and AAdest->isnet();
bool need_fmpt = true;
bool need_topt = true;
if(not need_netmail_kludges and AAorig->issquish() and not AAdest->issquish() and AAdest->isnet() and AAorig->isnet()) {
if(msg->orig.point and not strstr(msg->txt, "\001FMPT"))
need_netmail_kludges = true;
else
need_fmpt = false;
if(msg->dest.point and not strstr(msg->txt, "\001TOPT"))
need_netmail_kludges = true;
else
need_topt = false;
}
if(need_netmail_kludges) {
char buf[256] = "";
if(not strstr(msg->txt, "\001INTL"))
// The INTL kludge for zone crossing
if(CFG->useintl and (CFG->useintl == YES or (msg->dest.zone != msg->orig.zone))) {
sprintf(buf, "\001INTL %u:%u/%u %u:%u/%u%c",
msg->dest.zone ? msg->dest.zone : AA->Aka().addr.zone,
msg->dest.net, msg->dest.node,
msg->orig.zone ? msg->orig.zone : AA->Aka().addr.zone,
msg->orig.net, msg->orig.node, CR
);
}
if(not strstr(msg->txt, "\001TOPT") or not strstr(msg->txt, "\001FMPT")) {
// The FMPT and TOPT kludges for point addressing
if(msg->dest.point and need_topt)
sprintf(buf+strlen(buf), "\001TOPT %u%c", msg->dest.point, CR);
if(msg->orig.point and msg->orig.net == msg->oorig.net and msg->orig.node == msg->oorig.node and need_fmpt)
sprintf(buf+strlen(buf), "\001FMPT %u%c", msg->orig.point, CR);
}
uint alen = strlen(buf);
if(alen) {
uint mlen = strlen(msg->txt)+1;
msg->txt = (char*)throw_realloc(msg->txt, alen+mlen);
memmove(msg->txt+alen, msg->txt, mlen);
memmove(msg->txt, buf, alen);
}
}
else if(AA->isecho() and not AAorig->isecho()) {
char* kl = strstr(msg->txt, "\001INTL");
char* p;
if(kl and (p = strchr(kl, CR)) != NULL)
memmove(kl, p, strlen(p)+1);
kl = strstr(msg->txt, "\001TOPT");
if(kl and (p = strchr(kl, CR)) != NULL)
memmove(kl, p, strlen(p)+1);
kl = strstr(msg->txt, "\001FMPT");
if(kl and (p = strchr(kl, CR)) != NULL)
memmove(kl, p, strlen(p)+1);
}
// Save the new msg to the destination area
msgno = msg->msgno;
AA->SaveMsg(GMSG_NEW|GMSG_NOLSTUPD, msg);
// Switch back to original area
AA = AAorig;
}
// Delete original msg if moved
if(mode == MODE_MOVE) {
msg->msgno = msgno;
AA->DeleteMsg(msg, DIR_PREV);
AA->PMrk.Del(msg->msgno);
}
} while((do_mode == MODE_MARKED) and ((++mrk) < mrks));
kbput(Key_Tick);
// Unlock and close destination area
AL.SetActiveAreaId(destarea);
AA->UpdateAreadata();
AA->Unlock();
AA->Close();
// Return to original area and unlock it
AL.SetActiveAreaId(OrigArea);
throw_free(AA->adat);
AA->adat = orig_adat;
AA->Unlock();
if(do_mode == MODE_MARKED) {
if(cmf == MODE_MOVE)
AA->Mark.ResetAll();
}
else {
if(cmf == MODE_MOVE) {
AA->Mark.Del(msg->msgno);
AA->PMrk.Del(msg->msgno);
}
}
w_info(NULL);
GFTRK(NULL);
}
// ------------------------------------------------------------------
void CopyMoveForward() {
ulong lastread = reader_msg->msgno;
AA->set_lastread(AA->Msgn.ToReln(lastread, AA->lastread()));
AA->attr().hex0();
if(AA->Msgn.Count())
CmfMsgs(reader_msg);
AA->set_lastread(AA->Msgn.ToReln(lastread, AA->lastread()));
}
// ------------------------------------------------------------------

128
golded3/gectnr.cpp Normal file
View File

@ -0,0 +1,128 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Container class.
// ------------------------------------------------------------------
#include "golded.h"
// ------------------------------------------------------------------
inline int isstylechar(char c) { return (c == '*') or (c == '/') or (c == '_') or (c == '#'); }
void Container::StyleCodeHighlight(char* text, int row, int col, bool dohide, int color) {
uint sclen = 0;
char* txptr = text;
char buf[200];
char* ptr = text;
const char* stylemargins = " -|\\"; // we probably have to make a keyword for it
char* punctchars = CFG->stylecodepunct;
char* stylestopchars = CFG->stylecodestops;
char prevchar = ' ';
if(dohide or CFG->usestylies) {
while(*ptr) {
if(isstylechar(*ptr)) {
if(strchr(punctchars, prevchar)) {
int bb = 0, bi = 0, bu = 0, br = 0;
char* beginstyle = ptr;
while(isstylechar(*ptr)) {
switch(*ptr) {
case '*': bb++; break;
case '/': bi++; break;
case '_': bu++; break;
case '#': br++; break;
}
ptr++;
}
if((bb <= 1) and (bi <= 1) and (br <= 1) and (bu <= 1) and *ptr) {
char* beginword = ptr; // _/*>another*/_
char endchar = NUL;
char* end = ptr;
do {
end = strpbrk(++end, punctchars);
} while ((end) and not isstylechar(*(end-1)));
if(end)
endchar = *end;
else
end = ptr+strlen(ptr);
*end = NUL;
char* endstyle = end-1; // _/*another*/>_
if(isstylechar(*endstyle) and not strchr(stylemargins, *beginword)) {
char* endword = endstyle;
int eb = 0, ei = 0, eu = 0, er = 0;
while(isstylechar(*endword)) {
switch(*endword) {
case '*': eb++; break;
case '/': ei++; break;
case '_': eu++; break;
case '#': er++; break;
}
endword--;
} // _/*anothe>r*/_
if(endword >= beginword and not strchr(stylemargins, *endword)) {
if((bb == eb) and (bi == ei) and (bu == eu) and (br == er)) {
char endwordchar = *endword;
*endword = NUL;
char* style_stops_present = strpbrk(beginword, stylestopchars);
*endword = endwordchar;
if(not style_stops_present) {
int colorindex = (bb ? 1 : 0) | (bi ? 2 : 0) | (bu ? 4 : 0) | (br ? 8 : 0);
strxcpy(buf, txptr, (uint)(beginstyle-txptr)+1);
prints(row, col+sclen, color, buf);
sclen += strlen(buf);
if(dohide)
strxcpy(buf, beginword, (uint)(endword-beginword)+2);
else
strxcpy(buf, beginstyle, (uint)(endstyle-beginstyle)+2);
prints(row, col+sclen, C_STYLE[colorindex], buf);
sclen += strlen(buf);
txptr = end;
}
}
}
}
*end = endchar;
ptr = end-1;
}
}
}
if(*ptr)
prevchar = *ptr++;
}
}
if(*txptr) {
prints(row, col+sclen, color, txptr);
sclen += strlen(txptr);
}
uint splen = strlen(text) - sclen;
if(splen) {
memset(buf, ' ', splen); buf[splen] = NUL;
prints(row, col+sclen, color, buf);
}
}
// ------------------------------------------------------------------

42
golded3/gectnr.h Normal file
View File

@ -0,0 +1,42 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Container class.
// ------------------------------------------------------------------
// ------------------------------------------------------------------
class Container {
virtual void prints(int, int, int, char*) = 0;
public:
virtual ~Container() { }
void StyleCodeHighlight(char* text, int row, int col, bool dohide, int color);
};
// ------------------------------------------------------------------

652
golded3/gectrl.cpp Normal file
View File

@ -0,0 +1,652 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Random system and control info handling.
// ------------------------------------------------------------------
#include <golded.h>
#include <gutlcode.h>
#include <gutlmisc.h>
#include <gtimall.h>
// ------------------------------------------------------------------
int _use_fwd = true;
// ------------------------------------------------------------------
char* MakeOrigin(GMsg* msg, const char* orig) {
char buf[256];
char origin[100];
strxcpy(origin, orig, sizeof(origin));
if(msg->orig.net)
msg->orig.make_string(buf);
else
AA->Aka().addr.make_string(buf);
if(*origin == '@')
GetRandomLine(origin, sizeof(origin), origin+1);
sprintf(msg->origin, "%.*s (%s)", (int)(79 - 11 - 2 - strlen(buf) - 1), origin, buf);
return msg->origin;
}
// ------------------------------------------------------------------
char* MakeTearline(GMsg* msg, char* buf) {
if(*msg->tearline == '@')
GetRandomLine(msg->tearline, sizeof(msg->tearline), msg->tearline+1);
strcpy(stpcpy(buf, "--- "), strbtrim(msg->tearline));
return strtrim(buf);
}
// ------------------------------------------------------------------
void MakeFlags(GMsg* msg, Line** line, char* buf) {
// The FrontDoor FLAGS netmail kludge
if(CFG->switches.get(useflags)) {
sprintf(buf, "\001FLAGS ");
if(AA->ishudson()) {
if(msg->attr.hld())
strcat(buf, "HLD ");
if(msg->attr.frq())
strcat(buf, "FRQ ");
}
if(msg->attr.imm())
strcat(buf, "IMM ");
if(msg->attr.dir())
strcat(buf, "DIR ");
if(msg->attr.tfs())
strcat(buf, "TFS ");
if(msg->attr.kfs())
strcat(buf, "KFS ");
if(msg->attr.lok())
strcat(buf, "LOK ");
if(msg->attr.a_s())
strcat(buf, "A/S ");
if(msg->attr.zon())
strcat(buf, "ZON ");
if(msg->attr.hub())
strcat(buf, "HUB ");
if(msg->attr.xma())
strcat(buf, "XMA ");
if(msg->attr.cfm())
strcat(buf, "CFM ");
if(msg->attr.hir())
strcat(buf, "HIR ");
if(msg->attr.cov())
strcat(buf, "COV ");
if(msg->attr.sig())
strcat(buf, "SIG ");
if(msg->attr.let())
strcat(buf, "LET ");
if(msg->attr.fax())
strcat(buf, "FAX ");
if(strlen(buf) > 7) {
buf[strlen(buf)-1] = 0;
*line = AddKludge(*line, buf);
(*line)->kludge = GKLUD_FLAGS;
}
}
}
// ------------------------------------------------------------------
char* mime_header_encode(char* dest, const char* source, GMsg* msg) {
bool inmime = false;
const char* s = source;
char* bp = dest;
const char* lp;
char* temp_src = (char*)throw_malloc(4096);
if(*msg->charset) {
if((msg->charsetlevel&3) and ChsTP) {
char chln, *d = temp_src;
for(uint len = 0; *s; s++) {
char* tptr = (char*)ChsTP[(byte)*s];
chln = *tptr++;
while(chln-- and (len < 4096)) {
*(d++) = *tptr++;
++len;
}
if(len == 4096)
break;
}
*d = NUL;
s = temp_src;
}
}
if(CFG->encodeemailheaders) {
lp = s + strlen(s);
while((lp>s) and in_range((char)(*lp-1), (char)' ', (char)'\x7F'))
lp--;
for(const char* ptr = s; *ptr and (ptr<=lp); ptr++) {
if((*ptr < ' ') or (*ptr > '\x7F') or (inmime and strchr(" =?", *ptr))) {
if(not inmime) {
if(msg->charset) {
strcpy(bp, "=?");
bp += 2;
strcpy(bp, strlword(msg->charset));
strlwr(bp);
bp += strlen(bp);
strcpy(bp, "?Q?");
bp += 3;
}
else {
strcpy(bp, "=?iso-8859-1?Q?");
bp += 15;
}
inmime = true;
}
sprintf(bp, "=%Xc", *ptr);
bp += 3;
}
else
*bp++ = *ptr;
}
if(inmime) {
strcpy(bp, "?=");
bp += 2;
}
}
else
lp = s;
strcpy(bp, lp);
throw_free(temp_src);
return bp;
}
// ------------------------------------------------------------------
char* get_informative_string(char* buf) {
sprintf(buf, "%s%s%s %s%i.%i.%i%s (%s)",
__gver_prename__, __gver_name__, __gver_postname__,
__gver_preversion__, __gver_major__, __gver_minor__,
__gver_release__, __gver_postversion__, ggetosstring());
return buf;
}
// ------------------------------------------------------------------
void DoKludges(int mode, GMsg* msg, bool attronly) {
char* buf = (char*)throw_malloc(4096);
char buf2[356];
Line* line = msg->lin;
Line* newline;
int __tzoffset = tzoffset();
// Insert empty line at the top for practical purposes
newline = (Line*)throw_xcalloc(1, sizeof(Line));
newline = line = InsertLine(newline, line, DIR_PREV);
// Strip all the kludges we insert ourselves
while(line) {
int stripkludges = attronly ? GKLUD_FLAGS : (GKLUD_RFC|GKLUD_FWD|GKLUD_INTL|GKLUD_FMPT|GKLUD_TOPT|GKLUD_FLAGS|GKLUD_AREA|GKLUD_MSGID|GKLUD_REPLY|GKLUD_PID|GKLUD_CHARSET|GKLUD_KNOWN|(mode==MODE_FORWARD?(GKLUD_PATH|GKLUD_SEENBY):0));
if(line->kludge & stripkludges) {
bool waswrapped;
do {
waswrapped = (line->type & GLINE_WRAP) ? true : false;
line = DeleteLine(line);
} while(line and waswrapped);
}
else {
line = line->next;
}
}
line = newline;
if(attronly) {
if(AA->isnet())
MakeFlags(msg, &line, buf);
}
else {
if(not AA->isnet() and msg->areakludgeid) {
sprintf(buf, "\001AREA:%s", msg->areakludgeid);
line = AddKludge(line, buf);
line->kludge = GKLUD_AREA;
}
if(AA->isnet()) {
// The INTL kludge for zone crossing
if(CFG->useintl and (CFG->useintl == YES or (msg->dest.zone != msg->orig.zone))) {
sprintf(buf, "\001INTL %u:%u/%u %u:%u/%u",
msg->dest.zone ? msg->dest.zone : AA->Aka().addr.zone,
msg->dest.net, msg->dest.node,
msg->orig.zone ? msg->orig.zone : AA->Aka().addr.zone,
msg->orig.net, msg->orig.node
);
line = AddKludge(line, buf);
line->kludge = GKLUD_INTL;
}
// The FMPT and TOPT kludges for point addressing
if(msg->dest.point) {
sprintf(buf, "\001TOPT %u", msg->dest.point);
line = AddKludge(line, buf);
line->kludge = GKLUD_TOPT;
}
if(msg->orig.point and msg->orig.net == msg->oorig.net and msg->orig.node == msg->oorig.node) {
sprintf(buf, "\001FMPT %u", msg->orig.point);
line = AddKludge(line, buf);
line->kludge = GKLUD_FMPT;
}
MakeFlags(msg, &line, buf);
}
// The REPLY: kludge for Receiver identification
if(CFG->switches.get(usemsgid) and *msg->replys) {
sprintf(buf, "\001REPLY: %s", msg->replys);
line = AddKludge(line, buf);
line->kludge = GKLUD_REPLY;
}
// The MSGID: kludge for Origination identification
if(AA->Internetmsgid() and *msg->iorig and AA->isinternet()) {
// User configured Internetdomain, use it
if(*CFG->internetdomain) {
strcpy(buf, CFG->internetdomain);
}
else {
// Fallback method. Yes, its "Crosspoint"-style. Yes, it's not
// Son-Of-RFC1036-compatible. Yes, I don't care.
// '%' in domain name activates some braindead spamfilters, so
// don't use it. I've had to realize that myself (Dirk).
strcpy(buf, msg->iorig);
strchg(buf, '@', '.');
}
sprintf(buf2, "<GED%08lX@%s>", time(NULL)+(msgcount++), buf);
throw_release(msg->messageid);
msg->messageid = throw_strdup(buf2);
CvtMessageIDtoMSGID(buf2, buf, AA->echoid(), "MSGID");
strcpy(msg->msgids, buf+8);
}
else {
msg->orig.make_string(buf2, msg->odom);
sprintf(msg->msgids, "%s %08lx", buf2, time(NULL)+(msgcount++));
}
if(CFG->switches.get(usemsgid) and not AA->ispcboard()) {
sprintf(buf, "\001MSGID: %s", msg->msgids);
line = AddKludge(line, buf);
line->kludge = GKLUD_MSGID;
}
// The PID: (Product ID code) kludge
strcpy(msg->pid, __gver_shortpid__);
if(CFG->usepid and (CFG->switches.get(emptytearline) or not (striinc(__gver_longpid__, msg->tearline)))) {
sprintf(buf, "\001PID: %s", msg->pid);
line = AddKludge(line, strtrim(buf));
line->kludge = GKLUD_PID;
}
// The CHARSET kludge
if(CFG->usecharset and *msg->charset) {
*buf = NUL;
if(strieql(msg->charset, "I51"))
strcpy(buf, "\001I51");
else if(not strieql(msg->charset, "COMPOSED"))
sprintf(buf, "\001%s: %s", CFG->switches.get(kludgechrs) ? "CHRS" : "CHARSET", msg->charset);
if(*buf) {
line = AddKludge(line, buf);
line->kludge = GKLUD_CHARSET;
}
}
// The TZUTC kludge for timezone info
if(AA->Usetzutc()) {
sprintf(buf, "\001TZUTC: %0*d", (__tzoffset < 0) ? 5 : 4, __tzoffset);
line = AddKludge(line, buf);
line->kludge = GKLUD_KNOWN;
}
// The FWD* kludges
if(_use_fwd) {
if(*msg->fwdfrom) {
sprintf(buf, "\001FWDFROM %s", msg->fwdfrom);
line = AddKludge(line, buf);
line->kludge = GKLUD_FWD;
}
if(msg->fwdorig.net) {
sprintf(buf, "\001FWDORIG %s", msg->fwdorig.make_string(buf2));
line = AddKludge(line, buf);
line->kludge = GKLUD_FWD;
}
if(*msg->fwdto) {
sprintf(buf, "\001FWDTO %s", msg->fwdto);
line = AddKludge(line, buf);
line->kludge = GKLUD_FWD;
}
if(msg->fwddest.net) {
sprintf(buf, "\001FWDDEST %s", msg->fwddest.make_string(buf2));
line = AddKludge(line, buf);
line->kludge = GKLUD_FWD;
}
if(*msg->fwdsubj) {
sprintf(buf, "\001FWDSUBJ %s", msg->fwdsubj);
line = AddKludge(line, buf);
line->kludge = GKLUD_FWD;
}
if(*msg->fwdarea) {
sprintf(buf, "\001FWDAREA %s", msg->fwdarea);
line = AddKludge(line, buf);
line->kludge = GKLUD_FWD;
}
if(*msg->fwdmsgid) {
sprintf(buf, "\001FWDMSGID %s", msg->fwdmsgid);
line = AddKludge(line, buf);
line->kludge = GKLUD_FWD;
}
}
if(AA->isinternet()) {
const char* rfc = AA->Internetrfcbody() ? "" : "\001";
char to_buf[256];
*to_buf = NUL;
if(*msg->idest or strchr(msg->to, '@')) {
char* ptr = *msg->idest ? msg->idest : msg->to;
sprintf(to_buf, "%s%sTo: %s", rfc, AA->isnewsgroup() ? "X-" : "", ptr);
if(not strieql(ptr, msg->realto) and *msg->realto) {
mime_header_encode(buf, msg->realto, msg);
sprintf(buf2, " (%s)", buf);
strcat(to_buf, buf2);
}
}
if(*to_buf and AA->isemail()) {
line = AddKludge(line, to_buf);
line->kludge = GKLUD_RFC;
}
if(*msg->iorig) {
mime_header_encode(buf2, msg->By(), msg);
sprintf(buf, "%sFrom: %s (%s)", rfc, msg->iorig, buf2);
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
}
if(AA->isnewsgroup()) {
sprintf(buf, "%sNewsgroups: %s", rfc, strlwr(strcpy(buf2, AA->echoid())));
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
}
if(*msg->re) {
mime_header_encode(buf2, msg->re, msg);
sprintf(buf, "%sSubject: %s", rfc, buf2);
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
}
struct tm* tm = gmtime(&msg->written);
sprintf(buf, "%sDate: %s, %02d %s %04d %02d:%02d:%02d", rfc,
__gsweekday[tm->tm_wday],
tm->tm_mday, __gsmonth[tm->tm_mon], 1900+tm->tm_year,
tm->tm_hour, tm->tm_min, tm->tm_sec
);
if(AA->Usetzutc())
sprintf(buf + strlen(buf), " %+05d", __tzoffset);
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
if(msg->messageid) {
sprintf(buf, "%sMessage-ID: %s", rfc, msg->messageid);
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
}
if(msg->references) {
sprintf(buf, "%sReferences: %s", rfc, msg->references);
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
}
if(msg->inreplyto) {
sprintf(buf, "%sIn-Reply-To: %s", rfc, msg->inreplyto);
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
}
if(*msg->organization) {
sprintf(buf, "%sOrganization: %s", rfc, msg->organization);
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
}
if(striinc("LATIN-1", msg->charset) or striinc("LATIN1QP", msg->charset) or striinc("ASCII", msg->charset)) {
sprintf(buf, "%sMIME-Version: 1.0", rfc);
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
sprintf(buf, "%sContent-Type: text/plain; charset=%s", rfc, striinc("ASCII", msg->charset) ? "us-ascii" : "iso-8859-1");
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
sprintf(buf, "%sContent-Transfer-Encoding: %s", rfc, striinc("LATIN1QP", msg->charset) ? "quoted-printable" : striinc("ASCII", msg->charset) ? "7bit" : "8bit");
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
}
if(*to_buf and AA->isnewsgroup()) {
line = AddKludge(line, to_buf);
line->kludge = GKLUD_RFC;
}
if(*msg->iorig) {
mime_header_encode(buf2, msg->By(), msg);
sprintf(buf, "%sSender: %s (%s)", rfc, msg->iorig, buf2);
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
}
if((*msg->ireplyto or *CFG->soupreplyto) and (not streql(*msg->ireplyto ? msg->ireplyto : CFG->soupreplyto, msg->iorig))) {
sprintf(buf, "%sReply-To: %s", rfc, *msg->ireplyto ? msg->ireplyto : CFG->soupreplyto);
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
}
if(striinc("MNEMONIC", msg->charset)) {
sprintf(buf, "%sX-Charset: ISO_8859-1", rfc);
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
sprintf(buf, "%sX-Char-Esc: 29", rfc);
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
}
if(AA->isnewsgroup() or AA->isemail()) {
sprintf(buf, "%sX-%s: %s", rfc, AA->isnewsgroup() ? "Newsreader" : "Mailer", get_informative_string(buf2));
line = AddKludge(line, buf);
line->kludge = GKLUD_RFC;
}
if(AA->Internetrfcbody() and line->next and not strblank(line->next->text)) {
line = AddKludge(line, "");
line->kludge = GKLUD_RFC;
}
}
if(AA->isnet()) {
Line* firstline = FirstLine(line);
firstline = firstline->next;
// 123456789012345678901234567
if(strneql(firstline->text, "-----BEGIN PGP MESSAGE-----", 27)) {
line = AddKludge(line, "\001ENC: PGP");
}
if(*msg->iaddr and not AA->isinternet()) {
if(*msg->To() and (strpbrk(msg->iaddr, "<>()\"") == NULL) and not strieql(msg->To(), *AA->Internetgate().name ? AA->Internetgate().name : "UUCP")) {
Name name;
strcpy(name, msg->To());
sprintf(buf, "To: \"%s\" <%s>\r", StripQuotes(name), msg->iaddr);
}
else
sprintf(buf, "To: %s\r", msg->iaddr);
line = AddKludge(line, buf);
}
}
}
// Reset line pointer
msg->lin = DeleteLine(FirstLine(line));
MsgLineReIndex(msg, YES, YES, YES);
throw_free(buf);
}
// ------------------------------------------------------------------
void DoTearorig(int mode, GMsg* msg) {
uint ctrlinfo;
char buf[256];
char* ptr;
Line* line = msg->lin;
Line* newline;
string origin;
origin = AA->Origin();
if(AA->Taglinesupport()) {
if(*msg->tagline == '@')
GetRandomLine(msg->tagline, sizeof(msg->tagline), msg->tagline+1);
TokenXlat(mode, msg->tagline, msg, msg, CurrArea);
strbtrim(msg->tagline);
}
TokenXlat(mode, msg->tearline, msg, msg, CurrArea);
ctrlinfo = AA->Ctrlinfo();
if(not *msg->origin)
MakeOrigin(msg, origin.c_str());
// Delete current tag-, tear- and originlines
int deltypes = GLINE_TEAR|GLINE_ORIG;
if(AA->Taglinesupport())
deltypes |= GLINE_TAGL;
while(line) {
if(line->type & deltypes) {
if(line == msg->lin)
msg->lin = NULL;
newline = line;
Line* nextline = newline->next;
line = DeleteLine(line);
if(nextline == NULL)
line = NULL;
}
else
line = line->next;
}
// Make sure there is a blank line at the bottom, just before the tearline
// Unless the line is a tagline (..., ___ etc).
line = LastLine(msg->lin);
if(line == NULL)
msg->lin = line = AddLine(NULL, "");
else {
ptr = line->text;
if(not strblank(ptr))
if(not ((ptr[0] == ptr[1]) and (ptr[1] == ptr[2])))
line = AddLine(line, "");
}
// Check and fix originline
if(*msg->origin) {
ptr = strrchr(msg->origin, '(' /*)*/ );
if(ptr) {
if(ptr != msg->origin)
*((ptr++)-1) = NUL;
else
*ptr++ = NUL;
origin = msg->origin;
}
else
origin = msg->origin;
}
MakeOrigin(msg, origin.c_str());
TokenXlat(mode, msg->tagline, msg, msg, CurrArea);
TokenXlat(mode, msg->tearline, msg, msg, CurrArea);
TokenXlat(mode, msg->origin, msg, msg, CurrArea);
// Add the tagline, tearline and origin as defined
if(AA->Taglinesupport() and *msg->tagline) {
sprintf(buf, "%c%c%c %s", AA->Taglinechar(), AA->Taglinechar(), AA->Taglinechar(), msg->tagline);
strtrim(buf);
line = AddLine(line, buf);
line->type |= GLINE_TAGL;
}
if(ctrlinfo & CI_TEAR) {
line = AddLine(line, MakeTearline(msg, buf));
line->type |= GLINE_TEAR;
}
if(ctrlinfo & CI_ORIG) {
sprintf(buf, " * Origin: %s", msg->origin);
line = AddLine(line, buf);
line->type |= GLINE_ORIG;
}
}
// ------------------------------------------------------------------

BIN
golded3/ged2.ico Normal file

Binary file not shown.

3
golded3/gedcyg.rc Normal file
View File

@ -0,0 +1,3 @@
#define ICON_1 1
ICON_1 ICON "gedw.ico"

3
golded3/gedemx.rc Normal file
View File

@ -0,0 +1,3 @@
#include <os2.h>
ICON 1 PRELOAD ged2.ico

455
golded3/gedoit.cpp Normal file
View File

@ -0,0 +1,455 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Various major job handling funcs
// ------------------------------------------------------------------
#include <golded.h>
#include <gutlclip.h>
// ------------------------------------------------------------------
static FILE* prnfp;
static int prnmargin;
static int prnheader;
// ------------------------------------------------------------------
void SaveLines(int mode, const char* savefile, GMsg* msg, bool clip) {
int prn=NO;
char fnam[GMAXPATH];
char* prnacc;
if(mode == MODE_SAVE or mode == MODE_SAVENOCTRL)
prnacc = "wt";
else if(mode == MODE_APPEND) {
prnacc = "at";
mode = MODE_WRITE;
}
else
prnacc = "wt";
strcpy(fnam, "PRN");
if(mode == MODE_WRITE and streql(savefile, "\001PRN")) {
prn = YES;
#ifdef __UNIX__
if(prnfp == NULL)
prnfp = popen(fnam, "w");
#else
if(prnfp == NULL)
prnfp = fsopen(fnam, prnacc, CFG->sharemode);
#endif
}
else {
strcpy(fnam, savefile);
strschg_environ(fnam);
prnfp = fsopen(fnam, prnacc, CFG->sharemode);
}
int lines=0;
if(prnfp) {
if(mode == MODE_WRITE) {
if(prnheader)
DispHeader(msg, prn, prnfp, prnmargin);
if(prn)
lines = 6;
}
int n = 0;
Line** lin = msg->line;
if(lin and not (prnheader & WRITE_ONLY_HEADER)) {
Line* line = lin[n];
while(line) {
if(line->text) {
uint lineisctrl = line->type & (GLINE_TEAR|GLINE_ORIG|GLINE_KLUDGE);
if(not ((mode == MODE_SAVENOCTRL) and lineisctrl)) {
char* ptr = line->text;
while(*ptr) {
if(mode == MODE_WRITE) {
// Replace control codes, except the ANSI escape code
if(*ptr < ' ') {
// only allow ESC in file write
if(prn or (*ptr != '\x1B')) {
*ptr = (*ptr == CTRL_A) ? '@' : '.';
}
}
}
ptr++;
}
ptr = line->text;
fwrite(ptr, strlen(ptr), 1, prnfp);
if(mode == MODE_NEW) {
if(EDIT->HardLines()) {
if(line->type & GLINE_HARD) {
if(not ((line->type & (GLINE_TEAR|GLINE_ORIG|GLINE_KLUDGE|GLINE_QUOT)) or strblank(ptr))) {
fwrite(EDIT->HardLine(), strlen(EDIT->HardLine()), 1, prnfp);
}
}
}
}
fwrite(prn ? NL : "\n", prn ? sizeof(NL) : 1, 1, prnfp);
if(prn) {
lines++;
if(lines%CFG->printlength == 0 and CFG->switches.get(printformfeed)) {
fwrite("\f", 1, 1, prnfp);
}
}
}
}
line = lin[++n];
}
}
// Add an empty line and formfeed at the bottom
if(mode == MODE_WRITE) {
fwrite(prn ? NL : "\n", prn ? sizeof(NL) : 1, 1, prnfp);
}
// Add formfeed if requested
if((prn and CFG->switches.get(printformfeed)) or
(not prn and not clip and CFG->switches.get(formfeedseparator))) {
fwrite("\f", 1, 1, prnfp);
}
if(not prn)
fclose(prnfp);
}
else {
char buf[256];
sprintf(buf, LNG->CouldNotOpen, fnam);
w_info(buf);
waitkeyt(10000);
w_info(NULL);
}
}
// ------------------------------------------------------------------
void WriteMsgs(GMsg* msg) {
if(AA->Msgn.Tags() == 0)
return;
GFTRK("WriteMsgs");
char buf[256];
char fname[GMAXPATH], ofname[GMAXPATH];
int overwrite = NO;
prnfp = NULL;
GMenuDomarks MenuDomarks;
int source = AA->Mark.Count() ? MenuDomarks.Run(LNG->Write) : WRITE_CURRENT;
if(source != WRITE_QUIT) {
GMenuWriteMsg MenuWriteMsg;
int target = MenuWriteMsg.Run();
if(target != WRITE_QUIT) {
prnheader = (target & (WRITE_NO_HEADER|WRITE_ONLY_HEADER)) ^ WRITE_NO_HEADER;
if(target & WRITE_PRINTER)
prnmargin = CFG->printmargin;
else
prnmargin = 79;
if(source == WRITE_MARKED) {
if(target & WRITE_FILE) {
do {
overwrite = NO;
strcpy(CFG->outputfile, AA->Outputfile());
if(not edit_pathname(CFG->outputfile, sizeof(Path), LNG->WriteMsgs, H_WriteMessage))
goto Finish;
if(is_dir(CFG->outputfile)) {
AddBackslash(CFG->outputfile);
strcat(CFG->outputfile, "golded.txt");
}
AA->SetOutputfile(CFG->outputfile);
w_infof(" %s ", AA->Outputfile());
if(stricmp(AA->Outputfile(), "PRN") and strnicmp(AA->Outputfile(), "LPT", 3))
if(fexist(AA->Outputfile())) {
GMenuOverwrite MenuOverwrite;
overwrite = MenuOverwrite.Run();
}
} while(overwrite == -1);
}
else if(target & WRITE_PRINTER) {
#ifdef __UNIX__
prnfp = popen(CFG->printdevice, "w");
#else
prnfp = fsopen(CFG->printdevice, "wt", CFG->sharemode);
#endif
if(prnfp)
fwrite(CFG->printinit+1, CFG->printinit[0], 1, prnfp);
}
else if(target & WRITE_CLIPBRD) {
overwrite = YES;
strcpy(ofname, AA->Outputfile());
mktemp(strcpy(fname, AddPath(CFG->goldpath, "GDXXXXXX")));
AA->SetOutputfile(fname);
}
w_info(NULL);
w_progress(MODE_NEW, C_INFOW, 0, AA->Mark.Count(), LNG->Writing);
for(uint n=0; n<AA->Mark.Count(); n++) {
if(overwrite and n)
overwrite = NO; // Overwrite only the first time
if(kbxhit()) {
if(kbxget() == Key_Esc) {
HandleGEvent(EVTT_JOBFAILED);
break;
}
}
update_statuslinef(LNG->WritingMsg, n+1, AA->Mark.Count());
w_progress(MODE_UPDATE, C_INFOW, n+1, AA->Mark.Count(), LNG->Writing);
AA->LoadMsg(msg, AA->Mark[n], prnmargin);
if(target & WRITE_PRINTER) {
if(prnfp)
SaveLines(MODE_WRITE, "\001PRN", msg);
}
else {
SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, AA->Outputfile(), msg, (target & WRITE_CLIPBRD) ? true : false);
}
}
if(prnfp)
fwrite(CFG->printreset+1, CFG->printreset[0], 1, prnfp);
if(target & WRITE_CLIPBRD) {
AA->SetOutputfile(ofname);
gclipbrd clipbrd;
gfile fp;
if(fp.fopen(fname, "rb")) {
long len = fp.filelength();
char* buf = (char*) throw_malloc(len+1);
buf[len] = NUL;
fp.fread(buf, 1, len);
clipbrd.writeclipbrd(buf);
throw_free(buf);
fp.close();
}
remove(fname);
}
w_progress(MODE_QUIT, 0, 0, 0, NULL);
}
else if(source == WRITE_CURRENT) {
if(target & WRITE_FILE) {
do {
overwrite = NO;
strcpy(CFG->outputfile, AA->Outputfile());
if(edit_pathname(CFG->outputfile, sizeof(Path), LNG->WriteMsgs, H_WriteMessage)) {
if(is_dir(CFG->outputfile)) {
AddBackslash(CFG->outputfile);
strcat(CFG->outputfile, "golded.txt");
}
AA->SetOutputfile(CFG->outputfile);
w_infof(" %s ", AA->Outputfile());
if(stricmp(AA->Outputfile(), "PRN") and strnicmp(AA->Outputfile(), "LPT", 3)) {
if(fexist(AA->Outputfile())) {
GMenuOverwrite MenuOverwrite;
overwrite = MenuOverwrite.Run();
if(overwrite == -1) // Escape was hit
continue;
}
}
sprintf(buf, LNG->WritingFile, AA->Outputfile());
w_info(buf);
AA->LoadMsg(msg, msg->msgno, prnmargin);
SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, AA->Outputfile(), msg);
w_info(NULL);
}
} while(overwrite == -1);
}
else if(target & WRITE_PRINTER) {
w_info(LNG->WritingPRN);
AA->LoadMsg(msg, msg->msgno, prnmargin);
#ifdef __UNIX__
prnfp = popen(CFG->printdevice, "w");
#else
prnfp = fsopen(CFG->printdevice, "wt", CFG->sharemode);
#endif
if(prnfp) {
fwrite(CFG->printinit+1, CFG->printinit[0], 1, prnfp);
SaveLines(MODE_WRITE, "\001PRN", msg);
fwrite(CFG->printreset+1, CFG->printreset[0], 1, prnfp);
}
w_info(NULL);
}
else if(target & WRITE_CLIPBRD) {
w_info(LNG->Wait);
mktemp(strcpy(fname, AddPath(CFG->goldpath, "GDXXXXXX")));
AA->LoadMsg(msg, msg->msgno, prnmargin);
SaveLines(MODE_WRITE, fname, msg, true);
gclipbrd clipbrd;
gfile fp;
if(fp.fopen(fname, "rb")) {
long len = fp.filelength();
char* buf = (char*) throw_malloc(len+1);
buf[len] = NUL;
fp.fread(buf, 1, len);
clipbrd.writeclipbrd(buf);
throw_free(buf);
fp.close();
}
remove(fname);
w_info(NULL);
}
}
}
}
Finish:
w_info(NULL);
if(prnfp) {
#ifdef __UNIX__
pclose(prnfp);
#else
fclose(prnfp);
#endif
prnfp = NULL;
}
GFTRK(NULL);
}
// ------------------------------------------------------------------
void WriteMsg(GMsg* msg) {
if(AA->Msgn.Count())
WriteMsgs(msg);
}
// ------------------------------------------------------------------
// Get name of current quotebuffer filename
char* GetCurrQuotebuf(char* quotebuf) {
if(*AA->Quotebuffile()) {
strcpy(quotebuf, AA->Quotebuffile());
MakePathname(quotebuf, CFG->goldpath, quotebuf);
}
else {
if(AA->isezycom())
sprintf(quotebuf, "%sgld%05u.qbf", CFG->ezycom.msgbasepath, AA->board());
else if(AA->isfido())
sprintf(quotebuf, "%s%s", AA->path(), "golded.qbf");
else if(AA->isgoldbase())
sprintf(quotebuf, "%sgoldg%03u.qbf", CFG->goldbasepath, AA->board());
else if(AA->ishudson())
sprintf(quotebuf, "%sgoldh%03u.qbf", CFG->hudsonpath, AA->board());
else
sprintf(quotebuf, "%s%s", AA->path(), ".qbf");
}
return quotebuf;
}
// ------------------------------------------------------------------
void QuoteBuf(GMsg* msg) {
if(AA->Msgn.Count()) {
Path quotebuf;
char openmode[4];
TemplateToText(MODE_QUOTEBUF, msg, msg, AA->Tpl(), CurrArea);
msg->attr.tou1();
msg->TextToLines(-CFG->quotemargin);
msg->attr.tou0();
msg->charsetlevel = LoadCharset(CFG->xlatlocalset, CFG->xlatlocalset);
msg->LinesToText();
GetCurrQuotebuf(quotebuf);
w_infof(" %s ", quotebuf);
switch(CFG->quotebufmode) {
case QBUF_ASK:
*openmode = NUL;
if(fexist(quotebuf)) {
GMenuOverwrite MenuOverwrite;
switch(MenuOverwrite.Run()) {
case true:
strcpy(openmode, "wt");
break;
case false:
strcpy(openmode, "at");
break;
default:
*openmode = NUL;
}
}
else {
strcpy(openmode, "wt");
}
break;
case QBUF_APPEND:
strcpy(openmode, "at");
break;
case QBUF_OVERWRITE:
strcpy(openmode, "wt");
break;
}
if(*openmode) {
FILE* fp = fsopen(quotebuf, openmode, CFG->sharemode);
if(fp) {
strchg(msg->txt, 0x0D, 0x0A);
fputs(msg->txt, fp);
fclose(fp);
}
HandleGEvent(EVTT_JOBDONE);
waitkeyt(1000);
}
w_info(NULL);
}
}
// ------------------------------------------------------------------

499
golded3/gedoss.cpp Normal file
View File

@ -0,0 +1,499 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// DOS Shell, cleanup, errorhandling etc.
// ------------------------------------------------------------------
#include <golded.h>
#include <gutlos.h>
#include <gmoprot.h>
#ifdef __UNIX__
#include <gkbdunix.h>
#endif
// ------------------------------------------------------------------
extern GPickArealist* PickArealist;
extern bool in_arealist;
// ------------------------------------------------------------------
// Clean up the screen, memory and files before exiting to DOS
void Cleanup(void) {
if(CFG) {
if(CFG->switches.get(areakeeplast) and startupscan_success)
AL.WriteGoldLast();
#ifndef GMB_NOXBBS
if(AL.msgbases & MT_ADEPTXBBS)
XbbsExit();
#endif
#ifndef GMB_NOEZY
if(AL.msgbases & MT_EZYCOM)
EzycomExit();
#endif
if(AL.msgbases & MT_FIDO)
FidoExit();
#ifndef GMB_NOGOLD
if(AL.msgbases & MT_GOLDBASE)
GoldExit();
#endif
#ifndef GMB_NOHUDS
if(AL.msgbases & MT_HUDSON)
HudsExit();
#endif
#ifndef GMB_NOJAM
if(AL.msgbases & MT_JAM)
JamExit();
#endif
#ifndef GMB_NOPCB
if(AL.msgbases & MT_PCBOARD)
PcbExit();
#endif
#ifndef GMB_NOSQSH
if(AL.msgbases & MT_SQUISH)
SquishExit();
#endif
#ifndef GMB_NOWCAT
if(AL.msgbases & MT_WILDCAT)
WCatExit();
#endif
#ifndef GMB_NOSMB
if(AL.msgbases & MT_SMB)
SMBExit();
#endif
SearchExit();
// Free area data
AL.Reset();
// Free various lists
CFG->addressmacro.clear();
CFG->aka.clear();
CFG->akamatch.clear();
CFG->event.clear();
CFG->externutil.clear();
CFG->filealias.clear();
CFG->frqext.clear();
CFG->frqnodemap.clear();
CFG->kludge.clear();
CFG->mailinglist.clear();
CFG->mappath.clear();
CFG->origin.clear();
CFG->robotname.clear();
CFG->tagline.clear();
CFG->tpl.clear();
CFG->twitname.clear();
CFG->twitsubj.clear();
CFG->username.clear();
CFG->xlatcharset.clear();
CFG->xlatescset.clear();
CFG->cmdkey.clear();
CFG->macro.clear();
// Free misc data
throw_xrelease(CharTable);
throw_xrelease(CompTable);
throw_xrelease(MNETable);
throw_xrelease(I51Table);
throw_delete(QWK);
if(errorlevel != EXIT_CFGERR) {
if(netpost)
TouchFile(AddPath(CFG->areapath, CFG->semaphore.netscan));
if(echopost)
TouchFile(AddPath(CFG->areapath, CFG->semaphore.echoscan));
}
// Reset border color
if(C_BACKB != 0)
gvid->setoverscan(gvid->orig.color.overscan);
wcloseall(); // Close all windows
if(in_arealist)
PickArealist->close_all(); // Unlink hidden area windows
whelpundef(); // Disengage the help system
kbclear(); // Clear CXL keyboard buffer
freonkey(); // Free all onkeys (macros)
FreePastebuf(); // Free the internal editor cut'n'paste buffer
#if not defined(__UNIX__) and not defined(__USE_NCURSES__)
if(CFG->screenpalette[16])
gvid->setpalette(gvid->orig.color.palette);
if(gvid->curr.screen.mode != gvid->orig.screen.mode)
gvid->setmode(gvid->orig.screen.mode);
if(gvid->curr.screen.rows != gvid->orig.screen.rows)
gvid->setrows(gvid->orig.screen.rows);
if(oldscreen) {
vrestore(oldscreen);
throw_xrelease(oldscreen);
}
if(CFG->intensecolors)
gvid->setintensity(gvid->orig.color.intensity);
vcurset(gvid->orig.cursor.start, gvid->orig.cursor.end);
#endif
#ifndef __WIN32__
vposset(gvid->orig.cursor.row, 0);
vputx(gvid->orig.cursor.row, 0, gvid->orig.color.textattr, ' ', gvid->orig.screen.columns);
#endif
vposset(gvid->orig.cursor.row-1, 0);
vcurshow();
}
throw_xdelete(BodyView);
throw_xdelete(HeaderView);
throw_xdelete(gvid);
int smax = MinV((int)GLOG_STORELINES, LOG.storelines);
for(int s=0; s<smax; s++)
cout << LOG.storeline[s] << endl;
if(LOG.storelines > GLOG_STORELINES)
cout << "(See also " << CFG->logfile << ")" << endl;
if(errorlevel > EXIT_NONAME)
MakeNoise(SND_S_O_S);
#if defined(GUTLOS_FUNCS)
g_deinit_os();
#endif
// Back to default Ctrl-Break handler
signal(SIGINT, SIG_DFL);
}
// ------------------------------------------------------------------
// Multipurpose DOS shell function
int ShellToDos(char* command, char* message, int cls, int cursor, int swap, int pause) {
NW(swap);
int error = 0;
#if defined(GUTLOS_FUNCS)
char ge_temptitle[GMAXTITLE];
#endif
#ifndef __UNIX__
if(strlen(command) > 125) {
w_info(" Warning: Command line longer than 125 characters! ");
waitkeyt(10000);
w_info(NULL);
}
#endif
// Put up a wait window
if(shellvid)
w_info(LNG->Wait);
#if defined(GUTLOS_FUNCS)
g_get_ostitle_name(ge_temptitle);
g_set_ostitle_name("OS Shell",0);
#endif
// Close msgbase files
int _wasopen = AA->isopen();
if(_wasopen)
AA->Suspend();
HandleGEvent(EVTT_DOSSHELL);
// Change the prompt
#ifndef __UNIX__
static char prompt[256];
static char oldprompt[256];
if(CFG->switches.get(dosprompt)) {
#ifdef __DJGPP__
const char* p = getenv("PROMPT");
if(p) {
strcpy(oldprompt, p);
strcpy(stpcpy(prompt, LNG->Prompt), p);
setenv("PROMPT", prompt, true);
}
#else
int envn = 0;
while(environ[envn] and *environ[envn]) {
if(strnieql(environ[envn], "PROMPT=", 7)) {
strcpy(oldprompt, environ[envn]);
sprintf(prompt, "PROMPT=%s%s", LNG->Prompt, *oldprompt ? oldprompt+7 : "");
environ[envn] = prompt;
break;
}
envn++;
}
#endif
}
#endif
// Store the screen
vatch* scrnbuf = vsave();
// Store current drive/dir
Path orgdir;
getcwd(orgdir, sizeof(Path));
// Set cursor position
if(gvid->curr.screen.rows != gvid->orig.screen.rows)
gvid->setrows(gvid->orig.screen.rows);
if(gvid->curr.screen.mode != gvid->orig.screen.mode)
gvid->setmode(gvid->orig.screen.mode);
// Clear screen
if(cls)
vclrscr(cls);
// Reset border color
if(C_BACKB != 0)
gvid->setoverscan(gvid->orig.color.overscan);
// Turn on the blinking attributes
gvid->setintensity(gvid->orig.color.intensity);
// Restore original palette during the shell
if(CFG->screenpalette[16])
gvid->setpalette(gvid->orig.color.palette);
#ifdef __UNIX__
gkbd_tty_reset();
#endif
#ifdef __USE_NCURSES__
savetty();
reset_shell_mode();
#endif
// Write message on screen
if(*message)
puts(message);
// Turn on cursor
int yy, xx;
if(cursor) {
vposget(&yy, &xx);
vcurset(gvid->orig.cursor.start, gvid->orig.cursor.end);
vcurshow();
}
HandleGEvent(EVTT_BREAKLOOP);
// Shell return value
int status = -1;
// Shell using the regular RTL function
#ifndef __CYGWIN__
status = system(command);
#else
// Get executable and parameters
char* _arg_v[3];
char* _pars = "";
char _xfn[256] = ""; // Call command interpreter
if(strnieql(command, "/c", 2))
_pars = strskip_wht(command+2);
else {
_pars = strpbrk(command, " \t");
if(_pars) {
++_pars++;
strxcpy(_xfn, command, _pars-command);
_pars = strskip_wht(_pars);
}
else
_xfn = command;
}
_arg_v[0] = _xfn;
_arg_v[1] = _pars;
_arg_v[2] = NULL;
status = spawnvpe(P_WAIT, _xfn, _arg_v, environ);
#endif
if(status == -1)
error = errno;
if(status != -1)
status = 0;
// Restore keyboard settings
gkbd.Init();
#ifdef __USE_NCURSES__
clearok(stdscr, TRUE);
resetty();
#endif
// Pause if needed
if(pause) {
if((pause > 0) or (status != 0))
kbxget();
}
// Restore current directory
gchdir(orgdir);
// Restore video mode and rows
if(CFG->screensize > 0xFF)
gvid->setmode(CFG->screensize >> 8);
else if(CFG->screensize)
gvid->setrows(CFG->screensize);
// Restore cursor position and form
if(cursor) {
vposset(yy+1, xx);
vcurhide();
}
// Restore screen
if(scrnbuf) {
vrestore(scrnbuf);
throw_xrelease(scrnbuf);
} else
vclrscr();
// Restore screen intensity
gvid->setintensity(CFG->intensecolors);
// Restore border color
if(C_BACKB != 0)
gvid->setoverscan(C_BACKB);
// Set palette if changes were specified
if(CFG->screenpalette[16])
gvid->setpalette(CFG->screenpalette);
// Restore prompt
#ifndef __UNIX__
if(CFG->switches.get(dosprompt)) {
#ifdef __DJGPP__
setenv("PROMPT", oldprompt, true);
#else
int envn = 0;
while(environ[envn] and *environ[envn]) {
if(strnieql(environ[envn], "PROMPT=", 7)) {
environ[envn] = oldprompt;
break;
}
envn++;
}
#endif
}
#endif
// Re-open msgbase
if(_wasopen)
AA->Resume();
// Remove the wait window
if(shellvid)
w_info(NULL);
// Popup error message
if(error) {
switch(errno) {
case E2BIG: w_info("Argument list too long!"); break;
case EACCES: w_info("Permission denied!"); break;
case EAGAIN: w_info("Ressource temporarily unavailable!"); break;
case EBADF: w_info("Bad file descriptor!"); break;
case EBUSY: w_info("Resource busy!"); break;
case ECHILD: w_info("No child processes!"); break;
case EEXIST: w_info("File exists!"); break;
case EFAULT: w_info("Bad address!"); break;
case EFBIG: w_info("File too large!"); break;
case EINTR: w_info("Interrupted system call!"); break;
case EINVAL: w_info("Invalid argument!"); break;
case EISDIR: w_info("Is a directory!"); break;
case EMFILE: w_info("Too many open files!"); break;
case ENFILE: w_info("Too many open files in system!"); break;
case ENOENT: w_info("No such file or directory!"); break;
case ENOEXEC: w_info("Unable to execute file!"); break;
case ENOMEM: w_info("Not enough memory!"); break;
default:
w_info("error during shelling");
}
waitkeyt(10000);
w_info(NULL);
}
// Reset tick values to avoid triggering screenblanker or timeout
gkbdtickpressreset();
gkbdtickvaluereset();
#if defined(GUTLOS_FUNCS)
g_set_ostitle_name(ge_temptitle, 1);
g_set_osicon();
#endif
return status;
}
// ------------------------------------------------------------------
// Error exit function
void ErrorExit(int type) {
static int in_error_exit = false;
if(not in_error_exit++) {
error_exit = type;
if(type) {
HandleGEvent(EVTT_ERRORFATAL);
if(_in_editor) {
LOG.printf("+ TIP: If you were writing a msg and want to recover it,");
LOG.printf("+ try looking in the %s file.", AddPath(CFG->goldpath, EDIT->File()));
}
// Dump the function tracker log
#if defined(GFTRK_ENABLE)
__gftrk_log();
#endif
if(type != 9)
errorlevel = EXIT_ERRORS;
else if(type == 5)
errorlevel = 100;
else
errorlevel = EXIT_CFGERR;
exit(errorlevel);
}
exit(EXIT_OK);
}
}
// ------------------------------------------------------------------

BIN
golded3/gedw.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

2740
golded3/geedit.cpp Normal file

File diff suppressed because it is too large Load Diff

421
golded3/geedit.h Normal file
View File

@ -0,0 +1,421 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// The Internal Editor (IE).
// ------------------------------------------------------------------
#ifdef __GNUG__
#pragma interface "geedit.h"
#endif
// ------------------------------------------------------------------
// Screen coordinate models
// ------------------------------------------------------------------
//
// 00 ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 01
// 01 Msg# : 02
// 02 From : 03
// 03 To : 04
// 04 Subj : 05
// 05 ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 06
// 06 00 EDIT_MINROW 07 EDIT_MIN_ROW
// 07 01 08
// 08 02 09
// 09 03 10
// 10 04 11
// 11 05 12
// 12 06 13
// 13 07 14
// 14 08 15
// 15 09 16
// 16 10 17
// 17 11 18
// 18 12 19
// 19 13 10
// 10 14 21
// 21 15 22
// 22 16 23
// 23 17 EDIT_MAXROW 24 EDIT_MAX_ROW
// 24 ÛGoldED xxxx (statusline) 25
// ³ ³ ³
// ³ ³ ÀÄÄÄÄ one-based old-style coord
// ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ editor window corrdinates
// ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ actual screen coordinates
//
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// Defines
#define EDIT_BUFLEN 256
#define EDIT_PARABUFLEN 2048
#define EDIT_UNDO_CHAR 0x00000010U
#define EDIT_UNDO_INS_CHAR 0x00000011U
#define EDIT_UNDO_DEL_CHAR 0x00000012U
#define EDIT_UNDO_OVR_CHAR 0x00000014U
#define EDIT_UNDO_TEXT 0x00001000U
#define EDIT_UNDO_DEL_TEXT 0x00001100U
#define EDIT_UNDO_CUT_TEXT 0x00001200U
#define EDIT_UNDO_INS_TEXT 0x00001400U
#define EDIT_UNDO_WRAP_TEXT 0x00001800U
#define EDIT_UNDO_LINE 0x00100000U
#define EDIT_UNDO_DEL_LINE 0x00110000U
#define EDIT_UNDO_NEW_LINE 0x00120000U
#define EDIT_UNDO_PUSH_LINE 0x00140000U
#define EDIT_UNDO_POP_LINE 0x00180000U
#define EDIT_UNDO_ORPHAN_LINE 0x00190000U
#define EDIT_UNDO_VOID 0x00000000U
#define EDIT_UNDO_TYPE 0x00101010U
#define EDIT_UNDO_ACTION 0x001F1F1FU
#define LAST_LINE 0x20000000U
#define PREV_LINE 0x40000000U
#define BATCH_MODE 0x80000000U
#define NO_VALUE 0xFFFFFFFFU
// ------------------------------------------------------------------
// Globals
extern int CFG__editquotewrap;
extern Line* Edit__killbuf;
extern Line* Edit__pastebuf;
extern Path Edit__exportfilename;
// ------------------------------------------------------------------
// Reality check define and function
#ifdef NDEBUG
#define _test_halt(__t)
#define _test_haltab(__t, __a, __b)
#else
#define _test_halt(__t) if(__t) { debugtest(#__t, 0, 0, __FILE__, __LINE__, false); }
#define _test_haltab(__t, __a, __b) if(__t) { debugtest(#__t, __a, __b, __FILE__, __LINE__, true); }
#endif
// ------------------------------------------------------------------
// Undo data structures
class text_item {
public:
uint col; // Begining offset in the .text string
uint len; // Text length
__extension__ char text[0]; // Text string itself
text_item(uint __col, uint __len) : col(__col), len(__len) { }
void* operator new(size_t size, uint text_len = 0) { return malloc(sizeof(text_item) + size + text_len); }
void operator delete(void* ptr) { free(ptr); }
};
// ----------------------------------------------------------------
union data_rec {
text_item* text_ptr;
Line* line_ptr;
void* void_ptr;
char char_int;
};
struct col_rec {
uint num;
uint sav;
};
// ----------------------------------------------------------------
class UndoItem {
static UndoItem** last_item;
friend class UndoStack;
public:
UndoItem* prev;
Line* line; // Cursor line
col_rec col; // Cursor column
uint pcol; // After undo move cursor to pcol, prow
uint prow; //
uint action; // Undo action
data_rec data; // Undo data
UndoItem() { this->prev = *last_item; }
~UndoItem() { *last_item = this->prev; }
};
// ----------------------------------------------------------------
class IEclass;
class UndoStack {
IEclass* editor;
uint& row;
uint& col;
uint& pcol;
uint& prow;
uint& minrow;
uint& maxrow;
uint& thisrow;
Line*& currline;
bool& undo_ready;
public:
UndoItem* last_item;
bool undo_enabled;
UndoStack(IEclass* this_editor);
~UndoStack();
bool FixPushLine(Line* __line);
void PushItem(uint action, Line* __line = NULL, uint __col = NO_VALUE, uint __len = NO_VALUE);
void PlayItem();
};
// ------------------------------------------------------------------
// Internal Editor Class
class IEclass : public Container {
public:
gwindow editwin; // window
protected:
// ----------------------------------------------------------------
// Editor window data
int win_mincol; // First column
int win_minrow; // First row
int win_maxcol; // Last column
int win_maxrow; // Last row
int win_border; // Border type
int win_hasborder; // 1 == window has a border, 0 == no border
// ----------------------------------------------------------------
// Window-relative minimum/maximum values
uint mincol;
uint minrow;
uint maxcol;
uint maxrow;
// ----------------------------------------------------------------
// Cursor coordinates
uint col;
uint row;
uint pcol;
uint prow;
uint ccol;
uint crow;
// ----------------------------------------------------------------
// Undo stuff
friend class UndoStack;
UndoStack* Undo;
long batch_mode;
bool undo_ready;
// ----------------------------------------------------------------
// Misc.
int chartyped;
Line* currline;
int done;
int insert;
int marginquotes;
int margintext;
int msgmode;
GMsg* msgptr;
int quitnow;
uint thisrow;
char* unfinished;
int blockcol;
int selecting;
// ----------------------------------------------------------------
// Internal helper functions
void clreol (int __col=-1, int __row=-1);
void cursoroff ();
void cursoron ();
void deleteline (bool zapquotesbelow = false);
int dispchar (vchar __ch, int attr=-1);
void dispins ();
void displine (Line* __line, uint __row);
void dispstring (char* __string, uint __row, int attr=-1, Line* line=NULL);
int downoneline (uint __row);
void editexport (Line* __exportline, int __endat);
Line* findanchor ();
Line* findfirstline ();
Line* findtopline ();
void getthisrow (Line* __currline);
void gotorowcol (uint __col, uint __row);
int handlekey (gkey __key);
void editimport (Line* __line, char* __filename, bool imptxt = false);
void imptxt (char* __filename, bool imptxt = false);
void insertchar (char __ch);
Line* insertlinebelow (Line* __currline, char* __text = NULL, long __batch_mode = 0);
int isempty (Line* __line=NULL);
void killkillbuf ();
void killpastebuf ();
void prints (int wrow, int wcol, int atr, char* str);
int reflowok (char* __qstr);
void refresh (Line* __currline, uint __row);
void savefile (int __status);
void scrolldown (int __scol, int __srow, int __ecol, int __erow, int __lines=1);
void scrollup (int __scol, int __srow, int __ecol, int __erow, int __lines=1);
void setcolor (Line* __line);
void setlinetype (Line* __line);
void statusline ();
void strdelchr (char* __string, uint __position);
void strinschr (char*& __string, char __ch, uint __position);
void windowclose ();
void windowopen ();
Line* wrapit (Line** __currline, uint* __curr_col, uint* __curr_row, int __display=YES);
Line* wrapdel (Line** __currline, uint* __curr_col, uint* __curr_row, int __display=YES);
Line* wrapins (Line** __currline, uint* __curr_col, uint* __curr_row, int __display=YES);
#ifndef NDEBUG
void debugtest (char* __test, int __a, int __b, char* __file, int __line, int __values);
#endif
void Buf2Clip ();
void Clip2Buf ();
public:
// ----------------------------------------------------------------
// Constructor and destructor
IEclass(int __scol, int __ecol, int __srow, int __erow, int __border);
~IEclass();
// ----------------------------------------------------------------
// Function to start the editor
int Start(int __mode, uint* __position, GMsg* __msg);
// ----------------------------------------------------------------
// User key functions
void Abort ();
void AskExit ();
void BlockAnchor ();
void BlockCopy ();
void BlockCut (bool just_delete = false);
void BlockPaste ();
void BlockDel (Line* _anchor);
void ClearDeleteBuf ();
void ClearPasteBuf ();
void CopyAboveChar ();
void DelChar ();
void DeleteEOL ();
void DelLeft ();
void DelLine ();
void DelLtWord ();
void DelRtWord ();
void DosShell ();
void DupLine ();
void ExitMsg ();
void ExportText ();
void GoBegLine ();
void GoBotLine ();
void GoBotMsg ();
void GoDown ();
void GoEOL ();
void GoLeft ();
void GoPgDn ();
void GoPgUp ();
void GoRight ();
void GoTopLine ();
void GoTopMsg ();
void GoUp ();
void GoWordLeft ();
void GoWordRight ();
void Header ();
void ImportQuotebuf ();
void ImportText ();
void LoadFile ();
void LookupCursor ();
void LookupDest ();
void LookupOrig ();
void Newline ();
void QuitNow ();
void Reflow ();
void ReTab ();
void SaveFile ();
void SaveMsg ();
void Soundkill ();
void SpellCheck ();
void Tab ();
void ToggleCase ();
void ToggleInsert ();
void ToLower ();
void ToUpper ();
void UnDelete (bool before=true);
void ZapQuoteBelow ();
// ----------------------------------------------------------------
};
// ------------------------------------------------------------------
void Edit__killpastebuf(void);
inline void IEclass::killpastebuf() { Edit__killpastebuf(); }
// ------------------------------------------------------------------

1432
golded3/geedit2.cpp Normal file

File diff suppressed because it is too large Load Diff

110
golded3/geedit3.cpp Normal file
View File

@ -0,0 +1,110 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// OS/2 clipboard to/from edit paste buffer.
// ------------------------------------------------------------------
#include <golded.h>
#include <geedit.h>
#include <gutlclip.h>
void IEclass::Clip2Buf() {
gclipbrd clipbrd;
if(not clipbrd.openread())
return;
int tabsz = CFG->disptabsize ? CFG->disptabsize : 1;
__extension__ char spaces[tabsz+1];
memset(spaces, ' ', tabsz);
spaces[tabsz] = NUL;
// Allocate paragraph read buffer
char *buf = (char *)throw_malloc(EDIT_PARABUFLEN);
Line *__line = NULL;
Undo->undo_enabled = NO;
// Read paragraphs
while(clipbrd.read(buf, EDIT_PARABUFLEN-6)) {
// Replace tabs
char *ht = buf;
while((ht = strchr(ht, '\t')) != NULL) {
int rposn = ht-buf;
int rstart = rposn%tabsz+1;
*ht = ' ';
if(tabsz > rstart)
strins(spaces+rstart, buf, rposn);
}
// Copy the paragraph to the new line and retype it
Line* _newline = __line = insertlinebelow(__line, buf);
if(Edit__pastebuf == NULL)
Edit__pastebuf = _newline;
setlinetype(_newline);
// If the paragraph is longer than one line
uint _wrapmargin = (_newline->type & GLINE_QUOT) ? marginquotes : margintext;
if(strlen(_newline->text) >= _wrapmargin) {
// Wrap it
uint _tmpcol = 0;
uint _tmprow = 0;
_newline = wrapins(&_newline, &_tmpcol, &_tmprow, NO);
}
__line = _newline;
}
Undo->undo_enabled = YES;
throw_free(buf);
clipbrd.close();
}
void IEclass::Buf2Clip() {
gclipbrd clipbrd;
int buflen = 0;
Line *_bufline;
for(_bufline = Edit__pastebuf; _bufline; _bufline = _bufline->next)
buflen += strlen(_bufline->text) + 1;
char *clipdata = (char *)throw_malloc(buflen);
char *curptr = clipdata;
*curptr = NUL;
for(_bufline = Edit__pastebuf; _bufline; _bufline = _bufline->next) {
strcpy(curptr, _bufline->text);
if(*curptr) {
curptr += strlen(curptr) - 1;
if(*curptr == '\n') strcpy(curptr, "\r\n");
}
curptr += strlen(curptr);
}
clipbrd.writeclipbrd(clipdata);
throw_free(clipdata);
}

1002
golded3/gefile.cpp Normal file

File diff suppressed because it is too large Load Diff

173
golded3/gefind.cpp Normal file
View File

@ -0,0 +1,173 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Search functions.
// ------------------------------------------------------------------
#include <golded.h>
#include <gesrch.h>
// ------------------------------------------------------------------
void SearchExit() { }
// ------------------------------------------------------------------
void FindAll(GMsg* msg, int& topline, int& keyok) {
if(AA->Msgn.Count()) {
topline = 0;
AA->attr().hex0();
strcpy(CFG->searchfor, AA->Searchfor());
if(edit_string(CFG->searchfor, sizeof(INam), LNG->HeaderText, H_FindString)) {
AA->SetSearchfor(CFG->searchfor);
if(FindString(msg, AA->Searchfor(), GFIND_HDRTXT))
keyok = true;
}
}
}
// ------------------------------------------------------------------
void FindHdr(GMsg* msg, int& topline, int& keyok) {
if(AA->Msgn.Count()) {
topline = 0;
AA->attr().hex0();
strcpy(CFG->searchfor, AA->Searchfor());
if(edit_string(CFG->searchfor, sizeof(INam), LNG->HeaderOnly, H_FindString)) {
AA->SetSearchfor(CFG->searchfor);
if(FindString(msg, AA->Searchfor(), GFIND_HDR))
keyok = true;
}
}
}
// ------------------------------------------------------------------
bool SearchHighlight(const Line*, int, int, int) {
return false;
}
// ------------------------------------------------------------------
bool FindString(GMsg* msg, const char* prompt, int what) {
GFTRK("FindString");
static ulong lastfound = 0;
bool result = false;
bool breakloop = true;
golded_search_manager srchmgr;
srchmgr.prepare_from_string(prompt, what);
uint last = AA->lastread();
lastfound = AA->Msgn.CvtReln(AA->lastread());
w_progress(MODE_NEW, C_INFOW, AA->lastread(), AA->Msgn.Count(), LNG->AdvancedSearch);
ulong tmpmsgno;
int margin = CFG->dispmargin-(int)CFG->switches.get(disppagebar);
do {
update_statuslinef(LNG->ReadingMsg, AA->lastread(), AA->Msgn.Count());
w_progress(MODE_UPDATE, C_INFOW, AA->lastread(), AA->Msgn.Count(), LNG->AdvancedSearch);
if(AA->LoadMsg(msg, AA->Msgn.CvtReln(AA->lastread()), margin)) {
bool success;
// If hit, search again current mail without shortcircuit evaluation
success = srchmgr.search(msg, false, true);
if(success)
srchmgr.search(msg, false, false);
if((srchmgr.reverse ? not success : success) and (lastfound != msg->msgno)) {
bool istwitto, istwitsubj;
if(MsgIsTwit(msg, istwitto, istwitsubj) != TWIT_SKIP) {
HandleGEvent(EVTT_SEARCHSUCCESS);
lastfound = msg->msgno;
AA->set_lastread(AA->Msgn.ToReln(msg->msgno));
result = true;
breakloop = false;
break;
}
}
}
if(kbxhit() and (kbxget() == Key_Esc)) {
breakloop = false;
break;
}
tmpmsgno = msg->msgno;
switch(srchmgr.direction) {
case DIR_PREV:
if(AA->Msgn.ToReln(msg->msgno) > 1)
msg->msgno = AA->Msgn.CvtReln(AA->Msgn.ToReln(msg->msgno)-1);
else
msg->msgno = 0;
break;
case DIR_NEXT:
if(AA->Msgn.ToReln(msg->msgno) < AA->Msgn.Count())
msg->msgno = AA->Msgn.CvtReln(AA->Msgn.ToReln(msg->msgno)+1);
else
msg->msgno = 0;
break;
}
if(msg->msgno != 0)
AA->set_lastread(AA->Msgn.ToReln(msg->msgno));
} while((msg->msgno != 0) and (msg->msgno != tmpmsgno));
if(not result) {
HandleGEvent(EVTT_SEARCHFAILED);
AA->set_lastread(last);
}
w_progress(MODE_QUIT, 0, 0, 0, NULL);
if(breakloop)
HandleGEvent(EVTT_BREAKLOOP);
if(not result) {
w_info(LNG->NoMoreMatches);
waitkeyt(5000);
w_info(NULL);
}
GFTRK(NULL);
return result;
}
// ------------------------------------------------------------------

33
golded3/gefn.h Normal file
View File

@ -0,0 +1,33 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Standart filenames.
// ------------------------------------------------------------------
#ifndef __GEFN_H__
#define __GEFN_H__
#endif

290
golded3/geglob.cpp Normal file
View File

@ -0,0 +1,290 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Global data.
// ------------------------------------------------------------------
#include <golded.h>
#include <gcprot.h>
// ------------------------------------------------------------------
// Various global data
glog LOG;
gareafile* AFILE = NULL;
CfgGed* CFG = NULL;
LangGed* LNG = NULL;
NodeIxl* NODE = NULL;
Qwk* QWK = NULL;
GoldedCfgEdit* EDIT = NULL;
uint locpost=0, netpost=0, echopost=0;
Subj information = "";
Area* AA = NULL;
char m_title[80]; // Menu title string
int m_titlepos; // Menu title position
int m_titleattr; // Menu title color
char* tconv;
int AreaKeys = 0;
int ReadKeys = 0;
int ListKeys = 0;
int NodeKeys = 0;
int EditKeys = 0;
int FileKeys = 0;
list<CmdKey>::iterator AreaKey, ReadKey, ListKey, NodeKey, EditKey, FileKey;
int inforow = 18;
char goldmark = ' ';
int startecho = -1;
Echo stecho;
int fieldupd = 2; // State of field mode in winpdef()
int CurrArea = 0;
int OrigArea = 0;
Esc* MNETable = NULL;
Esc* I51Table = NULL;
Esc* CompTable = NULL;
Chs* CharTable = NULL;
EscTab* CompTP = NULL;
EscTab* I51TP = NULL;
EscTab* MNETP = NULL;
ChsTab* ChsTP = NULL;
bool quiet = true;
bool ignore = false;
int cfgerrors = 0;
bool veryverbose = false;
bool shellvid = true;
word* oldscreen = NULL;
bool disablesound = false;
int _in_editor = NO;
int _in_msglist = NO;
int savedirect = NO;
void(*SIGINT_OldHandler)(void) = NULL;
int arealistnumgrps = false;
int startupscan_success = false;
// ------------------------------------------------------------------
// 0 1 2 3 4 5 6 7 8 9 10 11
Win gold_color1[16] = {
{5, { 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0}, 2}, // Back 0
{5, { 31, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, 1}, // Stat 1
{0, { 15, 14, 14, 7, 12, 7, 7, 9, 7, 7, 7, 14}, 0}, // Brag 2
{0, { 7, 9, 14, 31, 15, 7, 7, 7, 7, 7, 7, 9}, 0}, // Area 3
{0, { 7, 7, 15, 14, 113, 8, 15, 79, 15, 15, 8, 7}, 5}, // Read 4
{0, { 7, 9, 14, 7, 15, 7, 15, 113, 7, 7, 7, 9}, 0}, // Head 5
{0, { 7, 12, 14, 31, 15, 8, 7, 7, 7, 7, 7, 12}, 0}, // Ask 6
{0, { 7, 12, 14, 31, 15, 8, 7, 2, 12, 15, 7, 12}, 0}, // Menu 7
{0, { 7, 14, 7, 79, 15, 7, 7, 7, 7, 7, 7, 14}, 0}, // Help 8
{3, { 7, 12, 14, 31, 15, 8, 7, 7, 7, 7, 7, 12}, 0}, // Cfg 9
{0, { 15, 12, 14, 7, 7, 7, 7, 7, 7, 7, 7, 12}, 0}, // Info 10
{3, { 7, 12, 14, 31, 15, 8, 7, 7, 7, 7, 7, 12}, 0}, // Cfgb 11
{0, { 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15}, 0}, // Style 12
{0, { 7, 7, 7, 7, 7, 7, 7, 8, 7, 7, 7, 7}, 0}, // Shad 13
{0, { 0, 0, 0, 0, 0, 0, 8, 15, 0, 0, 0, 0}, 0}, // Read2 14
};
// ------------------------------------------------------------------
// 0 1 2 3 4 5 6 7 8 9
Win gold_color2[16] = {
{5, { 240, 15, 7, 7, 7, 7, 7, 7, 7, 7, 7, 15}, 2}, // Back 0
{5, { 143, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, 1}, // Stat 1
{0, { 15, 14, 14, 7, 12, 7, 7, 9, 7, 7, 7, 14}, 0}, // Brag 2
{0, { 240, 241, 244, 143, 244, 7, 7, 7, 7, 7, 7, 241}, 0}, // Area 3
{0, { 241, 240, 242, 244, 64, 248, 240, 64, 240, 240, 248, 240}, 5}, // Read 4
{0, { 135, 142, 142, 135, 143, 7, 143, 64, 135, 135, 7, 142}, 0}, // Head 5
{0, { 224, 230, 232, 143, 228, 231, 7, 7, 7, 7, 7, 230}, 0}, // Ask 6
{0, { 112, 126, 116, 143, 126, 120, 117, 113, 125, 121, 7, 126}, 0}, // Menu 7
{0, { 135, 142, 7, 228, 143, 7, 7, 7, 7, 7, 7, 142}, 0}, // Help 8
{3, { 224, 230, 232, 143, 228, 231, 7, 7, 7, 7, 7, 230}, 0}, // Cfg 9
{0, { 15, 12, 14, 7, 7, 7, 7, 7, 7, 7, 7, 12}, 0}, // Info 10
{3, { 240, 241, 244, 143, 244, 7, 7, 7, 7, 7, 7, 241}, 0}, // Cfgb 11
{0, { 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249, 249}, 0}, // Style 12
{0, { 7, 7, 7, 7, 7, 7, 7, 8, 7, 7, 7, 7}, 0}, // Shad 13
{0, { 0, 0, 0, 0, 0, 0, 248, 241, 0, 0, 0, 0}, 0}, // Read2 14
};
// ------------------------------------------------------------------
// 0 1 2 3 4 5 6 7 8 9
Win gold_mono1[16] = {
{5, { 15, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0}, 2}, // Back 0
{5, { 112, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, 1}, // Stat 1
{0, { 15, 7, 15, 7, 15, 7, 7, 7, 7, 7, 7, 7}, 0}, // Brag 2
{0, { 7, 7, 15, 112, 15, 7, 7, 7, 7, 7, 7, 7}, 0}, // Area 3
{0, { 7, 7, 15, 15, 112, 15, 7, 7, 7, 7, 15, 7}, 5}, // Read 4
{0, { 7, 7, 15, 7, 15, 7, 112, 15, 7, 7, 7, 7}, 0}, // Head 5
{0, { 112, 112, 112, 15, 15, 7, 7, 7, 7, 7, 7, 112}, 0}, // Ask 6
{0, { 7, 7, 112, 112, 15, 7, 15, 15, 15, 15, 7, 7}, 0}, // Menu 7
{0, { 112, 112, 7, 15, 112, 7, 7, 7, 7, 7, 7, 112}, 0}, // Help 8
{3, { 7, 7, 112, 112, 15, 7, 7, 7, 7, 7, 7, 7}, 0}, // Cfg 9
{0, { 15, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, 0}, // Info A
{3, { 7, 7, 112, 112, 15, 7, 7, 7, 7, 7, 7, 7}, 0}, // Cfgb B
{0, { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, 0}, // Style C
{0, { 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7}, 0}, // Shad F
{0, { 0, 0, 0, 0, 0, 0, 7, 15, 0, 0, 0, 0}, 0}, // Read2 14
};
// ------------------------------------------------------------------
// Deallocate CFG at exit
static void CfgReset(void) {
throw_delete(QWK);
throw_delete(EDIT);
throw_delete(AFILE);
if(NODE)
throw_xrelease(NODE->nodelist);
throw_xrelease(NODE);
throw_delete(CFG);
}
// ------------------------------------------------------------------
// Assign default CFG values
void CfgInit() {
atexit(CfgReset);
CFG = new CfgGed;
throw_new(CFG);
NODE = (NodeIxl*)throw_calloc(1, sizeof(NodeIxl));
AFILE = new gareafile;
throw_new(AFILE);
EDIT = new GoldedCfgEdit;
throw_new(EDIT);
QWK = new Qwk;
throw_new(QWK);
LangInit();
}
// ------------------------------------------------------------------
// Assign default CFG values before reading the .CFG's
void CfgInit2() {
// ----------------------------------------------------------------
// Set some default robotnames
CfgRobotname("AreaFix, AreaMgr, FileFix, AreaLink, SqaFix, AllFix, SqaFixHost, Raid, GEcho");
// ----------------------------------------------------------------
// Set some default filerequest extensions
CfgFrqext(".ARC .ARJ .EXE .LHA .LZH .PAK .RUN .SDA .SDN .ZIP .ZOO .DOC .TXT .GIF .RAR .PNG .JPG .HA");
// ----------------------------------------------------------------
// Setup the standard beeping effects
static char Attention[] = "Attention PLAY ToYou";
CfgEvent(Attention);
static char EditComment[] = "EditComment PLAY ToYou";
CfgEvent(EditComment);
static char EndOfMsgs[] = "EndOfMsgs PLAY TheEnd";
CfgEvent(EndOfMsgs);
static char JobDone[] = "JobDone PLAY GotIt";
CfgEvent(JobDone);
static char JobFailed[] = "JobFailed PLAY TooBad";
CfgEvent(JobFailed);
static char MsgIsLocal[] = "MsgIsLocal PLAY ToYou";
CfgEvent(MsgIsLocal);
static char MsgToYou[] = "MsgToYou PLAY ToYou";
CfgEvent(MsgToYou);
static char SayBiBi[] = "SayBiBi PLAY SayBiBi";
CfgEvent(SayBiBi);
static char SearchFailed[] = "SearchFailed PLAY TooBad";
CfgEvent(SearchFailed);
static char SearchSuccess[] = "SearchSuccess PLAY GotIt";
CfgEvent(SearchSuccess);
// ----------------------------------------------------------------
}
// ------------------------------------------------------------------
int IsMacro(gkey key, int type) {
vector<Macro>::iterator m = CFG->macro.begin();
while(m != CFG->macro.end()) {
if((key == m->key) and (type == m->type))
return true;
m++;
}
return false;
}
// ------------------------------------------------------------------
int PlayMacro(gkey key, int type) {
vector<Macro>::iterator m = CFG->macro.begin();
while(m != CFG->macro.end()) {
if((key == m->key) and (type == m->type)) {
RunMacro(m);
return true;
}
m++;
}
return false;
}
// ------------------------------------------------------------------

193
golded3/geglob.h Normal file
View File

@ -0,0 +1,193 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Global data.
// ------------------------------------------------------------------
// ------------------------------------------------------------------
extern glog LOG;
extern gareafile* AFILE;
extern CfgGed* CFG;
extern LangGed* LNG;
extern NodeIxl* NODE;
extern Qwk* QWK;
extern GoldedCfgEdit* EDIT;
// GCCFGG.CPP
extern bool cfgingroup;
// GCKEYS.CPP
extern CmdKey DefaultKeyset[];
// GEAREA.CPP
extern int area_pos;
extern int area_width;
extern int marked_pos;
extern int marked_width;
extern const char marked_char;
extern int desc_pos;
extern int desc_width;
extern int count_pos;
extern int count_width;
extern int pmark_pos;
extern int pmark_width;
extern const char pmark_char;
extern int unread_pos;
extern int unread_width;
extern int changed_pos;
extern int changed_width;
extern const char changed_char;
extern int echoid_pos;
extern int echoid_width;
extern int groupid_pos;
extern int groupid_width;
// GEFILE.CPP
extern int fspecs;
extern int specfiles;
extern FileSpec* fspec;
// GEMENU.CPP
extern GMsg* MenuMsgPtr;
// GEPOST.CPP
extern uint position;
extern ulong msgcount;
// GEREAD.CPP
extern int reader_finished;
extern int reader_done;
extern int reader_topline;
extern int reader_keyok;
extern int reader_direction;
extern int reader_rcv_noise;
extern gkey reader_keycode;
extern GMsgHeaderView *HeaderView;
extern GMsgBodyView *BodyView;
// Other
extern uint locpost, netpost, echopost;
extern Subj information;
extern Area* AA;
extern char m_title[];
extern int m_titlepos;
extern int m_titleattr;
extern char* tconv;
extern int AreaKeys, ReadKeys, ListKeys, NodeKeys, EditKeys, FileKeys;
extern list<CmdKey>::iterator AreaKey, ReadKey, ListKey, NodeKey, EditKey, FileKey;
extern int inforow;
extern char goldmark;
extern int startecho;
extern Echo stecho;
extern int fieldupd;
extern int CurrArea;
extern int OrigArea;
extern Esc* MNETable;
extern Esc* I51Table;
extern Esc* CompTable;
extern Chs* CharTable;
extern EscTab* CompTP;
extern EscTab* I51TP;
extern EscTab* MNETP;
extern ChsTab* ChsTP;
//extern char gversion[];
extern bool quiet;
extern bool ignore;
extern int cfgerrors;
extern bool veryverbose;
extern bool shellvid;
extern word* oldscreen;
extern int keysread;
extern bool disablesound;
extern int _in_editor;
extern int _in_msglist;
extern int savedirect;
extern void(*SIGINT_OldHandler)(void);
extern bool cmdlinedebughg;
extern bool cmdlineimportsoup;
extern bool cmdlineoldkeyw;
extern int cmdlinesharemode;
extern Win gold_color1[];
extern Win gold_color2[];
extern Win gold_mono1[];
extern Echo area_maybe;
extern int blanked;
extern int startupscan_success;
// ------------------------------------------------------------------
// Global compile constants
extern const char* __gver_vendor_name__;
extern const char* __gver_vendor_fido__;
extern const char* __gver_vendor_email__;
extern const char* __gver_prename__;
extern const char* __gver_preshortname__;
extern const char* __gver_name__;
extern const char* __gver_shortname__;
extern const char* __gver_shortlogname__;
extern const char* __gver_postshortname__;
extern const char* __gver_postname__;
extern const char* __gver_platform__;
extern const char* __gver_shortplatform__;
extern const char* __gver_cfgext__;
extern const char* __gver_preversion__;
extern const char* __gver_postversion__;
extern int __gver_major__;
extern int __gver_minor__;
extern int __gver_release__;
extern const char* __gver_releasename__;
extern const char* __gver_date__;
extern const char* __gver_time__;
extern const char* __gver_longpid__;
extern const char* __gver_shortpid__;
// ------------------------------------------------------------------

545
golded3/gehdre.cpp Normal file
View File

@ -0,0 +1,545 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Header edit.
// ------------------------------------------------------------------
#include <golded.h>
#include <gwinput.h>
// ------------------------------------------------------------------
class GMsgHeaderEdit : public gwinput2 {
public:
enum {
id_from_name,
id_from_addr,
id_to_name,
id_to_addr,
id_subject
};
GMsgHeaderView &view;
GMsgHeaderEdit(GMsgHeaderView &v) : gwinput2(v.window), view(v) { msg = view.msg; }
GMsg* msg;
bool lookup;
bool handle_other_keys(uint& key);
bool validate();
};
// ------------------------------------------------------------------
bool GMsgHeaderEdit::handle_other_keys(uint& key) {
switch(key) {
case Key_F10:
vcurhide();
ChgAttrs(NO, msg);
lookup_addressbook(msg, get_field(id_to_name)->buf, get_field(id_to_addr)->buf, true);
ChgAttrs(YES, msg);
get_field(id_to_name)->draw();
get_field(id_to_addr)->draw();
current->update();
vcurshow();
break;
case Key_S_F10:
{
Addr addr,addr2;
INam buf;
field* p;
addr.set_all(65535u);
addr2.set_all(65535u);
addr.set(get_field(id_to_addr)->buf);
strcpy(buf, strtrim(get_field(id_to_name)->buf));
if(addr != addr2)
addr.make_string(buf);
addr2 = addr;
Lookup(msg, &addr, buf, -6, LNG->SelectDestNode);
vcurshow();
if(addr != addr2 and addr.valid()) {
p = get_field(id_to_addr);
addr.make_string(p->buf);
p->buf_end_pos = strlen(buf);
p->buf_pos = p->buf_end_pos;
if(current->id == id_to_addr)
p->update();
else
p->draw();
p = get_field(id_to_name);
strcpy(p->buf, buf);
if(current->id == id_to_name)
p->update();
else
p->draw();
}
}
return true;
default:
if(PlayMacro(key, 0))
return true;
}
return false;
}
// ------------------------------------------------------------------
bool set_to_address(GMsg* msg, gsetaddr* toname, gsetaddr* toaddr, gsetaddr* fromaddr, gsetaddr* subj, int pos, char* lng_lookup, bool lookup) {
INam buf, buf1, buf2;
char* ptr = toname->buf;
strcpy(buf, ptr);
if(not CFG->addressmacro.empty()) {
vector<AddrMacro>::iterator n;
for(n=CFG->addressmacro.begin(); n != CFG->addressmacro.end(); n++) {
if(strieql(buf, n->macro)) {
ptr = strcpy(buf1, n->name);
if(*buf1 == '@') {
// UUCP/INTERNET addressing
ptr = strchr(buf1, '/');
if(ptr) {
*ptr++ = NUL;
strcpy(msg->idest, ptr);
strcpy(msg->realto, buf1+1);
if(*AA->Internetgate().name) {
strcpy(msg->iaddr, ptr);
ptr = strcpy(buf1, AA->Internetgate().name);
}
else
strcpy(buf1, ptr);
}
else {
strcpy(msg->idest, buf1+1);
if(*AA->Internetgate().name) {
strcpy(msg->iaddr, buf1+1);
ptr = strcpy(buf1, AA->Internetgate().name);
}
else {
strcpy(buf2, buf1+1);
ptr = strcpy(buf1, buf2);
}
}
}
else if(AA->isinternet()) {
ParseInternetAddr(buf1, buf2, buf);
ptr = buf2;
strcpy(buf1, buf2);
strcpy(msg->idest, buf);
}
else {
*msg->iaddr = NUL;
*msg->realto = NUL;
}
strcpy(toname->buf, ptr);
toname->update = true;
strcpy(msg->to, buf1);
if(AA->isinternet()) {
strcpy(toaddr->buf, msg->idest);
if(n->addr.net)
msg->dest = msg->odest = n->addr;
else
msg->dest = msg->odest = AA->Internetgate().addr;
}
else {
n->addr.make_string(toaddr->buf);
}
toaddr->update = true;
if(*n->subj and subj) {
strcpy(subj->buf, n->subj);
subj->update = true;
}
AttrAdd(&msg->attr, &n->attr);
if(lookup or AA->isnet())
return false;
return true;
}
}
}
if(lookup_addressbook(msg, toname->buf, toaddr->buf, false)) {
if(lookup or AA->isnet())
return false;
return true;
}
// Internet gating
if(not AA->isinternet()) {
if(strchr(toname->buf, '@') and AA->Internetgate().addr.net) {
if(*AA->Internetgate().name) {
strcpy(msg->iaddr, toname->buf);
strcpy(msg->to, AA->Internetgate().name);
strcpy(toname->buf, msg->to);
toname->update = true;
}
AA->Internetgate().addr.make_string(toaddr->buf);
toaddr->update = true;
if(lookup or AA->isnet())
return false;
return true;
}
if(lookup) {
strcpy(buf1, toname->buf);
strcpy(buf2, msg->to);
if(strblank(toaddr->buf) or strblank(buf1) or strcmp(buf1, buf2)) {
if(strblank(toname->buf))
strcpy(buf, toaddr->buf);
else
strcpy(buf, toname->buf);
strtrim(buf);
if(*buf == NUL)
strcpy(buf, " ");
*msg->iaddr = NUL;
*msg->realto = NUL;
if(*buf) {
Addr addr;
addr.reset(fromaddr->buf); // Get the orig address to base lookup on
Lookup(msg, &addr, buf, pos, lng_lookup);
if(striinc("Sysop", buf) or strieql(AA->Whoto(), buf)) {
if(addr.net == 0) {
if(not AA->isnet())
return false;
return true;
}
}
int robotchk = false;
for(gstrarray::iterator n = CFG->robotname.begin(); n != CFG->robotname.end(); n++)
if(striinc(n->c_str(), buf)) {
robotchk = true;
break;
}
if(robotchk) {
EDIT->HardLines(false);
if(addr.net == 0)
return true;
}
if(addr.net) {
addr.make_string(toaddr->buf);
toaddr->update = true;
strcpy(msg->to, buf);
strcpy(toname->buf, buf);
toname->update = true;
return false;
}
else {
HandleGEvent(EVTT_SEARCHFAILED);
return true;
}
}
}
}
else {
if(strpbrk(buf, "*?")) {
if(CFG->switches.get(lookupuserbase)) {
if(AA->UserLookup(buf)) {
strcpy(msg->to, buf);
*msg->iaddr = NUL;
*msg->realto = NUL;
toname->update = true;
return true;
}
}
}
}
}
return true;
}
// ------------------------------------------------------------------
bool GMsgHeaderEdit::validate() {
if(current->id == id_to_name) {
field* ffromaddr = get_field(id_from_addr);
field* ftoaddr = get_field(id_to_addr);
field* fsubj = get_field(id_subject);
gsetaddr toname, toaddr, fromaddr, subj;
toname.buf = current->buf; toname.update = false;
toaddr.buf = ftoaddr->buf; toaddr.update = false;
fromaddr.buf = ffromaddr->buf; fromaddr.update = false;
subj.buf = fsubj->buf; subj.update = false;
bool res = set_to_address(msg, &toname, &toaddr, &fromaddr, &subj, 0, LNG->SelectDestNode, lookup);
vcurshow();
char bot2[200];
MakeAttrStr(bot2, &msg->attr);
strsetsz(bot2, EDIT->HdrNodeLen());
window.prints(1, EDIT->HdrNodePos(), C_HEADW, bot2);
if(toname.update) current->update();
if(toaddr.update) ftoaddr->update();
if(fromaddr.update) ffromaddr->update();
if(subj.update) fsubj->update();
if(res)
return true;
else
go_next_field();
}
else if(current->id == id_subject) {
CheckSubject(msg, current->buf);
current->update();
}
return true;
}
// ------------------------------------------------------------------
int EditHeaderinfo(int mode, GMsgHeaderView &view) {
GMsgHeaderEdit hedit(view);
GMsg *msg = view.msg;
string from_name, to_name, subject;
string from_addr, to_addr, orig_from_addr;
from_name = msg->By();
if(AA->isinternet()) {
from_addr = msg->iorig;
}
else {
if(msg->orig.net)
msg->orig.make_string(from_addr, msg->odom);
}
orig_from_addr = from_addr;
if(AA->isinternet()) {
to_name = msg->To();
to_addr = msg->idest;
}
else {
to_name = (*msg->iaddr and not *msg->igate) ? msg->iaddr : msg->to;
if(msg->dest.net)
msg->dest.make_string(to_addr, msg->ddom);
}
subject = msg->re;
if(AA->isnet())
hedit.lookup = CFG->switches.get(lookupnet);
else if(AA->isecho())
hedit.lookup = CFG->switches.get(lookupecho);
else
hedit.lookup = CFG->switches.get(lookuplocal);
int from_name_pos = EDIT->HdrNamePos();
int from_name_len = EDIT->HdrNameLen();
int from_addr_pos = EDIT->HdrNodePos();
int from_addr_len = EDIT->HdrNodeLen();
int to_name_pos = from_name_pos;
int to_name_len = from_name_len;
int to_addr_pos = from_addr_pos;
int to_addr_len = hedit.lookup or AA->isnet() ? from_addr_len : 0;
int subject_pos = 8;
int subject_len = MAXCOL - subject_pos;
int name_cvt = AA->Editmixcase() ? GMsgHeaderEdit::cvt_mixedcase : GMsgHeaderEdit::cvt_none;
int addr_cvt = GMsgHeaderEdit::cvt_none;
int subj_cvt = GMsgHeaderEdit::cvt_none;
hedit.setup(C_HEADW, C_HEADW, C_HEADE, _box_table(W_BHEAD,13), true);
hedit.add_field(GMsgHeaderEdit::id_from_name, 2, from_name_pos, from_name_len, from_name, sizeof(INam), name_cvt);
hedit.add_field(GMsgHeaderEdit::id_from_addr, 2, from_addr_pos, from_addr_len, from_addr, sizeof(IAdr), addr_cvt);
hedit.add_field(GMsgHeaderEdit::id_to_name, 3, to_name_pos, to_name_len, to_name, sizeof(INam), name_cvt);
hedit.add_field(GMsgHeaderEdit::id_to_addr, 3, to_addr_pos, to_addr_len, to_addr, sizeof(IAdr), addr_cvt);
hedit.add_field(GMsgHeaderEdit::id_subject, 4, subject_pos, subject_len, subject, sizeof(ISub), subj_cvt);
hedit.start_id = GMsgHeaderEdit::id_to_name;
switch(mode) {
case MODE_REPLYCOMMENT:
if(not (msg->dest.net or not AA->isnet()))
break;
// else drop through ...
case MODE_REPLY:
case MODE_QUOTE:
case MODE_CHANGE:
hedit.start_id = GMsgHeaderEdit::id_subject;
break;
}
int help = gwin.help;
ChgAttrs(true, msg);
whelpdef(CFG->helpged, Key_F1, C_HELPB, C_HELPW, C_HELPQ, C_HELPS, NULL);
vcurshow();
if(not (hedit.lookup or AA->isnet())) {
char date2[25] = {""};
strsetsz(date2, view.width - CFG->disphdrdateset.pos);
view.window.prints(3, CFG->disphdrdateset.pos, view.to_color, date2);
}
view.window.prints(5, view.width-strlen(LNG->HeaderEditHelp1)-1, view.title_color, LNG->HeaderEditHelp1);
view.window.prints(5, view.width-strlen(LNG->HeaderEditHelp1)-strlen(LNG->HeaderEditHelp2)-3, view.title_color, LNG->HeaderEditHelp2);
hedit.run(H_Header);
vcurhide();
ChgAttrs(false, msg);
whelpcat(help);
if(not hedit.dropped and not gkbd.quitall) {
strcpy(msg->by, from_name.c_str());
strcpy(msg->re, subject.c_str());
INam tmp_to_name;
strxcpy(tmp_to_name, *msg->igate ? to_name.c_str() : msg->iaddr, sizeof(INam));
if(lookup_addressbook(msg, tmp_to_name, NULL))
to_name = tmp_to_name;
if(AA->isinternet()) {
strcpy(msg->to, to_name.c_str());
strcpy(msg->realby, msg->by);
strcpy(msg->realto, msg->to);
strcpy(msg->iorig, from_addr.c_str());
strcpy(msg->idest, to_addr.c_str());
strcpy(msg->ifrom, msg->iorig);
strcpy(msg->ito, msg->idest);
if(msg->orig.net == 0)
msg->orig = msg->oorig = AA->Aka().addr;
if(msg->dest.net == 0)
msg->dest = msg->odest = AA->Internetgate().addr;
}
else {
if(strchr(to_name.c_str(), '@')) {
if(*AA->Internetgate().name)
strcpy(msg->iaddr, to_name.c_str());
else {
if(strlen(to_name.c_str()) > 34) {
strcpy(msg->to, *AA->Internetgate().name ? AA->Internetgate().name : "UUCP");
strcpy(msg->iaddr, to_name.c_str());
}
else
strcpy(msg->to, to_name.c_str());
}
}
else
strcpy(msg->to, to_name.c_str());
Addr address;
address = AA->Aka().addr;
if(from_addr.length()) {
address.set(from_addr.c_str(), msg->odom);
msg->orig.zone = address.zone;
msg->orig.net = address.net;
msg->orig.node = address.node;
msg->orig.point = address.point;
}
if(to_addr.empty()) {
// Set destination to yourself or the Boss node
address = msg->orig;
address.point = 0;
address.make_string(to_addr);
}
address = AA->Aka().addr;
const char* domain = address.set(to_addr);
msg->odest.zone = msg->dest.zone = address.zone;
msg->odest.net = msg->dest.net = address.net;
msg->odest.node = msg->dest.node = address.node;
msg->odest.point = msg->dest.point = address.point;
if(*domain) {
address.reset();
address.zone = msg->orig.zone;
address.set(domain);
if(address.net) {
msg->odest.zone = address.zone;
msg->odest.net = address.net;
msg->odest.node = address.node;
msg->odest.point = address.point;
}
else {
msg->odest.zone = msg->dest.zone;
msg->odest.net = msg->dest.net;
msg->odest.node = msg->dest.node;
msg->odest.point = msg->dest.point;
}
}
// Try to match akas with the dest address, but only if the orig address was NOT changed
vector<gaka>::iterator i;
for(i = CFG->aka.begin(); i != CFG->aka.end(); i++) {
if(memcmp(&msg->orig, i, sizeof(Addr)) == 0)
break; // Found one of our own akas.
}
// Try to match akas with the dest address, but only if the orig address was NOT changed
if(i != CFG->aka.end()) {
// ... and only if the orig aka was already one of our own
if(strieql(orig_from_addr.c_str(), from_addr.c_str())) {
// ... and only if we did NOT change aka manually
if(AA->Aka().addr.equals(AA->aka())) {
// Do aka matching
if(AA->Akamatching()) {
strcpy(msg->odom, CFG->aka[AkaMatch(&msg->orig, &msg->dest)].domain);
}
}
}
}
}
}
else {
for(int n=0; n<fspecs; n++)
throw_release(fspec[n].fblk);
fspecs = specfiles = 0;
}
view.Paint();
return hedit.dropped ? W_ESCPRESS : W_NOERROR;
}
// ------------------------------------------------------------------

244
golded3/gehdrs.cpp Normal file
View File

@ -0,0 +1,244 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Header display.
// ------------------------------------------------------------------
#include <golded.h>
// ------------------------------------------------------------------
char* strconv(char* str, char* conv) {
char* s=str;
char* p = str;
NW(conv); // Dummy
while(*str) {
if((*str < ' ') and (*str != '\n') and (*str != '\r')) // Control codes
*p++ = '.';
else
*p++ = *str;
str++;
}
return(s);
}
// ------------------------------------------------------------------
void DispHeader(GMsg* msg, bool prn, FILE* fp, int width) {
int namewidth = CFG->disphdrnodeset.pos - CFG->disphdrnameset.pos;
int nodewidth = CFG->disphdrdateset.pos - CFG->disphdrnodeset.pos;
int datewidth = width - CFG->disphdrdateset.pos;
char headerline[200];
memset(headerline, _box_table(W_BHEAD,1), width);
headerline[width] = NUL;
INam whofrom;
if(*msg->ifrom and *msg->realby)
sprintf(whofrom, "%s <%s>", msg->realby, msg->iorig);
else if(*msg->ifrom and *msg->iorig)
strcpy(whofrom, msg->iorig);
else
strcpy(whofrom, msg->By());
strsetsz(whofrom, (AA->isinternet() or *msg->ifrom) ? (namewidth+nodewidth) : namewidth);
INam whoto;
if(*msg->ito and *msg->realto)
sprintf(whoto, "%s <%s>", msg->realto, msg->idest);
else if(*msg->ito and *msg->idest)
strcpy(whoto, msg->idest);
else
strcpy(whoto, msg->To());
strsetsz(whoto, (AA->isinternet() or *msg->ito) ? (namewidth+nodewidth) : namewidth);
// Generate top line fields
char buf[256];
char top1[200];
strtrim(strcpy(buf, AA->desc()));
if((CFG->dispareano == ALWAYS) or (CFG->dispareano and AA->board()))
sprintf(top1, " [%u] %s ", AA->board(), buf);
else
sprintf(top1, " %s ", buf);
strtrim(top1);
strcat(top1, " (" /*)*/);
if(AA->isinternet())
strcpy(buf, AA->Internetaddress());
else
AA->Aka().addr.make_string(buf);
strcat(top1, buf);
strcat(top1, /*(*/ ") ");
char top2[200];
if(msg->areakludgeid)
sprintf(top2, " %s (%s) ", AA->echoid(), msg->areakludgeid);
else
sprintf(top2, " %s ", AA->echoid());
// Generate message attributes string
char bot2[200];
MakeAttrStr(bot2, &msg->attr);
int len2 = strlen(bot2);
if(len2 > width-CFG->disphdrnodeset.pos) {
len2 = width-CFG->disphdrnodeset.pos;
strsetsz(bot2, len2);
}
// Generate message number and reply links string
char bot1[200];
char* ptr = bot1;
int list_max = msg->link.list_max();
ulong* replies = (ulong*)throw_calloc(list_max+1, sizeof(ulong));
ulong replyto, replynext;
if(CFG->switches.get(disprealmsgno)) {
ptr += sprintf(ptr, " %-5.5s: #%lu [%u]", LNG->Msg, msg->msgno, AA->Msgn.Count()+(msg->attr.nwm() ? 1 : 0));
replyto = msg->link.to();
replies[0] = msg->link.first();
replynext = msg->link.next();
for(int replyn=1; replyn<list_max+1; replyn++)
replies[replyn] = msg->link.list(replyn-1);
}
else {
uint active = AA->Msgn.Count() + (msg->attr.nwm() ? 1 : 0);
ptr += sprintf(ptr, " %-5.5s: %u %s %u", LNG->Msg, msg->attr.nwm() ? active : AA->Msgn.ToReln(msg->msgno), LNG->of, active);
replyto = AA->Msgn.ToReln(msg->link.to());
replies[0] = AA->Msgn.ToReln(msg->link.first());
replynext = AA->Msgn.ToReln(msg->link.next());
for(int replyn=1; replyn<list_max+1; replyn++)
replies[replyn] = AA->Msgn.ToReln(msg->link.list(replyn-1));
}
if(replyto)
ptr += sprintf(ptr, " -%lu", replyto);
for(int replyn=0,plus=0; replyn<list_max+1; replyn++)
if(replies[replyn])
ptr += sprintf(ptr, " %s%lu", (plus++?"":"+"), replies[replyn]);
if(replynext)
sprintf(ptr, " *%lu", replynext);
int len1 = strlen(bot1)-8;
if((CFG->disphdrnameset.pos + len1) > CFG->disphdrnodeset.pos) {
if(8 + len1 + len2 > width) {
strsetsz(bot1, width-len2-1);
strtrim(bot1);
}
strcat(bot1, " ");
strcat(bot1, bot2);
*bot2 = NUL;
}
else {
strsetsz(bot1, namewidth+8);
strcat(bot1, bot2);
*bot2 = NUL;
}
strsetsz(bot1, width);
throw_free(replies);
// Generate orig node data
char node1[200];
if(msg->orig.net)
msg->orig.make_string(node1);
else
*node1 = NUL;
strsetsz(node1, nodewidth);
char date1[25] = "";
if(msg->written)
strftimei(date1, CFG->disphdrdateset.len, LNG->DateTimeFmt, gmtime(&msg->written));
strsetsz(date1, datewidth);
// Generate dest node data
char node2[200];
if(msg->dest.net and AA->isnet()) {
msg->dest.make_string(node2);
if(msg->odest.net) {
if(msg->odest.net != msg->dest.net or msg->odest.node != msg->dest.node) {
sprintf(buf, " %s %u/%u", LNG->Via, msg->odest.net, msg->odest.node);
strcat(node2, buf);
}
}
}
else
*node2 = NUL;
strsetsz(node2, nodewidth);
char date2[25] = "";
if(msg->arrived)
strftimei(date2, CFG->disphdrdateset.len, LNG->DateTimeFmt, gmtime(&msg->arrived));
strsetsz(date2, datewidth);
// Generate subjectline
char subj[200], lngsubj[10];
strcpy(lngsubj, (msg->attr.att() or msg->attr.frq() or msg->attr.urq()) ? LNG->File : LNG->Subj);
strxcpy(subj, msg->re, sizeof(subj));
strsetsz(subj, width-strlen(lngsubj));
// Write the total header to a file
strcpy(stpcpy(buf, headerline), prn ? NL : "\n");
strncpy(buf+1, top1, strlen(top1));
strncpy(buf+width-strlen(top2)-1, top2, strlen(top2));
strconv(buf, tconv);
fwrite(buf, strlen(buf), 1, fp);
strcpy(stpcpy(buf, bot1), bot2);
strtrim(buf);
strcat(buf, prn ? NL : "\n");
strconv(buf, tconv);
fwrite(buf, strlen(buf), 1, fp);
sprintf(buf, "%s%s%s%s",
LNG->From, whofrom,
((not (*msg->ifrom and (*msg->realby or *msg->iorig))) and not AA->isinternet()) ? node1 : "",
date1
);
strtrim(buf);
strcat(buf, prn ? NL : "\n");
strconv(buf, tconv);
fwrite(buf, strlen(buf), 1, fp);
sprintf(buf, "%s%s%s%s", LNG->To, whoto,
((not (*msg->ito and (*msg->realto or *msg->idest))) and not AA->isinternet()) ? node2 : "",
date2
);
strtrim(buf);
strcat(buf, prn ? NL : "\n");
strconv(buf, tconv);
fwrite(buf, strlen(buf), 1, fp);
strcpy(stpcpy(buf, lngsubj), subj);
strtrim(buf);
strcat(buf, prn ? NL : "\n");
strconv(buf, tconv);
fwrite(buf, strlen(buf), 1, fp);
strcpy(stpcpy(buf, headerline), prn ? NL : "\n");
strconv(buf, tconv);
fwrite(buf, strlen(buf), 1, fp);
}
// ------------------------------------------------------------------

130
golded3/gehelp.h Normal file
View File

@ -0,0 +1,130 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Help Categories.
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// Help Categories
// ------------------------------------------------------------------
// General
#define H_General 1000
#define H_AskDropMsg 1001
#define H_AskExit 1002
#define H_AskOverWrite 1003
#define H_Attributes 1004
#define H_ChangeAka 1005
#define H_ChangeOrigin 1006
#define H_ChangeTemplate 1007
#define H_ChangeUsername 1008
#define H_ChangeTagline 1009
#define H_ChangeXlatImport 1010
// ------------------------------------------------------------------
// Area
#define H_Area 2000
#define H_AreaMark 2001
#define H_ScanAreas 2002
#define H_AreaSelection 2003
#define H_HeatAreas 2004
#define H_ZapAreas 2005
#define H_SelectMarks 2006
#define H_AreaDropMarks 2007
#define H_AreaCatchUp 2008
// ------------------------------------------------------------------
// Reader Menus
#define H_Reader 3000
#define H_AskChange 3001
#define H_AskDelete 3002
#define H_AskDoMarks 3003
#define H_AskNextArea 3004
#define H_CopyMoveForward 3005
#define H_FindString 3006
#define H_InputMsgno 3007
#define H_MarkMessages 3008
#define H_MarkString 3009
#define H_MessageBrowser 3010
#define H_WriteMessage 3011
#define H_EditCryptKey 3012
#define H_FileRequest 3013
#define H_MenuConfirm 3014
#define H_GotoReplies 3015
#define H_ReplyThread 3016
// ------------------------------------------------------------------
// Header Menus
#define H_Header 4000
#define H_AskDelOrig 4001
#define H_AskReadOnly 4002
#define H_AskZoneGate 4003
#define H_CarbonCopy 4004
#define H_FileSelect 4005
#define H_Message 4006
#define H_NodelistBrowser 4007
#define H_SaveMsg 4008
#define H_AskForward 4009
#define H_Crosspost 4010
// ------------------------------------------------------------------
// Editor Menus
#define H_Editor 5000
#define H_ExportFile 5001
#define H_ImportFile 5002
#define H_ImportTxt 5003
// ------------------------------------------------------------------
// Userbase Menus
#define H_Userbase 6000
#define H_EditAdrEntry 6001
// ------------------------------------------------------------------
// Error messages
#define H_EOutOfMemory 9001
#define H_EWarnMsgtxt 9002
#define H_ENodelist 9003
#define H_EBetaVersion 9004
#define H_EOpenQbase 9005
#define H_ENoUser 9006
#define H_ECtrlBreak 9007
#define H_EQbaseRebuild 9008
#define H_EMemoryWarning 9009
// ------------------------------------------------------------------

1111
golded3/geinit.cpp Normal file

File diff suppressed because it is too large Load Diff

361
golded3/gekeys.h Normal file
View File

@ -0,0 +1,361 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Keyboard system.
// ------------------------------------------------------------------
// ------------------------------------------------------------------
//
// The keyboard system in GoldED
//
// Keycodes in the range 0x0000-0xFDFF are normal keys.
// Keycodes in the range 0xFE00-0xFE7F are macro numbers.
// Keycodes in the range 0xFE80-0xFFFE are command numbers.
//
// The global variable cmdkeys holds a list of all commands and
// the keys or macro numbers, sorted by key/macro.
//
// The global variable macros holds all the macros, sorted by key.
// The global variable totmacros contains the total number of macros.
//
// The macro list is searched first, then the command list, thus
// allowing macros that override commands.
//
// ------------------------------------------------------------------
const gkey KK_Auto = 0xFD00;
const gkey KK_Macro = 0xFE00;
const gkey KK_AreaMacro = 0xFE01;
const gkey KK_EditMacro = 0xFE02;
const gkey KK_FileMacro = 0xFE03;
const gkey KK_ListMacro = 0xFE04;
const gkey KK_NodeMacro = 0xFE05;
const gkey KK_ReadMacro = 0xFE06;
const gkey KK_Commands = 0xFE80;
const gkey KK_ExternUtil01 = 0xFE81;
const gkey KK_ExternUtil02 = 0xFE82;
const gkey KK_ExternUtil03 = 0xFE83;
const gkey KK_ExternUtil04 = 0xFE84;
const gkey KK_ExternUtil05 = 0xFE85;
const gkey KK_ExternUtil06 = 0xFE86;
const gkey KK_ExternUtil07 = 0xFE87;
const gkey KK_ExternUtil08 = 0xFE88;
const gkey KK_ExternUtil09 = 0xFE89;
const gkey KK_ExternUtil10 = 0xFE8A;
const gkey KK_ExternUtil11 = 0xFE8B;
const gkey KK_ExternUtil12 = 0xFE8C;
const gkey KK_ExternUtil13 = 0xFE8D;
const gkey KK_ExternUtil14 = 0xFE8E;
const gkey KK_ExternUtil15 = 0xFE8F;
const gkey KK_ExternUtil16 = 0xFE90;
const gkey KK_ExternUtil17 = 0xFE91;
const gkey KK_ExternUtil18 = 0xFE92;
const gkey KK_ExternUtil19 = 0xFE93;
const gkey KK_ExternUtil20 = 0xFE94;
const gkey KK_ExternUtil21 = 0xFE95;
const gkey KK_ExternUtil22 = 0xFE96;
const gkey KK_ExternUtil23 = 0xFE97;
const gkey KK_ExternUtil24 = 0xFE98;
const gkey KK_ExternUtil25 = 0xFE99;
const gkey KK_AreaAbort = 0xFEA0;
const gkey KK_AreaAskExit = 0xFEA1;
const gkey KK_AreaBoardnos = 0xFEA2;
const gkey KK_AreaCatchUp = 0xFEA3;
const gkey KK_AreaDosShell = 0xFEA4;
const gkey KK_AreaDropMsgMarks = 0xFEA5;
const gkey KK_AreaGotoFirst = 0xFEA6;
const gkey KK_AreaGotoLast = 0xFEA7;
const gkey KK_AreaGotoNext = 0xFEA8;
const gkey KK_AreaGotoPrev = 0xFEA9;
const gkey KK_AreaHeat = 0xFEAA;
const gkey KK_AreaInfo = 0xFEAB;
const gkey KK_AreaJump = 0xFEAC;
const gkey KK_AreaJumpNextMatch = 0xFEAD;
const gkey KK_AreaMainMenu = 0xFEAE;
const gkey KK_AreaMenu = 0xFEAF;
const gkey KK_AreaQuitNow = 0xFEB0;
const gkey KK_AreaScan = 0xFEB1;
const gkey KK_AreaScanPM = 0xFEB2;
const gkey KK_AreaSelect = 0xFEB3;
const gkey KK_AreaSelectMarks = 0xFEB4;
const gkey KK_AreaSoundkill = 0xFEB5;
const gkey KK_AreaToggle = 0xFEB6;
const gkey KK_AreaTouchNetscan = 0xFEB7;
const gkey KK_AreaWriteGoldlast = 0xFEB8;
const gkey KK_AreaZap = 0xFEB9;
const gkey KK_AreaShowDel = 0xFEBA;
const gkey KK_EditAbort = 0xFEC0;
const gkey KK_EditAnchor = 0xFEC1;
const gkey KK_EditAskExit = 0xFEC2;
const gkey KK_EditClearDeleteBuf = 0xFEC3;
const gkey KK_EditClearPasteBuf = 0xFEC4;
const gkey KK_EditCopy = 0xFEC5;
const gkey KK_EditCopyAbove = 0xFEC6;
const gkey KK_EditCopyAboveChar = 0xFEC7;
const gkey KK_EditCut = 0xFEC8;
const gkey KK_EditDelChar = 0xFEC9;
const gkey KK_EditDeleteEOL = 0xFECA;
const gkey KK_EditDelLeft = 0xFECB;
const gkey KK_EditDelLine = 0xFECC;
const gkey KK_EditDelLtWord = 0xFECD;
const gkey KK_EditDelRtWord = 0xFECE;
const gkey KK_EditDosShell = 0xFECF;
const gkey KK_EditDupLine = 0xFED0;
const gkey KK_EditExitMsg = 0xFED1;
const gkey KK_EditExportText = 0xFED2;
const gkey KK_EditGoBegLine = 0xFED3;
const gkey KK_EditGoBotLine = 0xFED4;
const gkey KK_EditGoBotMsg = 0xFED5;
const gkey KK_EditGoDown = 0xFED6;
const gkey KK_EditGoEOL = 0xFED7;
const gkey KK_EditGoLeft = 0xFED8;
const gkey KK_EditGoPgDn = 0xFED9;
const gkey KK_EditGoPgUp = 0xFEDA;
const gkey KK_EditGoRight = 0xFEDB;
const gkey KK_EditGoTopLine = 0xFEDC;
const gkey KK_EditGoTopMsg = 0xFEDD;
const gkey KK_EditGoUp = 0xFEDE;
const gkey KK_EditGoWordLeft = 0xFEDF;
const gkey KK_EditGoWordRight = 0xFEE0;
const gkey KK_EditHeader = 0xFEE1;
const gkey KK_EditImportQuotebuf = 0xFEE2;
const gkey KK_EditImportText = 0xFEE3;
const gkey KK_EditKillQuotes = 0xFEE4;
const gkey KK_EditLoadFile = 0xFEE5;
const gkey KK_EditLookupCursor = 0xFEE6;
const gkey KK_EditLookupDest = 0xFEE7;
const gkey KK_EditLookupOrig = 0xFEE8;
const gkey KK_EditMainMenu = 0xFEE9;
const gkey KK_EditMenu = 0xFEEA;
const gkey KK_EditNewline = 0xFEEB;
const gkey KK_EditPaste = 0xFEEC;
const gkey KK_EditQuitNow = 0xFEED;
const gkey KK_EditReflow = 0xFEEE;
const gkey KK_EditSaveFile = 0xFEEF;
const gkey KK_EditSaveMsg = 0xFEF0;
const gkey KK_EditSoundkill = 0xFEF1;
const gkey KK_EditSpellCheck = 0xFEF2;
const gkey KK_EditTab = 0xFEF3;
const gkey KK_EditTabReverse = 0xFEF4;
const gkey KK_EditToggleCase = 0xFEF5;
const gkey KK_EditToggleInsert = 0xFEF6;
const gkey KK_EditToLower = 0xFEF7;
const gkey KK_EditToUpper = 0xFEF8;
const gkey KK_EditUnDelete = 0xFEF9;
const gkey KK_EditZapQuoteBelow = 0xFEFA;
const gkey KK_EditBlockRight = 0xFEFB;
const gkey KK_EditBlockLeft = 0xFEFC;
const gkey KK_EditBlockUp = 0xFEFD;
const gkey KK_EditBlockDown = 0xFEFE;
const gkey KK_EditBlockHome = 0xFEFF;
const gkey KK_EditBlockEnd = 0xFF00;
const gkey KK_EditBlockPgDn = 0xFF01;
const gkey KK_EditBlockPgUp = 0xFF02;
const gkey KK_EditDelete = 0xFF03;
const gkey KK_EditUndo = 0xFF04;
const gkey KK_FileAbort = 0xFF10;
const gkey KK_FileAskExit = 0xFF11;
const gkey KK_FileDosShell = 0xFF12;
const gkey KK_FileGotoFirst = 0xFF13;
const gkey KK_FileGotoLast = 0xFF14;
const gkey KK_FileGotoNext = 0xFF15;
const gkey KK_FileGotoPrev = 0xFF16;
const gkey KK_FileMark = 0xFF17;
const gkey KK_FileMarkAll = 0xFF18;
const gkey KK_FileMenu = 0xFF19;
const gkey KK_FileQuitNow = 0xFF1A;
const gkey KK_FileSelect = 0xFF1B;
const gkey KK_FileToggleMark = 0xFF1C;
const gkey KK_FileToggleMarkAll = 0xFF1D;
const gkey KK_FileUnMark = 0xFF1E;
const gkey KK_FileUnMarkAll = 0xFF1F;
const gkey KK_ListAbort = 0xFF20;
const gkey KK_ListAskExit = 0xFF21;
const gkey KK_ListDosShell = 0xFF22;
const gkey KK_ListGotoBookMark = 0xFF23;
const gkey KK_ListGotoFirst = 0xFF24;
const gkey KK_ListGotoLast = 0xFF25;
const gkey KK_ListGotoNext = 0xFF26;
const gkey KK_ListGotoPrev = 0xFF27;
const gkey KK_ListMainMenu = 0xFF28;
const gkey KK_ListMarkingOptions = 0xFF29;
const gkey KK_ListMenu = 0xFF2A;
const gkey KK_ListQuitNow = 0xFF2B;
const gkey KK_ListSelect = 0xFF2C;
const gkey KK_ListToggleBookMark = 0xFF2D;
const gkey KK_ListToggleDate = 0xFF2E;
const gkey KK_ListToggleMark = 0xFF2F;
const gkey KK_ListToggleWideSubj = 0xFF30;
const gkey KK_NodeAbort = 0xFF40;
const gkey KK_NodeAskExit = 0xFF41;
const gkey KK_NodeDosShell = 0xFF42;
const gkey KK_NodeGotoFirst = 0xFF43;
const gkey KK_NodeGotoLast = 0xFF44;
const gkey KK_NodeGotoNext = 0xFF45;
const gkey KK_NodeGotoPrev = 0xFF46;
const gkey KK_NodeMainMenu = 0xFF47;
const gkey KK_NodeMenu = 0xFF48;
const gkey KK_NodeQuitNow = 0xFF49;
const gkey KK_NodeSelect = 0xFF4A;
const gkey KK_ReadAddressbookAdd = 0xFF50;
const gkey KK_ReadAskExit = 0xFF51;
const gkey KK_ReadChangeAka = 0xFF52;
const gkey KK_ReadChangeAttrs = 0xFF53;
const gkey KK_ReadChangeCharsIn = 0xFF54;
const gkey KK_ReadChangeCharsOut = 0xFF55;
const gkey KK_ReadChangeMsg = 0xFF56;
const gkey KK_ReadChangeOrigin = 0xFF57;
const gkey KK_ReadChangeTagline = 0xFF58;
const gkey KK_ReadChangeTemplate = 0xFF59;
const gkey KK_ReadChangeUsername = 0xFF5A;
const gkey KK_ReadChangeXlatImport = 0xFF5B;
const gkey KK_ReadCommentMsg = 0xFF5C;
const gkey KK_ReadCopyMoveForward = 0xFF5D;
const gkey KK_ReadDecreaseMargin = 0xFF5E;
const gkey KK_ReadDeleteMsg = 0xFF5F;
const gkey KK_ReadDosShell = 0xFF60;
const gkey KK_ReadExternUtilMenu = 0xFF61;
const gkey KK_ReadFidoRenumber = 0xFF62;
const gkey KK_ReadFileRequest = 0xFF63;
const gkey KK_ReadFindAll = 0xFF64;
const gkey KK_ReadFindHeader = 0xFF65;
const gkey KK_ReadGotoBookMark = 0xFF66;
const gkey KK_ReadGotoFirstMsg = 0xFF67;
const gkey KK_ReadGotoLastMsg = 0xFF68;
const gkey KK_ReadGotoMsgno = 0xFF69;
const gkey KK_ReadGotoNextArea = 0xFF6A;
const gkey KK_ReadGotoNextMsg = 0xFF6B;
const gkey KK_ReadGotoNextUnread = 0xFF6C;
const gkey KK_ReadGotoPrevArea = 0xFF6D;
const gkey KK_ReadGotoPrevMsg = 0xFF6E;
const gkey KK_ReadGotoPrevUnread = 0xFF6F;
const gkey KK_ReadGotoReplies = 0xFF70;
const gkey KK_ReadGotoReply1st = 0xFF71;
const gkey KK_ReadGotoReplyNext = 0xFF72;
const gkey KK_ReadGotoReplyPrev = 0xFF73;
const gkey KK_ReadIncreaseMargin = 0xFF74;
const gkey KK_ReadLookupDest = 0xFF75;
const gkey KK_ReadLookupOrig = 0xFF76;
const gkey KK_ReadMainMenu = 0xFF77;
const gkey KK_ReadMakeUserlist = 0xFF78;
const gkey KK_ReadMarkingOptions = 0xFF79;
const gkey KK_ReadMenu = 0xFF7A;
const gkey KK_ReadMessageList = 0xFF7B;
const gkey KK_ReadMakePathreport = 0xFF7C;
const gkey KK_ReadMoveCommentMsg = 0xFF7D;
const gkey KK_ReadMoveQuoteMsg = 0xFF7E;
const gkey KK_ReadMsgContinue = 0xFF7F;
const gkey KK_ReadMsgEnd = 0xFF80;
const gkey KK_ReadMsgHome = 0xFF81;
const gkey KK_ReadMsgLineDown = 0xFF82;
const gkey KK_ReadMsgLineUp = 0xFF83;
const gkey KK_ReadMsgPgDn = 0xFF84;
const gkey KK_ReadMsgPgUp = 0xFF85;
const gkey KK_ReadNewArea = 0xFF86;
const gkey KK_ReadNewMsg = 0xFF87;
const gkey KK_ReadQuitNow = 0xFF88;
const gkey KK_ReadQuoteBuf = 0xFF89;
const gkey KK_ReadQuoteMsg = 0xFF8A;
const gkey KK_ReadReplyMsg = 0xFF8B;
const gkey KK_ReadSearch = 0xFF8C;
const gkey KK_ReadSoundkill = 0xFF8D;
const gkey KK_ReadStealTagline = 0xFF8E;
const gkey KK_ReadThreadtree = 0xFF8F;
const gkey KK_ReadToggleBookMark = 0xFF90;
const gkey KK_ReadToggleHexdump = 0xFF91;
const gkey KK_ReadToggleHidden = 0xFF92;
const gkey KK_ReadToggleHiddKlud = 0xFF93;
const gkey KK_ReadToggleKludge = 0xFF94;
const gkey KK_ReadToggleMark = 0xFF95;
const gkey KK_ReadToggleMarkRead = 0xFF96;
const gkey KK_ReadTogglePageBar = 0xFF97;
const gkey KK_ReadToggleQuote = 0xFF98;
const gkey KK_ReadToggleRealMsgno = 0xFF99;
const gkey KK_ReadToggleROT13 = 0xFF9A;
const gkey KK_ReadToggleStyles = 0xFF9B;
const gkey KK_ReadToggleTwits = 0xFF9C;
const gkey KK_ReadTouchNetscan = 0xFF9D;
const gkey KK_ReadTouchSemaphore = 0xFF9E;
const gkey KK_ReadUserbase = 0xFF9F;
const gkey KK_ReadUUDecode = 0xFFA0;
const gkey KK_ReadWriteMsg = 0xFFA1;
const gkey KK_AreaUndefine = 0xFFB0;
const gkey KK_EditUndefine = 0xFFB1;
const gkey KK_FileUndefine = 0xFFB2;
const gkey KK_ListUndefine = 0xFFB3;
const gkey KK_NodeUndefine = 0xFFB4;
const gkey KK_ReadUndefine = 0xFFB5;
const gkey KK_ZzzzLast = 0xFFB6;
// ------------------------------------------------------------------
// Key groups (type of key)
const int KT_A = 1; // Arealist
const int KT_E = 2; // Editor
const int KT_G = 4; // General (not used)
const int KT_M = 8; // Msg lister
const int KT_N = 16; // Node browser
const int KT_R = 32; // Reader (+ external utils)
const int KT_F = 64; // File browser
// ------------------------------------------------------------------
// Key command
struct CmdKey {
gkey key; // Associated key or macro number
gkey cmd; // Command number
int type; // Type of key
};
// ------------------------------------------------------------------
// Macro
struct Macro {
int type; // Type of key
gkey key; // Associated key
gkey buf[128]; // Actual keys/commands
};
// ------------------------------------------------------------------
struct tglobalkey {
word crc_token;
gkey keyval;
word keytype;
};
// ------------------------------------------------------------------

473
golded3/gelang.h Normal file
View File

@ -0,0 +1,473 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Language pointer structure.
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// Language pointer structure
struct LangGed {
char* SWSun; // MS_SWSUN
char* SWMon; // MS_SWMON
char* SWTue; // MS_SWTUE
char* SWWed; // MS_SWWED
char* SWThu; // MS_SWTHU
char* SWFri; // MS_SWFRI
char* SWSat; // MS_SWSAT
char* LWSunday; // MS_LWSUNDAY
char* LWMonday; // MS_LWMONDAY
char* LWTuesday; // MS_LWTUESDAY
char* LWWednesday; // MS_LWWEDNESDAY
char* LWThursday; // MS_LWTHURSDAY
char* LWFriday; // MS_LWFRIDAY
char* LWSaturday; // MS_LWSATURDAY
char* SMJan; // MS_SMJAN
char* SMFeb; // MS_SMFEB
char* SMMar; // MS_SMMAR
char* SMApr; // MS_SMAPR
char* SMMay; // MS_SMMAY
char* SMJun; // MS_SMJUN
char* SMJul; // MS_SMJUL
char* SMAug; // MS_SMAUG
char* SMSep; // MS_SMSEP
char* SMOct; // MS_SMOCT
char* SMNov; // MS_SMNOV
char* SMDec; // MS_SMDEC
char* LMJanuary; // MS_LMJANUARY
char* LMFebruary; // MS_LMFEBRUARY
char* LMMarch; // MS_LMMARCH
char* LMApril; // MS_LMAPRIL
char* LMMay; // MS_LMMAY
char* LMJune; // MS_LMJUNE
char* LMJuly; // MS_LMJULY
char* LMAugust; // MS_LMAUGUST
char* LMSeptember; // MS_LMSEPTEMBER
char* LMOctober; // MS_LMOCTOBER
char* LMNovember; // MS_LMNOVEMBER
char* LMDecember; // MS_LMDECEMBER
char* ImportFile; // ST_IMPORTFILE
char* ImportWhichFile; // WT_IMPORTWHICHFILE
char* ImportTitle; // WT_IMPORTPICK
char* ImportTxt; // WT_IMPORTTXT
char* ImportTxtText; // MI_IMPORTTXTTEXT
char* ImportTxtQuote; // MI_IMPORTTXTQUOTE
char* ImportTxtUue; // MI_IMPORTTXTUUE
char* ImportTxtMime; // MI_IMPORTTXTMIME
char* ImportTxtClip; // MI_IMPORTTXTCLIP
char* ImportTxtXlat; // MI_IMPORTTXTXLAT
char* ImportTxtQuit; // MI_IMPORTTXTQUIT
char* ImportStatus; // ST_IMPORTSTATUS
char* ExportFile; // ST_EXPORTFILE
char* ExportWhatFile; // WT_EXPORTWHATFILE
char* ExportStatus; // ST_EXPORTSTATUS
char* EditStatus; // ST_EDITSTATUS
char* SelectFiles; // ST_SELECTFILES
char* SelectedFiles; // WL_SELECTEDFILES
char* SelectedBytes; // WL_SELECTEDBYTES
char* TotalFiles; // WL_TOTALFILES
char* TotalBytes; // WL_TOTALBYTES
char* ScanningDirectory; // WL_SCANNINGDIRECTORY
char* NoFilesFound; // WL_NOFILESFOUND
char* FilesPressKey; // ST_FILESPRESSKEY
char* Area; // WT_AREA
char* Description; // WT_DESCRIPTION
char* Msgs; // WT_MSGS
char* Last; // WT_LAST
char* EchoID; // WT_ECHOID
char* unread; // ST_UNREAD
char* Scan_Areas; // WT_SCANAREAS
char* Scan_All; // MI_SCANALL
char* Scan_Marked; // MI_SCANMARKED
char* Scan_Current; // MI_SCANCURRENT
char* Scan_Matching; // MI_SCANMATCHING
char* Scan_Unscanned; // MI_SCANUNSCANNED
char* No_Scan; // MI_NOSCAN
char* Heat_Areas; // WT_HEATAREAS
char* Heat_All; // MI_HEATALL
char* Heat_Marked; // MI_HEATMARKED
char* Heat_Current; // MI_HEATCURRENT
char* No_Heat; // MI_NOHEAT
char* Zap_Areas; // WT_ZAPAREAS
char* Zap_All; // MI_ZAPALL
char* Zap_Marked; // MI_ZAPMARKED
char* Zap_Current; // MI_ZAPCURRENT
char* No_Zap; // MI_NOZAP
char* DOS_Shell; // MS_DOS_SHELL
char* ScanningArea; // IL_SCANNINGAREA
char* SearchingFor; // IL_SEARCHINGFOR
char* ReadingMsg; // ST_READINGMSG
char* Outofmem; // ER_OUTOFMEM
char* Hexdumphead; // MS_HEXDUMPHEAD
char* Hexdumptext; // MS_HEXDUMPTEXT
char* Renumbering; // ST_RENUMBERING
char* Locked; // ST_LOCKED
char* Renumbered; // ST_RENUMBERED
char* BlankMsg; // WL_BLANKMSG
char* Wait; // WL_WAIT
char* GenHexdump; // IL_GENHEXDUMP
char* ProcessCC; // ST_PROCESSCC
char* StatusCC; // ST_STATUSCC
char* DestinationCC; // ST_DESTINATIONCC
char* ListCC; // MS_LISTCC
char* DelOrig; // WT_DELORIG
char* DelOrigYes; // MI_DELORIGYES
char* DelOrigNo; // MI_DELORIGNO
char* DropMsg; // WT_DROPMSG
char* DropMsgYes; // MI_DROPMSGYES
char* DropMsgNo; // MI_DROPMSGNO
char* ZoneGate; // WT_ZONEGATE
char* ZoneGateYes; // MI_ZONEGATEYES
char* ZoneGateNo; // MI_ZONEGATENO
char* Quotepct; // ST_QUOTEPCT
char* SaveMsg; // WT_SAVEMSG
char* YesGreat; // MI_YESGREAT
char* Kickit; // MI_KICKIT
char* Continue; // MI_CONTINUE
char* Rot13; // MI_ROT13
char* AttribS; // MI_ATTRS
char* OriginS; // MI_ORIGS
char* View; // MI_VIEW
char* SelectDestNode; // ST_SELECTDESTNODE
char* AttachFiles; // WT_ATTACHFILES
char* UpdreqFiles; // WT_UPDREQFILES
char* EditHeader; // ST_EDITHEADER
char* MsgOptions; // WT_EDITING
char* InternalEd; // MI_INTERNALED
char* ExternalEd; // MI_EXTERNALED
char* SaveNoEdit; // MI_SAVEMESSAGE
char* AttrO; // MI_ATTRO
char* Template; // MI_TEMPLATE
char* Origin; // MI_ORIGIN
char* QuitMessage; // MI_QUITMESSAGE
char* Templates; // ST_TEMPLATES
char* ChangeTemplate; // WT_CHANGETEMPLATES
char* CarbonCopy; // WT_CARBONCOPY
char* CCProcess; // MI_CCPROCESS
char* CCIgnore; // MI_CCIGNORE
char* CCAttribs; // MI_CCATTRIBS
char* CCListFmt; // MI_CCLISTFMT
char* CCList; // WT_CCLIST
char* CCListKeep; // MI_CCLISTKEEP
char* CCListNames; // MI_CCLISTNAMES
char* CCListVisible; // MI_CCLISTVISIBLE
char* CCListHidden; // MI_CCLISTHIDDEN
char* CCListRemove; // MI_CCLISTREMOVE
char* AttrTitle; // WT_ATTRTITLE
char* AttrPvt; // MI_ATTR01
char* AttrRcv; // MI_ATTR02
char* AttrSnt; // MI_ATTR03
char* AttrCrs; // MI_ATTR04
char* AttrHld; // MI_ATTR05
char* AttrFil; // MI_ATTR06
char* AttrFrq; // MI_ATTR07
char* AttrUpd; // MI_ATTR08
char* AttrKS; // MI_ATTR09
char* AttrKfs; // MI_ATTR10
char* AttrTfs; // MI_ATTR11
char* AttrDir; // MI_ATTR12
char* AttrImm; // MI_ATTR13
char* AttrLok; // MI_ATTR14
char* AttrZap; // MI_ATTR15
char* From; // HD_FROM
char* To; // HD_TO
char* Subj; // HD_SUBJ
char* File; // HD_FILE
char* EmptyMsg; // MS_EMPTYMSG
char* AutoAttachMsg; // MS_AUTOATTACHMSG
char* AutoRequestMsg; // MS_AUTOREQUESTMSG
char* AutoUpdreqMsg; // MS_AUTOUPDREQMSG
char* File_Attach; // WT_FILEATTACH
char* File_Request; // WT_FILEREQUEST
char* File_Updreq; // WT_FILEUPDREQ
char* FileAttaching; // ST_FILEATTACHING
char* FileRequesting; // ST_FILEREQUESTING
char* FileUpdreqing; // ST_FILEUPDREQING
char* ReadMarked; // ST_READMARKED
char* ReadAll; // ST_READALL
char* NoRenum; // ST_NOQRENUM
char* HidingTwit; // MS_HIDINGTWIT
char* Via; // HD_VIA
char* ChangeAttrs; // WT_CHANGEATTRS
char* HeaderText; // WT_HEADERTEXT
char* HeaderOnly; // WT_HEADERONLY
char* NewArea; // WT_NEWAREA
char* ReplyArea; // WT_REPLYAREA
char* CopyArea; // WT_COPYAREA
char* MoveArea; // WT_MOVEAREA
char* ForwardArea; // WT_FORWARDAREA
char* FreqArea; // WT_FREQAREA
char* FreqMenuTitle; // WT_FREQMENUTITLE
char* FreqStat; // ST_FREQSTAT
char* FreqInfoNoFiles; // IL_FREQINFONOFILES
char* Copy; // WT_COPY
char* Move; // WT_MOVE
char* Copying; // WT_COPYING
char* Moving; // WT_MOVING
char* CopyingMsg; // ST_COPYINGMSG
char* MovingMsg; // ST_MOVINGMSG
char* Delete; // WT_DELETE
char* Deleting; // WT_DELETING
char* DeletingMsg; // ST_DELETINGMSG
char* Write; // WT_WRITE
char* WriteMsgs; // WT_WRITEMSGS
char* Writing; // WT_WRITING
char* WritingMsg; // ST_WRITINGMSG
char* WritingFile; // WT_WRITINGFILE
char* WritingPRN; // WT_WRITINGPRN
char* ReadOnlyWarn; // IL_READONLYWARN
char* IsReadOnly; // WT_ISREADONLY
char* ReadOnlyYes; // MI_READONLYYES
char* ReadOnlyNo; // MI_READONLYNO
char* ChangeWarn; // IL_CHANGEWARN
char* Change; // WT_CHANGE
char* ChangeYes; // MI_CHANGEYES
char* ChangeNo; // MI_CHANGENO
char* DeleteThis; // WT_DELETETHIS
char* DeleteYes; // MI_DELETEYES
char* DeleteNo; // MI_DELETENO
char* DeleteNoAsk; // MI_DELETENOASK
char* GotoNext; // WT_GOTONEXT
char* GotoNextYes; // MI_GOTONEXTYES
char* GotoNextNo; // MI_GOTONEXTNO
char* GotoNextNew; // MI_GOTONEXTNEW
char* Forward; // WT_FORWARD
char* ForwardYes; // MI_FORWARDYES
char* ForwardNo; // MI_FORWARDNO
char* Msg; // WT_MSG
char* MsgReal; // WT_MSGREAL
char* FromL; // WT_FROML
char* ToL; // WT_TOL
char* SubjL; // WT_SUBJL
char* MsgLister; // ST_MSGLISTER
char* CopyMoveForward; // ST_COPYMOVEFORWARD
char* SelectAction; // WT_SELECTACTION
char* ForwardMessage; // MI_FORWARDMESSAGE
char* MoveMessage; // MI_MOVEMESSAGE
char* CopyMessage; // MI_COPYMESSAGE
char* QuitCMF; // MI_QUITCMF
char* are; // ST_ARE
char* is; // ST_IS
char* marked; // ST_MARKED
char* MarkedMsg; // MI_MARKEDMSG
char* CurrentMsg; // MI_CURRENTMSG
char* QuitMsgs; // MI_QUITMSGS
char* WriteMsgsTo; // ST_WRITEMSGSTO
char* WriteTo; // WT_WRITETO
char* Diskfile; // MI_DISKFILE
char* Printer; // MI_PRINTER
char* QuitWrite; // MI_QUITWRITE
char* MarkingOptions; // ST_MARKINGOPTIONS
char* MarkWhat; // WT_MARKWHAT
char* Yourmail; // MI_YOURMAIL
char* FromToSubj; // MI_FROMTOSUBJ
char* TextHdr; // MI_TEXTHDR
char* Thread; // MI_THREAD
char* NewMsgs; // MI_NEWMSGS
char* OldMsgs; // MI_OLDMSGS
char* AllMsgs; // MI_ALLMSGS
char* Unmark; // MI_UNMARK
char* Range; // MI_RANGE
char* Markstoggle; // MI_MARKSTOGGLE
char* QuitMarks; // MI_QUITMARKS
char* EnterMarkString; // WT_ENTERMARKSTRING
char* SearchingMsg; // ST_SEARCHINGMSG
char* UserlistName; // WT_USERLISTNAME
char* GenUserlist; // IL_GENUSERLIST
char* FileExists; // WT_FILEEXISTS
char* Append; // MI_APPEND
char* OverWrite; // MI_OVERWRITE
char* QuitExist; // MI_QUITEXIST
char* WarnUnsent; // IL_WARNUNSENT
char* WarnLocked; // IL_WARNLOCKED
char* ChangeOrigin; // ST_CHANGEORIGIN
char* Origins; // WT_ORIGINS
char* ChangeUsername; // ST_CHANGEUSERNAME
char* Usernames; // WT_USERNAMES
char* ChangeAka; // ST_CHANGEAKA
char* Akas; // WT_AKAS
char* Lookup; // WT_LOOKUP
char* Phone; // WL_PHONE
char* QuitGoldED; // WT_QUITGOLDED
char* QuitYes; // MI_QUITYES
char* QuitNo; // MI_QUITNO
char* EditCmd; // MS_EDITCMD
char* NoOrigDefined; // IL_NOORIGDEFINED
char* NoUserDefined; // IL_NOUSERDEFINED
char* NoAkaDefined; // IL_NOAKADEFINED
char* NoTplDefined; // IL_NOTPLDEFINED
char* NoThreadlist; // IL_NOTHREADLIST
char* SkippingTwit; // MS_SKIPPINGTWIT
char* KillingTwit; // MS_KILLINGTWIT
char* WritingCfg; // IL_WRITINGCFG
char* CouldNotOpen; // IL_COULDNOTOPEN
char* Prompt; // MS_PROMPT
char* UnfinishedMsg; // IL_UNFINISHEDMSG
char* LoadUnfinished; // ST_LOADUNFINISHED
char* ReadingEcholist; // IL_READINGECHOLIST
char* ReadingAddrMacros; // IL_READINGADDRMACROS
char* CheckingNodelists; // IL_CHECKINGNODELISTS
char* Crossposting; // ST_CROSSPOSTING
char* TwitBlanked; // IL_TWITBLANKED
char* TwitSkipped; // IL_TWITSKIPPED
char* TwitIgnoreSkip; // IL_TWITIGNORESKIP
char* TwitDisplayed; // IL_TWITDISPLAYED
char* TwitKilled; // IL_TWITKILLED
char* StylecodesNo; // IL_STYLECODESNO
char* StylecodesYes; // IL_STYLECODESYES
char* StylecodesHide; // IL_STYLECODESHIDE
char* GenCfmReceipt; // ST_GENCFMRECEIPT
char* New; // WT_NEW
char* LookupInfo; // ST_LOOKUPINFO
char* DateTimeFmt; // MS_DATETIMEFMT
char* DateFmt; // MS_DATEFMT
char* TimeFmt; // MS_TIMEFMT
char* Originallyin; // MS_ORIGINALLYIN
char* Crosspostedin; // MS_CROSSPOSTEDIN
char* CCTo; // MS_CCTO
char* StatusLineHelp; // ST_STATUSLINEHELP
char* of; // HD_OF
char* RobotMsg; // MS_ROBOTMSG
char* StatusLineTimeFmt; // ST_STATUSLINETIMEFMT
char* Replies; // WT_REPLIES
char* SelectReply; // ST_SELECTREPLY
char* WaitOrExit; // IL_WAITOREXIT
char* ReallyExit; // WT_REALLYEXIT
char* TaglineS; // MI_TAGLINES
char* HeaderEdit; // MI_HEADEREDIT
char* ScanGroup; // MI_SCANGROUP
char* QWKPacket; // WT_QWKPACKET
char* ScanQWK; // MI_SCANQWK
char* SoupPacket; // WT_SOUPPACKET
char* ScanSoup; // MI_SCANSOUP
char* ScanImport; // MI_SCANIMPORT
char* ScanExport; // MI_SCANEXPORT
char* ScanPM; // WT_SCANPM
char* Tagline; // MI_TAGLINE
char* Confirm; // WT_CONFIRM
char* ConfirmYes; // MI_CONFIRMYES
char* ConfirmNo; // MI_CONFIRMNO
char* ConfirmInfo; // IL_CONFIRMINFO
char* msg; // ST_MSG
char* msgs; // ST_MSGS
char* personal; // ST_PERSONAL
char* Grp; // WT_GRP
char* FoundPersonal; // IL_FOUNDPERSONAL
char* NoPersonal; // IL_NOPERSONAL
char* EscOrContinue; // ST_ESCORCONTINUE
char* SpellChecker; // MS_SPELLCHECKER
char* Ins; // WT_INS
char* FilelistFrom; // MI_FILELISTFROM
char* Initializing; // ST_INITIALIZING
char* Checking; // ST_CHECKING
char* LockShareCap; // ST_LOCKSHARECAP
char* AttrTurnOff; // WT_ATTRTURNOFF
char* Taglines; // WT_TAGLINES
char* ChangeTagline; // ST_CHANGETAGLINE
char* NoTagline; // IL_NOTAGLINE
char* Charsets; // WT_CHARSETS
char* ChangeXlatImp; // ST_CHANGEXLATIMP
char* CharsetAuto; // MI_CHARSETAUTO
char* NoXlatImport; // IL_NOXLATIMPORT
char* n_a; // WT_N_A
char* Written; // WT_WRITTEN
char* Arrived; // WT_ARRIVED
char* Received; // WT_RECEIVED
char* NoNodelist; // IL_NONODELIST
char* NodelistMissing; // IL_NODELISTMISSING
char* NodelistOutdated; // IL_NODELISTOUTDATED
char* Replylinker; // MS_REPLYLINKER
char* EnterMsgno; // WT_ENTERMSGNO
char* WaitUUdecoding; // IL_WAITUUDECODING
char* CompletedUUdecode; // IL_COMPLETEDUUDECODE
char* NotUUencoded; // IL_NOTUUENCODED
char* UUEinvalidpath; // IL_UUEINVALIDPATH
char* Pathreport; // IL_PATHREPORT
char* ErrorInSoup; // IL_ERRORINSOUP
char* WarnAlreadySent; // IL_WARNALREADYSENT
char* WaitLocked; // IL_WAITLOCKED
char* RetryOrESC; // ST_RETRYORESC
char* RetryLock; // ST_RETRYLOCK
char* RetryOpen; // ST_RETRYOPEN
char* TouchSemaphore; // WT_TOUCHSEMAPHORE
char* WriteToHdrNO; // MI_WRITETOHDRNO
char* WriteToHdrYES; // MI_WRITETIHDRYES
char* WriteToHdrONLY; // MI_WRITETIHDRONLY
char* Clipboard; // MI_CLIPBOARD
char* SelectMarks; // WT_SELECTMARKS
char* SelectMarksEdit; // WT_SELECTMARKSEDIT
char* DropMarksInfo; // IL_DROPMARKSINFO
char* DropMarks; // WT_DROPMARKS
char* DropAll; // MI_DROPALL
char* DropMarked; // MI_DROPMARKED
char* DropCurrent; // MI_DROPCURRENT
char* NoDrop; // MI_NODROP
char* CatchAreas; // WT_CATCHAREAS
char* CatchAll; // MI_CATCHALL
char* CatchMarked; // MI_CATCHMARKED
char* CatchCurrent; // MI_CATCHCURRENT
char* NoCatch; // MI_NOCATCH
char* Crosspost; // WT_CROSSPOST
char* XCProcess; // MI_XCPROCESS
char* XCIgnore; // MI_XCIGNORE
char* XCListFmt; // MI_XCLISTFMT
char* XCList; // WT_XCLIST
char* XCListKeep; // MI_XCLISTRAW
char* XCListNames; // MI_XCLISTVERBOSE
char* XCListVisible; // MI_XCLISTLINE
char* XCListRemove; // MI_XCLISTREMOVE
char* Addressbook; // WT_ADDRESSBOOK
char* AdvancedSearch; // WT_ADVANCEDSEARCH
char* NoMoreMatches; // IL_NOMOREMATCHES
char* HeaderEditHelp1; // WT_HEADEREDITHELP1
char* HeaderEditHelp2; // WT_HEADEREDITHELP2
char* ThreadlistTitle; // WT_THREADLISTTITLE
char* AdvancedMarking; // WT_ADVANCEDMARKING
char* UserStatusline; // ST_USERSTATUSLINE
char* UserHeaderName; // WT_USERHEADERNAME
char* UserHeaderOrg; // WT_USERHEADERORG
char* UserHeaderAka; // WT_USERHEADERAKA
char* UserWait; // IL_USERWAIT
char* ArealistSelections1;// MI_ALSELECTIONS1
char* ArealistSelections2;// MI_ALSELECTIONS2
char* Decode; // IL_DECODE
char* Preparing; // MI_PREPARING
char* EndLanguage; // LAST_CRC
};
// ------------------------------------------------------------------

3035
golded3/geline.cpp Normal file

File diff suppressed because it is too large Load Diff

122
golded3/gelmsg.cpp Normal file
View File

@ -0,0 +1,122 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Load message or header. Save header.
// ------------------------------------------------------------------
#include <golded.h>
// ------------------------------------------------------------------
void ResetMsg(GMsg* msg) {
throw_xfree(msg->references);
throw_xfree(msg->inreplyto);
throw_xfree(msg->messageid);
throw_xfree(msg->txt);
throw_xfree(msg->line);
Line* line = msg->lin;
while(line) {
Line* nextline = line->next;
if(line->isallocated())
throw_free(line->text);
throw_xfree(line);
line = nextline;
}
memset(msg, 0, sizeof(GMsg));
}
// ------------------------------------------------------------------
int Area::LoadHdr(GMsg* msg, ulong msgno) {
ResetMsg(msg);
msg->msgno = msgno;
int retval = area->load_hdr(msg);
// Don't translate charsets if we don't know charset
// Currently, it only mime-decodes, so it's okay.
if(retval) {
// Charset translate header fields
strxmimecpy(msg->realby, msg->realby, msg->charsetlevel, sizeof(INam));
strxmimecpy(msg->realto, msg->realto, msg->charsetlevel, sizeof(INam));
strxmimecpy(msg->by , msg->by , msg->charsetlevel, sizeof(INam));
strxmimecpy(msg->to , msg->to , msg->charsetlevel, sizeof(INam));
if(not (msg->attr.frq() or msg->attr.att() or msg->attr.urq()))
strxmimecpy(msg->re , msg->re , msg->charsetlevel, sizeof(ISub), true);
}
return retval;
}
// ------------------------------------------------------------------
int Area::LoadMsg(GMsg* msg, ulong msgno, int margin, int mode) {
ResetMsg(msg);
msg->msgno = msgno;
if(msgno and area->load_msg(msg)) {
if(mode & (GMSG_COPY|GMSG_MOVE)) {
if(not ((mode & GMSG_MOVE) and (mode & GMSG_UNS_NOT_RCV)))
return true;
if(not (msg->attr.uns() and not msg->attr.rcv()))
return true;
}
else {
// We can't rely on the destination address unless we are in netmail
if(not AA->isnet()) {
msg->dest.reset_fast();
msg->odest.reset_fast();
}
}
msg->attr.tou0();
msg->TextToLines(margin);
return true;
}
return false;
}
// ------------------------------------------------------------------
void Area::SaveHdr(int mode, GMsg* msg) {
// Translate softcr to configured char
if(EDIT->SoftCrXlat()) {
strchg(msg->by, SOFTCR, EDIT->SoftCrXlat());
strchg(msg->to, SOFTCR, EDIT->SoftCrXlat());
strchg(msg->realby, SOFTCR, EDIT->SoftCrXlat());
strchg(msg->realto, SOFTCR, EDIT->SoftCrXlat());
if(not (msg->attr.frq() or msg->attr.att() or msg->attr.urq()))
strchg(msg->re, SOFTCR, EDIT->SoftCrXlat());
}
area->save_hdr(mode, msg);
UpdateAreadata();
}
// ------------------------------------------------------------------

42
golded3/gemain.cpp Normal file
View File

@ -0,0 +1,42 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Main entry point and overlay size setting function.
// ------------------------------------------------------------------
#include <golded.h>
#include <gutlos.h>
// ------------------------------------------------------------------
// Main function
int main(int argc, char *argv[]) {
Initialize(argc, argv);
Reader();
return errorlevel;
}
// ------------------------------------------------------------------

843
golded3/gemenu.cpp Normal file
View File

@ -0,0 +1,843 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Menus.
// ------------------------------------------------------------------
#include <golded.h>
// ------------------------------------------------------------------
GMsg* MenuMsgPtr;
// ------------------------------------------------------------------
void DispHeadAttrs(GMsg* msg) {
char atrs[200];
MakeAttrStr(atrs, &msg->attr);
strsetsz(atrs, MAXCOL-CFG->disphdrnodeset.pos);
HeaderView->window.prints(1, CFG->disphdrnodeset.pos, HeaderView->window_color, atrs);
HeaderView->window.prints(4, 0, HeaderView->window_color, (msg->attr.att() or msg->attr.frq() or msg->attr.urq()) ? LNG->File : LNG->Subj);
}
// ------------------------------------------------------------------
static void DispHeadAttrs() {
DispHeadAttrs(MenuMsgPtr);
}
// ------------------------------------------------------------------
static void toggle_pvt() {
MenuMsgPtr->attr.pvtX();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_received() {
MenuMsgPtr->attr.rcvX();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_crash() {
MenuMsgPtr->attr.craX();
if(MenuMsgPtr->attr.cra())
MenuMsgPtr->attr.hld0();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_hold() {
MenuMsgPtr->attr.hldX();
if(MenuMsgPtr->attr.hld()) {
MenuMsgPtr->attr.cra0();
MenuMsgPtr->attr.imm0();
}
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_file() {
MenuMsgPtr->attr.attX();
if(MenuMsgPtr->attr.att()) {
AttrAdd(&MenuMsgPtr->attr, &CFG->attribsattach);
MenuMsgPtr->attr.urq0();
MenuMsgPtr->attr.frq0();
}
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_freq() {
MenuMsgPtr->attr.frqX();
if(MenuMsgPtr->attr.frq()) {
MenuMsgPtr->attr.att0();
MenuMsgPtr->attr.urq0();
}
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_updreq() {
MenuMsgPtr->attr.urqX();
if(MenuMsgPtr->attr.urq()) {
MenuMsgPtr->attr.att0();
MenuMsgPtr->attr.frq0();
}
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_kill() {
MenuMsgPtr->attr.k_sX();
if(MenuMsgPtr->attr.k_s())
MenuMsgPtr->attr.a_s0();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_sent() {
MenuMsgPtr->attr.sntX();
if(MenuMsgPtr->attr.snt()) {
MenuMsgPtr->attr.uns0();
MenuMsgPtr->attr.scn1();
}
else {
MenuMsgPtr->attr.uns1();
MenuMsgPtr->attr.scn0();
MenuMsgPtr->attr.loc1();
}
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_trunc() {
MenuMsgPtr->attr.tfsX();
if(MenuMsgPtr->attr.tfs())
MenuMsgPtr->attr.kfs0();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_delsent() {
MenuMsgPtr->attr.kfsX();
if(MenuMsgPtr->attr.kfs())
MenuMsgPtr->attr.tfs0();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_direct() {
MenuMsgPtr->attr.dirX();
if(MenuMsgPtr->attr.dir()) {
MenuMsgPtr->attr.zon0();
MenuMsgPtr->attr.hub0();
}
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_imm() {
MenuMsgPtr->attr.immX();
if(MenuMsgPtr->attr.imm())
MenuMsgPtr->attr.hld0();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_locked() {
MenuMsgPtr->attr.lokX();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_reserved() {
MenuMsgPtr->attr.rsvX();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_groupmsg() {
MenuMsgPtr->attr.grpX();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_arcsent() {
MenuMsgPtr->attr.a_sX();
if(MenuMsgPtr->attr.a_s())
MenuMsgPtr->attr.k_s0();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_zonegate() {
MenuMsgPtr->attr.zonX();
if(MenuMsgPtr->attr.zon()) {
MenuMsgPtr->attr.dir0();
MenuMsgPtr->attr.hub0();
}
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_transit() {
MenuMsgPtr->attr.trsX();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_retrecreq() {
MenuMsgPtr->attr.rrqX();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_retrec() {
MenuMsgPtr->attr.rrcX();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_orphan() {
MenuMsgPtr->attr.orpX();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_audit() {
MenuMsgPtr->attr.arqX();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_hubhost() {
MenuMsgPtr->attr.hubX();
if(MenuMsgPtr->attr.hub()) {
MenuMsgPtr->attr.dir0();
MenuMsgPtr->attr.zon0();
}
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_local() {
MenuMsgPtr->attr.locX();
if(MenuMsgPtr->attr.loc())
MenuMsgPtr->attr.trs0();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_xmail() {
MenuMsgPtr->attr.xmaX();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_cfmrecreq() {
MenuMsgPtr->attr.cfmX();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void toggle_scanned() {
MenuMsgPtr->attr.scnX();
if(MenuMsgPtr->attr.scn()) {
MenuMsgPtr->attr.snt1();
MenuMsgPtr->attr.uns0();
}
else {
MenuMsgPtr->attr.snt0();
MenuMsgPtr->attr.uns1();
MenuMsgPtr->attr.loc1();
}
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void clear_attrib() {
MenuMsgPtr->attr.reset();
DispHeadAttrs();
}
// ------------------------------------------------------------------
static void DispAttrWindow(int show=-1) {
static int wh_background = -1;
static int wh_attributes = -1;
if(show == -1)
show = wh_attributes == -1;
if(show) {
wh_background = whandle();
int wide = MaxV(strlen(LNG->AttrTitle)+2, strlen(LNG->AttrPvt)+2);
wide = MinV(wide, MAXCOL-4);
wh_attributes = wopen_(6, 0, 17, wide, W_BMENU, C_MENUB, C_MENUW);
set_title(LNG->AttrTitle, TCENTER, C_MENUT);
if(*LNG->AttrTurnOff)
wtitle(LNG->AttrTurnOff, TCENTER|TBOTTOM, C_MENUT);
title_shadow();
int n = 0;
wide -= 2;
wprintns(n++, 0, C_MENUW, LNG->AttrPvt, wide, ' ', C_MENUW);
wprintns(n++, 0, C_MENUW, LNG->AttrRcv, wide, ' ', C_MENUW);
wprintns(n++, 0, C_MENUW, LNG->AttrSnt, wide, ' ', C_MENUW);
wprintns(n++, 0, C_MENUW, LNG->AttrCrs, wide, ' ', C_MENUW);
wprintns(n++, 0, C_MENUW, LNG->AttrHld, wide, ' ', C_MENUW);
wprintns(n++, 0, C_MENUW, LNG->AttrFil, wide, ' ', C_MENUW);
wprintns(n++, 0, C_MENUW, LNG->AttrFrq, wide, ' ', C_MENUW);
wprintns(n++, 0, C_MENUW, LNG->AttrUpd, wide, ' ', C_MENUW);
wprintns(n++, 0, C_MENUW, LNG->AttrKS , wide, ' ', C_MENUW);
wprintns(n++, 0, C_MENUW, LNG->AttrKfs, wide, ' ', C_MENUW);
wprintns(n++, 0, C_MENUW, LNG->AttrTfs, wide, ' ', C_MENUW);
wprintns(n++, 0, C_MENUW, LNG->AttrDir, wide, ' ', C_MENUW);
wprintns(n++, 0, C_MENUW, LNG->AttrImm, wide, ' ', C_MENUW);
wprintns(n++, 0, C_MENUW, LNG->AttrLok, wide, ' ', C_MENUW);
wprintns(n++, 0, C_MENUW, LNG->AttrZap, wide, ' ', C_MENUW);
wactiv_(wh_background);
}
else if(wh_attributes != -1) {
wactiv_(wh_attributes);
wclose();
wactiv_(wh_background);
wh_attributes = -1;
}
}
// ------------------------------------------------------------------
static void toggle_dispattrwindow() {
DispAttrWindow();
}
// ------------------------------------------------------------------
void ChgAttrs(int mode, GMsg* __msg) {
static KBnd* k1;
if(mode) {
MenuMsgPtr = __msg;
if(EDIT->HeaderAttrs() or (mode == ALWAYS))
DispAttrWindow(true);
k1 = chgonkey(NULL);
setonkey(Key_A_F1, toggle_dispattrwindow, 0);
setonkey(Key_A_1, toggle_reserved , 0);
setonkey(Key_A_2, toggle_groupmsg , 0);
setonkey(Key_A_4, toggle_scanned , 0);
setonkey(Key_A_A, toggle_file , 0);
setonkey(Key_A_B, toggle_arcsent , 0);
setonkey(Key_A_C, toggle_crash , 0);
setonkey(Key_A_D, toggle_direct , 0);
setonkey(Key_A_E, toggle_delsent , 0);
setonkey(Key_A_F, toggle_freq , 0);
setonkey(Key_A_G, toggle_zonegate , 0);
setonkey(Key_A_H, toggle_hold , 0);
setonkey(Key_A_I, toggle_imm , 0);
setonkey(Key_A_J, toggle_transit , 0);
setonkey(Key_A_K, toggle_kill , 0);
setonkey(Key_A_L, toggle_locked , 0);
setonkey(Key_A_M, toggle_retrecreq , 0);
setonkey(Key_A_N, toggle_retrec , 0);
setonkey(Key_A_O, toggle_orphan , 0);
setonkey(Key_A_P, toggle_pvt , 0);
setonkey(Key_A_Q, toggle_audit , 0);
setonkey(Key_A_R, toggle_received , 0);
setonkey(Key_A_S, toggle_sent , 0);
setonkey(Key_A_T, toggle_trunc , 0);
setonkey(Key_A_U, toggle_updreq , 0);
setonkey(Key_A_V, toggle_hubhost , 0);
setonkey(Key_A_W, toggle_local , 0);
setonkey(Key_A_X, toggle_xmail , 0);
setonkey(Key_A_Y, toggle_cfmrecreq , 0);
setonkey(Key_A_Z, clear_attrib , 0);
}
else {
DispAttrWindow(false);
freonkey();
chgonkey(k1);
}
}
// ------------------------------------------------------------------
void AskAttributes(GMsg* __msg) {
ChgAttrs(ALWAYS, __msg);
update_statusline(LNG->ChangeAttrs);
whelpdef(CFG->helpged, Key_F1, C_HELPB, C_HELPW, C_HELPQ, C_HELPS, NULL);
whelppcat(H_Attributes);
getxch();
whelpop();
ChgAttrs(false, __msg);
}
// ------------------------------------------------------------------
int SelectFromFile(const char* file, char* selection, const char* title, const char* nolines) {
char buf[256];
int n;
bool retval=false;
char** Listi;
int lines = 0;
FILE* fp = fsopen(AddPath(CFG->goldpath, file), "rt", CFG->sharemode);
if(fp) {
while(fgets(buf, sizeof(buf), fp))
lines++;
}
if(lines) {
Listi = (char**)throw_calloc(lines+1, sizeof(char*));
rewind(fp);
for(n=0; n<lines; n++) {
fgets(buf, sizeof(buf)-2, fp);
strtrim(buf);
strins(" ", buf, 0);
strcat(buf, " ");
if(strlen(buf) > MAXCOL-2-2)
buf[MAXCOL-2-2] = NUL;
Listi[n] = throw_strdup(buf);
}
n = MinV(n, (MAXROW-10));
set_title(title, TCENTER, C_ASKT);
n = wpickstr(6, 0, 6+n+1, -1, W_BASK, C_ASKB, C_ASKW, C_ASKS, Listi, 0, title_shadow);
if(n != -1) {
strcpy(selection, Listi[n]);
retval = true;
}
for(n=0; n<lines; n++)
throw_free(Listi[n]);
throw_free(Listi);
}
else {
w_info(nolines);
waitkeyt(10000);
w_info(NULL);
}
if(fp)
fclose(fp);
return retval;
}
// ------------------------------------------------------------------
int ChangeTagline() {
char buf[256];
int n;
bool retval=false;
char** Listi;
if(not CFG->tagline.empty()) {
Listi = (char**)throw_calloc(CFG->tagline.size()+1, sizeof(char*));
gstrarray::iterator i;
for(n = 0, i = CFG->tagline.begin(); i != CFG->tagline.end(); i++, n++) {
if((*i)[0] == '@')
strxmerge(buf, MAXCOL-2-2, " [", CleanFilename(i->c_str()+1), "] ", NULL);
else
strxmerge(buf, MAXCOL-2-2, " ", i->c_str(), " ", NULL);
Listi[n] = throw_strdup(buf);
}
n = MinV(n, (MAXROW-10));
set_title(LNG->Taglines, TCENTER, C_ASKT);
update_statusline(LNG->ChangeTagline);
whelppcat(H_ChangeTagline);
n = wpickstr(6, 0, 6+n+1, -1, W_BASK, C_ASKB, C_ASKW, C_ASKS, Listi, CFG->taglineno, title_shadow);
if(n != -1) {
const char *tagl = CFG->tagline[n].c_str();
if(tagl[0] == '@') {
strxmerge(buf, MAXCOL-2-2, LNG->Taglines, " [", CleanFilename(tagl+1), "] ", NULL);
if(SelectFromFile(tagl+1, buf, LNG->Taglines, LNG->NoTagline)) {
AA->SetTagline(buf);
retval = true;
}
}
else {
CFG->taglineno = n;
AA->SetTagline(CFG->tagline[n].c_str());
retval = true;
}
}
for(n=CFG->tagline.size(); n; n--)
throw_free(Listi[n-1]);
throw_free(Listi);
whelpop();
}
else {
w_info(LNG->NoTagline);
waitkeyt(10000);
w_info(NULL);
}
return(retval);
}
// ------------------------------------------------------------------
int ChangeOrigin() {
char buf[256];
int n;
bool retval=false;
char** Listi;
if(not CFG->origin.empty()) {
Listi = (char**)throw_calloc(CFG->origin.size()+1, sizeof(char*));
gstrarray::iterator i;
for(n = 0, i = CFG->origin.begin(); i != CFG->origin.end(); n++, i++) {
if((*i)[0] == '@')
strxmerge(buf, MAXCOL-2-2, " [", CleanFilename(i->c_str()+1), "] ", NULL);
else
strxmerge(buf, MAXCOL-2-2, " ", i->c_str(), " ", NULL);
Listi[n] = throw_strdup(buf);
}
n = MinV(n, (MAXROW-10));
set_title(LNG->Origins, TCENTER, C_ASKT);
update_statusline(LNG->ChangeOrigin);
whelppcat(H_ChangeOrigin);
n = wpickstr(6, 0, 6+n+1, -1, W_BASK, C_ASKB, C_ASKW, C_ASKS, Listi, CFG->originno, title_shadow);
if(n != -1) {
const char *orig = CFG->origin[n].c_str();
if(orig[0] == '@') {
strxmerge(buf, MAXCOL-2-2, LNG->Origins, " [", CleanFilename(orig+1), "] ", NULL);
if(SelectFromFile(orig+1, buf, LNG->Origins, LNG->NoOrigDefined)) {
AA->SetOrigin(buf);
retval = true;
}
}
else {
CFG->originno = n;
AA->SetOrigin(orig);
retval = true;
}
}
for(n = CFG->origin.size(); n; n--)
throw_free(Listi[n-1]);
throw_free(Listi);
whelpop();
}
else {
w_info(LNG->NoOrigDefined);
waitkeyt(10000);
w_info(NULL);
}
return(retval);
}
// ------------------------------------------------------------------
int ChangeUsername() {
char buf[256], adrs[40];
int n;
char** Listi;
if(not CFG->username.empty()) {
Listi = (char**)throw_calloc(CFG->username.size()+1, sizeof(char*));
vector<Node>::iterator i;
for(n = 0, i = CFG->username.begin(); i != CFG->username.end(); n++, i++) {
i->addr.make_string(adrs);
sprintf(buf, " %-35s %s ", i->name, adrs);
Listi[n] = throw_strdup(buf);
}
n = MinV(n, (MAXROW-10));
set_title(LNG->Usernames, TCENTER, C_ASKT);
update_statusline(LNG->ChangeUsername);
whelppcat(H_ChangeUsername);
n = wpickstr(6, 0, 6+n+1, -1, W_BASK, C_ASKB, C_ASKW, C_ASKS, Listi, CFG->usernameno, title_shadow);
if(n != -1) {
CFG->usernameno = n;
AA->SetUsername(CFG->username[n]);
for(vector<gaka>::iterator a = CFG->aka.begin(); a != CFG->aka.end(); a++) {
if(AA->Username().addr.match(a->addr)) {
AA->SetAka(a->addr);
break;
}
}
}
for(n = CFG->username.size(); n; n--)
throw_free(Listi[n-1]);
throw_free(Listi);
whelpop();
}
else {
w_info(LNG->NoUserDefined);
waitkeyt(10000);
w_info(NULL);
}
return(YES);
}
// ------------------------------------------------------------------
int ChangeTemplate() {
char buf[256], adrs[40];
int n;
int selected=-1;
char** Listi;
if(not CFG->tpl.empty()) {
Listi = (char**)throw_calloc(CFG->tpl.size()+1, sizeof(char*));
vector<Tpl>::iterator t;
for(n = 0, t = CFG->tpl.begin(); t != CFG->tpl.end(); n++, t++) {
t->match.make_string(adrs);
sprintf(buf, " %-45s %s ", t->name, adrs);
Listi[n] = throw_strdup(buf);
}
n = MinV(n, (MAXROW-10));
set_title(LNG->Templates, TCENTER, C_ASKT);
update_statusline(LNG->ChangeTemplate);
whelppcat(H_ChangeTemplate);
n = wpickstr(6, 0, 6+n+1, -1, W_BASK, C_ASKB, C_ASKW, C_ASKS, Listi, CFG->tplno, title_shadow);
whelpop();
if(n != -1) {
AA->SetTpl(CFG->tpl[n].file);
CFG->tplno = n;
}
selected = n;
for(n = CFG->tpl.size(); n; n--)
throw_free(Listi[n-1]);
throw_free(Listi);
}
else {
w_info(LNG->NoTplDefined);
waitkeyt(10000);
w_info(NULL);
}
return selected;
}
// ------------------------------------------------------------------
int ChangeAka() {
int n;
vector<gaka>::iterator i;
int startat = 0;
char** Listi;
char addr[100], buf[100];
if(CFG->aka.size() > 1) {
Listi = (char**)throw_calloc(CFG->aka.size()+1, sizeof(char*));
for(i = CFG->aka.begin(), n=0; i != CFG->aka.end(); n++, i++) {
i->addr.make_string(addr, i->domain);
sprintf(buf, " %s ", addr);
Listi[n] = throw_strdup(buf);
if(AA->Aka().addr.equals(i->addr))
startat = n;
}
n = MinV(n, (MAXROW-10));
set_title(LNG->Akas, TCENTER, C_ASKT);
update_statusline(LNG->ChangeAka);
whelppcat(H_ChangeAka);
n = wpickstr(6, 0, 6+n+1, -1, W_BASK, C_ASKB, C_ASKW, C_ASKS, Listi, startat, title_shadow);
whelpop();
if(n != -1)
AA->SetAka(CFG->aka[n].addr);
for(n=CFG->aka.size(); n; n--)
throw_free(Listi[n-1]);
throw_free(Listi);
}
else {
w_info(LNG->NoAkaDefined);
waitkeyt(10000);
w_info(NULL);
}
return(YES);
}
// ------------------------------------------------------------------
int ChangeXlatImport() {
int n, startat = 0;
int xlatimports = 1;
int maximport = 0;
int maxexport = 0;
char** Listi;
char buf[100];
if(not CFG->xlatcharset.empty()) {
Listi = (char**)throw_calloc(CFG->xlatcharset.size()+2, sizeof(char*));
vector<Map>::iterator xlt;
for(xlt = CFG->xlatcharset.begin(); xlt != CFG->xlatcharset.end(); xlt++) {
if(strieql(xlt->exp, CFG->xlatlocalset)) {
maximport = MaxV(maximport, (int)strlen(xlt->imp));
maxexport = MaxV(maxexport, (int)strlen(xlt->exp));
if(strieql(xlt->imp, AA->Xlatimport()))
startat = xlatimports;
xlatimports++;
}
}
Listi[0] = throw_strdup(LNG->CharsetAuto);
xlatimports = 1;
for(xlt = CFG->xlatcharset.begin(); xlt != CFG->xlatcharset.end(); xlt++) {
if(strieql(xlt->exp, CFG->xlatlocalset)) {
sprintf(buf, " %*.*s -> %-*.*s ",
maximport, maximport, xlt->imp,
maxexport, maxexport, xlt->exp
);
Listi[xlatimports++] = throw_strdup(buf);
}
}
n = MinV(xlatimports, (MAXROW-10));
set_title(LNG->Charsets, TCENTER, C_ASKT);
update_statusline(LNG->ChangeXlatImp);
whelppcat(H_ChangeXlatImport);
n = wpickstr(6, 0, 6+n+1, -1, W_BASK, C_ASKB, C_ASKW, C_ASKS, Listi, startat, title_shadow);
whelpop();
if(n == 0) {
CFG->ignorecharset = false;
}
else if(n != -1) {
CFG->ignorecharset = true;
AA->SetXlatimport(strtok(Listi[n], " "));
}
for(n=0; n<xlatimports; n++)
throw_free(Listi[n]);
throw_free(Listi);
}
else {
w_info(LNG->NoXlatImport);
waitkeyt(10000);
w_info(NULL);
}
return true;
}
// ------------------------------------------------------------------

1294
golded3/gemlst.cpp Normal file

File diff suppressed because it is too large Load Diff

1078
golded3/gemnus.cpp Normal file

File diff suppressed because it is too large Load Diff

306
golded3/gemnus.h Normal file
View File

@ -0,0 +1,306 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Derived menu classes.
// ------------------------------------------------------------------
// ------------------------------------------------------------------
#include <gmnubase.h>
// ------------------------------------------------------------------
// General menu with ASK colors
class GMnuAsk : public GMnu {
public:
void AskInit(int __row, int __col, char* __title, int __help);
};
// ------------------------------------------------------------------
// General YES/NO selection menu
class GMnuYesNo : public GMnuAsk {
public:
int YesNo(int __row, int __col, char* __title, char* __yes, char* __no, int __help, int __yesno=YES);
};
// ------------------------------------------------------------------
class GMenuQuit : public GMnuYesNo {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuReadonly : public GMnuYesNo {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuChange : public GMnuYesNo {
public:
int Run(char* info);
};
// ------------------------------------------------------------------
class GMenuLockLoop : public GMnuYesNo {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuDelorig : public GMnuYesNo {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuDropmsg : public GMnuYesNo {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuZonegate : public GMnuYesNo {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuForward : public GMnuYesNo {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuOverwrite : public GMnuAsk {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuDelete : public GMnuAsk {
public:
int Run(int all, GMsg* __msg);
};
// ------------------------------------------------------------------
class GMenuNewarea : public GMnuAsk {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuCMF : public GMnuAsk {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuDomarks : public GMnuAsk {
public:
int Run(char* dowhat);
};
// ------------------------------------------------------------------
class GMenuWriteMsg : public GMnuAsk {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuImportTxt : public GMnuAsk {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuMarkMsgs : public GMnuAsk {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuEditfile : public GMnuAsk {
public:
int Run(GMsg* __msg);
};
// ------------------------------------------------------------------
class GMenuCarbon : public GMnuAsk {
public:
int Run(GMsg* __msg);
};
// ------------------------------------------------------------------
class GMenuCross : public GMnuAsk {
public:
int Run(GMsg* __msg);
};
// ------------------------------------------------------------------
class GMnuAreaDo : public GMnuAsk {
public:
int With(char* __title, char* __all, char* __marked, char* __current, int __full, char* __no, int __help);
};
// ------------------------------------------------------------------
class GMenuAreaScan : public GMnuAreaDo {
public:
int Run(int pmscan);
};
// ------------------------------------------------------------------
class GMenuAreaHeat : public GMnuAreaDo {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuAreaZap : public GMnuAreaDo {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuAreaCatchup : public GMnuAreaDo {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuAreaDropMarks : public GMnuAreaDo {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuEditHeader : public GMnu {
public:
int Run(int mode, GMsg* msg);
};
// ------------------------------------------------------------------
class GMenuConfirm : public GMnuYesNo {
public:
int Run();
};
// ------------------------------------------------------------------
class GMenuNavigate : public GMnu {
public:
int Run();
};
// ------------------------------------------------------------------

357
golded3/gemrks.cpp Normal file
View File

@ -0,0 +1,357 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Msg marks handling.
// ------------------------------------------------------------------
#include <golded.h>
#include <gesrch.h>
// ------------------------------------------------------------------
extern GMsg* reader_msg;
// ------------------------------------------------------------------
int NextMarkedmsg(int direction, GMsg* msg) {
GTag& tag = AA->isreadpm ? AA->PMrk : AA->Mark;
if(tag.Count()) {
uint n;
ulong msgno = 0;
if(direction == DIR_NEXT) {
if(msg->msgno != tag[tag.Count()-1]) {
for(n=0; n<tag.Count(); n++) {
if(tag[n] > msg->msgno) {
break;
}
}
if(n >= tag.Count())
n = tag.Count()-1;
msgno = n+1;
}
else {
n = tag.Count()-1;
}
AA->set_lastread(AA->Msgn.ToReln(tag[n]));
}
else {
if(msg->msgno != tag[0]) {
n = tag.Count();
do {
if(tag[--n] < msg->msgno)
break;
} while(n);
msgno = n+1;
}
else {
n = 0;
}
AA->set_lastread(AA->Msgn.ToReln(tag[n]));
}
return msgno ? 1 : 0;
}
return 0;
}
// ------------------------------------------------------------------
void MarkMsgs_Unmark() {
AA->Mark.ResetAll();
AA->isreadmark = false;
}
// ------------------------------------------------------------------
void MarkMsgs_Toggle() {
GTag tmp;
// Transplant current marks
tmp.SetCount(AA->Mark.Count());
tmp.tag = AA->Mark.tag;
tmp.allocated = AA->Mark.allocated;
// Reset marks
AA->Mark.SetCount(0);
AA->Mark.tag = NULL;
AA->Mark.allocated = 0;
AA->isreadmark = false;
if(tmp.Count()) {
AA->Mark.Resize(AA->Msgn.Count()-tmp.Count());
uint m=0, x=0;
for(uint n = 0; n < AA->Msgn.Count(); n++) {
if(tmp.tag[x] != AA->Msgn[n])
AA->Mark[m++] = AA->Msgn[n];
else
x++;
}
}
tmp.Reset();
}
// ------------------------------------------------------------------
void MarkMsgs_All() {
AA->Mark.Resize(AA->Msgn.Count());
memcpy(AA->Mark.tag, AA->Msgn.tag, AA->Msgn.Count()*sizeof(ulong));
}
// ------------------------------------------------------------------
void MarkMsgs_New() {
uint oldmarks = AA->Mark.Count();
AA->Mark.Resize(AA->Mark.Count()+(AA->Msgn.Count() - AA->lastread()));
memcpy(AA->Mark.tag+oldmarks, AA->Msgn.tag+AA->lastread(), (AA->Msgn.Count()-AA->lastread())*sizeof(ulong));
AA->Mark.Sort();
AA->Mark.ElimDups();
}
// ------------------------------------------------------------------
void MarkMsgs_Old() {
uint oldmarks = AA->Mark.Count();
AA->Mark.Resize(AA->Mark.Count() + (AA->lastread() - 1));
memcpy(AA->Mark.tag+oldmarks, AA->Msgn.tag, (AA->lastread()-1)*sizeof(ulong));
AA->Mark.Sort();
AA->Mark.ElimDups();
}
// ------------------------------------------------------------------
void MarkMsgs_Range() {
uint markstart = AA->Msgn.ToReln(AA->bookmark);
uint markstop = AA->lastread();
uint temp = MinV(markstart, markstop);
uint mrks = (MaxV(markstart, markstop) - MinV(markstart, markstop)) + 1;
uint oldmarks = AA->Mark.Count();
AA->Mark.Resize(AA->Mark.Count() + mrks);
for(uint n=0; n<mrks; n++)
AA->Mark[oldmarks+n] = AA->Msgn[temp+n-1];
AA->Mark.Sort();
AA->Mark.ElimDups();
}
// ------------------------------------------------------------------
void MarkMsgs_Txt(int item, char* markstring) {
if(item == TAG_MARKHEADER or item == TAG_MARKTXTHDR) {
if(not edit_string(markstring, sizeof(INam), LNG->EnterMarkString, H_MarkString))
return;
}
GMsg* msg = (GMsg*)throw_calloc(1, sizeof(GMsg));
golded_search_manager srchmgr;
srchmgr.prepare_from_string(markstring, (item == TAG_MARKTXTHDR) ? GFIND_HDRTXT : GFIND_HDR);
w_progress(MODE_NEW, C_INFOW, 0, AA->Msgn.Count(), LNG->AdvancedMarking);
uint n;
int marked=0;
for(n=AA->lastread(); srchmgr.direction == DIR_NEXT ? (n<=AA->Msgn.Count()) : (n>=1); srchmgr.direction == DIR_NEXT ? n++ : n--) {
if(kbxhit()) {
if(kbxget() == Key_Esc) {
HandleGEvent(EVTT_SEARCHFAILED);
break;
}
}
update_statuslinef(LNG->SearchingMsg, n, AA->Msgn.Count(), marked);
w_progress(MODE_UPDATE, C_INFOW, n, AA->Msgn.Count(), NULL);
if(AA->LoadMsg(msg, AA->Msgn[n-1], CFG->dispmargin-(int)CFG->switches.get(disppagebar))) {
bool success = srchmgr.search(msg, false, true);
if(srchmgr.reverse ? not success : success) {
AA->Mark.Add(msg->msgno);
update_statuslinef(LNG->SearchingMsg, n, AA->Msgn.Count(), ++marked);
}
}
}
w_progress(MODE_QUIT, 0, 0, 0, NULL);
ResetMsg(msg);
throw_free(msg);
}
// ------------------------------------------------------------------
static void recursive_mark(GMsg* msg, ulong msgno) {
int i;
gmsg_links templink;
if(AA->Msgn.ToReln(msgno) and AA->LoadHdr(msg, msgno)) {
templink = msg->link;
if(templink.first())
AA->Mark.Add(templink.first());
for(i = 0; i < templink.list_max(); i++) {
if(templink.list(i)) {
AA->Mark.Add(templink.list(i));
}
}
if(templink.first())
recursive_mark(msg, templink.first());
for(i = 0; i < templink.list_max(); i++) {
if(templink.list(i)) {
recursive_mark(msg, templink.list(i));
}
}
}
}
// ------------------------------------------------------------------
void MarkMsgs_Thread(GMsg* msg) {
GMsg* tempmsg = (GMsg*)throw_calloc(1, sizeof(GMsg));
tempmsg->msgno = msg->msgno;
w_info(LNG->Wait);
AA->Mark.Add(msg->msgno);
ulong msgno = msg->link.to();
while(AA->Msgn.ToReln(msgno)) { // Search backwards
AA->Mark.Add(msgno);
if(not AA->LoadHdr(tempmsg, msgno))
tempmsg->link.to_set(0);
msgno = tempmsg->link.to();
}
recursive_mark(tempmsg, tempmsg->msgno);
w_info(NULL);
ResetMsg(tempmsg);
throw_free(tempmsg);
}
// ------------------------------------------------------------------
void MarkMsgs(GMsg* msg) {
GFTRK("MarkMsgs");
static INam markstring;
GMenuMarkMsgs MenuMarkMsgs;
int item = MenuMarkMsgs.Run();
switch(item) {
// ---------------------------------------------------------------
case TAG_MARKUNMARK:
MarkMsgs_Unmark();
break;
// ---------------------------------------------------------------
case TAG_MARKTOGGLE:
MarkMsgs_Toggle();
break;
// ---------------------------------------------------------------
case TAG_MARKALLMSGS:
MarkMsgs_All();
break;
// ---------------------------------------------------------------
case TAG_MARKNEWMSGS:
MarkMsgs_New();
break;
// ---------------------------------------------------------------
case TAG_MARKOLDMSGS:
MarkMsgs_Old();
break;
// ---------------------------------------------------------------
case TAG_MARKRANGE:
MarkMsgs_Range();
break;
// ---------------------------------------------------------------
case TAG_MARKYOURMAIL:
sprintf(markstring, "\"%s\"", AA->Username().name);
// Drop through!
// ---------------------------------------------------------------
case TAG_MARKHEADER:
// Drop through!
// ---------------------------------------------------------------
case TAG_MARKTXTHDR:
MarkMsgs_Txt(item, markstring);
break;
// ---------------------------------------------------------------
case TAG_MARKTHREAD:
MarkMsgs_Thread(msg);
break;
}
GFTRK(NULL);
}
// ------------------------------------------------------------------
void MarkingOptions() {
if(AA->Msgn.Count())
MarkMsgs(reader_msg);
}
// ------------------------------------------------------------------

608
golded3/gemsgs.cpp Normal file
View File

@ -0,0 +1,608 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Misc. msg handling.
// ------------------------------------------------------------------
#include <cstdarg>
#include <golded.h>
#include <gtimall.h>
// ------------------------------------------------------------------
static bool tokenxchg(char*& dst, char* tok, const char* src, int len = 0, int cnt = 0, ...) {
uint toklen = strlen(tok);
char buf[100];
bool use;
if(*dst != *tok)
return false;
if(not strnieql(dst, tok, toklen)) {
if(len and *dst and (*(dst+1) == '_') and *(dst+2)) {
if(not strnieql(dst+2, tok+1, toklen-1))
return false;
else
toklen++;
}
else
return false;
}
else
len = 0;
va_list a;
va_start(a, cnt);
for(int i = 0; i < cnt; i ++) {
use = va_arg(a, bool);
if(dst[toklen] == '{') {
char *p = strchr(dst+toklen, '}');
if(p) {
uint len = p-dst-toklen-1;
if(use && len) {
strxcpy (buf, dst+toklen+1, len+1);
src = buf;
}
toklen = p-dst+1;
}
}
}
va_end(a);
uint sl = strlen(src);
uint srclen = (len == 0) ? sl : len;
memmove(dst+srclen, dst+toklen, strlen(dst+toklen)+1);
memset(dst, ' ', srclen);
memcpy(dst, src, sl);
dst += srclen;
return true;
}
// ------------------------------------------------------------------
char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int __origarea) {
char longpid[100];
sprintf(longpid, "%s%s%s%s", __gver_prename__, __gver_name__, __gver_postname__, __gver_platform__);
char shortpid[100];
sprintf(shortpid, "%s%s", __gver_shortname__, __gver_shortplatform__);
char longverbuf[100];
sprintf(longverbuf, "%s%i.%i.%i%s", __gver_preversion__, __gver_major__, __gver_minor__, __gver_release__, __gver_postversion__);
char verbuf[100];
sprintf(verbuf, "%i.%i.%i", __gver_major__, __gver_minor__, __gver_release__);
char revbuf[100];
sprintf(revbuf, "%02d%02d", str2mon(__gver_date__), atoi(&__gver_date__[4]));
char xmailer[356];
get_informative_string(xmailer);
struct tm* written_tm = gmtime(&msg->written);
char cdate[32];
strftimei(cdate, 32, LNG->DateFmt, written_tm);
char ctime[32];
strftimei(ctime, 32, LNG->TimeFmt, written_tm);
written_tm = gmtime(&oldmsg->written);
char odate[32];
strftimei(odate, 32, LNG->DateFmt, written_tm);
char otime[32];
strftimei(otime, 32, LNG->TimeFmt, written_tm);
const char* osslashbuf = __gver_platform__;
const char* origareaid = AL.AreaIdToPtr(__origarea)->echoid();
bool origareaisinet = AL.AreaIdToPtr(__origarea)->isinternet();
bool currareaisinet = AA->isinternet();
char* modereptr = oldmsg->re;
if(mode == MODE_QUOTE or mode == MODE_REPLYCOMMENT or mode == MODE_REPLY) {
if(AL.AreaIdToPtr(__origarea)->Areareplydirect() and oldmsg->areakludgeid)
origareaid = oldmsg->areakludgeid;
}
else if(mode != MODE_FORWARD)
modereptr = msg->re;
char buf[100];
char* dst = input;
while(*dst) {
while((*dst != '@') and (*dst != LF) and *dst)
dst++;
if(*dst == LF)
*dst++ = CR;
else if(*dst == '@') {
if(dst[1] == '@') {
memmove(dst, dst+1, strlen(dst+1)+1);
dst++;
}
else {
if(tokenxchg(dst, "@cecho", AA->echoid()))
continue;
if(tokenxchg(dst, "@cdesc", AA->desc()))
continue;
if(tokenxchg(dst, "@oecho", origareaid))
continue;
if(tokenxchg(dst, "@odesc", AL.AreaEchoToPtr(origareaid)->desc()))
continue;
if(origareaisinet) {
if(tokenxchg(dst, "@oaddr", oldmsg->iorig, 19))
continue;
}
else {
if(tokenxchg(dst, "@oaddr", oldmsg->orig.make_string(buf, oldmsg->odom), 19))
continue;
if(strnieql(dst, "@o3daddr", 8)) {
ftn_addr boss = oldmsg->orig;
boss.point = 0;
tokenxchg(dst, "@o3daddr", boss.make_string(buf, oldmsg->odom), 19);
continue;
}
}
if(tokenxchg(dst, "@oname", strbtrim(strtmp(oldmsg->By())), 34, 2,
msg->by_me(), msg->by_you()))
continue;
if(tokenxchg(dst, "@ofname", strlword(oldmsg->By()), 0, 2,
msg->by_me(), msg->by_you()))
continue;
if(tokenxchg(dst, "@olname", strrword(oldmsg->By()), 0, 2,
msg->by_me(), msg->by_you()))
continue;
if(tokenxchg(dst, "@odate", odate))
continue;
if(tokenxchg(dst, "@otime", otime))
continue;
if(tokenxchg(dst, "@otzoffset", (oldmsg->tzutc == -32767) ? "" : (sprintf(buf, " %+05d", oldmsg->tzutc), buf)))
continue;
if(tokenxchg(dst, "@ofrom", oldmsg->ifrom))
continue;
if(tokenxchg(dst, "@oto", oldmsg->ito))
continue;
if(tokenxchg(dst, "@omessageid", oldmsg->messageid ? oldmsg->messageid : ""))
continue;
if(origareaisinet) {
if(tokenxchg(dst, "@daddr", oldmsg->iaddr, 19))
continue;
}
else {
if(tokenxchg(dst, "@daddr", oldmsg->dest.make_string(buf, oldmsg->ddom), 19))
continue;
if(strnieql(dst, "@d3daddr", 8)) {
ftn_addr boss = oldmsg->dest;
boss.point = 0;
tokenxchg(dst, "@d3daddr", boss.make_string(buf, oldmsg->ddom), 19);
continue;
}
}
if(tokenxchg(dst, "@dname", strbtrim(strtmp(oldmsg->To())), 34, 3,
msg->to_me(), msg->to_you(), oldmsg->to_all()))
continue;
if(tokenxchg(dst, "@dfname", strlword(oldmsg->To()), 0, 3,
msg->to_me(), msg->to_you(), oldmsg->to_all()))
continue;
if(tokenxchg(dst, "@dlname", strrword(oldmsg->To()), 0, 3,
msg->to_me(), msg->to_you(), oldmsg->to_all()))
continue;
if(currareaisinet) {
if(tokenxchg(dst, "@taddr", msg->iaddr, 19))
continue;
}
else {
if(tokenxchg(dst, "@taddr", msg->dest.make_string(buf, msg->ddom), 19))
continue;
if(strnieql(dst, "@t3daddr", 8)) {
ftn_addr boss = msg->dest;
boss.point = 0;
tokenxchg(dst, "@t3daddr", boss.make_string(buf, msg->ddom), 19);
continue;
}
}
if(tokenxchg(dst, "@tname", strbtrim(strtmp(msg->To())), 34, 3,
false, false, msg->to_all()))
continue;
if(tokenxchg(dst, "@tfname", strlword(msg->To()), 0, 3,
false, false, msg->to_all()))
continue;
if(tokenxchg(dst, "@tlname", strrword(msg->To()), 0, 3,
false, false, msg->to_all()))
continue;
if(currareaisinet) {
if(tokenxchg(dst, "@caddr", AA->Internetaddress(), 19))
continue;
}
else {
if(tokenxchg(dst, "@caddr", AA->Aka().addr.make_string(buf), 19))
continue;
if(strnieql(dst, "@c3daddr", 8)) {
ftn_addr boss = AA->Aka().addr;
boss.point = 0;
tokenxchg(dst, "@c3daddr", boss.make_string(buf), 19);
continue;
}
}
if(tokenxchg(dst, "@cname", AA->Username().name, 34))
continue;
if(tokenxchg(dst, "@cfname", strlword(strcpy(buf, AA->Username().name))))
continue;
if(tokenxchg(dst, "@clname", strrword(strcpy(buf, AA->Username().name))))
continue;
if(tokenxchg(dst, "@cdate", cdate))
continue;
if(tokenxchg(dst, "@ctime", ctime))
continue;
if(tokenxchg(dst, "@ctzoffset", AA->Usetzutc() ? (sprintf(buf, " %+05d", tzoffset()), buf) : ""))
continue;
if(currareaisinet) {
if(tokenxchg(dst, "@faddr", msg->iorig, 19))
continue;
}
else {
if(tokenxchg(dst, "@faddr", msg->orig.make_string(buf, msg->odom), 19))
continue;
if(strnieql(dst, "@f3daddr", 8)) {
ftn_addr boss = msg->orig;
boss.point = 0;
tokenxchg(dst, "@f3daddr", boss.make_string(buf, msg->odom), 19);
continue;
}
}
if(tokenxchg(dst, "@fname", strbtrim(strtmp(msg->By())), 34))
continue;
if(tokenxchg(dst, "@ffname", strlword(msg->By())))
continue;
if(tokenxchg(dst, "@flname", strrword(msg->By())))
continue;
if(strnieql(dst, "@dpseudo", 8)) {
if(*(oldmsg->pseudoto) == NUL)
build_pseudo(oldmsg);
tokenxchg(dst, "@dpseudo", oldmsg->pseudoto, 0, 3, msg->to_me(), msg->to_you(), oldmsg->to_all());
continue;
}
if(strnieql(dst, "@opseudo", 8)) {
if(*(oldmsg->pseudofrom) == NUL)
build_pseudo(oldmsg, false);
tokenxchg(dst, "@opseudo", oldmsg->pseudofrom, 0, 2, msg->by_me(), msg->by_you());
continue;
}
if(strnieql(dst, "@tpseudo", 8)) {
if(*(msg->pseudoto) == NUL)
build_pseudo(msg);
tokenxchg(dst, "@tpseudo", msg->pseudoto, 0, 3, false, false, msg->to_all());
continue;
}
// Same as above (just for backward compatibility)
if(strnieql(dst, "@pseudo", 7)) {
if(*(msg->pseudoto) == NUL)
build_pseudo(msg);
tokenxchg(dst, "@pseudo", msg->pseudoto, 0, 3, false, false, msg->to_all());
continue;
}
if(strnieql(dst, "@fpseudo", 8)) {
if(*(msg->pseudofrom) == NUL)
build_pseudo(msg, false);
tokenxchg(dst, "@fpseudo", msg->pseudofrom);
continue;
}
if(tokenxchg(dst, "@cpseudo", *AA->Nickname() ? AA->Nickname() : strlword(strcpy(buf, AA->Username().name))))
continue;
if(tokenxchg(dst, "@version", longverbuf))
continue;
if(tokenxchg(dst, "@ver", verbuf))
continue;
if(tokenxchg(dst, "@rev", revbuf))
continue;
if(tokenxchg(dst, "@pid", shortpid))
continue;
if(tokenxchg(dst, "@longpid", longpid))
continue;
if(tokenxchg(dst, "@widepid", xmailer))
continue;
if(tokenxchg(dst, "@serialno", ""))
continue;
if(tokenxchg(dst, "@os2slash", osslashbuf))
continue;
if(tokenxchg(dst, "@osslash", osslashbuf))
continue;
if(tokenxchg(dst, "@subject", modereptr))
continue;
if(tokenxchg(dst, "@tagline",
HandleRandomLine(strxcpy(buf, AA->Tagline(), sizeof(buf)), sizeof(buf))))
continue;
if(tokenxchg(dst, "@tearline",
HandleRandomLine(strxcpy(buf, AA->Tearline(), sizeof(buf)), sizeof(buf))))
continue;
if(tokenxchg(dst, "@origin",
HandleRandomLine(strxcpy(buf, AA->Origin(), sizeof(buf)), sizeof(buf))))
continue;
dst++;
}
}
}
return input;
}
// ------------------------------------------------------------------
// ROT13 De/crypting function
void Rot13(GMsg* msg) {
char c;
char* ptr;
int n;
Line* line;
static char rot13_table[256];
static char done = NO;
#define ROT13_DECODE(c) (((c) & 0x80) ? (c) : rot13_table[c])
if(not done) {
for(n=0; n<256; n++) {
c = (char)n;
if (c >= 'a' and c <= 'm') c += '\xD';
else if(c >= 'n' and c <= 'z') c -= '\xD';
else if(c >= 'A' and c <= 'M') c += '\xD';
else if(c >= 'N' and c <= 'Z') c -= '\xD';
rot13_table[n] = c;
}
done = YES;
}
line = msg->lin;
while(line) {
if(not (line->type & (GLINE_KLUDGE|GLINE_TEAR|GLINE_ORIG))) {
ptr = line->text;
while((c = *ptr) != NUL)
*ptr++ = ROT13_DECODE(c);
}
line = line->next;
}
}
// ------------------------------------------------------------------
void LoadText(GMsg* msg, const char* textfile) {
FILE* fp;
uint size;
char* buf;
char* ptr;
char* txtptr;
int hardcr = NO, hardlen;
char hardline[20], tabspaces[9];
strcpy(tabspaces, " ");
#define PBUFSIZE 4096 // Allow a 4k long paragraph
buf = (char*)throw_malloc(PBUFSIZE);
fp = fsopen(textfile, "rt", CFG->sharemode);
if(fp) {
uint tlen = (uint)(fsize(fp)+512);
msg->txt = txtptr = (char*)throw_realloc(msg->txt, tlen);
memset(msg->txt, NUL, tlen);
tabspaces[CFG->disptabsize] = NUL;
if(EDIT->HardLines())
strcpy(hardline, EDIT->HardLine());
else
*hardline = NUL;
strcat(hardline, "\n");
hardlen = strlen(hardline);
*txtptr = NUL;
while(fgets(buf, PBUFSIZE, fp)) {
strsrep(buf, "\t", tabspaces); // Expand tabs
if(strneql(buf, hardline, hardlen)) {
hardcr = not hardcr;
if(*txtptr == LF)
*txtptr = CR;
if(*txtptr)
txtptr++;
strcpy(buf, "\r");
}
else {
ptr = buf;
while(*ptr == ' ') // Skip leading spaces
ptr++;
if(*ptr != LF) {
strsrep(buf, hardline, "\r");
if(hardcr or *buf == CTRL_A) {
buf[strlen(buf)-1] = CR;
if(*txtptr == LF)
*txtptr = CR;
}
else if(is_quote(buf)) {
buf[strlen(buf)-1] = CR;
if(*txtptr == LF)
*txtptr = CR;
}
else if((buf[0] == buf[1]) and (buf[0] == buf[2])) {
buf[strlen(buf)-1] = CR;
if(*txtptr == LF)
*txtptr = CR;
}
else if(strnieql(buf, " * Origin: ", 11)) {
buf[strlen(buf)-1] = CR;
if(*txtptr == LF)
*txtptr = CR;
}
else if(strnieql(ptr, "CC:", 3)) {
buf[strlen(buf)-1] = CR;
if(*txtptr == LF)
*txtptr = CR;
}
else if(strnieql(ptr, "XC:", 3)) {
buf[strlen(buf)-1] = CR;
if(*txtptr == LF)
*txtptr = CR;
}
else if(strnieql(buf, "SEEN-BY: ", 9)) {
buf[strlen(buf)-1] = CR;
if(*txtptr == LF)
*txtptr = CR;
}
if(*txtptr == LF) {
if(*(txtptr-1) != ' ' and *ptr != ' ')
*txtptr++ = ' ';
}
else if(*txtptr != 0)
txtptr++;
}
else {
if(*txtptr == LF)
*txtptr = CR;
if(*txtptr)
txtptr++;
strcpy(buf, "\r");
}
}
if(*(txtptr-1) == CR or *txtptr == NUL) {
ptr = buf;
size = strlen(ptr);
memcpy(txtptr, ptr, size);
txtptr += size-1;
}
}
if(*txtptr != CR)
*(++txtptr) = CR;
*(++txtptr) = NUL;
fclose(fp);
}
throw_free(buf);
}
// ------------------------------------------------------------------
void GMsg::LinesToText() {
// Allow paragraphs up to 64k-1 long in the transfer buffer
int bufsize = 65535;
char* _buf = (char*)throw_malloc(bufsize);
Chs* _xlat_table = CharTable;
int _xlat_level = _xlat_table ? (_xlat_table->level ? _xlat_table->level : 2) : 0;
XlatStr(_buf, realby, _xlat_level, _xlat_table);
strxcpy(realby, _buf, sizeof(INam));
XlatStr(_buf, realto, _xlat_level, _xlat_table);
strxcpy(realto, _buf, sizeof(INam));
XlatStr(_buf, by, _xlat_level, _xlat_table);
strxcpy(by, _buf, sizeof(INam));
XlatStr(_buf, to, _xlat_level, _xlat_table);
strxcpy(to, _buf, sizeof(INam));
if(not (attr.frq() or attr.att() or attr.urq())) {
XlatStr(_buf, re, _xlat_level, _xlat_table);
strxcpy(re, _buf, sizeof(ISub));
}
int _lfterm = EDIT->CrLfTerm() and not AA->ispcboard();
int _hardterm = AA->Edithardterm() or AA->ispcboard() or AA->iswildcat();
int _isezycom = AA->isezycom();
uint _alloc_size = 1024;
Line* _line = lin;
uint _lines = 0;
// Approximate the size of the text
while(_line) {
_alloc_size += strlen(_line->text);
_line = _line->next;
_lines++;
}
_alloc_size += _lines * (_lfterm ? 2 : 1);
// Allocate the text
txt = (char*)throw_realloc(txt, _alloc_size);
// Setup variables for the loop
_line = lin;
uint _size = 0;
char* _ptr = txt;
// Build the text from the lines
while(_line) {
*_buf = NUL;
char* _bptr;
bool _hterm = true;
if(_line->isheader()) {
_bptr = stpcpy(_buf, _line->text);
while(_line->next and _line->iswrapped()) {
_line = _line->next;
_bptr = stpcpy(_bptr, _line->text);
if((_bptr-_buf) > (bufsize-256)) {
int bptrlen = (int)(_bptr - _buf);
bufsize += 4096;
_buf = (char*)throw_realloc(_buf, bufsize);
_bptr = _buf + bptrlen;
}
}
}
else {
_bptr = XlatStr(_buf, _line->text, _xlat_level, _xlat_table);
if(*_buf and not _line->ishard()) {
if(_line->next) {
if(_line->next->text) {
if((*(_bptr-1) != ' ') and (*_line->next->text != ' '))
if(_isezycom or not _hardterm)
*_bptr++ = ' ';
if(not _hardterm) {
if(_isezycom and not CFG->switches.get(dispsoftcr))
*_bptr++ = SOFTCR;
_hterm = false;
}
}
}
}
}
if(_hterm) {
*_bptr++ = CR;
if(_lfterm)
*_bptr++ = LF;
}
if(*_buf) {
uint _buflen = (uint)(_bptr-_buf);
_size += _buflen;
if(_size >= _alloc_size) {
_alloc_size += 1024;
txt = (char*)throw_realloc(txt, _alloc_size);
}
_ptr = txt + _size;
memcpy(_ptr-_buflen, _buf, _buflen);
}
_line = _line->next;
}
*_ptr = NUL;
throw_free(_buf);
}
// ------------------------------------------------------------------

1189
golded3/genode.cpp Normal file

File diff suppressed because it is too large Load Diff

312
golded3/geplay.cpp Normal file
View File

@ -0,0 +1,312 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Functions related to sound.
// ------------------------------------------------------------------
#define GOLD_SOUNDSUPPORT 1
#include <golded.h>
#include <gtimall.h>
#ifdef GOLD_SOUNDSUPPORT
#include <gsndall.h>
#endif
// ------------------------------------------------------------------
#ifdef GOLD_SOUNDSUPPORT
gsound* snd = NULL;
#endif
// ------------------------------------------------------------------
#if defined(__MSDOS__)
#define Beep(A,B) { sound(A); usleep(B*CFG->beepfactor+1); }
#define Sleep(A) { usleep(A*CFG->beepfactor+1); }
#define NoSound() { nosound(); }
#elif defined(__OS2__)
#define Beep(A,B) { DosBeep(A, B*CFG->beepfactor/1000+1); }
#define Sleep(A) { usleep(A*CFG->beepfactor+1); }
#define NoSound() { }
#elif defined(__WIN32__)
#define Beep(A,B) { (Beep)(A, B*CFG->beepfactor/1000+1); }
#define Sleep(A) { usleep(A*CFG->beepfactor+1); }
#define NoSound() { }
#else
#define Beep(A,B) { }
#define Sleep(A) { }
#define NoSound() { }
#endif
// ------------------------------------------------------------------
void ResetSound(void) {
#ifdef GOLD_SOUNDSUPPORT
if(snd->is_installed()) {
while(snd->is_playing()) {
if(kbxhit()) {
if(kbxget() == Key_Esc) {
snd->stop();
break;
}
}
}
}
delete snd;
snd = NULL;
#endif
}
// ------------------------------------------------------------------
void InitSound() {
// Find out if there are any sound files to be played
#ifdef GOLD_SOUNDSUPPORT
vector<GEvent>::iterator n;
for(n = CFG->event.begin(); n != CFG->event.end(); n++) {
if(n->play.type == PLAY_VOC) {
snd = new gsound;
if(snd->is_installed()) {
if(not quiet)
printf("\n* Soundcard support was successfully initialized.");
atexit(ResetSound);
}
else {
if(not quiet)
printf("\n* Soundcard support could NOT be initialized!");
ResetSound();
}
break;
}
}
#endif
}
// ------------------------------------------------------------------
// Fill out a GPlay struct using a filename
void FileToGPlay(GPlay* playbuf, char* filename) {
if(strchr(CleanFilename(filename), '.') != NULL)
playbuf->type = PLAY_VOC;
else {
playbuf->type = PLAY_DOS;
if(strieql(filename, "TheEnd"))
playbuf->effectno = SND_THEEND;
else if(strieql(filename, "GotIt"))
playbuf->effectno = SND_GOTIT;
else if(strieql(filename, "TooBad"))
playbuf->effectno = SND_TOOBAD;
else if(strieql(filename, "ToYou"))
playbuf->effectno = SND_TOYOU;
else if(strieql(filename, "SayBiBi"))
playbuf->effectno = SND_SAYBIBI;
else if(strieql(filename, "SOS"))
playbuf->effectno = SND_S_O_S;
else
playbuf->effectno = 0xFFFF;
}
strcpy(playbuf->file, filename);
}
// ------------------------------------------------------------------
// Handle event
int HandleGEvent(uint event) {
int retval = -1; // Event could not be handled
if(event == EVTT_BREAKLOOP) {
#ifdef GOLD_SOUNDSUPPORT
if(snd) {
while(snd->is_playing()) {
if(kbxhit()) {
if(kbxget() == Key_Esc) {
snd->stop();
break;
}
}
}
}
#endif
return 0;
}
if(event == EVTT_STOPVOICE) {
#ifdef GOLD_SOUNDSUPPORT
if(snd)
snd->stop();
#endif
return 0;
}
if(event == EVTT_REMOVEVOCBUF) {
#ifdef GOLD_SOUNDSUPPORT
if(snd) {
if(not snd->is_playing())
snd->unload();
}
#endif
return 0;
}
if(CFG) {
vector<GEvent>::iterator n;
for(n = CFG->event.begin(); n != CFG->event.end(); n++) {
if(event == n->type) {
switch(n->command) {
case EVTC_PLAY:
n->play.Play();
retval = 0; // Event was found and handled
break;
}
break;
}
}
}
else {
MakeNoise(SND_S_O_S);
}
return retval;
}
// ------------------------------------------------------------------
// Make infernal noises
int MakeNoise(int type) {
int n;
if((CFG and CFG->switches.get(beepnoises)) and not disablesound) {
switch(type) {
case SND_SAYBIBI:
Beep(440, 111);
NoSound();
break;
case SND_TOYOU:
for(n=100; n<800; n+=400)
Beep(n, 18);
for(; n>100; n-=400)
Beep(n, 18);
NoSound();
break;
case SND_THEEND:
Beep(220, 111);
Beep(110, 167);
NoSound();
break;
case SND_GOTIT:
Beep(110, 56);
Beep(220, 56);
Beep(110, 56);
Beep(220, 111);
NoSound();
break;
case SND_TOOBAD:
Beep(440, 111);
Beep(220, 111);
Beep(110, 167);
NoSound();
break;
case SND_S_O_S:
Beep(1000, 56);
Sleep(111);
Beep(1000, 56);
Sleep(111);
Beep(1000, 56);
Sleep(222);
Beep(1000, 167);
Sleep(167);
Beep(1000, 167);
Sleep(167);
Beep(1000, 167);
Sleep(222);
Beep(1000, 56);
Sleep(111);
Beep(1000, 56);
Sleep(111);
Beep(1000, 56);
NoSound();
break;
}
}
return(type);
}
// ------------------------------------------------------------------
// Play a file
int GPlay::Play() const {
switch(type) {
case PLAY_DOS:
MakeNoise(effectno);
break;
case PLAY_VOC:
if(not disablesound) {
#ifdef GOLD_SOUNDSUPPORT
if(snd) {
snd->load(AddPath(CFG->soundpath, file));
snd->play();
}
#endif
}
break;
}
return 0;
}
// ------------------------------------------------------------------
// Say a simple bibi
void SayBibi() {
if(CFG and CFG->switches.get(beepnoises))
HandleGEvent(EVTT_SAYBIBI);
}
// ------------------------------------------------------------------

1204
golded3/gepost.cpp Normal file

File diff suppressed because it is too large Load Diff

449
golded3/geprot.h Normal file
View File

@ -0,0 +1,449 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Collective header for GE*.CPP source files.
// ------------------------------------------------------------------
#ifndef __GEHDRS_H
#define __GEHDRS_H
// ------------------------------------------------------------------
// GCAREA prototypes
void FixEchoid(char* echoid, int type);
// ------------------------------------------------------------------
// GCCFGG prototypes
void CfgAddress(char* value);
void CfgAddressmacro(char* value);
void CfgEvent(char* value);
void CfgFrqext(const char* value);
void CfgRobotname(const char* value);
void CfgUsername(char* value);
int SwitchCfgAtoG(word crc, char* val);
int SwitchCfgHtoZ(word crc, char* val);
int ReadGoldCfg(int force);
bool ReadGoldedCfg(int& force);
void WriteGoldGed();
void InstallDetect(char* path);
int InstallFinish();
// ------------------------------------------------------------------
// GCKEYS prototypes
int ReadKeysCfg(int force);
void KeyCmdAdd(gkey cmd, gkey val, int type);
void RunMacro(Macro* m);
// ------------------------------------------------------------------
// GCLANG prototypes
void LangInit();
bool ReadLangCfg(int force);
void LoadLanguage(const char* file);
// ------------------------------------------------------------------
// GCMISC prototypes
int ReadHelpCfg(int force);
int GetColor(char* ink);
int MakeColor(char* colors);
void GetColors(char* value);
void ReadXlatTables();
// ------------------------------------------------------------------
// GEAREA prototypes
int AreaPick(char* title, int wpos, int* idx);
void a_closeall();
void GetAreaconf();
// ------------------------------------------------------------------
// GECTRL prototypes
char* MakeOrigin(GMsg* msg, const char* _origin);
char* MakeTearline(GMsg* msg, char* buf);
void DoKludges(int mode, GMsg* msg, bool attronly = false);
void DoTearorig(int mode, GMsg* msg);
void GetRandom(int mode, GMsg* msg);
char* GetRandomLine(char* __buf, size_t __bufsize, const char* __file);
char* HandleRandomLine(char* buf, size_t bufsize);
char* get_informative_string(char* buf);
// ------------------------------------------------------------------
// GEDOIT prototypes
void CmfMsgs(GMsg* msg);
void LoadText(GMsg* msg, const char* textfile);
void SaveLines(int mode, const char* savefile, GMsg* msg, bool clip=false);
void WriteMsgs(GMsg* msg);
// ------------------------------------------------------------------
// GEDOSS prototypes
void Cleanup(void);
int ShellToDos(char* command, char* message, int cls, int cursor, int swap=YES, int pause=NO);
// ------------------------------------------------------------------
// GEEDIT prototypes
int EditMsg(int mode, uint* position, GMsg* msg);
void FreePastebuf();
// ------------------------------------------------------------------
// GEFILE prototypes
void CreateFileAddr(GMsg* msg);
void CreateFileMsgs(int mode, GMsg* msg);
void FileSelect(GMsg* msg, char* title, FileSpec* fspec);
// ------------------------------------------------------------------
// GEFIND prototypes
bool FindString(GMsg* msg, const char* prompt, int what);
void FindAll(GMsg* msg, int& topline, int& keyok);
void FindHdr(GMsg* msg, int& topline, int& keyok);
bool SearchHighlight(const Line* line, int row, int width, int highlight_color);
void SearchExit();
void AdvancedSearch(GMsg* msg, int& topline, int& keyok);
// ------------------------------------------------------------------
// GEGLOB prototypes
void CfgInit();
void CfgInit2();
int PlayMacro(gkey key, int type);
int IsMacro(gkey key, int type);
// ------------------------------------------------------------------
// GEINIT prototypes
void Initialize(int argc, char* argv[]);
// ------------------------------------------------------------------
// GELINE prototypes
int LoadCharset(const char* imp, const char* exp, int query = 0);
Line* AddKludge(Line* line, char* buf, int where=DIR_BELOW);
Line* AddLineFast(Line* line, char* text);
Line* DeleteLine(Line* line);
Line* FirstLine(Line* line);
Line* InsertLine(Line* newline, Line* oldline, int pos);
Line* LastLine(Line* line);
void MakeLineIndex(GMsg* msg, int rmargin, bool header_recode = true);
void MsgLineReIndex(GMsg* msg, int viewhidden=-1, int viewkludge=-1, int viewquote=-1);
char* XlatStr(char* dest, char* src, int level, Chs* chrtbl, int qpencoded=false, bool i51=false);
char* mime_header_decode(char* decoded, const char* encoded, char* charset = NULL);
char* strxmimecpy(char* dest, const char* source, int level, int size, bool detect = false);
void InvalidateControlInfo(GMsg *msg);
// ------------------------------------------------------------------
// GEMENU prototypes
void DispHeadAttrs(GMsg* msg);
void AskAttributes(GMsg* msg);
void ChgAttrs(int mode, GMsg* msg);
int ChangeAka();
int ChangeCharsIn();
int ChangeCharsOut();
int ChangeTagline();
int ChangeOrigin();
int ChangeTemplate();
int ChangeUsername();
int ChangeXlatImport();
// ------------------------------------------------------------------
// GEMLST prototypes
uint MsgBrowser(GMsg* msg);
void MsgThreadlist();
// ------------------------------------------------------------------
// GEMRKS prototypes
void MarkMsgs(GMsg* msg);
int NextMarkedmsg(int direction, GMsg* msg);
// ------------------------------------------------------------------
// GEMSGS prototypes
char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int origarea);
void Rot13(GMsg* msg);
void ResetMsg(GMsg* msg);
int DoCarboncopy(GMsg* msg, GMsg** carbon);
void DoCrosspost(GMsg* msg, vector<int> &postareas);
char* ParseInternetAddr(char* __string, char* __name, char* __addr);
// ------------------------------------------------------------------
// GENODE prototypes
void Lookup(GMsg* msg, ftn_addr* addr, char* name, int topline, char* status);
bool Lookup2(Addr& addr, char* name, int topline, const char* status);
const char *lookup_nodelist(ftn_addr* addr);
void LookupNode(GMsg* msg, char* name, int what);
void CheckNodelists();
// ------------------------------------------------------------------
// GEPLAY prototypes
void InitSound();
void FileToGPlay(GPlay* playbuf, char* filename);
int HandleGEvent(uint event);
int MakeNoise(int type);
void SayBibi();
// ------------------------------------------------------------------
// GEHDRE prototypes
typedef struct {
char *buf;
bool update;
} gsetaddr;
bool set_to_address(GMsg* msg, gsetaddr* toname, gsetaddr* toaddr, gsetaddr* fromaddr, gsetaddr* subj, int pos, char* lng_lookup, bool lookup=true);
// ------------------------------------------------------------------
// GEPOST prototypes
void MakeMsg(int mode, GMsg* oldmsg);
int EditHeaderinfo(int mode, GMsgHeaderView &view);
void CheckSubject(GMsg* msg, char* subj);
// ------------------------------------------------------------------
// GEQWKS prototypes
int ImportQWK();
int ExportQWK();
// ------------------------------------------------------------------
// GEREAD prototypes
char* GetCurrQuotebuf(char* quotebuf);
int MsgIsTwit(GMsg* msg, bool& istwitto, bool& istwitsubj);
ulong MsgHasReplies(GMsg* msg);
gkey ViewMessage(int istwit=NOT_TWIT);
int LoadMessage(GMsg* msg, int margin);
void DispHeader(GMsg* msg, bool prn, FILE* fp=NULL, int width=-1);
void LoadRawMsg(GMsg* msg, int margin);
void make_pathreport(char* reportfile);
void NextArea();
void PrevArea();
void Reader();
void UpdateArea(GMsg* msg);
int ExternUtil(GMsg* __msg, int __utilno);
void ExternUtilMenu();
uint next_msg(int direction);
void ChangeAttributes();
void ChangeMsg();
void CommentMsg();
void ConfirmMsg();
void CopyMoveForward();
void DecMargin();
void DosShell();
void ExitAsk();
void FileRequest(GMsg* __msg);
void GotoBookMark();
void GotoFirstMsg();
void GotoLastMsg();
void GotoMsgno();
void GotoNextMsg();
void GotoPrevMsg();
void GotoNextUnread();
void GotoPrevUnread();
void GotoReplies();
void GotoReply1st();
void GotoReplyNext();
void GotoReplyPrev();
void IncMargin();
void MakeUserList();
void MakePathreport();
void MarkingOptions();
void MessageBrowse();
void NewArea(bool jumpnext = false);
void NewMsg();
void OtherAreaQuoteMsg();
void OtherAreaCommentMsg();
void QuitNow();
void QuoteBuf(GMsg* msg);
void QuoteMsg();
void RenumberArea();
void ReplyMsg();
void ToggleBookMark();
void ToggleHidden();
void ToggleHiddKlud();
void ToggleKludge();
void ToggleMark();
void ToggleMarkRead();
void TogglePageBar();
void ToggleQuote();
void ToggleRealMsgno();
void ToggleROT13();
void ToggleTwits();
void ToggleStyles();
void ToggleXlat();
void TouchNetscan(int __popup=true);
void UUDecode(GMsg* msg);
void WriteMsg(GMsg* msg);
void TouchSemaphore();
// ------------------------------------------------------------------
// GESCAN prototypes
void CheckSemaphores();
// ------------------------------------------------------------------
// GESOUP prototypes
char* CvtMSGIDtoMessageID(char* midbuf, char* msgid, ftn_addr* addr, char* domain, char* from, char* to, char* subject, struct tm* datetime);
char* CvtMessageIDtoMSGID(char* mptr, char* msgidbuf, const char* echoid, char* kludge);
int ImportSOUP();
int ExportSOUP();
// ------------------------------------------------------------------
// GETPLS prototypes
void CookieIndex(char* textfile, char* indexfile);
int TemplateToText(int mode, GMsg* msg, GMsg* oldmsg, const char* tpl, int origarea);
bool is_user(const char* name);
// ------------------------------------------------------------------
// GEUTIL prototypes
void ScreenBlankIdle();
void IdleCheckSemaphores();
int AkaMatch(ftn_addr* __match, const ftn_addr* __addr);
void call_help();
void CheckTick(gkey quitkey);
char* CvtName(char* inp);
int edit_string(char* buf, int buf_size, char* title, int helpcat);
bool edit_pathname(char* buf, int buf_size, char* title, int helpcat);
int GetAkaNo(const ftn_addr& __aka);
int GetQuotestr(const char* ptr, char* qbuf, uint* qlen);
int is_quote(const char* ptr);
int IsQuoteChar(const char* s);
void maketitle();
void ProgMeter(int mode, int xx, int yy, long len, long barlen, int attr, long pos, long size);
int ReadCfg(const char* cfg, int ignoreunknown=false);
void ScanMsgTxtForAddr(GMsg* msg);
gkey SearchKey(gkey key, list<CmdKey>::iterator keys, int totkeys);
int SearchTaglist(Echo* taglist, char* tag);
void set_title(const char* t, int p, int a);
char* strconv(char* str, char* conv);
void title_shadow();
void update_statusline(const char* info);
void update_statuslinef(const char* format, ...) __attribute__ ((format (printf, 1, 2)));
void update_statuslines();
void w_info(const char* info=NULL);
void w_infof(const char* format, ...) __attribute__ ((format (printf, 1, 2)));
void w_progress(int mode, int attr, long pos, long size, const char* title);
void w_shadow();
void ZonegateIt(ftn_addr& gate, ftn_addr& orig, ftn_addr& dest);
char* strtmp(const char* str);
int quotecolor(const char* line);
void doinvalidate(char* text, const char* find, const char* replace, bool is_tearline = false);
// ------------------------------------------------------------------
// GEUSRBSE prototypes
bool lookup_addressbook(GMsg* msg, char* name, char* aka, bool browser = false);
void build_pseudo(GMsg* msg, bool direction = true);
void update_addressbook(GMsg* msg, bool reverse = false, bool force = false);
void edit_addressbook(GMsg* msg);
// ------------------------------------------------------------------
// SOFTCR management
inline bool issoftcr(char c) {
return (c == SOFTCR) and not CFG->switches.get(dispsoftcr);
}
inline char *spanspaces(const char *str) {
if(CFG->switches.get(dispsoftcr))
while(isspace(*str))
str++;
else
while(isspace(*str) or (*str == SOFTCR))
str++;
return (char *)str;
}
inline char *spanfeeds(const char *str) {
if(CFG->switches.get(dispsoftcr))
while(*str == LF)
str++;
else
while((*str == LF) or (*str == SOFTCR))
str++;
return (char *)str;
}
// ------------------------------------------------------------------
#endif
// ------------------------------------------------------------------

943
golded3/geqwks.cpp Normal file
View File

@ -0,0 +1,943 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// QWK packet handling.
// ------------------------------------------------------------------
#include <golded.h>
#include <gs_qwk.h>
// ------------------------------------------------------------------
static void ReadGldFile() {
if(QWK->FoundBBS()) {
gfile fp;
Path gldfile;
QWK->ResetConfNo();
sprintf(gldfile, "%s%s.GLD", CFG->goldpath, QWK->BbsID());
fp.fopen(gldfile, "rt");
if(fp.isopen()) {
char* key;
char* val;
char buf[256];
while(fp.fgets(buf, sizeof(buf))) {
val = strtrim(buf);
getkeyval(&key, &val);
strtrim(StripQuotes(val));
if(QWK->FindEcho(val))
QWK->ConfNo(atoi(key));
}
fp.fclose();
}
}
}
// ------------------------------------------------------------------
int ImportQWK() {
if(not *QWK->ImportPath())
return 0;
gfile fp;
gfile fpb; // For BBSID.GLD
Path file;
Path gldfile;
char bbsid[9] = {""};
// Parse the control file
strcpy(file, AddPath(QWK->ImportPath(), "CONTROL.DAT"));
fp.fopen(file, "rt");
if(fp.isopen()) {
char buf[256];
int line = 0;
int confno = 0;
int confcnt = 0;
int confnos = 0;
while(fp.fgets(buf, sizeof(buf))) {
line++;
strtrim(buf);
if((line >= 12) and (confcnt < confnos)) {
if(line % 2) {
if(fpb.isopen())
fpb.printf("%u \"%s\"\n", confno, buf);
confcnt++;
}
else
confno = atoi(buf);
}
else if(line == 5) {
char* ptr = strchr(buf, ',');
if(ptr) {
strxcpy(bbsid, strskip_wht(ptr+1), 9);
sprintf(gldfile, "%s%s.GLD", CFG->goldpath, bbsid);
fpb.fopen(gldfile, "wt");
}
}
else if(line == 11)
confnos = atoi(buf) + 1;
}
if(fpb.isopen())
fpb.fclose();
fp.fclose();
remove(file);
}
if(strblank(bbsid))
return 0;
QWK->FindBBS(bbsid);
ReadGldFile();
int imported = 0;
OrigArea = CurrArea = -1;
strcpy(file, AddPath(QWK->ImportPath(), "MESSAGES.DAT"));
fp.fopen(file, "rb");
if(fp.isopen()) {
// Skip past product info header
fp.fseekset(sizeof(QWKHdr));
QWKHdr hdr;
GMsg* msg = (GMsg*)throw_calloc(1, sizeof(GMsg));
// Read each message, header first
int tosstobadmsgs = false;
int lastconfno = -1;
int more;
do {
ResetMsg(msg);
memset(&hdr, 0, sizeof(QWKHdr));
more = 1 == fp.fread(&hdr, sizeof(QWKHdr));
if(more) {
char blocks[7];
strxcpy(blocks, hdr.blocks, 7);
uint msglen = atoi(blocks);
if(msglen == 0) {
break;
}
msglen = (msglen-1)*128;
if(hdr.confno != lastconfno) {
lastconfno = hdr.confno;
if(QWK->FindEcho(hdr.confno)) {
int areano = AL.AreaEchoToNo(QWK->EchoID());
if(areano != -1) {
CurrArea = AL.AreaNoToId(areano);
tosstobadmsgs = false;
}
}
else {
int areano = AL.AreaEchoToNo(QWK->BadMsgs());
if(areano != -1) {
CurrArea = AL.AreaNoToId(areano);
tosstobadmsgs = true;
}
else {
tosstobadmsgs = -1;
fp.fseek(msglen, SEEK_CUR);
}
}
}
if(tosstobadmsgs != -1) {
if(OrigArea != CurrArea) {
if(AA->isopen()) {
AA->Unlock();
AA->Close();
}
AL.SetActiveAreaId(CurrArea);
OrigArea = CurrArea;
AA->Open();
AA->Lock();
AA->RandomizeData();
}
// Convert header
msg->orig = msg->oorig = AA->aka();
msg->dest = msg->odest = AA->aka();
msg->attr.pvt(hdr.status == '*' or hdr.status == '+');
msg->attr.rcv(hdr.status == '+' or hdr.status == '-' or hdr.status == '`' or hdr.status == '^' or hdr.status == '#');
msg->attr.del(hdr.activestatus == 226);
strtrim(strxcpy(msg->by, hdr.from, 26));
strtrim(strxcpy(msg->to, hdr.to, 26));
strtrim(strxcpy(msg->re, hdr.subject, 26));
int _year, _month, _day, _hour, _minute;
sscanf(hdr.date, "%d%*c%d%*c%2d", &_month, &_day, &_year);
sscanf(hdr.time, "%d%*c%2d", &_hour, &_minute);
struct tm _tm;
_tm.tm_year = (_year < 80) ? (_year+100) : _year;
_tm.tm_mon = _month - 1;
_tm.tm_mday = _day;
_tm.tm_hour = _hour;
_tm.tm_min = _minute;
_tm.tm_sec = 0;
_tm.tm_isdst = -1;
time_t a = mktime(&_tm);
time_t b = mktime(gmtime(&a));
msg->written = a + a - b;
a = time(NULL);
b = mktime(gmtime(&a));
msg->arrived = a + a - b;
// Read message text
char* txtptr = msg->txt = (char*)throw_calloc(1, msglen+128);
if(tosstobadmsgs) {
sprintf(msg->txt, "AREA:%s_%u\r", bbsid, hdr.confno);
txtptr += strlen(msg->txt);
}
fp.fread(txtptr, msglen);
strtrim(txtptr);
strchg(txtptr, 0xE3, 0x0D);
imported++;
AA->istossed = true;
update_statuslinef("%s: %u", AA->echoid(), imported);
msg->attr.tou0();
msg->TextToLines(CFG->dispmargin-1);
if(msg->messageid or msg->references or msg->inreplyto or *msg->ifrom) {
char kbuf[256];
uint txtlen = strlen(msg->txt);
if(*msg->ifrom) {
INam _fromname;
IAdr _fromaddr;
ParseInternetAddr(msg->ifrom, _fromname, _fromaddr);
if(AA->Internetgate().addr.net) {
char abuf[40];
sprintf(kbuf, "\x1""REPLYTO %s %s\r""\x1""REPLYADDR %s\r",
AA->Internetgate().addr.make_string(abuf),
*AA->Internetgate().name ? AA->Internetgate().name : "UUCP",
_fromaddr
);
uint addlen = strlen(kbuf);
msg->txt = (char*)throw_realloc(msg->txt, txtlen+addlen+1);
memmove(msg->txt+addlen, msg->txt, txtlen+1);
memcpy(msg->txt, kbuf, addlen);
txtlen += addlen;
}
}
if(msg->references) {
char* mptr = msg->references;
char* sptr = mptr;
while(*mptr) {
if(not strnieql(mptr, "<NOMSGID_", 9)) {
sptr = strpbrk(mptr, " ,");
if(sptr == NULL)
sptr = mptr + strlen(mptr);
while(((*sptr == ' ') or (*sptr == ',')) and *sptr)
*sptr++ = NUL;
CvtMessageIDtoMSGID(mptr, kbuf, AA->echoid(), "REPLY");
strcat(kbuf, "\r");
uint addlen = strlen(kbuf);
msg->txt = (char*)throw_realloc(msg->txt, txtlen+addlen+1);
memmove(msg->txt+addlen, msg->txt, txtlen+1);
memcpy(msg->txt, kbuf, addlen);
txtlen += addlen;
}
mptr = sptr;
}
}
if(msg->inreplyto) {
if(not strnieql(msg->inreplyto, "<NOMSGID_", 9)) {
CvtMessageIDtoMSGID(msg->inreplyto, kbuf, AA->echoid(), "REPLY");
strcat(kbuf, "\r");
uint addlen = strlen(kbuf);
msg->txt = (char*)throw_realloc(msg->txt, txtlen+addlen+1);
memmove(msg->txt+addlen, msg->txt, txtlen+1);
memcpy(msg->txt, kbuf, addlen);
txtlen += addlen;
}
}
if(msg->messageid) {
if(not strnieql(msg->messageid, "<NOMSGID_", 9)) {
CvtMessageIDtoMSGID(msg->messageid, kbuf, AA->echoid(), "MSGID");
strcat(kbuf, "\r");
uint addlen = strlen(kbuf);
msg->txt = (char*)throw_realloc(msg->txt, txtlen+addlen+1);
memmove(msg->txt+addlen, msg->txt, txtlen+1);
memcpy(msg->txt, kbuf, addlen);
}
}
}
if(*msg->realto and (strieql(msg->to, AA->Whoto()) or not *msg->to))
strcpy(msg->to, msg->realto);
AA->SaveMsg(GMSG_NEW, msg);
}
}
} while(more);
if(AA->isopen()) {
AA->Unlock();
AA->Close();
}
ResetMsg(msg);
throw_free(msg);
fp.fclose();
remove(file);
if(*QWK->TossLog()) {
fp.fopen(QWK->TossLog(), "at");
if(fp.isopen()) {
uint na = 0;
while(na < AL.size()) {
if(AL[na]->istossed) {
AL[na]->istossed = false;
AL[na]->isunreadchg = true;
fp.printf("%s\n", AL[na]->echoid());
}
na++;
}
fp.fclose();
}
}
if(imported and *QWK->ReplyLinker()) {
char buf[256];
sprintf(buf, LNG->Replylinker, QWK->ReplyLinker());
ShellToDos(QWK->ReplyLinker(), buf, LGREY|_BLACK, YES);
}
}
if(imported)
startupscan_success = true;
return imported;
}
// ------------------------------------------------------------------
int ExportQwkMsg(GMsg* msg, gfile& fp, int confno, int& pktmsgno) {
// Prepare for Return Receipt Request
char msg__re[26];
if(QWK->ReceiptAllowed() and msg->attr.rrq())
sprintf(msg__re, "RRR%-22.22s", msg->re);
else
strxcpy(msg__re, msg->re, 26);
// Build QWK header
QWKHdr hdr;
char buf[26];
int tolen = strlen(msg->to); tolen = MinV(25,tolen);
int bylen = strlen(msg->by); bylen = MinV(25,bylen);
int relen = strlen(msg__re); relen = MinV(25,relen);
memset(&hdr, ' ', sizeof(QWKHdr));
hdr.status = msg->attr.pvt() ? '*' : ' ';
sprintf(buf, "%u", confno);
memcpy(hdr.msgno, buf, strlen(buf));
struct tm* _tm = gmtime(&msg->written);
int _year = _tm->tm_year % 100;
sprintf(buf, "%02d-%02d-%02d", _tm->tm_mon+1, _tm->tm_mday, _year);
memcpy(hdr.date, buf, 8);
sprintf(buf, "%02d:%02d", _tm->tm_hour, _tm->tm_min);
memcpy(hdr.time, buf, 5);
strxcpy(buf, msg->to, tolen+1);
if(not QWK->MixCaseAllowed())
strupr(buf);
memcpy(hdr.to, buf, tolen);
strxcpy(buf, msg->by, bylen+1);
if(not QWK->MixCaseAllowed())
strupr(buf);
memcpy(hdr.from, buf, bylen);
memcpy(hdr.subject, msg__re, relen);
hdr.activestatus = '\xE1';
hdr.confno = (word)confno;
hdr.pktmsgno = (word)++pktmsgno;
// Write preliminary header
fp.fwrite(&hdr, sizeof(QWKHdr));
// Write body
int level = 0;
if(CharTable)
level = CharTable->level ? CharTable->level : 2;
char mbuf[512];
uint msglen = 0;
if(msg->charsetencoding & GCHENC_MNE) {
if(not striinc("MNEMONIC", CharTable->exp))
LoadCharset(CFG->xlatlocalset, "MNEMONIC");
}
else if(striinc("LATIN1QP", msg->charset)) {
if(not striinc("LATIN1QP", CharTable->exp))
LoadCharset(CFG->xlatlocalset, "LATIN1QP");
}
else if(striinc("LATIN-1", msg->charset)) {
if(not striinc("LATIN-1", CharTable->exp))
LoadCharset(CFG->xlatlocalset, "LATIN-1");
}
char qwkterm = '\xE3';
// Process kludges and write header lines
Line* line = msg->lin;
while(line) {
if(line->type & GLINE_KLUDGE) {
if(AA->isinternet()) {
if((line->kludge == GKLUD_RFC) or (line->kludge == 0)) {
XlatStr(mbuf, line->text, level, CharTable);
msglen += fp.printf("%s%c", mbuf, qwkterm);
}
else if(line->type & GLINE_WRAP) {
while(line->next and (line->type & GLINE_WRAP))
line = line->next;
}
}
else {
if((line->type & GLINE_KLUDGE) and QWK->KludgesAllowed()) {
XlatStr(mbuf, line->text, level, CharTable);
msglen += fp.printf("%s%c", mbuf, qwkterm);
}
}
}
line = line->next;
}
// Write blank line after header lines
if(AA->Internetrfcbody()) {
msglen += fp.printf("%c", qwkterm);
}
// Write all message lines
line = msg->lin;
while(line) {
if(not (line->type & GLINE_KLUDGE)) {
XlatStr(mbuf, line->text, level, CharTable);
msglen += fp.printf("%s%c", mbuf, qwkterm);
}
line = line->next;
}
// Calculate blocks
uint endlen = msglen % 128;
uint blocks = 1+(msglen/128)+(endlen?1:0);
sprintf(buf, "%u", blocks);
memcpy(hdr.blocks, buf, strlen(buf));
// Write padding spaces at the end if necessary
if(endlen) {
char padding[128];
memset(padding, ' ', 128);
fp.fwrite(padding, 128-endlen);
}
// Re-write the header
fp.fseek(-(blocks*128), SEEK_CUR);
fp.fwrite(&hdr, sizeof(QWKHdr));
fp.fseek((blocks-1)*128, SEEK_CUR);
// Mark msg as sent
msg->attr.snt1();
msg->attr.scn1();
msg->attr.uns0();
AA->SaveHdr(GMSG_UPDATE, msg);
return 1;
}
// ------------------------------------------------------------------
int ExportQwkArea(int areano, gfile& fp, int confno, int& pktmsgno) {
int exported = 0;
AL.SetActiveAreaNo(areano);
AA->Open();
AA->Lock();
AA->RandomizeData();
GMsg* msg = (GMsg*)throw_calloc(1, sizeof(GMsg));
for(uint n=0; n<AA->Expo.Count(); n++) {
if(AA->LoadMsg(msg, AA->Expo[n], 80)) {
if(msg->attr.uns()) {
exported += ExportQwkMsg(msg, fp, confno, pktmsgno);
update_statuslinef("%s: %u", AA->echoid(), exported);
}
}
}
ResetMsg(msg);
throw_free(msg);
AA->Unlock();
AA->Close();
AA->Expo.ResetAll();
return exported;
}
// ------------------------------------------------------------------
int ExportQWK() {
if(not *QWK->ExportPath())
return 0;
int exported = 0;
gfile fp;
Path scanfile;
// Get the scan list
strcpy(scanfile, AddPath(CFG->goldpath, "GOLDQWK.LST"));
fp.fopen(scanfile, "rt");
if(fp.isopen()) {
char buf[256];
while(fp.fgets(buf, sizeof(buf))) {
char* ptr = strchr(buf, ' ');
if(ptr) {
*ptr++ = NUL;
int a = AL.AreaEchoToNo(buf);
if(a != -1 and AL[a]->isqwk())
AL[a]->Expo.Add(atol(ptr));
}
}
fp.fclose();
}
// Export from the QWK areas
if(QWK->FirstBBS()) {
do {
ReadGldFile();
Path replyfile;
int pktmsgno = 0;
if(QWK->FirstConf()) {
sprintf(replyfile, "%s%s.MSG", QWK->ExportPath(), QWK->BbsID());
fp.fopen(replyfile, "wb");
if(fp.isopen()) {
char firstrec[128];
memset(firstrec, ' ', 128);
memcpy(firstrec, QWK->BbsID(), strlen(QWK->BbsID()));
fp.fwrite(firstrec, 128);
pktmsgno = 0;
}
do {
int a = AL.AreaEchoToNo(QWK->EchoID());
if(a != -1 and AL[a]->Expo.Count()) {
if(QWK->ConfNo() != -1)
exported += ExportQwkArea(a, fp, QWK->ConfNo(), pktmsgno);
}
} while(QWK->NextConf());
}
if(fp.isopen()) {
fp.fclose();
if(pktmsgno == 0)
remove(replyfile);
}
} while(QWK->NextBBS());
}
// Delete the scanfile
remove(scanfile);
return exported;
}
// ------------------------------------------------------------------
Qwk::Qwk() {
bbs = bbsp = NULL;
mapp = NULL;
bbss = 0;
}
// ------------------------------------------------------------------
Qwk::~Qwk() {
Reset();
}
// ------------------------------------------------------------------
void Qwk::Reset() {
for(int n=0; n<bbss; n++)
throw_release(bbs[n].map);
throw_xrelease(bbs);
bbsp = NULL;
mapp = NULL;
bbss = 0;
}
// ------------------------------------------------------------------
void Qwk::AddBBS(char* bbsid) {
bbs = (QwkBbs*)throw_realloc(bbs, (bbss+1)*sizeof(QwkBbs));
bbsp = bbs + bbss++;
strxcpy(bbsp->bbsid, bbsid, sizeof(bbsp->bbsid));
bbsp->kludges = false;
bbsp->mixcase = false;
bbsp->receipt = false;
bbsp->maxlines = -1;
bbsp->map = NULL;
bbsp->maps = 0;
mapp = NULL;
}
// ------------------------------------------------------------------
void Qwk::AddMap(char* bbsid, char* echoid, char* confname, int confno) {
FindAddBBS(bbsid);
bbsp->map = (QwkMap*)throw_realloc(bbsp->map, (bbsp->maps+1)*sizeof(QwkMap));
mapp = bbsp->map + bbsp->maps++;
strxcpy(mapp->confname, confname, sizeof(mapp->confname));
strxcpy(mapp->echoid, echoid, sizeof(mapp->echoid));
mapp->confno = confno;
}
// ------------------------------------------------------------------
int Qwk::FindBBS(char* bbsid) {
bbsp = bbs;
for(int n=0; n<bbss; n++,bbsp++) {
if(strieql(bbsid, bbsp->bbsid)) {
mapp = bbsp->map;
return true;
}
}
mapp = NULL;
return false;
}
// ------------------------------------------------------------------
void Qwk::FindAddBBS(char* bbsid) {
if(not FindBBS(bbsid))
AddBBS(bbsid);
}
// ------------------------------------------------------------------
int Qwk::FirstBBS() {
if(bbs) {
bbsp = bbs;
bbsn = 1;
return true;
}
bbsp = NULL;
bbsn = 0;
return false;
}
// ------------------------------------------------------------------
int Qwk::NextBBS() {
if(bbsp and (bbsn < bbss)) {
bbsp++;
bbsn++;
return true;
}
bbsp = NULL;
bbsn = 0;
return false;
}
// ------------------------------------------------------------------
int Qwk::FindConf(char* echoid) {
if(bbsp) {
mapp = bbsp->map;
for(int n=0; n<bbsp->maps; n++,mapp++)
if(strieql(echoid, mapp->echoid))
return true;
}
mapp = NULL;
return false;
}
// ------------------------------------------------------------------
int Qwk::FindEcho(char* confname) {
if(bbsp) {
mapp = bbsp->map;
for(int n=0; n<bbsp->maps; n++,mapp++)
if(strieql(confname, mapp->confname))
return true;
}
mapp = NULL;
return false;
}
// ------------------------------------------------------------------
int Qwk::FindEcho(int confno) {
if(bbsp) {
mapp = bbsp->map;
for(int n=0; n<bbsp->maps; n++,mapp++)
if(confno == mapp->confno)
return true;
}
mapp = NULL;
return false;
}
// ------------------------------------------------------------------
int Qwk::FirstConf() {
if(bbsp and bbsp->map) {
mapp = bbsp->map;
mapn = 1;
return true;
}
mapp = NULL;
mapn = 0;
return false;
}
// ------------------------------------------------------------------
int Qwk::NextConf() {
if(mapp and (mapn < bbsp->maps)) {
mapp++;
mapn++;
return true;
}
mapp = NULL;
mapn = 0;
return false;
}
// ------------------------------------------------------------------
const char* Qwk::BbsID() {
return bbsp ? bbsp->bbsid : "";
}
// ------------------------------------------------------------------
const char* Qwk::ConfName() {
return mapp ? mapp->confname : "";
}
// ------------------------------------------------------------------
int Qwk::ConfNo(int set) {
if(mapp) {
if(set != -2)
mapp->confno = set;
return mapp->confno;
}
return -1;
}
// ------------------------------------------------------------------
const char* Qwk::EchoID() {
return mapp ? mapp->echoid : "";
}
// ------------------------------------------------------------------
int Qwk::KludgesAllowed(int set) {
if(bbsp) {
if(set != -1)
bbsp->kludges = set;
return bbsp->kludges;
}
return false;
}
// ------------------------------------------------------------------
int Qwk::MixCaseAllowed(int set) {
if(bbsp) {
if(set != -1)
bbsp->mixcase = set;
return bbsp->mixcase;
}
return false;
}
// ------------------------------------------------------------------
int Qwk::ReceiptAllowed(int set) {
if(bbsp) {
if(set != -1)
bbsp->receipt = set;
return bbsp->receipt;
}
return false;
}
// ------------------------------------------------------------------
int Qwk::MaxLines(int set) {
if(bbsp) {
if(set != -1)
bbsp->maxlines = set;
return bbsp->maxlines;
}
return 0;
}
// ------------------------------------------------------------------
void Qwk::ResetConfNo(int set) {
if(bbsp) {
mapp = bbsp->map;
for(int n=0; n<bbsp->maps; n++,mapp++)
mapp->confno = set;
}
}
// ------------------------------------------------------------------
char* Qwk::BadMsgs(char* set) {
if(set)
strxcpy(cfg.badmsgs, set, sizeof(Echo));
return cfg.badmsgs;
}
// ------------------------------------------------------------------
char* Qwk::ExportPath(char* set) {
if(set)
PathCopy(cfg.exportpath, set);
return cfg.exportpath;
}
// ------------------------------------------------------------------
char* Qwk::ImportPath(char* set) {
if(set)
PathCopy(cfg.importpath, set);
return cfg.importpath;
}
// ------------------------------------------------------------------
char* Qwk::ReplyLinker(char* set) {
if(set)
strxcpy(cfg.replylinker, set, sizeof(Path));
return cfg.replylinker;
}
// ------------------------------------------------------------------
char* Qwk::TossLog(char* set) {
if(set)
strxcpy(cfg.tosslog, set, sizeof(Path));
return cfg.tosslog;
}
// ------------------------------------------------------------------

117
golded3/geqwks.h Normal file
View File

@ -0,0 +1,117 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// QWK Implementation Structures and Classes.
// ------------------------------------------------------------------
// ------------------------------------------------------------------
struct QwkCfg {
Echo badmsgs;
Path exportpath;
Path importpath;
Path replylinker;
Path tosslog;
};
// ------------------------------------------------------------------
struct QwkMap {
char confname[21];
int confno;
Echo echoid;
};
// ------------------------------------------------------------------
struct QwkBbs {
char bbsid[9];
int kludges : 1; // TRUE if allowed to export kludges
int mixcase : 1; // TRUE if mixed case is allowed
int receipt : 1; // TRUE if return receipts are supported
int maxlines;
QwkMap* map;
int maps;
};
// ------------------------------------------------------------------
class Qwk {
QwkCfg cfg; // Global QWK configuration
QwkBbs* bbs; // Collection of BBS data
int bbss; // Number of BBS'es stored
QwkBbs* bbsp; // Pointer to current BBS
int bbsn; // Number of current BBS
QwkMap* mapp; // Pointer to current conference map
int mapn; // Number of current conference map
public:
Qwk();
~Qwk();
void Reset();
void AddBBS(char* bbsid);
void AddMap(char* bbsid, char* echoid, char* confname, int confno=-1);
int FindBBS(char* bbsid);
void FindAddBBS(char* bbsid);
int FoundBBS() { return !!bbsp; }
int FirstBBS();
int NextBBS();
int FindConf(char* echoid);
int FindEcho(char* confname);
int FindEcho(int confno);
int FoundConf() { return !!mapp; }
int FirstConf();
int NextConf();
const char* BbsID();
const char* ConfName();
int ConfNo(int set=-2);
const char* EchoID();
int KludgesAllowed(int set=-1);
int MixCaseAllowed(int set=-1);
int ReceiptAllowed(int set=-1);
int MaxLines(int set=-1);
void ResetConfNo(int set=-1);
char* BadMsgs(char* set=NULL);
char* ExportPath(char* set=NULL);
char* ImportPath(char* set=NULL);
char* ReplyLinker(char* set=NULL);
char* TossLog(char* set=NULL);
};
// ------------------------------------------------------------------

381
golded3/gerand.cpp Normal file
View File

@ -0,0 +1,381 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Random system and control info handling.
// ------------------------------------------------------------------
#include <golded.h>
// ------------------------------------------------------------------
char* GetRandomLine(char* __buf, size_t __bufsize, const char* __file) {
Path indexfile;
replaceextension(indexfile, __file, ".sdx");
FILE* fp = fsopen(AddPath(CFG->goldpath, __file), "rb", CFG->sharemode);
if(fp) {
// Check if index exists or if it is older than the textfile
const char* idxfile = AddPath(CFG->goldpath, indexfile);
int idxexist = fexist(idxfile);
if(idxexist)
if(FiletimeCmp(__file, idxfile) > 0)
idxexist = false;
FILE* fpi = fsopen(idxfile, idxexist ? "rb" : "wb+", CFG->sharemode);
if(fpi) {
// Create index if one was missing
if(not idxexist) {
setvbuf(fp, NULL, _IOFBF, 32000);
setvbuf(fpi, NULL, _IOFBF, 16000);
long fpos = 0;
char buf[512];
while(fgets(buf, sizeof(buf), fp)) {
fwrite(&fpos, sizeof(long), 1, fpi);
fpos += strlen(buf);
}
}
// Get random line if there is at least one
int _lines = (int)(fsize(fpi)/sizeof(long));
if(_lines > 0) {
// Select a random line
long _offset = 0;
long _ourline = rand() % _lines;
fseek(fpi, _ourline*(long)sizeof(long), SEEK_SET);
fread(&_offset, sizeof(long), 1, fpi);
// Get it
char buf[512];
fseek(fp, _offset, SEEK_SET);
fgets(buf, sizeof(buf), fp);
StripQuotes(strbtrim(buf));
strxcpy(__buf, buf, __bufsize);
}
fclose(fpi);
}
fclose(fp);
}
return __buf;
}
// ------------------------------------------------------------------
char* HandleRandomLine(char* buf, size_t bufsize) {
if(*buf == '@')
GetRandomLine(buf, bufsize, buf+1);
return buf;
}
// ------------------------------------------------------------------
void Area::InitData() {
// Set defaults
adat->aka = CFG->aka[GetAkaNo(aka())];
adat->akamatching = (CFG->switches.get(akamatchnet) and isnet()) or
(CFG->switches.get(akamatchecho) and isecho()) or
(CFG->switches.get(akamatchlocal) and islocal());
adat->attributes = attr();
adat->areacopyaddid = CFG->areacopyaddid;
adat->areacopydirect = CFG->areacopydirect;
strcpy(adat->areacopyto, CFG->areacopyto);
adat->areaforwarddirect = CFG->areaforwarddirect;
adat->areafreqdirect = CFG->areafreqdirect;
strcpy(adat->areafreqto, CFG->areafreqto);
adat->areareplydirect = CFG->areareplydirect;
strcpy(adat->areareplyto, CFG->areareplyto);
strcpy(adat->areayouwroteto, CFG->areayouwroteto);
if(isemail())
adat->ctrlinfo = CFG->ctrlinfoemail;
else if(isnewsgroup())
adat->ctrlinfo = CFG->ctrlinfonews;
else if(isnet())
adat->ctrlinfo = CFG->ctrlinfonet;
else if(isecho())
adat->ctrlinfo = CFG->ctrlinfoecho;
else
adat->ctrlinfo = CFG->ctrlinfolocal;
adat->edithardterm = EDIT->HardTerm();
adat->editmixcase = EDIT->MixCase();
adat->forcetemplate = CFG->forcetemplate;
strcpy(adat->inputfile, CFG->inputfile);
strcpy(adat->internetaddress, CFG->internetaddress);
memcpy(&adat->internetgate, &CFG->internetgate, sizeof(Node));
adat->internetmsgid = CFG->internetmsgid;
adat->internetrfcbody = CFG->internetrfcbody;
strcpy(adat->loadlanguage, CFG->loadlanguage);
adat->msglistdate = CFG->msglistdate;
adat->msglistfast = CFG->msglistfast;
adat->msglistfirst = CFG->msglistfirst;
adat->msglistheader = CFG->msglistheader;
adat->msglistwidesubj = CFG->msglistwidesubj;
strcpy(adat->organization, CFG->organization);
strxcpy(adat->origin, CFG->origin.empty() ? "" : CFG->origin[CFG->originno].c_str(), sizeof(adat->origin));
strcpy(adat->outputfile, CFG->outputfile);
memcpy(&adat->play, &CFG->play, sizeof(GPlay));
strcpy(adat->quotebuffile, CFG->quotebuffile);
strcpy(adat->quotechars, CFG->quotechars);
adat->quotectrl = CFG->quotectrl;
strcpy(adat->quotestring, CFG->quotestring);
adat->quotewraphard = CFG->quotewraphard;
adat->replyre = EDIT->ReplyRe();
if(*CFG->searchfor)
strcpy(adat->searchfor, CFG->searchfor);
strcpy(adat->tagline, CFG->tagline.empty() ? "" : CFG->tagline[CFG->taglineno].c_str());
adat->taglinechar = CFG->taglinechar;
adat->taglinesupport = CFG->taglinesupport;
strcpy(adat->tearline, CFG->tearline);
strcpy(adat->tpl, (CFG->tplno and (CFG->tplno < CFG->tpl.size())) ? CFG->tpl[CFG->tplno].file : "");
adat->templatematch = CFG->templatematch;
adat->twitmode = CFG->twitmode;
adat->usefwd = CFG->usefwd;
strcpy(adat->username.name, CFG->username.empty() ? "" : CFG->username[CFG->usernameno].name);
adat->username.addr = adat->aka.addr;
adat->usetzutc = CFG->usetzutc;
adat->viewhidden = CFG->viewhidden;
adat->viewkludge = CFG->viewkludge;
adat->viewquote = CFG->viewquote;
strcpy(adat->nickname, CFG->nickname);
strcpy(adat->whoto, CFG->whoto);
strcpy(adat->xlatexport, CFG->xlatexport);
strcpy(adat->xlatimport, CFG->xlatimport);
LoadLanguage(adat->loadlanguage);
}
// ------------------------------------------------------------------
// Get data from the Random System
void Area::RandomizeData(int mode) {
if(not adat) {
adat = (AreaData*)throw_calloc(1, sizeof(AreaData));
InitData();
}
else { // reset to global defaults
strcpy(adat->tpl, (CFG->tplno and (CFG->tplno < CFG->tpl.size())) ? CFG->tpl[CFG->tplno].file : "");
}
char _groupid[10];
if(CFG->areafilegroups and groupid()) {
if(groupid() & 0x8000u)
sprintf(_groupid, "#%u", groupid() & 0x7FFF);
else {
_groupid[0] = (char)(isalpha(groupid()) ? groupid() : NUL);
_groupid[1] = NUL;
}
}
else {
*_groupid = NUL;
}
Echo _echoid;
strcpy(_echoid, echoid());
const char* found = CFG->grp.SetGrp(_echoid);
int curgrp = CFG->grp.currgrpno;
if(*_groupid) {
found = CFG->grp.SetGrp(_groupid);
if(found and (strieql(found, "*") or ((curgrp >= 0) and (curgrp < CFG->grp.currgrpno))))
found = NULL;
if(not found)
found = CFG->grp.SetGrp(_echoid);
}
if(found) {
char buf[256];
if(CFG->grp.GetItm(GRP_AKA, &adat->aka, sizeof(gaka)))
SetAka(adat->aka.addr);
CFG->grp.GetItm(GRP_AKAMATCHING, adat->akamatching);
if(CFG->grp.GetItm(GRP_ATTRIBUTES, buf, sizeof(buf))) {
if(isnet())
adat->attributes = CFG->attribsnet;
else if(isecho())
adat->attributes = CFG->attribsecho;
else
adat->attributes = CFG->attribslocal;
GetAttribstr(&adat->attributes, buf);
}
CFG->grp.GetItm(GRP_AREACOPYADDID, adat->areacopyaddid);
CFG->grp.GetItm(GRP_AREACOPYDIRECT, adat->areacopydirect);
CFG->grp.GetItm(GRP_AREACOPYTO, adat->areacopyto, sizeof(adat->areacopyto));
CFG->grp.GetItm(GRP_AREAFORWARDDIRECT, adat->areaforwarddirect);
CFG->grp.GetItm(GRP_AREAFREQDIRECT, adat->areafreqdirect);
CFG->grp.GetItm(GRP_AREAFREQTO, adat->areafreqto, sizeof(adat->areareplyto));
CFG->grp.GetItm(GRP_AREAREPLYDIRECT, adat->areareplydirect);
CFG->grp.GetItm(GRP_AREAREPLYTO, adat->areareplyto, sizeof(adat->areareplyto));
CFG->grp.GetItm(GRP_AREAYOUWROTETO, adat->areayouwroteto, sizeof(adat->areayouwroteto));
CFG->grp.GetItm(GRP_CTRLINFO, adat->ctrlinfo);
CFG->grp.GetItm(GRP_EDITHARDTERM, adat->edithardterm);
CFG->grp.GetItm(GRP_EDITMIXCASE, adat->editmixcase);
CFG->grp.GetItm(GRP_EDITREPLYRE, adat->replyre);
CFG->grp.GetItm(GRP_FORCETEMPLATE, adat->forcetemplate);
CFG->grp.GetItm(GRP_INPUTFILE, adat->inputfile, sizeof(adat->inputfile));
CFG->grp.GetItm(GRP_INTERNETADDRESS, adat->internetaddress, sizeof(adat->internetaddress));
CFG->grp.GetItm(GRP_INTERNETGATE, &adat->internetgate, sizeof(Node));
CFG->grp.GetItm(GRP_INTERNETMSGID, adat->internetmsgid);
CFG->grp.GetItm(GRP_INTERNETRFCBODY, adat->internetrfcbody);
if(CFG->grp.GetItm(GRP_LOADLANGUAGE, adat->loadlanguage, sizeof(adat->loadlanguage)))
LoadLanguage(adat->loadlanguage);
CFG->grp.GetItm(GRP_MSGLISTDATE, adat->msglistdate);
CFG->grp.GetItm(GRP_MSGLISTFAST, adat->msglistfast);
CFG->grp.GetItm(GRP_MSGLISTFIRST, adat->msglistfirst);
CFG->grp.GetItm(GRP_MSGLISTHEADER, adat->msglistheader);
CFG->grp.GetItm(GRP_MSGLISTWIDESUBJ, adat->msglistwidesubj);
CFG->grp.GetItm(GRP_ORGANIZATION, adat->organization, sizeof(adat->organization));
if(CFG->grp.GetItm(GRP_ORIGIN, buf, sizeof(buf)))
strxcpy(adat->origin, buf, sizeof(adat->origin));
CFG->grp.GetItm(GRP_OUTPUTFILE, adat->outputfile, sizeof(adat->outputfile));
CFG->grp.GetItm(GRP_QUOTEBUFFILE, adat->quotebuffile, sizeof(adat->quotebuffile));
CFG->grp.GetItm(GRP_QUOTECHARS, adat->quotechars, sizeof(adat->quotechars));
CFG->grp.GetItm(GRP_QUOTECTRL, adat->quotectrl);
CFG->grp.GetItm(GRP_QUOTESTRING, adat->quotestring, sizeof(adat->quotestring));
CFG->grp.GetItm(GRP_QUOTEWRAPHARD, adat->quotewraphard);
if(CFG->grp.GetItm(GRP_PLAY, buf, sizeof(buf))) {
if(*buf == '@')
GetRandomLine(buf, sizeof(buf), buf+1);
FileToGPlay(&adat->play, buf);
}
CFG->grp.GetItm(GRP_SEARCHFOR, adat->searchfor, sizeof(adat->searchfor));
if(CFG->grp.GetItm(GRP_TAGLINE, buf, sizeof(buf)))
strxcpy(adat->tagline, buf, sizeof(adat->tagline));
CFG->grp.GetItm(GRP_TAGLINECHAR, adat->taglinechar);
CFG->grp.GetItm(GRP_TAGLINESUPPORT, adat->taglinesupport);
if(CFG->grp.GetItm(GRP_TEARLINE, buf, sizeof(buf)))
strxcpy(adat->tearline, buf, sizeof(adat->tearline));
if(not adat->forcetemplate) {
if(CFG->tplno and (CFG->tplno < CFG->tpl.size()))
strxcpy(adat->tpl, CFG->tpl[CFG->tplno].file, sizeof(adat->tpl));
else
if(CFG->grp.GetItm(GRP_TEMPLATE, buf, sizeof(buf))) {
if(*buf == '@')
GetRandomLine(buf, sizeof(buf), buf+1);
strxcpy(adat->tpl, buf, sizeof(adat->tpl));
}
}
CFG->grp.GetItm(GRP_TEMPLATEMATCH, adat->templatematch);
CFG->grp.GetItm(GRP_TWITMODE, adat->twitmode);
CFG->grp.GetItm(GRP_USEFWD, adat->usefwd);
if(CFG->grp.GetItm(GRP_USERNAME, buf, sizeof(buf))) {
if(*buf == '@')
GetRandomLine(buf, sizeof(buf), buf+1);
Addr tmp;
tmp.reset();
switch(mode) {
case MODE_NEW:
case MODE_QUOTE:
case MODE_REPLY:
case MODE_REPLYCOMMENT:
case MODE_FORWARD:
char* aptr = strrchr(buf, ',');
if(aptr) {
*aptr++ = NUL;
aptr = strskip_wht(aptr);
}
else {
aptr = strrchr(buf, ' ');
if(aptr) {
aptr++;
tmp.set(aptr);
if(tmp.net == 0)
aptr = NULL;
else
*aptr++ = NUL;
}
}
if(aptr) {
tmp = adat->aka.addr;
tmp.set(aptr);
if(tmp.net != 0)
*aptr = NUL;
}
strbtrim(buf);
break;
}
if(tmp.net == 0)
tmp = adat->aka.addr;
strxcpy(adat->username.name, buf, sizeof(adat->username.name));
adat->username.addr = tmp;
SetAka(tmp);
}
CFG->grp.GetItm(GRP_USETZUTC, adat->usetzutc);
if(not mode) {
CFG->grp.GetItm(GRP_VIEWHIDDEN, adat->viewhidden);
CFG->grp.GetItm(GRP_VIEWKLUDGE, adat->viewkludge);
CFG->grp.GetItm(GRP_VIEWQUOTE, adat->viewquote);
}
if(CFG->grp.GetItm(GRP_NICKNAME, buf, sizeof(buf)))
strxcpy(adat->nickname, buf, sizeof(adat->nickname));
if(CFG->grp.GetItm(GRP_WHOTO, buf, sizeof(buf))) {
if(*buf == '@')
GetRandomLine(buf, sizeof(buf), buf+1);
strxcpy(adat->whoto, buf, sizeof(adat->whoto));
}
CFG->grp.GetItm(GRP_XLATEXPORT, adat->xlatexport, sizeof(adat->xlatexport));
CFG->grp.GetItm(GRP_XLATIMPORT, adat->xlatimport, sizeof(adat->xlatimport));
}
vector<MailList>::iterator z;
for(z = CFG->mailinglist.begin(); z != CFG->mailinglist.end(); z++)
if(strieql(echoid(), z->echoid)) {
strcpy(adat->whoto, *z->contribution ? z->contribution : z->sender);
break;
}
}
// ------------------------------------------------------------------

1316
golded3/geread.cpp Normal file

File diff suppressed because it is too large Load Diff

814
golded3/geread2.cpp Normal file
View File

@ -0,0 +1,814 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Reader secondary functions
// ------------------------------------------------------------------
#include <golded.h>
#include <gwinput.h>
#include <gftnall.h>
#include <vector>
#define PROTOTYPES
#include <uudeview.h>
// ------------------------------------------------------------------
// Global data from GEREAD
extern GMsg* reader_msg;
// ------------------------------------------------------------------
void ChangeAttributes() {
if(reader_msg->msgno) {
// Reload if hexdumped
if(AA->attr().hex()) {
AA->attr().hex0();
AA->LoadMsg(reader_msg, reader_msg->msgno, CFG->dispmargin-(int)CFG->switches.get(disppagebar));
}
GMsg* msg = (GMsg*)throw_malloc(sizeof(GMsg));
memcpy(msg, reader_msg, sizeof(GMsg));
AskAttributes(reader_msg);
if(memcmp(msg, reader_msg, sizeof(GMsg))) {
msg->charsetlevel = LoadCharset(CFG->xlatlocalset, msg->charset);
DoKludges(MODE_CHANGE, reader_msg, true);
reader_msg->LinesToText();
AA->SaveMsg(GMSG_UPDATE, reader_msg);
}
throw_free(msg);
}
}
// ------------------------------------------------------------------
void DecMargin() {
if(CFG->dispmargin > (MAXCOL/3))
CFG->dispmargin--;
else {
SayBibi();
reader_keyok = YES;
}
}
// ------------------------------------------------------------------
void IncMargin() {
if(CFG->dispmargin < MAXCOL)
CFG->dispmargin++;
else {
SayBibi();
reader_keyok = YES;
}
}
// ------------------------------------------------------------------
void ToggleMark() {
uint tmp = AA->Mark.Find(reader_msg->msgno);
if(tmp)
AA->Mark.DelReln(tmp);
else
AA->Mark.Add(reader_msg->msgno);
HeaderView->Use(AA, reader_msg);
HeaderView->Paint();
reader_keyok = YES;
}
// ------------------------------------------------------------------
void ToggleBookMark() {
if(AA->bookmark == reader_msg->msgno)
AA->bookmark = 0;
else
AA->bookmark = reader_msg->msgno;
HeaderView->Use(AA, reader_msg);
HeaderView->Paint();
reader_keyok = YES;
}
// ------------------------------------------------------------------
void ToggleHiddKlud() {
AA->ToggleViewhidden();
AA->ToggleViewkludge();
MsgLineReIndex(reader_msg);
reader_topline = 0;
reader_keyok = YES;
}
// ------------------------------------------------------------------
void ToggleKludge() {
AA->ToggleViewkludge();
MsgLineReIndex(reader_msg);
reader_topline = 0;
reader_keyok = YES;
}
// ------------------------------------------------------------------
void ToggleHidden() {
AA->ToggleViewhidden();
MsgLineReIndex(reader_msg);
reader_topline = 0;
reader_keyok = YES;
}
// ------------------------------------------------------------------
void ToggleQuote() {
AA->ToggleViewquote();
MsgLineReIndex(reader_msg);
reader_topline = 0;
reader_keyok = YES;
}
// ------------------------------------------------------------------
void ToggleROT13() {
if(AA->Msgn.Count()) {
reader_msg->attr.rotX();
Rot13(reader_msg);
reader_keyok = YES;
}
}
// ------------------------------------------------------------------
void TogglePageBar() {
CFG->switches.set(disppagebar, not CFG->switches.get(disppagebar));
}
// ------------------------------------------------------------------
void ToggleRealMsgno() {
CFG->switches.set(disprealmsgno, not CFG->switches.get(disprealmsgno));
HeaderView->Use(AA, reader_msg);
HeaderView->Paint();
reader_keyok = YES;
}
// ------------------------------------------------------------------
void ToggleTwits() {
gkey k;
do {
switch(AA->Twitmode()) {
case TWIT_SHOW:
AA->SetTwitmode(TWIT_BLANK);
w_info(LNG->TwitBlanked);
break;
case TWIT_BLANK:
AA->SetTwitmode(TWIT_SKIP);
w_info(LNG->TwitSkipped);
break;
case TWIT_SKIP:
AA->SetTwitmode(TWIT_IGNORE);
w_info(LNG->TwitIgnoreSkip);
break;
case TWIT_IGNORE:
AA->SetTwitmode(TWIT_KILL);
w_info(LNG->TwitKilled);
break;
case TWIT_KILL:
AA->SetTwitmode(TWIT_SHOW);
w_info(LNG->TwitDisplayed);
break;
}
k = waitkeyt(3000);
} while(k and k != Key_Ent and k != Key_Esc);
w_info(NULL);
if(k == Key_Esc)
AA->SetTwitmode(CFG->twitmode);
else
CFG->twitmode = AA->Twitmode();
}
// ------------------------------------------------------------------
void ToggleStyles() {
gkey k;
int setting = CFG->usestylies + CFG->hidestylies*2;
do {
switch(setting) {
case 2:
case 0: w_info(LNG->StylecodesYes); setting = 1; break;
case 1: w_info(LNG->StylecodesHide); setting = 3; break;
case 3: w_info(LNG->StylecodesNo); setting = 0; break;
}
k = waitkeyt(3000);
} while (k and k != Key_Ent and k != Key_Esc);
w_info(NULL);
if(k != Key_Esc) {
CFG->usestylies = (setting & 1) ? true : false;
CFG->hidestylies = (setting & 2) ? true : false;
}
}
// ------------------------------------------------------------------
void GotoMsgno() {
if(AA->Msgn.Count()) {
// Set the active window
int lastwh = whandle();
int inhdr = AA->Msglistheader() or not _in_msglist;
if(reader_keycode < KK_Macro)
if(gkbd.kbuf == NULL)
kbput(reader_keycode); // Put back the key
char buf[150];
char* ptr = buf;
int list_max = reader_msg->link.list_max();
ulong* replies = (ulong*)throw_calloc(list_max+1, sizeof(ulong));
ulong replyto, replynext;
if(CFG->switches.get(disprealmsgno)) {
ptr += sprintf(ptr, " %-5.5s: %s %u", LNG->MsgReal, LNG->of, AA->Msgn.Count());
replyto = reader_msg->link.to();
replies[0] = reader_msg->link.first();
replynext = reader_msg->link.next();
for(int replyn=1; replyn<list_max+1; replyn++)
replies[replyn] = reader_msg->link.list(replyn-1);
}
else {
ptr += sprintf(ptr, " %-5.5s: %s %u", LNG->Msg, LNG->of, AA->Msgn.Count());
replyto = AA->Msgn.ToReln(reader_msg->link.to());
replies[0] = AA->Msgn.ToReln(reader_msg->link.first());
replynext = AA->Msgn.ToReln(reader_msg->link.next());
for(int replyn=1; replyn<list_max+1; replyn++)
replies[replyn] = AA->Msgn.ToReln(reader_msg->link.list(replyn-1));
}
if(replyto)
ptr += sprintf(ptr, " -%lu", replyto);
for(int replyn=0,plus=0; replyn<list_max+1; replyn++)
if(replies[replyn])
ptr += sprintf(ptr, " %s%lu", (plus++?"":"+"), replies[replyn]);
if(replynext)
sprintf(ptr, " *%lu", replynext);
if(inhdr) {
HeaderView->window.activate_quick();
}
else {
wopen_(0, 0, 3, strlen(buf)+3, W_BHEAD, C_HEADB, C_HEADW);
w_shadow();
wtitle(LNG->EnterMsgno, TCENTER, C_HEADT);
}
int wrow = inhdr ? 1 : 0;
wprints(wrow, 0, C_HEADW, buf);
*buf = NUL;
gwindow iwindow(whandle());
string fbuf = buf;
gwinput2 iform(iwindow);
iform.setup(C_HEADW, C_HEADW, C_HEADI, _box_table(W_BHEAD, 13), true);
iform.add_field(0, wrow, 8, 5, fbuf, 20, gwinput::cvt_none, gwinput::entry_new);
vcurshow();
iform.run(H_InputMsgno);
vcurhide();
if(iform.dropped)
fbuf = "";
long active = AA->Msgn.Count();
long msgno = atol(fbuf.c_str());
if(CFG->switches.get(disprealmsgno))
if(msgno > 0)
msgno = AA->Msgn.ToReln(msgno);
if((msgno < 0) and ((active+msgno) > 0))
msgno = active + msgno;
if(RngV(msgno, 1L, active))
AA->set_lastread((uint)msgno);
if(inhdr)
wactiv_(lastwh);
else
wclose();
throw_free(replies);
}
}
// ------------------------------------------------------------------
void PrevArea() {
AA->attr().hex0();
AA->Close();
int currarea = AL.AreaIdToNo(CurrArea);
int testarea = currarea;
while(testarea > 0) {
testarea--;
if(not AL[testarea]->isseparator()) {
currarea = testarea;
break;
}
}
if(currarea == testarea) {
AL.SetActiveAreaNo(currarea);
OrigArea = CurrArea;
}
else
HandleGEvent(EVTT_ENDOFMSGS);
AA->Open();
AA->RandomizeData();
AA->SetBookmark(AA->lastread());
if(AA->PMrk.Tags()) {
AA->isreadpm = false;
ToggleMarkRead();
}
}
// ------------------------------------------------------------------
void NextArea() {
AA->attr().hex0();
AA->Close();
uint currarea = AL.AreaIdToNo(CurrArea);
uint testarea = currarea;
while(testarea < (AL.size()-1)) {
testarea++;
if(not AL[testarea]->isseparator()) {
currarea = testarea;
break;
}
}
if(currarea == testarea) {
AL.SetActiveAreaNo(currarea);
OrigArea = CurrArea;
}
else
HandleGEvent(EVTT_ENDOFMSGS);
AA->Open();
AA->RandomizeData();
AA->SetBookmark(AA->lastread());
if(AA->PMrk.Tags()) {
AA->isreadpm = false;
ToggleMarkRead();
}
}
// ------------------------------------------------------------------
void QuitNow() {
AA->attr().hex0();
reader_finished = YES;
reader_done = YES;
}
// ------------------------------------------------------------------
void ExitAsk() {
AA->attr().hex0();
GMenuQuit MenuQuit;
reader_done = reader_finished = MenuQuit.Run();
}
// ------------------------------------------------------------------
void NewArea(bool jumpnext) {
AA->attr().hex0();
if(AA->isopen())
AA->Close();
int newarea = CurrArea;
if(jumpnext) {
uint idx = AL.AreaIdToNo(CurrArea);
uint oidx = idx;
do {
idx++;
// Wrap around
if(idx >= AL.size())
idx = 0;
// Exit loop if no area with new mail found
if(idx == oidx) {
newarea = AreaPick(LNG->NewArea, 0, &newarea);
if(newarea != -1)
idx = AL.AreaIdToNo(newarea);
break;
}
} while(AL.AreaNoToPtr(idx)->unread == 0);
CurrArea = AL.AreaNoToId(idx);
}
else {
newarea = AreaPick(LNG->NewArea, 0, &newarea);
if(newarea != -1)
CurrArea = newarea;
}
AL.Sort();
reader_done = YES;
if(gkbd.quitall)
QuitNow();
else {
AL.SetActiveAreaId(CurrArea);
OrigArea = CurrArea;
strcpy(stecho, AA->echoid());
AA->RandomizeData();
if(AA->Msglistfirst())
kbput(KK_ReadMessageList);
}
}
// ------------------------------------------------------------------
void DosShell() {
ShellToDos(getenv(GOLD_SHELL_ENV), LNG->DOS_Shell, LGREY|_BLACK, YES);
}
// ------------------------------------------------------------------
void TouchNetscan(int popup) {
FILE* fp = fsopen(AddPath(CFG->areapath, CFG->semaphore.netscan), "wb", CFG->sharemode);
if(fp) {
fclose(fp);
if(popup) {
w_infof(" %s ", CFG->semaphore.netscan);
HandleGEvent(EVTT_JOBDONE);
waitkeyt(10000);
w_info(NULL);
}
}
}
// ------------------------------------------------------------------
int ExternUtil(GMsg* msg, int utilno) {
Path editorfile, tmpfile;
strcpy(editorfile, AddPath(CFG->goldpath, EDIT->File()));
mktemp(strcpy(tmpfile, AddPath(CFG->goldpath, "GDXXXXXX")));
vector<ExtUtil>::iterator extutil = CFG->externutil.begin();
for(int utlno=0; extutil != CFG->externutil.end(); utlno++, extutil++) {
if(extutil->utilno == utilno) {
char cmdline[256], buf[256];
strcpy(cmdline, extutil->cmdline);
int mode = (extutil->options & EXTUTIL_KEEPCTRL) ? MODE_SAVE : MODE_SAVENOCTRL;
SaveLines(mode, editorfile, msg);
if(striinc("@tmpfile", cmdline))
SaveLines(mode, tmpfile, msg);
strcpy(buf, CFG->goldpath);
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
strischg(cmdline, "@path", buf);
strcpy(buf, editorfile);
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
strischg(cmdline, "@file", buf);
strcpy(buf, tmpfile);
strchg(buf, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
strischg(cmdline, "@tmpfile", buf);
TokenXlat(MODE_NEW, cmdline, msg, msg, CurrArea);
int pauseval = 0;
if(extutil->options & EXTUTIL_PAUSEONERROR)
pauseval = -1;
if(extutil->options & EXTUTIL_PAUSE)
pauseval = 1;
ShellToDos(cmdline, "",
extutil->options & EXTUTIL_CLS ? LGREY|_BLACK : 0,
extutil->options & EXTUTIL_CURSOR,
extutil->options & EXTUTIL_SWAP,
pauseval
);
if(extutil->options & EXTUTIL_RELOAD) {
if(not (extutil->options & EXTUTIL_KEEPCTRL)) {
if(*msg->tearline or *msg->origin) {
gfile fp;
fp.fopen(editorfile, "at");
if(fp.isopen()) {
if(*msg->tearline)
fp.printf("--- %s\n", msg->tearline);
if(*msg->origin)
fp.printf(" * Origin: %s\n", msg->origin);
fp.fclose();
}
}
}
int hardlines = EDIT->HardLines();
EDIT->HardLines(false);
LoadText(msg, editorfile);
if(extutil->options & EXTUTIL_WIPE)
WipeFile(editorfile, 0);
WipeFile(tmpfile, 0);
EDIT->HardLines(hardlines);
msg->attr.tou1(); // Ignore any kludge address found
msg->TextToLines(CFG->dispmargin-(int)CFG->switches.get(disppagebar));
msg->attr.tou0();
}
return YES;
}
}
SayBibi();
return YES;
}
// ------------------------------------------------------------------
void ExternUtilMenu() {
// Not implemented yet
}
// ------------------------------------------------------------------
void UUDecode(GMsg* msg) {
Path infile, outfile;
bool ok = false;
if((*CFG->uudecodepath == NUL) or is_dir(CFG->uudecodepath)) {
mktemp(strcpy(infile, AddPath(CFG->goldpath, "GDXXXXXX")));
strcpy(outfile, CFG->uudecodepath);
GMenuDomarks MenuDomarks;
int source = AA->Mark.Count() ? MenuDomarks.Run(LNG->Decode) : WRITE_CURRENT;
bool overwrite = true;
if(source == WRITE_QUIT)
return;
if(source == WRITE_MARKED) {
for(uint n=0; n<AA->Mark.Count(); n++) {
if(overwrite and n)
overwrite = false; // Overwrite only the first time
w_progress(MODE_UPDATE, C_INFOW, n+1, AA->Mark.Count(), LNG->Preparing);
AA->LoadMsg(msg, AA->Mark[n], 79);
SaveLines(overwrite ? MODE_WRITE : MODE_APPEND, infile, msg);
}
if(AA->Mark.Count())
w_progress(MODE_QUIT, 0, 0, 0, NULL);
}
else if(source == WRITE_CURRENT)
SaveLines(MODE_WRITE, infile, msg);
uulist* item;
int i, res;
w_info(LNG->WaitUUdecoding);
UUInitialize();
UUSetOption(UUOPT_SAVEPATH, 0, outfile);
if((res = UULoadFile(infile, NULL, 0)) == UURET_OK) {
for (i=0; (item=UUGetFileListItem(i)) != NULL; i++) {
if ((item->state & UUFILE_OK) == 0)
continue;
if ((res = UUDecodeFile(item, NULL)) == UURET_OK) {
ok = true;
w_infof(LNG->CompletedUUdecode, item->filename);
}
}
}
UUCleanUp ();
remove(infile);
if(not ok)
w_info(LNG->NotUUencoded);
}
else
w_info(LNG->UUEinvalidpath);
if(not ok)
waitkeyt(10000);
w_info(NULL);
}
// ------------------------------------------------------------------
void Make_Userlist(const char* userlist) {
FILE* fp;
word* crclist;
word crc, crcs=0;
uint n, x;
char userline[80], adrs[40];
GMsg* msg = (GMsg*)throw_calloc(1, sizeof(GMsg));
crclist = (word*)throw_calloc(AA->Msgn.Count()+1, sizeof(word));
fp = fsopen(userlist, "ab", CFG->sharemode);
if(fp) {
w_progress(MODE_NEW, C_INFOW, 0, AA->Msgn.Count(), LNG->GenUserlist);
for(n=AA->Msgn.Count(); n; n--) {
update_statuslinef(LNG->ReadingMsg, n, AA->Msgn.Count());
w_progress(MODE_UPDATE, C_INFOW, (AA->Msgn.Count()-n)+1, AA->Msgn.Count(), NULL);
AA->LoadMsg(msg, AA->Msgn.CvtReln(n), CFG->dispmargin);
crc = strCrc16(msg->by, false);
for(x=0; x<crcs; x++)
if(crclist[x] == crc)
break; // We have already used it
if(x >= crcs) {
crclist[crcs++] = crc;
strrevname(userline, msg->by);
msg->orig.make_string(adrs);
fprintf(fp, "%-36.36s%24.24s\r\n", userline, adrs);
}
}
throw_free(crclist);
w_progress(MODE_QUIT, 0, 0, 0, NULL);
fclose(fp);
}
ResetMsg(msg);
throw_free(msg);
}
// ------------------------------------------------------------------
void MakeUserList() {
if(AA->Msgn.Count()) {
uint temp = AA->lastread();
if(not edit_pathname(CFG->userlistfile, sizeof(Path), LNG->UserlistName, 0))
return;
Make_Userlist(AddPath(CFG->goldpath, CFG->userlistfile));
AA->set_lastread(temp);
}
}
// ------------------------------------------------------------------
void TouchSemaphore() {
Path file;
*file = NUL;
if(edit_string(file, sizeof(Path), LNG->TouchSemaphore, 0))
TouchFile(file);
}
// ------------------------------------------------------------------
void make_pathreport(const char* reportfile) {
gfile fp;
fp.fopen(reportfile, "wt");
if(fp) {
string path;
ftn_addr address;
vector<ftn_addr> alist;
GMsg* msg = (GMsg*)throw_calloc(1, sizeof(GMsg));
w_progress(MODE_NEW, C_INFOW, 0, AA->Msgn.Count(), "Generating PATH report");
for(int n=AA->Msgn.Count(); n>=AA->lastread(); n--) {
update_statuslinef(LNG->ReadingMsg, n, AA->Msgn.Count());
w_progress(MODE_UPDATE, C_INFOW, n, AA->Msgn.Count(), NULL);
AA->LoadMsg(msg, AA->Msgn.CvtReln(n), CFG->dispmargin-(int)CFG->switches.get(disppagebar));
address = msg->orig;
int x;
for(x=0; x<alist.size(); x++) {
if(alist[x] == address)
break; // We have already used it
}
if(x >= alist.size()) {
alist.push_back(address);
INam buf;
strcpy(buf, msg->By());
strchg(buf, ' ', '_');
string temp;
fp.printf("%s %s ", buf, address.make_string(temp).c_str());
path = "";
Line* line = msg->lin;
while(line) {
if(line->kludge == GKLUD_PATH)
path += line->text + 6;
line = line->next;
}
if(path.length()) {
gstrarray links;
tokenize(links, path.c_str(), " ");
for(int i=0; i<links.size(); i++)
address = links[i];
}
fp.printf("%s\n", path.c_str());
}
}
w_progress(MODE_QUIT, 0, 0, 0, NULL);
fp.fclose();
ResetMsg(msg);
throw_free(msg);
}
}
// ------------------------------------------------------------------
void MakePathreport() {
if(AA->Msgn.Count()) {
uint temp = AA->lastread();
if(not edit_pathname(CFG->pathreportfile, sizeof(Path), LNG->Pathreport, 0))
return;
make_pathreport(AddPath(CFG->goldpath, CFG->pathreportfile));
AA->set_lastread(temp);
}
}
// ------------------------------------------------------------------

361
golded3/gescan.cpp Normal file
View File

@ -0,0 +1,361 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Area scanning functions.
// ------------------------------------------------------------------
#include <golded.h>
#include <gmoprot.h>
// ------------------------------------------------------------------
extern bool in_arealist;
extern GPickArealist* PickArealist;
// ------------------------------------------------------------------
void Area::UpdateAreadata() {
if(isscanned) {
uint _unread = Msgn.Count() - lastread();
if(not isvalidchg) {
unread = _unread;
isvalidchg = true;
}
isunreadchg = (bool)(unread != _unread);
unread = _unread;
word oldmask = AL.mask;
AL.mask = 0;
set_marked(_unread);
AL.mask = oldmask;
}
}
// ------------------------------------------------------------------
void Area::ScanArea() {
if(cmdlinedebughg)
LOG.printf("- ScanArea: %s", echoid());
area->Msgn = &Msgn;
area->PMrk = &PMrk;
area->scan_area();
isscanned = true;
UpdateAreadata();
}
// ------------------------------------------------------------------
void Area::ScanAreaPM() {
if(cmdlinedebughg)
LOG.printf("- ScanAreaPM: %s", echoid());
area->Msgn = &Msgn;
area->PMrk = &PMrk;
area->scan_area_pm();
isscanned = true;
ispmscanned = true;
UpdateAreadata();
}
// ------------------------------------------------------------------
int AreaList::SetActiveAreaNo(int __areano) {
AA = idx[__areano];
CurrArea = AA->areaid();
CFG->originno = AA->originno();
return CurrArea; // Return the areaid
}
// ------------------------------------------------------------------
int AreaList::AreaScan(int mode, uint currno, int pmscan, int& pmails, int& pmareas, const char* file) {
gstrarray bag;
int groupid = -1;
// Load scan list into a string bag
if(mode == SCAN_LIST) {
gfile fp;
Path tmp;
strcpy(tmp, file ? file : ListScan.File());
char* listfile;
char* option=tmp;
getkeyval(&listfile, &option);
fp.fopen(AddPath(CFG->goldpath, listfile), "rt");
if(fp.isopen()) {
char buf[512];
while(fp.fgets(buf, sizeof(buf))) {
strbtrim(buf);
char* val = strtok(buf, ", \t");
while(val) {
bag.push_back(val);
val = strtok(NULL, ", \t");
}
}
fp.fclose();
if(((*option == '-') or (*option == '/')) and strieql(option+1, "delete"))
remove(listfile);
}
}
else if(mode == SCAN_GROUP) {
groupid = idx[currno]->groupid();
}
int currid = AreaNoToId(currno);
int scanned = false;
// For optimized overlay usage, sort arealist by msgbase type, path, board and echoid
if(*CFG->areascansort) {
Sort(CFG->areascansort);
scanned = true;
}
currno = AreaIdToNo(currid);
#ifndef GMB_NOPCB
if(AL.msgbases & MT_PCBOARD) PcbWideOpen();
#endif
#ifndef GMB_NOGOLD
if(AL.msgbases & MT_GOLDBASE) GoldWideOpen();
#endif
#ifndef GMB_NOHUDS
if(AL.msgbases & MT_HUDSON) HudsWideOpen();
#endif
#ifndef GMB_NOXBBS
if(AL.msgbases & MT_ADEPTXBBS) XbbsWideOpen();
#endif
for(uint n=0; n<idx.size(); n++) {
// Check if ESC was pressed to skip the scan
gkey xch = kbxhit();
if(xch) {
xch = kbxget();
if(xch == Key_Esc)
break;
else
kbput(xch);
}
SetActiveAreaNo(n);
if(not AA->isseparator()) {
int scanit = false;
int dopmscan = pmscan and AA->pmscan();
int dopmscanexcl = pmscan and AA->pmscanexcl();
int dopmscanincl = pmscan and AA->pmscanincl();
int doscan = AA->scan() or dopmscan;
//if Area is excluded from pm-scanning, scan it instead
int doscanexcl = AA->scanexcl();
int doscanincl = AA->scanincl() or dopmscanincl or (dopmscanexcl and doscan);
if(mode != SCAN_STARTUP and pmscan)
dopmscan = true;
switch(mode) {
case SCAN_STARTUP:
if(doscan and (not doscanexcl or doscanincl))
scanit = true;
break;
case SCAN_ALL:
if(not doscanexcl or doscanincl)
scanit = true;
break;
case SCAN_CURRENT:
scanit = n == currno;
break;
case SCAN_MARKED:
if(AA->ismarked())
scanit = true;
break;
case SCAN_MATCHING:
if(striinc(area_maybe, AA->echoid()))
scanit = true;
break;
case SCAN_UNSCANNED:
scanit = not (pmscan ? AA->ispmscanned : AA->isscanned);
break;
case SCAN_GROUP:
scanit = AA->groupid() == groupid;
break;
case SCAN_NETMAIL:
scanit = AA->isnet();
break;
case SCAN_LIST:
{
gstrarray::iterator i;
for(i = bag.begin(); i != bag.end(); i++)
if(strwild(AA->echoid(), i->c_str())) {
scanit = true;
break;
}
}
break;
}
if(scanit) {
if(not AA->isopen()) {
AA->Msgn.Reset();
AA->Mark.ResetAll();
AA->PMrk.ResetAll();
}
scanned = YES;
if(not blanked)
update_statuslinef("%s %s", 1+LNG->ScanningArea, AA->echoid());
if(dopmscan and (not dopmscanexcl or dopmscanincl)) {
AA->ScanAreaPM();
uint count = AA->PMrk.Count();
if(count) {
pmails += count;
pmareas++;
}
if(CFG->personalmail & PM_LISTONLY)
AA->PMrk.Reset();
}
else {
AA->ScanArea();
}
}
}
}
#ifndef GMB_NOXBBS
if(AL.msgbases & MT_ADEPTXBBS) XbbsWideClose();
#endif
#ifndef GMB_NOHUDS
if(AL.msgbases & MT_HUDSON) HudsWideClose();
#endif
#ifndef GMB_NOGOLD
if(AL.msgbases & MT_GOLDBASE) GoldWideClose();
#endif
#ifndef GMB_NOPCB
if(AL.msgbases & MT_PCBOARD) PcbWideClose();
#endif
return scanned;
}
// ------------------------------------------------------------------
void CheckSemaphores() {
Path file;
int scanned = 0;
int pmareas = 0;
int pmails = 0;
if(fexist(CFG->semaphore.qwkimport)) {
ImportQWK();
remove(CFG->semaphore.qwkimport);
scanned++;
}
if(fexist(CFG->semaphore.qwkexport)) {
ExportQWK();
remove(CFG->semaphore.qwkexport);
}
if(fexist(CFG->semaphore.soupimport)) {
ImportSOUP();
remove(CFG->semaphore.soupimport);
scanned++;
}
if(fexist(CFG->semaphore.soupexport)) {
ExportSOUP();
remove(CFG->semaphore.soupexport);
}
if(fexist(CFG->semaphore.exitnow) and in_arealist) {
gkbd.quitall = YES;
kbput(KK_AreaAbort);
remove(CFG->semaphore.exitnow);
}
else {
if(fexist(CFG->semaphore.scanall)) {
scanned += AL.AreaScan(SCAN_ALL, 0, false, pmails, pmareas);
remove(CFG->semaphore.scanall);
}
if(fexist(CFG->semaphore.scanthis)) {
sprintf(file, "%s -delete", CFG->semaphore.scanthis);
scanned += AL.AreaScan(SCAN_LIST, 0, false, pmails, pmareas, file);
}
if(fexist(CFG->semaphore.scannetmail)) {
scanned += AL.AreaScan(SCAN_NETMAIL, 0, false, pmails, pmareas);
remove(CFG->semaphore.scannetmail);
}
if(fexist(CFG->semaphore.pmscanall)) {
scanned += AL.AreaScan(SCAN_ALL, 0, true, pmails, pmareas);
remove(CFG->semaphore.pmscanall);
}
if(fexist(CFG->semaphore.pmscanthis)) {
sprintf(file, "%s -delete", CFG->semaphore.pmscanthis);
scanned += AL.AreaScan(SCAN_LIST, 0, true, pmails, pmareas, file);
}
if(fexist(CFG->semaphore.pmscannetmail)) {
scanned += AL.AreaScan(SCAN_NETMAIL, 0, true, pmails, pmareas);
remove(CFG->semaphore.pmscannetmail);
}
}
if(scanned) {
AL.Sort();
if(in_arealist and not blanked) {
PickArealist->update(); // update arealist-display
PickArealist->do_delayed(); // update statusline
}
AL.WriteGoldLast();
}
}
// ------------------------------------------------------------------

814
golded3/gesoup.cpp Normal file
View File

@ -0,0 +1,814 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Internet SOUP packet handling.
// ------------------------------------------------------------------
#include <fcntl.h>
#include <golded.h>
#include <gesrch.h>
// ------------------------------------------------------------------
void KludgeDATE(GMsg* msg, char* ptr);
// ------------------------------------------------------------------
char* CvtMessageIDtoMSGID(char* mptr, char* msgidbuf, const char* echoid, char* kludge) {
sprintf(msgidbuf, "\x1""%s: ", kludge);
char* bptr = msgidbuf + strlen(msgidbuf);
if(strnieql(mptr, "<MSGID_", 7)) {
mptr += 7;
while((*mptr != '@') and *mptr) {
if(*mptr == '=') {
*bptr++ = (char)((xtoi(mptr[1]) << 4) | xtoi(mptr[2]));
mptr += 3;
}
else if(*mptr == '_') {
*bptr++ = ' ';
mptr++;
}
else {
*bptr++ = *mptr++;
}
}
*bptr = NUL;
}
else {
int spaces = strchr(mptr, ' ') ? true : false;
dword crc32 = CRC32_MASK_CCITT;
crc32 = strCrc32(mptr, NO, crc32);
crc32 = strCrc32(echoid, YES, crc32);
crc32 ^= CRC32_MASK_CCITT;
if(spaces)
*bptr++ = '\"';
while(*mptr) {
if(spaces and (*mptr == '\"'))
*bptr++ = '\"';
*bptr++ = *mptr++;
}
if(spaces)
*bptr++ = '\"';
sprintf(bptr, " %08lx", crc32);
}
return msgidbuf;
}
// ------------------------------------------------------------------
char* UnfoldLine(char* mptr) {
char* eptr = mptr;
do {
eptr = strskip_to(eptr, '\n');
if(*eptr) {
char lwsp = eptr[1];
if((lwsp == ' ') or (lwsp == '\t'))
*eptr = lwsp;
else {
*eptr++ = NUL;
break;
}
}
} while(*eptr);
return eptr;
}
// ------------------------------------------------------------------
int CheckMailinglists(GMsg* msg, int current) {
if(AA->isemail()) {
vector<MailList>::iterator z;
for(z = CFG->mailinglist.begin(); z != CFG->mailinglist.end(); z++)
if(z->sender_is_pattern) {
golded_search_manager srchmgr;
srchmgr.prepare_from_string(z->sender, GFIND_HDRTXT);
bool success = srchmgr.search(msg, true, true);
if(srchmgr.reverse ? not success : success) {
int areano = AL.AreaEchoToNo(z->echoid);
if(areano != -1)
return AL.AreaNoToId(areano);
}
}
}
return current;
}
// ------------------------------------------------------------------
int CheckMailinglists(const char* what, int current) {
if(AA->isemail()) {
vector<MailList>::iterator z;
for(z = CFG->mailinglist.begin(); z != CFG->mailinglist.end(); z++)
if(not z->sender_is_pattern and strieql(what, z->sender)) {
int areano = AL.AreaEchoToNo(z->echoid);
if(areano != -1)
return AL.AreaNoToId(areano);
}
}
return current;
}
// ------------------------------------------------------------------
bool MatchRFC(char*& p, const char* what) {
bool match = strnieql(p, what, strlen(what));
if(match)
p = strskip_wht(p + strlen(what) - 1);
return match;
}
// ------------------------------------------------------------------
void ProcessSoupMsg(char* lbuf, GMsg* msg, int& msgs, char* areaname, int tosstobadmsgs) {
int entryCurrArea = CurrArea;
if(msg->txt) {
msgs++;
msg->orig = msg->oorig = CFG->internetgate.addr.net ? CFG->internetgate.addr : AA->aka();
msg->dest = msg->odest = AA->aka();
time_t a = time(NULL);
time_t b = mktime(gmtime(&a));
msg->arrived = a + a - b;
Line* line = NULL;
Line* fline = NULL;
int lineno = 0;
int inhdr = true;
char* mptr = msg->txt;
char smsgid[2010]; *smsgid = NUL;
char sreply[2010]; *sreply= NUL;
if(tosstobadmsgs)
AddLineF(line, "AREA:%s", areaname);
while(*mptr) {
char* eptr = mptr;
do {
eptr = strskip_to(eptr, '\n');
if(*eptr) {
char lwsp = eptr[1];
if(inhdr and (mptr != eptr) and ((lwsp == ' ') or (lwsp == '\t'))) {
*eptr = lwsp;
}
else {
*eptr++ = NUL;
break;
}
}
} while(*eptr);
strchg(mptr, '\t', ' ');
if(inhdr) {
if(*mptr == NUL) {
inhdr = false;
CurrArea = CheckMailinglists(msg, CurrArea);
const char* echo_id = AL.AreaIdToPtr(CurrArea)->echoid();
fline = FirstLine(line);
char buf[2010];
if(*smsgid) {
CvtMessageIDtoMSGID(smsgid, buf, echo_id, "MSGID");
fline = AddKludge(fline, buf);
}
if(*sreply) {
CvtMessageIDtoMSGID(sreply, buf, echo_id, "REPLY");
fline = AddKludge(fline, buf);
}
}
else {
int addkludge = true;
*lbuf = CTRL_A;
strcpy(lbuf+1, mptr);
if(MatchRFC(mptr, "From: ")) {
INam fromname;
IAdr fromaddr;
ParseInternetAddr(mptr, fromname, fromaddr);
strxcpy(msg->by, *fromname ? fromname : fromaddr, sizeof(msg->by));
if(AA->Internetgate().addr.net) {
char abuf[40];
char kbuf[2048];
sprintf(kbuf, "\x1""REPLYTO %s %s",
AA->Internetgate().addr.make_string(abuf),
*AA->Internetgate().name ? AA->Internetgate().name : "UUCP"
);
line = AddKludge(line, kbuf);
sprintf(kbuf, "\x1""REPLYADDR %s", fromaddr);
line = AddKludge(line, kbuf);
}
CurrArea = CheckMailinglists(fromaddr, CurrArea);
}
else if(MatchRFC(mptr, "To: ")) {
strxcpy(msg->ito, mptr, sizeof(msg->ito));
INam toname;
IAdr toaddr;
ParseInternetAddr(mptr, toname, toaddr);
strxcpy(msg->to, *toname ? toname : toaddr, sizeof(msg->to));
}
else if(MatchRFC(mptr, "Cc: ")) {
char* ccbuf = (char*)throw_malloc(strlen(msg->icc) + strlen(mptr) + 3);
strcpy(stpcpy(stpcpy(ccbuf, msg->icc), *msg->icc ? ", " : ""), mptr);
strxcpy(msg->icc, ccbuf, sizeof(msg->icc));
throw_free(ccbuf);
}
else if(MatchRFC(mptr, "Bcc: ")) {
char* bccbuf = (char*)throw_malloc(strlen(msg->ibcc) + strlen(mptr) + 3);
strcpy(stpcpy(stpcpy(bccbuf, msg->ibcc), *msg->ibcc ? ", " : ""), mptr);
strxcpy(msg->ibcc, bccbuf, sizeof(msg->ibcc));
throw_free(bccbuf);
}
else if(MatchRFC(mptr, "X-To: ")) {
INam toname;
IAdr toaddr;
ParseInternetAddr(mptr, toname, toaddr);
strxcpy(msg->to, *toname ? toname : toaddr, sizeof(msg->to));
}
else if(MatchRFC(mptr, "Subject: ")) {
strxcpy(msg->re, mptr, sizeof(msg->re));
}
else if(MatchRFC(mptr, "Date: ")) {
KludgeDATE(msg, mptr);
}
else if(MatchRFC(mptr, "Organization: ")) {
// not used
}
else if(MatchRFC(mptr, "Message-ID: ")) {
if(not strnieql(mptr, "<NOMSGID_", 9))
strxcpy(smsgid, mptr, 201);
}
else if(MatchRFC(mptr, "References: ")) {
while(*mptr) {
char* sptr = strpbrk(mptr, " ,");
if(sptr == NULL)
sptr = mptr + strlen(mptr);
while(((*sptr == ' ') or (*sptr == ',')) and *sptr)
*sptr++ = NUL;
if(not strnieql(mptr, "<NOMSGID_", 9))
strxcpy(sreply, mptr, 201);
mptr = sptr;
}
}
else if(MatchRFC(mptr, "In-Reply-To: ")) {
if(not strnieql(mptr, "<NOMSGID_", 9))
strxcpy(sreply, mptr, 201);
}
else if(MatchRFC(mptr, "Sender: ")) {
INam sendername;
IAdr senderaddr;
ParseInternetAddr(mptr, sendername, senderaddr);
CurrArea = CheckMailinglists(senderaddr, CurrArea);
}
else if(MatchRFC(mptr, "X-Mailing-List: ")) {
INam listname;
IAdr listaddr;
ParseInternetAddr(mptr, listname, listaddr);
CurrArea = CheckMailinglists(listaddr, CurrArea);
}
if(addkludge)
line = AddKludge(line, lbuf);
}
}
else {
line = AddLineFast(line, mptr);
lineno++;
}
mptr = eptr;
}
if(not *msg->to)
strcpy(msg->to, "All");
msg->lin = FirstLine(line);
if(OrigArea != CurrArea) {
AA->Unlock();
AA->Close();
AL.SetActiveAreaId(CurrArea);
OrigArea = CurrArea;
AA->Open();
AA->Lock();
AA->RandomizeData();
}
if(lineno) {
AA->istossed = true;
update_statuslinef("%s: %u", AA->echoid(), msgs);
msg->LinesToText();
AA->SaveMsg(GMSG_NEW, msg);
}
ResetMsg(msg);
CurrArea = entryCurrArea;
}
}
// ------------------------------------------------------------------
dword swapendian(dword n) {
byte* c = (byte*)&n;
n = ((c[0]*256 + c[1])*256 + c[2])*256 + c[3];
return n;
}
// ------------------------------------------------------------------
int ImportSOUP() {
int imported = 0;
if(*CFG->soupimportpath) {
const int MBUF_SIZE = 65535;
const int LBUF_SIZE = 65535;
gfile fpa; // For AREAS file
gfile fpm; // For *.MSG files
int importedmsgs = 0;
Path areasfile;
strcpy(areasfile, AddPath(CFG->soupimportpath, "AREAS"));
fpa.fopen(areasfile, "rt");
if(fpa.isopen()) {
char buf[2048];
LoadCharset("N/A", "N/A");
char* mbuf = (char*)throw_malloc(MBUF_SIZE);
char* lbuf = (char*)throw_malloc(LBUF_SIZE);
GMsg* msg = (GMsg*)throw_calloc(1, sizeof(GMsg));
while(fpa.fgets(buf, sizeof(buf))) {
char* delim = "\t\n";
char* prefix = strtok(buf, delim);
char* areaname = strtok(NULL, delim);
char* encoding = strtok(NULL, delim);
char msgfmt = *encoding++;
char idxfmt = (char)(*encoding ? *encoding++ : 0);
char kind = (char)(*encoding ? *encoding : 0);
int isemail = false;
int isnews = false;
switch(msgfmt) {
case 'M':
// not supported yet
break;
case 'm':
case 'b':
isemail = true;
break;
case 'u':
if(kind == 'm') {
isemail = true;
break;
}
case 'B':
isnews = true;
break;
}
Path msgfile, idxfile;
strcpy(stpcpy(msgfile, prefix), ".msg");
strcpy(msgfile, AddPath(CFG->soupimportpath, msgfile));
if(idxfmt) {
strcpy(stpcpy(idxfile, prefix), ".idx");
strcpy(idxfile, AddPath(CFG->soupimportpath, idxfile));
}
strupr(areaname);
int tosstobadmsgs = false;
if(isemail)
areaname = CFG->soupemail;
int areano = AL.AreaEchoToNo(areaname);
if(areano == -1) {
areano = AL.AreaEchoToNo(CFG->soupbadmsgs);
tosstobadmsgs = true;
}
if((areano != -1) and (isemail or isnews)) {
AL.SetActiveAreaNo(areano);
OrigArea = CurrArea;
fpm.fopen(msgfile, "rb");
if(fpm.isopen()) {
imported++;
int msgs = 0;
AA->Open();
AA->Lock();
AA->RandomizeData();
uint txtlen = 0;
char* txtptr = NULL;
uint allocated_len = 0;
if((msgfmt == 'b') or (msgfmt == 'B')) {
// Get binary formats
dword msglen = 0;
while(fpm.fread(&msglen, 4) == 1) {
msglen = swapendian(msglen);
uint msglensz = (uint)msglen;
if(msglen != msglensz)
msglensz--;
msg->txt = (char*)throw_calloc(1, msglensz+1);
fpm.fread(msg->txt, msglensz);
if(msglen != msglensz)
fpm.fseek(msglen-msglensz, SEEK_CUR);
ProcessSoupMsg(lbuf, msg, msgs, areaname, tosstobadmsgs);
}
}
else {
// Get non-binary formats
while(fpm.fgets(mbuf, MBUF_SIZE)) {
if(msgfmt == 'u') {
if(strneql(mbuf, "#! rnews ", 9)) {
dword msglen = atol(mbuf+9);
uint msglensz = (uint)msglen;
if(msglen != msglensz)
msglensz--;
msg->txt = (char*)throw_calloc(1, msglensz+1);
fpm.fread(msg->txt, msglensz);
if(msglen != msglensz)
fpm.fseek(msglen-msglensz, SEEK_CUR);
ProcessSoupMsg(lbuf, msg, msgs, areaname, tosstobadmsgs);
}
else {
w_infof(LNG->ErrorInSoup, msgfile);
waitkeyt(10000);
w_info(NULL);
break;
}
}
else if(msgfmt == 'm') {
if(strneql(mbuf, "From ", 5)) {
msg->txt = txtptr;
txtptr = NULL;
txtlen = 0;
allocated_len = 0;
ProcessSoupMsg(lbuf, msg, msgs, areaname, tosstobadmsgs);
}
uint len = strlen(mbuf);
if((txtlen+len+1) > allocated_len) {
if(allocated_len)
allocated_len *= 2;
else
allocated_len = (txtlen+len+1) * 100;
txtptr = (char*)throw_realloc(txtptr, allocated_len);
}
strcpy(txtptr+txtlen, mbuf);
txtlen += len;
}
else if(msgfmt == 'M') {
// Not supported yet
}
}
if(msgfmt == 'm') {
if(txtptr) {
msg->txt = txtptr;
txtptr = NULL;
ProcessSoupMsg(lbuf, msg, msgs, areaname, tosstobadmsgs);
}
}
}
throw_free(txtptr);
AA->Unlock();
AA->Close();
if(msgs)
importedmsgs += msgs;
fpm.fclose();
}
}
remove(msgfile);
if(idxfmt)
remove(idxfile);
}
ResetMsg(msg);
throw_free(msg);
throw_free(lbuf);
throw_free(mbuf);
fpa.fclose();
remove(areasfile);
if(*CFG->souptosslog)
fpa.fopen(CFG->souptosslog, "at");
for(uint na = 0; na < AL.size(); na++) {
if(AL[na]->istossed) {
AL[na]->istossed = false;
AL[na]->isunreadchg = true;
if(fpa.isopen())
fpa.printf("%s\n", AL[na]->echoid());
}
}
if(fpa.isopen())
fpa.fclose();
if(importedmsgs and *CFG->soupreplylinker) {
sprintf(buf, LNG->Replylinker, CFG->soupreplylinker);
ShellToDos(CFG->soupreplylinker, buf, LGREY|_BLACK, YES);
}
}
}
if(imported)
startupscan_success = true;
return imported;
}
// ------------------------------------------------------------------
int ExportSoupMsg(GMsg* msg, char* msgfile, gfile& fp, int ismail) {
NW(ismail);
if(not fp.isopen()) {
fp.open(AddPath(CFG->soupexportpath, msgfile), O_RDWR|O_CREAT|O_BINARY, "rb+");
if(fp.isopen())
fp.fseek(0, SEEK_END);
}
if(fp.isopen()) {
int level = 0;
if(CharTable)
level = CharTable->level ? CharTable->level : 2;
char mbuf[1030];
// Write placeholder for message length
dword msglen = 0xFFFFFFFFL;
fp.fwrite(&msglen, 4);
msglen = 0;
bool qp = false;
if(msg->charsetencoding & GCHENC_MNE) {
if(not CharTable or not striinc("MNEMONIC", CharTable->exp))
LoadCharset(CFG->xlatlocalset, "MNEMONIC");
}
else if(striinc("LATIN1QP", msg->charset)) {
qp = true;
if(not CharTable or not striinc("LATIN1QP", CharTable->exp))
LoadCharset(CFG->xlatlocalset, "LATIN1QP");
}
else {
if(not CharTable or not striinc(msg->charset, CharTable->exp))
LoadCharset(CFG->xlatlocalset, msg->charset);
}
// Process kludges and write header lines
Line* line = msg->lin;
while(line) {
if(line->type & GLINE_KLUDGE) {
if((line->kludge == GKLUD_RFC) or (line->kludge == 0)) {
strcpy(mbuf, (*line->text == CTRL_A) ? line->text+1 : line->text);
msglen += fp.printf("%s%s", mbuf, (line->type & GLINE_WRAP) ? "" : "\n");
}
else if(line->type & GLINE_WRAP) {
while(line->next and (line->type & GLINE_WRAP))
line = line->next;
}
}
line = line->next;
}
// Write blank line after header lines
msglen += fp.printf("\n");
// Write all message lines
line = msg->lin;
while(line) {
if(not (line->type & (GLINE_KLUDGE|GLINE_TEAR|GLINE_ORIG))) {
XlatStr(mbuf, line->text, level, CharTable);
char* mptr = mbuf;
if(qp and strlen(mptr) > 76) {
// 12345v7890
// =FF - back one
// =FF - back two
// =FF - okay
do {
char* mbeg = mptr;
mptr += 75;
if(*(mptr-2) == '=')
mptr -= 2;
else if(*(mptr-1) == '=')
mptr--;
int mlen = (int)(mptr - mbeg);
msglen += fp.printf("%*.*s=\n", mlen, mlen, mbeg);
} while(strlen(mptr) > 76);
}
msglen += fp.printf("%s\n", mptr);
}
line = line->next;
}
// Re-write the correct message length
fp.fseek(-(msglen+4), SEEK_CUR);
dword be_msglen = swapendian(msglen);
fp.fwrite(&be_msglen, 4);
fp.fseek(msglen, SEEK_CUR);
msg->attr.snt1();
msg->attr.scn1();
msg->attr.uns0();
time_t a = time(NULL);
time_t b = mktime(gmtime(&a));
msg->arrived = a + a - b;
AA->SaveHdr(GMSG_UPDATE, msg);
if(msg->attr.k_s())
AA->DeleteMsg(msg, DIR_NEXT);
return 1;
}
return 0;
}
// ------------------------------------------------------------------
int ExportSoupArea(int areano, char* msgfile, gfile& fp, int ismail) {
int exported = 0;
AL.SetActiveAreaNo(areano);
AA->Open();
AA->Lock();
AA->RandomizeData();
GMsg* msg = (GMsg*)throw_calloc(1, sizeof(GMsg));
for(uint n=0; n<AA->Expo.Count(); n++) {
if(AA->LoadMsg(msg, AA->Expo[n], CFG->soupexportmargin)) {
if(msg->attr.uns() and not (msg->attr.del() or msg->attr.lok())) {
exported += ExportSoupMsg(msg, msgfile, fp, ismail);
update_statuslinef("%s: %u", AA->echoid(), exported);
}
}
}
ResetMsg(msg);
throw_free(msg);
AA->Unlock();
AA->Close();
AA->Expo.ResetAll();
return exported;
}
// ------------------------------------------------------------------
int ExportSOUP() {
int mailexported = 0;
int newsexported = 0;
if(*CFG->soupexportpath) {
Path scanfile;
gfile fp, mfp, nfp;
// Get the scan list
strcpy(scanfile, AddPath(CFG->goldpath, "goldsoup.lst"));
fp.fopen(scanfile, "rt");
if(fp.isopen()) {
char buf[256];
while(fp.fgets(buf, sizeof(buf))) {
char* ptr = strchr(buf, ' ');
if(ptr) {
*ptr++ = NUL;
int a = AL.AreaEchoToNo(buf);
if(a != -1)
AL[a]->Expo.Add(atol(ptr));
}
}
fp.fclose();
}
// Export from the e-mail and newsgroup areas
for(uint na = 0; na < AL.size(); na++) {
Area* ap = AL[na];
if(ap->isemail() and ap->Expo.Count())
mailexported += ExportSoupArea(na, "GOLDMAIL.MSG", mfp, true);
else if(ap->isnewsgroup() and ap->Expo.Count())
newsexported += ExportSoupArea(na, "GOLDNEWS.MSG", nfp, false);
}
// Close any open SOUP files
if(mfp.isopen())
mfp.fclose();
if(nfp.isopen())
nfp.fclose();
// Update the REPLIES file
fp.open(AddPath(CFG->soupexportpath, "REPLIES"), O_RDWR|O_CREAT|O_BINARY, "rb+");
if(fp.isopen()) {
char buf[512];
int hasmail = false;
int hasnews = false;
while(fp.fgets(buf, sizeof(buf))) {
strtok(buf, "\t\n");
if(strieql(buf, "GOLDMAIL"))
hasmail = true;
else if(strieql(buf, "GOLDNEWS"))
hasnews = true;
}
if(mailexported and not hasmail)
fp.printf("GOLDMAIL\tmail\tbn\n");
if(newsexported and not hasnews)
fp.printf("GOLDNEWS\tnews\tBn\n");
fp.fclose();
}
// Delete the scanfile
remove(scanfile);
}
return mailexported + newsexported;
}
// ------------------------------------------------------------------

567
golded3/gesrch.cpp Normal file
View File

@ -0,0 +1,567 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Advanced search functions.
// ------------------------------------------------------------------
#include <golded.h>
#include <gmnubase.h>
#include <geval.h>
#include <gesrch.h>
// ------------------------------------------------------------------
golded_search_manager::golded_search_manager() {
}
// ------------------------------------------------------------------
golded_search_manager::~golded_search_manager() {
}
// ------------------------------------------------------------------
inline void search_item_option(bool& a, const char* s) {
if(s[1] == '^')
a = not a;
else
a = s[1] != '\'';
}
// ------------------------------------------------------------------
const char* search_item_set(search_item& item, const char* s) {
while(*s) {
switch(*s) {
case '!': search_item_option(item.reverse, s); break;
case '<': search_item_option(item.where.from, s); break;
case '>': search_item_option(item.where.to, s); break;
case ':': search_item_option(item.where.subject, s); break;
case '#': search_item_option(item.where.body, s); break;
case '.': search_item_option(item.where.tagline, s); break;
case '_': search_item_option(item.where.tearline, s); break;
case '*': search_item_option(item.where.origin, s); break;
case '@': search_item_option(item.where.signature, s); break;
case '%': search_item_option(item.where.kludges, s); break;
case '=': search_item_option(item.case_sensitive, s); break;
case '?':
s++;
switch(tolower(*s)) {
case 'r': item.type = gsearch::regex; break;
case 'w': item.type = gsearch::wildcard; break;
case 'p': item.type = gsearch::plain; break;
case 'f':
item.type = gsearch::fuzzy;
if(isdigit(s[1])) {
item.fuzzydegree = atoi(s+1);
while(isdigit(s[1]))
s++;
}
break;
}
break;
case '^':
case '\'':
break;
default:
return s;
}
s++;
}
return s;
}
// ------------------------------------------------------------------
void golded_search_manager::prepare_from_string(const char* prompt, int what) {
// Get defaults
reverse = false;
direction = DIR_NEXT;
search_item default_item;
const char* p = prompt;
if(*p == '-' or *p == '+') {
direction = (*p == '-') ? DIR_PREV : DIR_NEXT;
p++;
}
p = search_item_set(default_item, p);
if(default_item.reverse) {
default_item.reverse = false;
reverse = true;
}
if(what == GFIND_HDR or what == GFIND_HDRTXT) {
if(not (default_item.where.from or default_item.where.to or default_item.where.subject)) {
default_item.where.from = true;
default_item.where.to = true;
default_item.where.subject = true;
}
if(what == GFIND_HDRTXT)
default_item.where.body = true;
}
char buf[256];
char* b = buf;
bool item_complete = false;
search_item item = default_item;
p = search_item_set(item, strskip_wht(p));
do {
switch(*p) {
// Logic AND
case '&':
item.logic = search_item::logic_and;
item_complete = true;
p++;
break;
// Logic OR
case '|':
item.logic = search_item::logic_or;
item_complete = true;
p++;
break;
// Get quoted string
case '\"':
case '\'':
{
char q = *p++;
while(*p) {
if(*p == q) {
p++;
break;
}
switch(*p) {
case '\\':
if(*(++p))
*b++ = *p++;
break;
default:
*b++ = *p++;
}
}
}
break;
// Get literal escaped character
case '\\':
if(*(++p))
*b++ = *p++;
break;
// Skip whitespace
case ' ':
p++;
case NUL:
break;
default:
*b++ = *p++;
}
if(item_complete or (*p == NUL)) {
item_complete = false;
*b = NUL;
if(*buf != NUL) {
item.pattern = buf;
items.push_back(item);
}
if(*p == NUL)
break;
item = default_item;
p = search_item_set(item, strskip_wht(p));
b = buf;
}
} while(*p);
}
// ------------------------------------------------------------------
bool golded_search_manager::search(GMsg* msg, bool quick, bool shortcircuit) {
search_item* item = items.begin();
bool exit = false;
bool and_cycle = false;
bool or_cycle = false;
for(int i=0; i<items.size(); i++, item++) {
if(shortcircuit) {
if(item->logic == search_item::logic_and) {
if(not and_cycle) {
if(exit)
return true;
}
else
if(not exit)
continue;
and_cycle = true;
}
else {
if(and_cycle) {
and_cycle = (item->logic == search_item::logic_and);
if(not exit)
continue;
} else {
and_cycle = (item->logic == search_item::logic_and);
if(exit)
return true;
}
or_cycle = (item->logic == search_item::logic_or);
}
}
int found = 0;
if(item->where.from) {
if(item->search(*msg->ifrom ? msg->ifrom : msg->By())) {
msg->foundwhere |= GFIND_FROM;
found++;
if(quick)
goto quick_found;
}
}
if(item->where.to) {
if(item->search(*msg->ito ? msg->ito : msg->to)) {
msg->foundwhere |= GFIND_TO;
found++;
if(quick)
goto quick_found;
}
else if(*msg->icc and item->search(msg->icc)) {
msg->foundwhere |= GFIND_TO;
found++;
if(quick)
goto quick_found;
}
else if(*msg->ibcc and item->search(msg->ibcc)) {
msg->foundwhere |= GFIND_TO;
found++;
if(quick)
goto quick_found;
}
}
if(item->where.subject) {
if(item->search(msg->re)) {
msg->foundwhere |= GFIND_SUBJECT;
found++;
if(quick)
goto quick_found;
}
}
if(item->where.body or item->where.tagline or item->where.tearline or item->where.origin or item->where.signature or item->where.kludges) {
Line* line = msg->lin;
while(line) {
uint type = line->type;
bool search_this_line = false;
if(item->where.body and not (type & (GLINE_TAGL|GLINE_TEAR|GLINE_ORIG|GLINE_SIGN|GLINE_KLUDGE)))
search_this_line = true;
if(item->where.tagline and (type & GLINE_TAGL))
search_this_line = true;
if(item->where.tearline and (type & GLINE_TEAR))
search_this_line = true;
if(item->where.origin and (type & GLINE_ORIG))
search_this_line = true;
if(item->where.signature and (type & GLINE_SIGN))
search_this_line = true;
if(item->where.kludges and (type & GLINE_KLUDGE))
search_this_line = true;
if(search_this_line) {
if(item->search(line->text)) {
line->type |= GLINE_HIGH;
if(type & (GLINE_TAGL|GLINE_TEAR|GLINE_ORIG|GLINE_SIGN|GLINE_KLUDGE)) {
if(type & GLINE_TAGL)
msg->foundwhere |= GFIND_TAGLINE;
else if(type & GLINE_TEAR)
msg->foundwhere |= GFIND_TEARLINE;
else if(type & GLINE_ORIG)
msg->foundwhere |= GFIND_ORIGIN;
else if(type & GLINE_SIGN)
msg->foundwhere |= GFIND_SIGNATURE;
else if(type & GLINE_KLUDGE)
msg->foundwhere |= GFIND_KLUDGES;
}
else {
msg->foundwhere |= GFIND_BODY;
}
found++;
if(quick)
goto quick_found;
}
}
line = line->next;
}
}
quick_found:
if(item->reverse)
found = not found;
// Perform short-circuit logic analysis
if(shortcircuit) {
exit = found ? true : false;
if(item == items.end()-1)
return exit;
}
// else save success/failure as score
else {
item->score = found ? 1 : 0;
}
}
if(not shortcircuit) {
gevalhum logic;
if(items.size()) {
for(int i=0; i<items.size(); i++) {
logic.push_value(items[i].score);
if((i+1) < items.size()) {
if(items[i].logic == search_item::logic_and)
logic.push_operator(geval::logic_and);
else
logic.push_operator(geval::logic_or);
}
}
return (bool)logic.evaluate();
}
}
// It should never end up here unless there are no items
return false;
}
// ------------------------------------------------------------------
void search_mgr_form::before() {
gwinput2::before();
}
// ------------------------------------------------------------------
void search_mgr_form::after() {
gwinput2::after();
}
// ------------------------------------------------------------------
void search_mgr_form::select(gstrarray& menu, const char* title) {
int srow = window.start_row + current->row;
int scol = window.start_column + current->column;
if((current->id < id_direction) and ((current->id % 3) == 2))
scol -= 20;
GMnu m;
m.Init();
m.SetColor(7, 7, 7, 112, 8);
m.SetTitle(title, 14);
m.SetBorder(0, 7);
m.SetPos(srow, scol);
m.SetMask(0);
m.Begin();
for(int i=0; i<menu.size(); i++)
m.Item(i, menu[i].c_str());
m.End();
vcurhide();
m.Start();
vcurshow();
if(m.FinalTag() != -1) {
if(not ((current->id < id_direction) and ((current->id % 3) == 2))) {
strbtrim(strcpy(current->buf, menu[m.FinalTag()].c_str()+1));
current->update();
}
}
}
// ------------------------------------------------------------------
bool search_mgr_form::validate() {
gstrarray menu;
if(current->id >= id_direction) {
switch(current->id) {
case id_direction:
menu.insert(menu.end(), "F Forward");
menu.insert(menu.end(), "B Backward ");
select(menu, "Direction");
break;
case id_messages:
menu.insert(menu.end(), "N New");
menu.insert(menu.end(), "U Unread ");
menu.insert(menu.end(), "A All");
select(menu, "Messages");
break;
case id_action:
menu.insert(menu.end(), "R Read");
menu.insert(menu.end(), "T Tag");
menu.insert(menu.end(), "D Delete ");
menu.insert(menu.end(), "W Write");
menu.insert(menu.end(), "C Copy");
menu.insert(menu.end(), "M Move");
select(menu, "Action");
break;
case id_areas:
menu.insert(menu.end(), "C Current ");
menu.insert(menu.end(), "A All");
menu.insert(menu.end(), "T Tagged");
select(menu, "Areas");
break;
}
}
else if((current->id % 3) == 1) {
menu.insert(menu.end(), "a and ");
menu.insert(menu.end(), "o or");
select(menu, "Logic");
}
else if((current->id % 3) == 2) {
menu.insert(menu.end(), " Plain ");
menu.insert(menu.end(), " Regex ");
menu.insert(menu.end(), " Wildcard ");
menu.insert(menu.end(), " Fuzzy ");
menu.insert(menu.end(), " Success if not found ");
menu.insert(menu.end(), " Case sensitive ");
menu.insert(menu.end(), " Search \"from\" ");
menu.insert(menu.end(), " Search \"to\" ");
menu.insert(menu.end(), " Search \"subject\" ");
menu.insert(menu.end(), " Search msg body ");
menu.insert(menu.end(), " Search tagline ");
menu.insert(menu.end(), " Search tearline ");
menu.insert(menu.end(), " Search origin ");
menu.insert(menu.end(), " Search signature ");
menu.insert(menu.end(), " Search kludges ");
select(menu, "Options");
}
return true;
}
// ------------------------------------------------------------------
void AdvancedSearch(GMsg*, int&, int&) {
int patterns = 9;
int width = 77;
int height = patterns+11;
int widths[3] = { 55, 5, 7 };
int field_widths[3] = { 100, 5, 7 };
int border_type = BT_SINGLE;
int title_color = YELLOW | _BLUE;
int heading_color = YELLOW | _BLUE;
int window_color = LGREY | _BLUE;
int border_color = LBLUE | _BLUE;
int edit_color = YELLOW | _BLUE;
int idle_color = LGREY | _BLUE;
int active_color = WHITE | _BLUE;
int shadow_color = DGREY | _BLACK;
widths[0] = width - 3*2 - 2 - 5 - 7 - 2;
gwindow window;
window.openxy(1, ((MAXCOL-width)/2), height, width,
border_type, border_color, window_color);
window.shadow(shadow_color);
window.horizontal_line( 1, 0, width-2, border_type, border_color);
window.horizontal_line(patterns+2, 0, width-2, border_type, border_color);
window.vertical_line(0, widths[0]+2, patterns+3, border_type, border_color);
window.vertical_line(0, widths[0]+widths[1]+5, patterns+3, border_type, border_color);
window.title(" Advanced Search Manager ", title_color);
window.prints(0, 1, heading_color, "Pattern");
window.prints(0, widths[0]+4, heading_color, "Logic");
window.prints(0, widths[0]+widths[1]+7, heading_color, "Options");
window.prints(patterns+3, 1, heading_color, "Direction : ");
window.prints(patterns+4, 1, heading_color, "Messages : ");
window.prints(patterns+5, 1, heading_color, "Action : ");
window.prints(patterns+6, 1, heading_color, "Areas : ");
window.prints(patterns+7, 1, heading_color, "Destination : ");
window.prints(patterns+8, 1, heading_color, "Identifier : ");
search_mgr_form iform(window);
iform.setup(idle_color, active_color, edit_color, _box_table(border_type, 13), true);
string buffers[9*3 + 6];
int i = 0;
for(int r=0; r<9; r++) {
int cs = 1;
for(int c=0; c<3; c++,i++) {
char z[80];
sprintf(z, "%i,%i", r+1, c+1);
buffers[i] = z;
iform.add_field(i, r+2, cs, widths[c], buffers[i], field_widths[c]);
cs += widths[c] + 3;
}
}
buffers[i+0] = "Forward";
buffers[i+1] = "New";
buffers[i+2] = "Read";
buffers[i+3] = "Current";
buffers[i+4] = "C:\\TEMP\\DUMPFILE.TXT";
buffers[i+5] = "Testing";
for(int y=0; y<6; y++,i++)
iform.add_field(100+y, patterns+3+y, 15, width-15-3, buffers[i], width-15-3, gwinput::cvt_none, y>=4 ? gwinput::entry_conditional : gwinput::entry_noedit);
iform.run(0);
window.close();
}
// ------------------------------------------------------------------

76
golded3/gesrch.h Normal file
View File

@ -0,0 +1,76 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Advanced search functions.
// ------------------------------------------------------------------
#include <gstrarr.h>
#include <gsrchmgr.h>
// ------------------------------------------------------------------
class golded_search_manager : public search_manager {
public:
bool reverse;
int direction;
golded_search_manager();
~golded_search_manager();
void prepare_from_string(const char* prompt, int what);
bool search(GMsg* msg, bool quick, bool shortcircuit);
};
// ------------------------------------------------------------------
class search_mgr_form : public gwinput2 {
public:
enum {
id_direction = 100,
id_messages,
id_action,
id_areas
};
search_mgr_form(gwindow& w) : gwinput2(w) { }
virtual ~search_mgr_form() { }
bool validate();
void select(gstrarray& menu, const char* title);
void before();
void after();
};
// ------------------------------------------------------------------

1109
golded3/getpls.cpp Normal file

File diff suppressed because it is too large Load Diff

927
golded3/geusrbse.cpp Normal file
View File

@ -0,0 +1,927 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Userbase (Addressbook) functions.
// ------------------------------------------------------------------
#include <cerrno>
#include <fcntl.h>
#include <golded.h>
#include <geusrbse.h>
#include <gftnnl.h>
// ------------------------------------------------------------------
guserbase::guserbase() {
long tries = 0;
strcpy(fname, AddPath(CFG->goldpath, CFG->golduser));
do {
usrbase.open(fname, O_RDWR|O_CREAT|O_BINARY, SH_DENYNO, S_STDRW);
if(not usrbase) {
if((errno != EACCES) or (not PopupLocked(++tries, false, fname))) {
WideLog->ErrOpen();
WideLog->printf("! GoldED's Addressbook cannot be opened.");
WideLog->printf(": %s", fname);
WideLog->ErrOSInfo();
OpenErrorExit();
}
}
} while(not usrbase);
if(tries)
PopupLocked(0, 0, NULL);
if((uint) usrbase.filelength() < sizeof(gusrbaseheader) + sizeof(gusrbaseentry)) {
header.version = 0;
strcpy(entry.macro, "_asa_");
strcpy(entry.name, "Alexander S. Aganichev");
entry.fidoaddr.reset();
entry.fidoaddr.zone = 2;
entry.fidoaddr.net = 5049;
entry.fidoaddr.node = 49;
entry.fidoaddr.point = 50;
strcpy(entry.iaddr, "asa@eed.miee.ru");
entry.prefer_internet = YES;
entry.is_deleted = NO;
strcpy(entry.pseudo, "As\'ka");
strcpy(entry.organisation, "[unemployed]");
strcpy(entry.snail1, "Zelenograd");
strcpy(entry.snail2, "Moscow");
strcpy(entry.snail3, "Russia");
entry.dataphone[0] = NUL;
entry.voicephone[0] = NUL;
entry.faxphone[0] = NUL;
entry.firstdate = entry.lastdate = entry.times = 0;
strcpy(entry.homepage, "http://asa.i-connect.ru");
entry.group = 0;
strcpy(entry.comment1, "GoldED+ Maintainer");
entry.comment2[0] = NUL;
entry.comment3[0] = NUL;
usrbase.lseek(0, SEEK_SET);
usrbase.write(&header.version, sizeof(header.version));
write_entry(0);
}
index = 0;
read_time = 0; // Indicate that we're should reread timestamp
refresh_maximum_index();
need_update = false;
}
// ------------------------------------------------------------------
guserbase::~guserbase() {
usrbase.close();
}
// ------------------------------------------------------------------
void guserbase::refresh_maximum_index() {
// Are we doing it for the first time?
if(not read_time) {
usrbase.getftime(&read_time);
need_update = true;
}
else {
dword tmp;
usrbase.getftime(&tmp);
if(read_time != tmp) {
read_time = tmp;
need_update = true;
}
}
if(need_update)
maximum_index = (usrbase.filelength()-sizeof(gusrbaseheader)) / sizeof(gusrbaseentry) - 1;
if(index > maximum_index)
index = maximum_index;
}
// ------------------------------------------------------------------
void guserbase::lock() {
if(WideCanLock) {
long tries = 0;
do {
usrbase.lock(0, 1);
if(not usrbase.okay()) {
if(not PopupLocked(++tries, false, fname)) {
WideLog->ErrLock();
WideLog->printf("! GoldED's Addressbook could not be locked.");
WideLog->printf(": %s", fname);
WideLog->ErrOSInfo();
LockErrorExit();
}
}
} while(not usrbase.okay());
if(tries)
PopupLocked(0, 0, NULL);
}
}
// ------------------------------------------------------------------
void guserbase::unlock() {
if(WideCanLock)
usrbase.unlock(0, 1);
}
// ------------------------------------------------------------------
void guserbase::open() {
window.openxy(ypos, xpos, ylen+2, xlen+2, btype, battr, 7);
cwidth = (xlen-28) / 2;
window.message(LNG->UserHeaderName, TP_BORD, 3, tattr);
window.message(LNG->UserHeaderOrg, TP_BORD, 4+cwidth, tattr);
window.message(LNG->UserHeaderAka, TP_BORD, 5+(cwidth*2)/3 + cwidth, tattr);
center(CFG->displistcursor);
}
// ------------------------------------------------------------------
void guserbase::close() {
window.close();
}
// ------------------------------------------------------------------
void guserbase::do_delayed() {
wscrollbar(W_VERT, maximum_index+1, maximum_index, index);
update_statuslinef(LNG->UserStatusline, index+1, maximum_index+1, maximum_index-index);
}
// ------------------------------------------------------------------
void guserbase::print_line(uint idx, uint pos, bool isbar) {
char buf[200];
char buf2[100];
read_entry(idx);
*buf2 = NUL;
if(AA->isinternet() or not entry.fidoaddr.valid()) {
if(*entry.iaddr) {
strcat(buf2, "<");
strcat(buf2, entry.iaddr);
strcat(buf2, ">");
}
}
else {
if(entry.fidoaddr.valid()) {
*buf2 = '(';
entry.fidoaddr.make_string(buf2+1);
strcat(buf2, ")");
}
}
sprintf(buf, "%c %-*.*s %-*.*s %s ",
entry.is_deleted ? 'D' : ' ',
cwidth, (int)cwidth, entry.name,
(cwidth*2)/3, (int)(cwidth*2)/3, entry.organisation,
buf2);
strsetsz(buf, xlen);
window.prints(pos, 0, isbar ? sattr : wattr, buf);
}
// ------------------------------------------------------------------
addressbook_form::~addressbook_form() { }
addressbook_form::addressbook_form(gwindow& w) : gwinput2(w) { };
void addressbook_form::after() { gwinput2::after(); };
void addressbook_form::before() { gwinput2::before(); };
// ------------------------------------------------------------------
bool addressbook_form::validate() {
if(current->id == id_name) {
if(g->find_entry(current->buf)) {
LoadForm();
reload_all();
go_next_field();
}
}
return true;
}
// ------------------------------------------------------------------
void addressbook_form::LoadForm() {
gusrbaseentry& entry = g->entry;
entry.fidoaddr.make_string(fidoaddr);
name = entry.name;
macro = entry.macro;
pseudo = entry.pseudo;
iaddr = entry.iaddr;
organisation = entry.organisation;
voicephone= entry.voicephone;
faxphone = entry.faxphone;
dataphone = entry.dataphone;
snail1 = entry.snail1;
snail2 = entry.snail2;
snail3 = entry.snail3;
comment1 = entry.comment1;
comment2 = entry.comment2;
comment3 = entry.comment3;
homepage = entry.homepage;
}
// ------------------------------------------------------------------
void addressbook_form::SaveForm() {
gusrbaseentry& entry = g->entry;
entry.fidoaddr.reset();
entry.fidoaddr.set(fidoaddr);
strcpy(entry.name, name.c_str());
strcpy(entry.macro, macro.c_str());
strcpy(entry.pseudo, pseudo.c_str());
strcpy(entry.iaddr, iaddr.c_str());
strcpy(entry.organisation, organisation.c_str());
strcpy(entry.voicephone, voicephone.c_str());
strcpy(entry.faxphone, faxphone.c_str());
strcpy(entry.dataphone, dataphone.c_str());
strcpy(entry.snail1, snail1.c_str());
strcpy(entry.snail2, snail2.c_str());
strcpy(entry.snail3, snail3.c_str());
strcpy(entry.comment1, comment1.c_str());
strcpy(entry.comment2, comment2.c_str());
strcpy(entry.comment3, comment3.c_str());
strcpy(entry.homepage, homepage.c_str());
}
// ------------------------------------------------------------------
bool guserbase::edit_entry(uint idx) {
gwindow window;
char tbuf[50];
const int width = 75;
const int height = 16;
window.openxy((MAXROW-height)/2, (MAXCOL-width)/2, height, width, btype, battr, wattr);
window.shadow(C_SHADOW);
sprintf(tbuf, " Record <%d> ", idx+1);
window.title(tbuf, tattr);
window.prints( 0, 1, wattr, "Full Name :");
window.prints( 1, 1, wattr, "Macro Name:");
window.prints( 1,34, wattr, "Nick Name :");
window.prints( 2, 1, wattr, "Fidonet :");
window.prints( 2,34, wattr, "Internet :");
window.prints( 3, 1, wattr, "Organisat.:");
window.horizontal_line(4, 0, width-2, btype, battr);
window.prints( 5, 1, wattr, "Voice Num.:");
window.prints( 6, 1, wattr, "Fax Number:");
window.prints( 7, 1, wattr, "Data Num. :");
window.prints( 5,34, wattr, "Address(1):");
window.prints( 6,34, wattr, "Address(2):");
window.prints( 7,34, wattr, "Address(3):");
window.prints( 8, 1, wattr, "Group :");
window.prints( 8,34, wattr, "Homepage :");
window.prints( 9, 1, wattr, "Comment(1):");
window.prints(10, 1, wattr, "Comment(2):");
window.prints(11, 1, wattr, "Comment(3):");
window.horizontal_line(12, 0, width-2, btype, battr);
window.prints(13, 1, wattr, "First Used:");
window.prints(13, 27, wattr, "Last Used:");
window.prints(13, 53, wattr, "Times Used:");
char dbuf[16];
time_t dt = entry.firstdate;
if(dt)
window.prints(13, 13, wattr, strftimei(dbuf, 16, "%d %b %y", gmtime(&dt)));
dt = entry.lastdate;
if(dt)
window.prints(13, 38, wattr, strftimei(dbuf, 16, "%d %b %y", gmtime(&dt)));
sprintf(dbuf, "%8ld", entry.times);
window.prints(13, width-11, wattr, dbuf);
addressbook_form form(window);
form.g = this;
form.setup(C_HEADW, C_HEADW, C_HEADE, _box_table(W_BHEAD, 13), true);
read_entry(idx);
form.LoadForm();
form.add_field(addressbook_form::id_name, 0, 13, 59, form.name, sizeof(entry.name));
form.add_field(addressbook_form::id_macro, 1, 13, 20, form.macro, sizeof(entry.macro));
form.add_field(addressbook_form::id_pseudo, 1, 46, 26, form.pseudo, sizeof(entry.pseudo));
form.add_field(addressbook_form::id_fidoaddr, 2, 13, 20, form.fidoaddr, 24);
form.add_field(addressbook_form::id_iaddr, 2, 46, 26, form.iaddr, sizeof(entry.iaddr));
form.add_field(addressbook_form::id_organisation, 3, 13, 59, form.organisation, sizeof(entry.organisation));
form.add_field(addressbook_form::id_voicephone, 5, 13, 20, form.voicephone, sizeof(entry.voicephone));
form.add_field(addressbook_form::id_faxphone, 6, 13, 20, form.faxphone, sizeof(entry.faxphone));
form.add_field(addressbook_form::id_dataphone, 7, 13, 20, form.dataphone, sizeof(entry.dataphone));
form.add_field(addressbook_form::id_snail1, 5, 46, 26, form.snail1, sizeof(entry.snail1));
form.add_field(addressbook_form::id_snail2, 6, 46, 26, form.snail2, sizeof(entry.snail2));
form.add_field(addressbook_form::id_snail3, 7, 46, 26, form.snail3, sizeof(entry.snail3));
form.add_field(addressbook_form::id_homepage , 8, 46, 26, form.homepage, sizeof(entry.homepage));
form.add_field(addressbook_form::id_comment1, 9, 13, 59, form.comment1, sizeof(entry.comment1));
form.add_field(addressbook_form::id_comment2, 10, 13, 59, form.comment2, sizeof(entry.comment2));
form.add_field(addressbook_form::id_comment3, 11, 13, 59, form.comment3, sizeof(entry.comment3));
form.run(H_EditAdrEntry);
window.close();
if(not form.dropped)
form.SaveForm();
return not form.dropped;
}
// ------------------------------------------------------------------
bool guserbase::find_entry(char* name, bool lookup) {
gusrbaseentry ent;
if(not strblank(name)) {
refresh_maximum_index();
usrbase.lseek(sizeof(gusrbaseheader), SEEK_SET);
for(uint i=0; i<=maximum_index; i++) {
read_entry(i, &ent);
if(strieql(name, ent.name) or (lookup and strieql(name, ent.macro))) {
strcpy(entry.macro, ent.macro);
strcpy(entry.name, ent.name);
entry.fidoaddr = ent.fidoaddr;
strcpy(entry.iaddr, ent.iaddr);
entry.prefer_internet = ent.prefer_internet;
entry.is_deleted = ent.is_deleted;
strcpy(entry.pseudo, ent.pseudo);
strcpy(entry.organisation, ent.organisation);
strcpy(entry.snail1, ent.snail1);
strcpy(entry.snail2, ent.snail2);
strcpy(entry.snail3, ent.snail3);
strcpy(entry.dataphone, ent.dataphone);
strcpy(entry.voicephone, ent.voicephone);
strcpy(entry.faxphone, ent.faxphone);
entry.firstdate = ent.firstdate;
entry.lastdate = ent.lastdate;
entry.times = ent.times;
strcpy(entry.homepage, ent.homepage);
entry.group = ent.group;
strcpy(entry.comment1, ent.comment1);
strcpy(entry.comment2, ent.comment1);
strcpy(entry.comment3, ent.comment1);
index = i;
return true;
}
}
}
return false;
}
// ------------------------------------------------------------------
void guserbase::write_entry(uint idx, bool updateit) {
if(updateit and not entry.is_deleted) {
time_t a = time(NULL);
time_t b = mktime(gmtime(&a));
entry.lastdate = a + a - b;
if(not entry.firstdate)
entry.firstdate = entry.lastdate;
entry.times++;
}
usrbase.lseek(sizeof(gusrbaseheader) + sizeof(gusrbaseentry)*(idx+1)-1, SEEK_SET);
char z = 0;
usrbase.write(&z, 1); // adjust entry size first...
usrbase.lseek(sizeof(gusrbaseheader) + sizeof(gusrbaseentry)*idx, SEEK_SET);
usrbase.write(entry.macro, sizeof(entry.macro));
usrbase.write(entry.name, sizeof(entry.name));
usrbase.write(&entry.fidoaddr.zone, sizeof(entry.fidoaddr.zone));
usrbase.write(&entry.fidoaddr.net, sizeof(entry.fidoaddr.net));
usrbase.write(&entry.fidoaddr.node, sizeof(entry.fidoaddr.node));
usrbase.write(&entry.fidoaddr.point, sizeof(entry.fidoaddr.point));
usrbase.write(entry.iaddr, sizeof(entry.iaddr));
usrbase.write(&entry.prefer_internet, sizeof(entry.prefer_internet));
usrbase.write(&entry.is_deleted, sizeof(entry.is_deleted));
usrbase.write(entry.pseudo, sizeof(entry.pseudo));
usrbase.write(entry.organisation, sizeof(entry.organisation));
usrbase.write(entry.snail1, sizeof(entry.snail1));
usrbase.write(entry.snail2, sizeof(entry.snail2));
usrbase.write(entry.snail3, sizeof(entry.snail3));
usrbase.write(entry.dataphone, sizeof(entry.dataphone));
usrbase.write(entry.voicephone, sizeof(entry.voicephone));
usrbase.write(entry.faxphone, sizeof(entry.faxphone));
usrbase.write(&entry.firstdate, sizeof(entry.firstdate));
usrbase.write(&entry.lastdate, sizeof(entry.lastdate));
usrbase.write(&entry.times, sizeof(entry.times));
usrbase.write(entry.homepage, sizeof(entry.homepage));
usrbase.write(&entry.group, sizeof(entry.group));
usrbase.write(entry.comment1, sizeof(entry.comment1));
usrbase.write(entry.comment2, sizeof(entry.comment1));
usrbase.write(entry.comment3, sizeof(entry.comment1));
}
// ------------------------------------------------------------------
void guserbase::clear_entry(gusrbaseentry *ent) {
ent->macro[0] = NUL;
ent->name[0] = NUL;
ent->fidoaddr.reset();
ent->iaddr[0] = NUL;
ent->prefer_internet = NO;
ent->is_deleted = NO;
ent->pseudo[0] = NUL;
ent->organisation[0] = NUL;
ent->snail1[0] = NUL;
ent->snail2[0] = NUL;
ent->snail3[0] = NUL;
ent->dataphone[0] = NUL;
ent->voicephone[0] = NUL;
ent->faxphone[0] = NUL;
ent->firstdate = ent->lastdate = ent->times = 0;
ent->homepage[0] = NUL;
ent->group = 0;
ent->comment1[0] = NUL;
ent->comment2[0] = NUL;
ent->comment3[0] = NUL;
}
// ------------------------------------------------------------------
bool guserbase::read_entry(uint idx, gusrbaseentry *ent) {
if(ent == NULL)
ent = &entry;
refresh_maximum_index();
if(idx > maximum_index) {
clear_entry(ent);
return false;
}
else {
usrbase.lseek(idx*sizeof(gusrbaseentry)+sizeof(gusrbaseheader), SEEK_SET);
usrbase.read(ent->macro, sizeof(ent->macro));
usrbase.read(ent->name, sizeof(ent->name));
usrbase.read(&ent->fidoaddr.zone, sizeof(ent->fidoaddr.zone));
usrbase.read(&ent->fidoaddr.net, sizeof(ent->fidoaddr.net));
usrbase.read(&ent->fidoaddr.node, sizeof(ent->fidoaddr.node));
usrbase.read(&ent->fidoaddr.point, sizeof(ent->fidoaddr.point));
usrbase.read(ent->iaddr, sizeof(ent->iaddr));
usrbase.read(&ent->prefer_internet, sizeof(ent->prefer_internet));
usrbase.read(&ent->is_deleted, sizeof(ent->is_deleted));
usrbase.read(ent->pseudo, sizeof(ent->pseudo));
usrbase.read(ent->organisation, sizeof(ent->organisation));
usrbase.read(ent->snail1, sizeof(ent->snail1));
usrbase.read(ent->snail2, sizeof(ent->snail2));
usrbase.read(ent->snail3, sizeof(ent->snail3));
usrbase.read(ent->dataphone, sizeof(ent->dataphone));
usrbase.read(ent->voicephone, sizeof(ent->voicephone));
usrbase.read(ent->faxphone, sizeof(ent->faxphone));
usrbase.read(&ent->firstdate, sizeof(ent->firstdate));
usrbase.read(&ent->lastdate, sizeof(ent->lastdate));
usrbase.read(&ent->times, sizeof(ent->times));
usrbase.read(ent->homepage, sizeof(ent->homepage));
usrbase.read(&ent->group, sizeof(ent->group));
usrbase.read(ent->comment1, sizeof(ent->comment1));
usrbase.read(ent->comment2, sizeof(ent->comment1));
usrbase.read(ent->comment3, sizeof(ent->comment1));
return true;
}
}
// ------------------------------------------------------------------
void guserbase::pack_addressbook() {
long tries = 0;
lock();
refresh_maximum_index();
uint nidx = 0;
uint nindex = index;
for(uint idx = 0; idx <= maximum_index; idx++) {
read_entry(idx);
if(not entry.is_deleted) {
if(nidx != idx)
write_entry(nidx);
++nidx;
}
else if(idx < index)
--nindex;
}
index = nindex;
// zap
maximum_index = nidx;
// At least one record should present
if(maximum_index)
--maximum_index;
usrbase.chsize((maximum_index + 1) * sizeof(gusrbaseentry) + sizeof(gusrbaseheader));
usrbase.close();
do {
usrbase.open(fname, O_RDWR|O_CREAT|O_BINARY, SH_DENYNO, S_STDRW);
if(not usrbase) {
if((errno != EACCES) or (not PopupLocked(++tries, false, fname))) {
WideLog->ErrOpen();
WideLog->printf("! GoldED's Addressbook cannot be opened.");
WideLog->printf(": %s", fname);
WideLog->ErrOSInfo();
OpenErrorExit();
}
}
} while(not usrbase);
if(tries)
PopupLocked(0, 0, NULL);
unlock();
}
// ------------------------------------------------------------------
void guserbase::update_screen(bool force) {
refresh_maximum_index();
if(force or need_update) {
if(position > index)
center(CFG->displistcursor);
update();
do_delayed();
need_update = false;
}
}
// ------------------------------------------------------------------
bool guserbase::handle_key() {
switch(key) {
case Key_Esc:
aborted = true;
return false;
case Key_Ins: // Add new entry
{
clear_entry(&entry);
lock();
refresh_maximum_index();
uint nidx = maximum_index + 1;
if(edit_entry(nidx)) {
if(nidx == maximum_index + 1) {
maximum_index++;
if(maximum_position < ylen-1)
maximum_position = maximum_index;
}
write_entry(nidx);
index = nidx;
}
unlock();
center(CFG->displistcursor);
}
break;
case Key_Ent: // Select/Edit entry
if(not select_list) {
if(not entry.is_deleted) {
lock();
if(edit_entry(index)) {
write_entry(index);
display_bar();
}
unlock();
}
break;
}
else {
aborted = false;
return false;
}
case Key_Del: // Soft-Delete Entry
lock();
refresh_maximum_index();
read_entry(index);
entry.is_deleted = not entry.is_deleted;
write_entry(index);
unlock();
update_screen();
break;
case Key_A_P: // Pack Addressbook
pack_addressbook();
index = position = 0;
update_screen();
break;
case Key_Tick:
CheckTick(0); // KK_UserQuitNow ???
break;
default:
SayBibi();
}
return true;
}
// ------------------------------------------------------------------
bool guserbase::run(GMsg* msg, bool selectonly) {
select_list = selectonly;
ypos = selectonly ? 6 : 1;
xpos = 0;
ylen = MAXROW-3-ypos;
xlen = MAXCOL-2;
btype = W_BMENU;
battr = C_MENUB;
wattr = C_MENUW;
tattr = C_MENUT;
sattr = C_MENUS;
hattr = C_MENUQ;
sbattr = C_MENUPB;
helpcat = H_Userbase;
listwrap = CFG->switches.get(displistwrap);
maximum_position = MinV(maximum_index, ylen - 1);
if(not select_list)
find_entry(msg->By(), false);
run_picker();
if(not aborted) {
read_entry(index);
// other stuff not yet implemented
}
return not aborted;
}
// ------------------------------------------------------------------
void guserbase::update_addressbook(GMsg* msg, bool reverse, bool force) {
Addr fidoaddr;
IAdr iaddr;
INam name;
strcpy(name, (reverse ? msg->By() : msg->To()));
strcpy(iaddr, (reverse ? msg->iorig : msg->idest));
fidoaddr = (reverse ? msg->orig : msg->dest);
if(not strblank(name)) {
if(find_entry(name)) {
if(not force)
if((CFG->addressbookadd == NO) or ((CFG->addressbookadd == YES) and not (AA->isnet() or AA->isemail())))
return;
}
else {
if(not force) {
// Don't automatically add the user if...
// 1. It's not allowed
if((CFG->addressbookadd == NO) or ((CFG->addressbookadd == YES) and not (AA->isnet() or AA->isemail())))
return;
// 2. It's a robotname
for(gstrarray::iterator n = CFG->robotname.begin(); n != CFG->robotname.end(); n++)
if(striinc(n->c_str(), name))
return;
// 3. It's a username
if(is_user(name))
return;
// 4. It's a WHOTO name
if(strieql(AA->Whoto(), name))
return;
// 5. It's the mailinglist's sender address
if(AA->isemail()) {
vector<MailList>::iterator z;
for(z = CFG->mailinglist.begin(); z != CFG->mailinglist.end(); z++)
if(strieql(z->sender, name) or strieql(z->sender, iaddr))
return;
}
// 6. If it is already an email address
if(AA->isemail() and strchr(name, '@'))
return;
// 7. User listed in nodelist
const char *nlname = lookup_nodelist(&fidoaddr);
if(nlname and strieql(nlname, name))
return;
}
// Ok, let's add it...
clear_entry(&entry);
strxcpy(entry.name, name, sizeof(entry.name));
refresh_maximum_index();
index = ++maximum_index;
}
if((AA->isinternet() and strblank(iaddr)) or (not AA->isinternet() and not fidoaddr.valid()))
return;
// Update address
if(AA->isinternet())
strxcpy(entry.iaddr, iaddr, sizeof(entry.iaddr));
else
entry.fidoaddr = fidoaddr;
lock();
write_entry(index, not force);
unlock();
}
}
// ------------------------------------------------------------------
bool guserbase::lookup_addressbook(GMsg* msg, char* name, char* aka, bool browser) {
bool found = false;
if(not strblank(name) or browser) {
w_info(LNG->UserWait);
if((find_entry(name, true) and not entry.is_deleted) or browser) {
if(browser) {
if(not run(msg, true)) {
w_info(NULL);
return false;
}
}
found = true;
strcpy(name, entry.name);
if(not strblank(entry.pseudo))
strcpy(msg->pseudoto, entry.pseudo);
if(aka) {
*aka = NUL;
if(AA->isinternet())
strcpy(aka, entry.iaddr);
else {
entry.fidoaddr.make_string(aka);
if(strblank(aka) and not strblank(entry.iaddr)) {
// do UUCP addressing
strcpy(msg->realto, entry.name);
strcpy(name, entry.iaddr);
strcpy(msg->iaddr, entry.iaddr);
}
}
}
}
w_info(NULL);
return found ? (aka ? not strblank(aka) : true) : false;
}
return false;
}
// ------------------------------------------------------------------
void guserbase::build_pseudo(GMsg* msg, char* name, char* aka, bool direction) {
strcpy(direction ? msg->pseudoto : msg->pseudofrom, strlword(name));
if(find_entry(name, true) and not entry.is_deleted) {
if(not strblank(entry.pseudo)) {
if(AA->isinternet()) {
if(strcmp(aka, entry.iaddr))
return;
}
else {
Addr AKA = aka;
if(entry.fidoaddr != AKA)
return;
}
strcpy(direction ? msg->pseudoto : msg->pseudofrom, entry.pseudo);
}
}
}
// ------------------------------------------------------------------
void update_addressbook(GMsg* msg, bool reverse, bool force) {
guserbase p;
p.update_addressbook(msg, reverse, force);
}
// ------------------------------------------------------------------
bool lookup_addressbook(GMsg* msg, char* name, char* aka, bool browser) {
guserbase p;
bool result = p.lookup_addressbook(msg, name, aka, browser);
return result;
}
// ------------------------------------------------------------------
void build_pseudo(GMsg* msg, bool direction) {
guserbase p;
char buf[128];
if(direction)
p.build_pseudo(msg, strbtrim(msg->To()), msg->dest.make_string(buf));
else
p.build_pseudo(msg, strbtrim(msg->By()), msg->orig.make_string(buf), false);
}
// ------------------------------------------------------------------
void edit_addressbook(GMsg* msg) {
guserbase p;
p.run(msg, false);
}
// ------------------------------------------------------------------

196
golded3/geusrbse.h Normal file
View File

@ -0,0 +1,196 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// GEUSRBSE header file.
// ------------------------------------------------------------------
#include <gmnubase.h>
#include <gwinput.h>
// ------------------------------------------------------------------
#if defined(GOLD_CANPACK)
#pragma pack(1)
#endif
struct gusrbaseheader {
word version;
byte reserved[4094];
};
struct gusrbaseentry {
char macro[20];
IAdr name;
ftn_addr fidoaddr;
IAdr iaddr;
byte prefer_internet;
byte is_deleted;
char pseudo[40];
char organisation[78];
char snail1[78];
char snail2[78];
char snail3[78];
char dataphone[40];
char voicephone[40];
char faxphone[40];
ulong firstdate;
ulong lastdate;
ulong times;
char homepage[128];
byte group;
char comment1[78];
char comment2[78];
char comment3[78];
byte reserved[915];
};
#if defined(GOLD_CANPACK)
#pragma pack()
#endif
// ------------------------------------------------------------------
class guserbase;
class addressbook_form : public gwinput2 {
string macro;
string name;
string fidoaddr;
string iaddr;
string pseudo;
string organisation;
string snail1;
string snail2;
string snail3;
string dataphone;
string voicephone;
string faxphone;
string homepage;
string comment1;
string comment2;
string comment3;
bool validate();
void before();
void after();
void LoadForm();
void SaveForm();
enum {
id_macro,
id_name,
id_fidoaddr,
id_iaddr,
id_prefer_internet,
id_pseudo,
id_organisation,
id_snail1,
id_snail2,
id_snail3,
id_dataphone,
id_voicephone,
id_faxphone,
id_firstdate,
id_lastdate,
id_times,
id_homepage,
id_group,
id_comment1,
id_comment2,
id_comment3
};
friend class guserbase;
public:
guserbase* g;
addressbook_form(gwindow& w);
virtual ~addressbook_form();
void select();
};
// ------------------------------------------------------------------
class guserbase : public gwinpick {
private:
gwindow window;
gfile usrbase;
gusrbaseheader header;
gusrbaseentry entry;
uint cwidth;
bool select_list;
bool need_update;
dword read_time;
Path fname;
void open();
void close();
void lock();
void unlock();
void refresh_maximum_index();
void print_line(uint idx, uint pos, bool isbar);
void do_delayed();
bool handle_key();
bool edit_entry(uint idx);
void clear_entry(gusrbaseentry *ent);
bool read_entry(uint idx, gusrbaseentry *ent=NULL);
void write_entry(uint idx, bool updateit = false);
bool find_entry(char* name, bool lookup = false);
void pack_addressbook();
void update_screen(bool force = true);
friend class addressbook_form;
public:
bool lookup_addressbook(GMsg* msg, char* name, char* aka, bool browser);
void build_pseudo(GMsg* msg, char* name, char* aka, bool direction = true);
void update_addressbook(GMsg* msg, bool reverse = false, bool force = false);
bool run(GMsg* msg, bool selectonly);
guserbase();
~guserbase();
};
// ------------------------------------------------------------------

566
golded3/geutil.cpp Normal file
View File

@ -0,0 +1,566 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Global utility functions (not overlayed in 16-bit DOS).
// ------------------------------------------------------------------
#include <cstdarg>
#include <golded.h>
// ------------------------------------------------------------------
extern bool in_arealist;
extern GPickArealist* PickArealist;
// ------------------------------------------------------------------
void update_statuslines() {
char buf[200];
static char old_status_line[200] = "";
static int called = NO;
HandleGEvent(EVTT_REMOVEVOCBUF);
if(CFG->switches.get(dispstatusline) or not called) {
called = YES;
vchar sep = _box_table(W_BSTAT, 3);
char help[200], meminfo[200], clkinfo[200];
*clkinfo = NUL;
*meminfo = NUL;
*help = NUL;
if(CFG->switches.get(statuslineclock)) {
time_t t = time(NULL);
sprintf(clkinfo, " %c %s", sep, strftimei(help, 40, LNG->StatusLineTimeFmt, localtime(&t)));
}
if(CFG->statuslinehelp == -1)
*help = NUL;
else if(CFG->statuslinehelp)
sprintf(help, "%s %c ", LNG->StatusLineHelp, sep);
else
sprintf(help, "%s%s%s%s%c%s%i.%i.%i%s %c ",
__gver_prename__,
__gver_name__,
__gver_postname__,
__gver_platform__,
goldmark,
__gver_preversion__,
__gver_major__,
__gver_minor__,
__gver_release__,
__gver_postversion__,
sep
);
int len = MAXCOL-strlen(help)-strlen(meminfo)-strlen(clkinfo)-2;
sprintf(buf, " %s%-*.*s%s%s ", help, len, len, information, meminfo, clkinfo);
if(streql(old_status_line, buf))
return;
strcpy(old_status_line, buf);
#ifdef GOLD_MOUSE
gmou.GetStatus();
if(gmou.Row() == MAXROW-1)
gmou.HideCursor();
#endif
int row, col;
vposget(&row, &col);
wwprintstr(W_STAT, 0,0, C_STATW, buf);
vposset(row, col);
#ifdef GOLD_MOUSE
if(gmou.Row() == MAXROW-1)
gmou.ShowCursor();
#endif
}
}
// ------------------------------------------------------------------
void update_statusline(const char* info) {
strxcpy(information, info, sizeof(Subj));
update_statuslines();
}
// ------------------------------------------------------------------
void update_statuslinef(const char* format, ...) {
va_list argptr;
va_start(argptr, format);
vsprintf(information, format, argptr);
va_end(argptr);
update_statuslines();
}
// ------------------------------------------------------------------
void w_shadow() {
if(CFG->switches.get(screenshadows))
wshadow(C_SHADOW);
}
// ------------------------------------------------------------------
void w_info(const char* info) {
static int wh=-1;
static int srow;
static int scol;
static int erow;
static int ecol;
static int len;
static char buf[150] = { "" };
char* buf2 = NULL;
int prev_wh = whandle();
if(wh != -1)
wactiv_(wh);
if(info) {
int tmp = strlen(info);
if(tmp > MAXCOL-5) {
buf2 = (char *)throw_malloc(MAXCOL-5);
strxcpy(buf2, info, MAXCOL-5);
info = buf2;
tmp = MAXCOL-6;
}
if(wh == -1) {
len = tmp;
srow = inforow;
erow = srow+3-1;
scol = ((MAXCOL-len)/2)-1;
ecol = scol+len+1;
wh = wopen(srow, scol, erow, ecol, W_BINFO, C_INFOB, C_INFOW);
w_shadow();
}
else {
if(len != tmp) {
len = tmp;
scol = ((MAXCOL-len)/2)-1;
ecol = scol+len+1;
wclose();
wh = wopen(srow, scol, erow, ecol, W_BINFO, C_INFOB, C_INFOW);
w_shadow();
}
}
if(not streql(buf, info)) {
strcpy(buf, info);
wprints(0, 0, C_INFOW, buf);
}
}
else {
if(wh != -1) {
*buf = NUL;
wclose();
wh = -1;
}
}
wactiv_(prev_wh);
if(buf2)
throw_free(buf2);
}
// ------------------------------------------------------------------
void w_infof(const char* format, ...) {
char winfobuf[350];
va_list argptr;
va_start(argptr, format);
vsprintf(winfobuf, format, argptr);
va_end(argptr);
w_info(winfobuf);
}
// ------------------------------------------------------------------
void w_progress(int mode, int attr, long pos, long size, const char* title) {
static int wh = -1;
int prev_wh = whandle();
if(wh != -1)
wactiv_(wh);
switch(mode) {
case MODE_NEW:
oops:
if(wh == -1) {
wh = wopen_(inforow, ((MAXCOL-63)/2)-1, 3, 63, W_BINFO, C_INFOB, C_INFOW);
set_title(title, TCENTER, C_INFOT);
title_shadow();
}
case MODE_UPDATE:
if(wh == -1)
goto oops; // Oops, someone forgot to open the window..
wpropbar(PROP_BARGRAPH, 1, 0, -59, 1, attr, pos, size);
break;
case MODE_QUIT:
if(wh != -1) {
wclose();
wunlink(wh);
wh = -1;
}
break;
}
wactiv_(prev_wh);
}
// ------------------------------------------------------------------
void maketitle() {
wtitle(m_title, m_titlepos, m_titleattr);
}
// ------------------------------------------------------------------
void set_title(const char* t, int p, int a) {
strcpy(m_title, t);
m_titlepos = p;
m_titleattr = a;
}
// ------------------------------------------------------------------
void title_shadow() {
maketitle();
w_shadow();
}
// ------------------------------------------------------------------
int IsQuoteChar(const char* s) {
if(*s) {
if(*s == '>')
return true;
if(*AA->Quotechars())
if(strchr(AA->Quotechars(), *s))
return true;
}
return false;
}
// ------------------------------------------------------------------
int is_quote(const char* ptr) {
const char* endptr = ptr + 11;
// Skip leading whitespace
while((*ptr == ' ') or (*ptr == LF) or issoftcr(*ptr))
ptr++;
// Check for empty string
if((*ptr == NUL) or (ptr >= endptr))
return false;
// Check for userdefined quotechars after first whitespace
if(IsQuoteChar(ptr))
return true;
int spaces = 0;
while((ptr < endptr) and *ptr) {
if(*ptr == LF or issoftcr(*ptr)) {
// Ignore LF's and SOFTCR's and extend check zone if found
endptr++;
}
else if(*ptr == '>') {
// Found true quote char
return true;
}
else if(*ptr == ' ') {
spaces++;
if(spaces > 1)
return false;
}
else if((*ptr < ' ') or strchr("<\"\'-", *ptr)) {
// Found a char that cannot occur in a quotestring
return false;
}
ptr++;
}
return false;
}
// ------------------------------------------------------------------
int quotecolor(const char* line) {
char buf[100];
uint len;
GetQuotestr(line, buf, &len);
uint qc = 0;
for(uint i=0; i<len; i++)
if(IsQuoteChar(&buf[i]))
qc++;
return (qc & 1) ? C_READQ : C_READQ2;
}
// ------------------------------------------------------------------
int GetQuotestr(const char* ptr, char* qbuf, uint* qlen) {
if(is_quote(ptr)) {
char* qptr;
const char* tmp;
const char* lp = ptr;
int n, x;
MoreQuotes: // Naughty goto-point for quotestring skipping
// Skip leading spaces
while(isspace(*lp) or issoftcr(*lp))
lp++;
if(IsQuoteChar(lp)) { // Type 1 : ">xxxx>" and ">xxxx:"
lp++;
while(isspace(*lp) or issoftcr(*lp))
lp++;
if(is_quote(lp))
goto MoreQuotes;
if(not (IsQuoteChar(lp-1) or (*(lp-1) == ':'))) {
while(not IsQuoteChar(lp))
lp--;
lp++;
}
}
else { // Type 2: "xxxx>"
while(not (IsQuoteChar(lp) and not IsQuoteChar(lp+1)) and *lp != CR and *lp)
++lp;
if(is_quote(lp))
goto MoreQuotes;
if(*lp)
lp++;
}
// lp now points to the character after the quotestring
*qlen = (int)((dword)lp - (dword)ptr);
if(isspace(*lp) or issoftcr(*lp))
(*qlen)++;
for(x=*qlen,n=0,tmp=ptr,qptr=qbuf; n<x and n<40; n++,tmp++) {
if(*tmp != LF and not issoftcr(*tmp))
*qptr++ = *tmp;
else
(*qlen)--;
}
*qptr = NUL;
if(*qlen > 40)
*qlen = 40;
}
else {
*qbuf = NUL;
*qlen = 0;
}
return *qlen;
}
// ------------------------------------------------------------------
static int KeyCmp(const gkey* a, const gkey* b) {
return CmpV(*a, *b);
}
// ------------------------------------------------------------------
gkey SearchKey(gkey key, list<CmdKey>::iterator keys, int totkeys) {
list<CmdKey>::iterator kmin;
int again = 0;
do {
kmin = keys;
int tkeys=totkeys;
while(tkeys > 0) {
int j = KeyCmp(&key, &(kmin->key));
if(j == 0)
return(kmin->cmd);
else if(j < 0)
break;
else {
kmin++;
tkeys--;
}
}
// Key not found. Try again, this time without the scancode.
key &= 0x00FF;
} while(not again++ and key);
return 0;
}
// ------------------------------------------------------------------
static void call_func_geutil(VfvCP func) {
struct _menu_t* menu;
int row, col;
bool hidden = vcurhidden();
vposget(&row, &col);
menu = gwin.cmenu;
(*func)();
gwin.cmenu = menu;
vposset(row, col);
if(hidden)
vcurhide();
else
vcurshow();
}
// ------------------------------------------------------------------
void call_help() {
// search through onkey linked list for a
// matching defined onkey. if one is found,
// then save the current environment, call the
// onkey's function, and restore the environment.
KBnd* onkey = gkbd.onkey;
while(onkey != NULL) {
if(onkey->keycode == Key_F1) {
call_func_geutil(onkey->func);
break;
}
onkey = onkey->prev;
}
}
// ------------------------------------------------------------------
void CheckTick(gkey quitkey) {
Clock idle_secs = (gkbd.tickvalue - gkbd.tickpress) / 10L;
if(CFG->timeout) {
if(idle_secs >= CFG->timeout) {
kbput(quitkey);
return;
}
}
IdleCheckSemaphores();
if(CFG->screenblanker) {
if(idle_secs >= CFG->screenblanker) {
blanked = true;
ScreenBlankIdle();
kbdsettickfunc(ScreenBlankIdle);
getxch();
blanked = false;
ScreenBlankIdle();
kbdsettickfunc(update_statuslines);
//maybe we've scanned areas while in screenblanker, so
//update screen
if(in_arealist) {
PickArealist->update();
PickArealist->do_delayed();
}
}
}
}
// ------------------------------------------------------------------
void IdleCheckSemaphores() {
// I don't like this solution either... :(
static Clock last_secs = 0;
Clock idle_secs = (gkbd.tickvalue - gkbd.tickpress) / 10L;
// Make sure the stuff below is only run once in a second
if(not idle_secs or (idle_secs - last_secs == 0))
return ;
if(in_arealist) {
if(CFG->semaphore.idletime) {
if((idle_secs % CFG->semaphore.idletime) == 0)
CheckSemaphores();
}
}
last_secs = idle_secs;
}
// ------------------------------------------------------------------
char* strtmp(const char* str) {
static INam tmp;
return strxcpy(tmp, str, sizeof(tmp));
}
// ------------------------------------------------------------------

321
golded3/geutil2.cpp Normal file
View File

@ -0,0 +1,321 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Global utility functions.
// ------------------------------------------------------------------
#include <golded.h>
#include <gwinput.h>
// ------------------------------------------------------------------
int edit_string(char* buf, int buf_size, char* title, int helpcat) {
gwindow window;
window.openxy(inforow,((MAXCOL-63)/2)-1,3,63,W_BASK,C_ASKB,C_ASKW);
window.title(title, C_ASKT);
if(CFG->switches.get(screenshadows))
window.shadow(C_SHADOW);
gwinput2 iform(window);
string buf2 = buf;
iform.setup(C_ASKW, C_ASKW, C_ASKQ, _box_table(W_BASK, 13), true);
iform.add_field(0, 0, 1, 59, buf2, buf_size, gwinput::cvt_none, fieldupd);
vcurshow();
iform.run(helpcat);
vcurhide();
window.close();
if(iform.dropped)
return false;
size_t len = buf2.length();
while(len and ('!' > buf2[--len]))
buf2.erase(len, 1);
strcpy(buf, buf2.c_str());
return *buf ? true : false;
}
// ------------------------------------------------------------------
bool edit_pathname(char* buf, int buf_size, char* title, int helpcat) {
if(not edit_string(buf, buf_size, title, helpcat))
return false;
vector<FileAlias>::iterator z;
for(z = CFG->filealias.begin(); z != CFG->filealias.end(); z++) {
if(strieql(buf, z->alias)) {
strcpy(buf, z->file);
break;
}
}
strschg_environ(buf);
return true;
}
// ------------------------------------------------------------------
int PopupLocked(long tries, int isopen, const char* file) {
// Close popup window if requested
if(tries == 0) {
w_info(NULL);
return true;
}
// Tell the world
char buf[200];
if((uint) strlen(file) > (uint) (MAXCOL-25))
sprintf(buf, "[..]%*.*s", MAXCOL-30, MAXCOL-30, file);
else
strcpy(buf, file);
w_infof(LNG->WaitLocked, buf);
update_statuslinef(LNG->RetryOrESC, isopen ? LNG->RetryLock : LNG->RetryOpen , tries);
// Check for keypress
if(kbxhit()) {
// Return fail value if Escape was pressed
gkey keyval = kbxget();
if(keyval == Key_Esc) {
GMenuLockLoop MenuLockLoop;
if(MenuLockLoop.Run()) {
w_info(NULL);
return false;
}
}
}
// Pause approx 1 second before trying again
usleep(1000);
// Try again
return true;
}
// ------------------------------------------------------------------
// Build zonegate address from orig/dest address
void ZonegateIt(ftn_addr& gate, ftn_addr& orig, ftn_addr& dest) {
gate.zone = orig.zone; // Send to the local zoneGate
gate.net = orig.zone;
gate.node = dest.zone;
gate.point = 0;
}
// ------------------------------------------------------------------
int GetAkaNo(const ftn_addr& aka) {
int akano = 0;
while(akano < CFG->aka.size()) {
if(CFG->aka[akano].addr.equals(aka))
return akano;
akano++;
}
return -1;
}
// ------------------------------------------------------------------
void doinvalidate(char* text, const char* find, const char* replace, bool is_tearline) {
int n = strlen(find);
if(strnieql(text, find, n) and (not is_tearline or (text[n] == NUL) or isspace(text[n]))) {
char buf[256];
strcpy(buf, text);
strcpy(stpcpy(text, replace), &buf[n]);
}
}
// ------------------------------------------------------------------
int AkaMatchOne(const ftn_addr* mask, const ftn_addr* addr) {
int match = 0;
// Count matching parts
if((mask->zone == 0) or (addr->zone == 0) or (mask->zone == GFTN_ALL) or (mask->zone == addr->zone)) {
match++;
if((mask->net == GFTN_ALL) or (mask->net == addr->net)) {
match++;
if((mask->node == GFTN_ALL) or (mask->node == addr->node)) {
match++;
if((mask->point == GFTN_ALL) or (mask->point == addr->point)) {
match++;
}
}
}
}
return match;
}
// ------------------------------------------------------------------
int AkaMatch(ftn_addr* match, const ftn_addr* addr) {
int aka;
for(vector<AkaMatchG>::iterator am = CFG->akamatch.begin(), aka=0; am != CFG->akamatch.end(); am++, aka++) {
if(addr->match(am->mask)) {
int akano = GetAkaNo(am->aka);
if(akano != -1) {
*match = CFG->aka[akano].addr;
return akano;
}
}
}
int bestaka = -1;
int bestmatch = 0;
int matchaka = 0;
vector<gaka>::iterator a;
for(a = CFG->aka.begin(), aka = 0; a != CFG->aka.end(); aka++, a++) {
if(match->equals(a->addr))
matchaka = aka;
// Ignore fakenet addresses
if(a->addr.net != a->pointnet) {
int match = AkaMatchOne(&a->addr, addr);
// Note if we found a better match
if(match > bestmatch) {
bestmatch = match;
bestaka = aka;
}
}
}
// If there was no matching aka, use the aka
if(bestaka == -1)
bestaka = matchaka;
else {
// If the current address matches at least as good as the best match, don't change it
if(bestmatch <= AkaMatchOne(match, addr)) {
int akano = GetAkaNo(*match);
if(akano != -1)
return akano;
}
}
*match = CFG->aka[bestaka].addr;
return bestaka;
}
// ------------------------------------------------------------------
void ScreenBlankIdle() {
static int whb = -1;
static int whh = -1;
static int wascurhid = false;
static Clock lastmoved = 0;
int windowheight = 4;
IdleCheckSemaphores();
char blankmsg1[80];
char blankmsg2[80];
time_t t = time(NULL);
sprintf(blankmsg1, " %s %s ", __gver_longpid__, strftimei(blankmsg2, 40, LNG->StatusLineTimeFmt, localtime(&t)));
sprintf(blankmsg2, " %s ", LNG->BlankMsg);
if(strblank(blankmsg2)) {
*blankmsg2 = NUL;
windowheight--;
}
int b1 = strlen(blankmsg1);
int b2 = strlen(blankmsg2);
int blankmsglen = MaxV(b1,b2);
int ry = rand() % (MAXROW-windowheight);
int rx = rand() % ((MAXCOL-blankmsglen)-2);
if(blanked and (whb == -1)) {
wascurhid = vcurhidden();
vcurhide();
if(C_BACKB != 0)
gvid->setoverscan(0);
whb = wopen(0,0,MAXROW-1,MAXCOL-1, 5, 7, 7);
if(CFG->screenblankertype == BLANK_SLIDEWIN)
whh = wopen_(ry, rx, windowheight, blankmsglen+2, W_BINFO, C_INFOB, C_INFOW);
lastmoved = gkbd.tickvalue;
}
if(not blanked and (whb != -1)) {
if(CFG->screenblankertype == BLANK_SLIDEWIN) {
wactiv_(whh);
wclose();
whh = -1;
}
wactiv_(whb);
wclose();
whb = -1;
if(C_BACKB != 0)
gvid->setoverscan(C_BACKB);
if(wascurhid)
vcurhide();
else
vcurshow();
return;
}
if(gkbd.tickvalue > (lastmoved+50L)) {
lastmoved = gkbd.tickvalue;
if(CFG->screenblankertype == BLANK_SLIDEWIN)
wslide(ry, rx);
}
if(CFG->screenblankertype == BLANK_SLIDEWIN) {
wcenters(0, C_INFOW, blankmsg1);
if(*blankmsg2)
wcenters(1, C_INFOW, blankmsg2);
}
// If timed out, exit screenblanker
if(CFG->timeout)
if(gkbd.tickvalue >= (gkbd.tickpress+(CFG->timeout*10L)))
kbput(Key_Tick);
}
// ------------------------------------------------------------------

657
golded3/geview.cpp Normal file
View File

@ -0,0 +1,657 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Message viewer class implementation.
// ------------------------------------------------------------------
#include <golded.h>
#include <gutlos.h>
// ------------------------------------------------------------------
GMsgHeaderView::GMsgHeaderView() {
alive = false;
at_row = at_column = width = height = 0;
border_type = gwindow::bordertype_none;
window_color = from_color = to_color = subject_color = BLUE|_LGREY;
title_color = highlight_color = RED|_LGREY;
border_color = YELLOW|_LGREY;
}
// ------------------------------------------------------------------
GMsgHeaderView::~GMsgHeaderView() {
Destroy();
}
// ------------------------------------------------------------------
void GMsgHeaderView::Create() {
alive = true;
window.openxy(
at_row,
at_column,
height,
width,
border_type,
border_color,
window_color
);
}
// ------------------------------------------------------------------
void GMsgHeaderView::Destroy() {
if(alive)
window.close();
else
alive = false;
}
// ------------------------------------------------------------------
void GMsgHeaderView::Use(Area *areaptr, GMsg *msgptr) {
area = areaptr;
msg = msgptr;
}
// ------------------------------------------------------------------
void GMsgHeaderView::Paint() {
int namewidth = CFG->disphdrnodeset.pos - CFG->disphdrnameset.pos;
int nodewidth = CFG->disphdrdateset.pos - CFG->disphdrnodeset.pos;
int datewidth = width - CFG->disphdrdateset.pos;
vchar headerline[200];
for(int c = 0; c < width; c++)
headerline[c] = _box_table(W_BHEAD, 1);
headerline[width] = NUL;
INam whofrom;
if(*msg->ifrom and *msg->realby)
sprintf(whofrom, "%s <%s>", msg->realby, msg->iorig);
else if(*msg->ifrom and *msg->iorig)
strcpy(whofrom, msg->iorig);
else
strcpy(whofrom, msg->By());
strsetsz(whofrom, (area->isinternet() or *msg->ifrom) ? (namewidth+nodewidth) : namewidth);
INam whoto;
if(*msg->ito and *msg->realto)
sprintf(whoto, "%s <%s>", msg->realto, msg->idest);
else if(*msg->ito and *msg->idest)
strcpy(whoto, msg->idest);
else
strcpy(whoto, msg->To());
strsetsz(whoto, (area->isinternet() or *msg->ito) ? (namewidth+nodewidth) : namewidth);
// Generate top line fields
ISub buf;
char top1[200];
strtrim(strcpy(buf, area->desc()));
if((CFG->dispareano == ALWAYS) or (CFG->dispareano and area->board()))
sprintf(top1, " [%u] %s ", area->board(), buf);
else
sprintf(top1, " %s ", buf);
strtrim(top1);
strcat(top1, " (" /*)*/);
if(area->isinternet())
strcpy(buf, area->Internetaddress());
else
area->Aka().addr.make_string(buf);
strcat(top1, buf);
strcat(top1, /*(*/ ") ");
char top2[200];
if(msg->areakludgeid)
sprintf(top2, " %s (%s) ", area->echoid(), msg->areakludgeid);
else
sprintf(top2, " %s ", area->echoid());
#if defined(GUTLOS_FUNCS)
g_set_ostitle_name(struplow(strtmp(area->echoid())), 0);
#endif
// Get marks
int bookmark = (area->bookmark == msg->msgno);
int markmark = (area->Mark.Count() ? (area->Mark.Find(msg->msgno) ? 1 : 0) : NO);
// Generate message attributes string
char bot2[200];
MakeAttrStr(bot2, &msg->attr);
int len2 = strlen(bot2);
if(len2 > width-CFG->disphdrnodeset.pos) {
len2 = width-CFG->disphdrnodeset.pos;
strsetsz(bot2, len2);
}
// Generate message number and reply links string
char bot1[200];
char* ptr = bot1;
int list_max = msg->link.list_max();
ulong* replies = (ulong*)throw_calloc(list_max+1, sizeof(ulong));
ulong replyto, replynext;
if(CFG->switches.get(disprealmsgno)) {
ptr += sprintf(ptr, " %-5.5s: #%lu [%u]", LNG->Msg, msg->msgno, area->Msgn.Count()+(msg->attr.nwm() ? 1 : 0));
replyto = msg->link.to();
replies[0] = msg->link.first();
replynext = msg->link.next();
for(int replyn=1; replyn<list_max+1; replyn++)
replies[replyn] = msg->link.list(replyn-1);
}
else {
uint active = area->Msgn.Count() + (msg->attr.nwm() ? 1 : 0);
ptr += sprintf(ptr, " %-5.5s: %u %s %u", LNG->Msg, msg->attr.nwm() ? active : area->Msgn.ToReln(msg->msgno), LNG->of, active);
replyto = area->Msgn.ToReln(msg->link.to());
replies[0] = area->Msgn.ToReln(msg->link.first());
replynext = area->Msgn.ToReln(msg->link.next());
for(int replyn=1; replyn<list_max+1; replyn++)
replies[replyn] = area->Msgn.ToReln(msg->link.list(replyn-1));
}
if(replyto)
ptr += sprintf(ptr, " -%lu", replyto);
for(int replyn=0,plus=0; replyn<list_max+1; replyn++)
if(replies[replyn])
ptr += sprintf(ptr, " %s%lu", (plus++?"":"+"), replies[replyn]);
if(replynext)
sprintf(ptr, " *%lu", replynext);
int len1 = strlen(bot1) - 8;
if((CFG->disphdrnameset.pos + len1) > CFG->disphdrnodeset.pos) {
if(8 + len1 + len2 > width) {
strsetsz(bot1, width-len2-1);
strtrim(bot1);
}
strcat(bot1, " ");
strcat(bot1, bot2);
*bot2 = NUL;
}
else {
strsetsz(bot1, namewidth+8);
strcat(bot1, bot2);
*bot2 = NUL;
}
strsetsz(bot1, width);
throw_free(replies);
// Generate orig node data
char node1[200];
if(msg->orig.net)
msg->orig.make_string(node1);
else
*node1 = NUL;
strsetsz(node1, nodewidth);
char date1[25] = "";
if(msg->written)
strftimei(date1, CFG->disphdrdateset.len, LNG->DateTimeFmt, gmtime(&msg->written));
strsetsz(date1, datewidth);
// Generate dest node data
char node2[200];
if(msg->dest.net and area->isnet()) {
msg->dest.make_string(node2);
if(msg->odest.net) {
if(msg->odest.net != msg->dest.net or msg->odest.node != msg->dest.node) {
sprintf(buf, " %s %u/%u", LNG->Via, msg->odest.net, msg->odest.node);
strcat(node2, buf);
}
}
}
else
*node2 = NUL;
strsetsz(node2, nodewidth);
char date2[25] = "";
if(msg->arrived)
strftimei(date2, CFG->disphdrdateset.len, LNG->DateTimeFmt, gmtime(&msg->arrived));
strsetsz(date2, datewidth);
// Generate subjectline
char subj[200], lngsubj[10];
strcpy(lngsubj, (msg->attr.att() or msg->attr.frq() or msg->attr.urq()) ? LNG->File : LNG->Subj);
strxcpy(subj, msg->re, sizeof(subj));
strsetsz(subj, width-strlen(lngsubj));
// Paint the total header in the window
vchar borderchar[2] = { (vchar)' ', 0 };
*borderchar = window.boxchar_upper_horizontal_line();
window.printvs(0, 0, border_color|ACSET, borderchar);
window.prints(0, 1, title_color, top1);
window.printvs(0, strlen(top1)+1, border_color|ACSET, headerline+strlen(top1)+strlen(top2)-2);
window.prints(0, width-strlen(top2)-1, title_color, top2);
window.printvs(0, width-1, border_color|ACSET, borderchar);
window.printvs(5, 0, border_color|ACSET, headerline);
window.prints(1, 0, window_color, bot1);
if(bookmark)
window.prints(1, 5, highlight_color, "\x11");
if(markmark)
window.prints(1, 7, highlight_color, "\x10");
if(*bot2)
window.prints(1, CFG->disphdrnodeset.pos, window_color, bot2);
window.prints(2, 0, window_color, LNG->From);
window.prints(2, CFG->disphdrnameset.pos, ((msg->foundwhere&GFIND_FROM) or msg->attr.fmu() or (msg->attr.loc() and CFG->switches.get(displocalhigh))) ? highlight_color : from_color, whofrom);
window.prints(3, 0, window_color, LNG->To);
window.prints(3, CFG->disphdrnameset.pos, ((msg->foundwhere&GFIND_TO) or msg->attr.tou()) ? highlight_color : to_color, whoto);
if(not area->isinternet()) {
if(not (*msg->ifrom and (*msg->realby or *msg->iorig)))
window.prints(2, CFG->disphdrnodeset.pos, from_color, node1);
if(not (*msg->ito and (*msg->realto or *msg->idest)))
window.prints(3, CFG->disphdrnodeset.pos, to_color, node2);
}
window.prints(2, CFG->disphdrdateset.pos, from_color, date1);
window.prints(3, CFG->disphdrdateset.pos, to_color, date2);
window.prints(4, 0, window_color, lngsubj);
window.prints(4, strlen(lngsubj), (msg->foundwhere&GFIND_SUBJECT) ? highlight_color : subject_color, subj);
// Calculate attach file sizes
if(msg->attr.att()) {
if(CFG->dispattachsize) {
char buf2[GMAXPATH];
int begpos = strlen(LNG->File);
strcpy(buf, msg->re);
char* ptr = strtok(buf, " ");
while(ptr) {
if(*ptr == '^')
ptr++;
if((isalpha(*ptr) and (ptr[1] == ':')) or ((ptr[0] == '\\') and (ptr[1] == '\\')))
strcpy(buf2, ptr);
else
sprintf(buf2, "%s%s", CFG->inboundpath, ptr);
long sz = GetFilesize(MapPath(buf2));
if(sz == -1)
sprintf(subj, " %s ", LNG->n_a);
else {
switch(CFG->dispattachsize) {
case ATTACH_BYTES:
sprintf(subj, " %li ", sz);
break;
case ATTACH_KBYTES:
sprintf(subj, " %lik ", (sz+512L)/1024L);
break;
}
}
window.prints(5, begpos+int(ptr-buf)-1, title_color, subj);
ptr = strtok(NULL, " ");
}
}
}
if(CFG->dispmsgsize and msg->txt and not _in_editor) {
uint len = strlen(msg->txt);
switch(CFG->dispmsgsize) {
case DISPMSGSIZE_BYTES:
sprintf(subj, "%u", len);
break;
case DISPMSGSIZE_KBYTES:
sprintf(subj, "%uk", (len+512)/1024);
break;
case DISPMSGSIZE_KBYTES+1:
sprintf(subj, "%u", msg->lines);
break;
default:
*subj = NUL;
}
if(*subj)
window.prints(5, 1, title_color, subj);
}
}
// ------------------------------------------------------------------
GMsgBodyView::GMsgBodyView() {
alive = false;
scrollbar_visible = false;
at_row = at_column = width = height = visible_width = 0;
border_type = gwindow::bordertype_none;
window_color = BLACK|_LGREY;
highlight_color = WHITE|_RED;
scrollbar_color = DGREY|_LGREY;
border_color = YELLOW|_LGREY;
}
// ------------------------------------------------------------------
GMsgBodyView::~GMsgBodyView() {
Destroy();
}
// ------------------------------------------------------------------
void GMsgBodyView::Create() {
alive = true;
window.openxy(
at_row,
at_column,
height,
width,
border_type,
border_color,
window_color,
scrollbar_color
);
dummy_line.text = "";
dummy_line.type = 0;
dummy_line.color = window_color;
visible_width = width - (CFG->switches.get(disppagebar) ? 1 : 0);
}
// ------------------------------------------------------------------
void GMsgBodyView::Destroy() {
if(alive)
window.close();
else
alive = false;
}
// ------------------------------------------------------------------
void GMsgBodyView::Use(Area *areaptr, GMsg *msgptr, int startline) {
area = areaptr;
msg = msgptr;
// Find the first highlighted line and go to it
if(msg->foundwhere & GFIND_BODY) {
for(startline=0; startline<msg->lines; startline++) {
if(msg->line[startline]->type & GLINE_HIGH)
break;
}
// Adjust position in window
startline -= height / 3;
if(startline < 0)
startline = 0;
else if((startline + height - 1) >= msg->lines)
startline = msg->lines - height;
}
if(startline >= msg->lines)
startline = msg->lines - 1;
if(startline < 0)
startline = 0;
upperline = startline;
lowerline = upperline + height - 1;
can_pagedown = lowerline < (msg->lines-1);
scrollbar_visible = CFG->switches.get(disppagebar) ? (msg->lines > height) : false;
visible_width = scrollbar_visible ? width-1 : width;
window.set_scrollbar_color(scrollbar_visible ? scrollbar_color : -1);
}
// ------------------------------------------------------------------
void GMsgBodyView::PaintLine(int row, Line *line) {
// Calculate effective coordinates for vputs
int vrow = gwin.active->srow + row;
uint llen = strlen(line->text);
int color = (line->type & GLINE_HIGH) ? highlight_color : line->color;
// Trim line if it longer than should be. This actually happens in very rare
// cases, but always when hex dump displayed.
if(llen > visible_width) {
llen = visible_width;
line->text[llen] = NUL;
}
// Print it
if(not SearchHighlight(line, vrow, visible_width, highlight_color)) {
if(line->type & GLINE_ORIG and strneql(line->text, " * Origin: ", 11)) {
vputs(vrow, 0, color, " * Origin: ");
StyleCodeHighlight(line->text+11, vrow, 11, not AA->attr().hex() and CFG->hidestylies, color);
}
else
StyleCodeHighlight(line->text, vrow, 0, not AA->attr().hex() and CFG->hidestylies, color);
int tlen = strlen(line->text);
vputns(vrow, tlen, color, "", visible_width-tlen);
}
else
vputns(vrow, 0, color, line->text, visible_width);
}
// ------------------------------------------------------------------
void GMsgBodyView::Paint() {
window.activate_quick();
Line* dummy_index = NULL;
Line** line_index = msg->line ? (msg->line + upperline) : &dummy_index;
for(int row=0; row<height; row++)
PaintLine(row, *line_index ? *line_index++ : &dummy_line);
UpdateScrollbar();
}
// ------------------------------------------------------------------
int GMsgBodyView::Top(int redraw) {
if(redraw or (msg->lines > height)) {
can_pagedown = true;
upperline = 0;
lowerline = height - 1;
Paint();
return true;
}
return false;
}
// ------------------------------------------------------------------
int GMsgBodyView::Bottom() {
if(msg->lines > height) {
if(msg->lines <= height) {
can_pagedown = true;
upperline = 0;
}
else {
can_pagedown = false;
upperline = msg->lines - height;
}
lowerline = upperline + height - 1;
Paint();
return true;
}
return false;
}
// ------------------------------------------------------------------
int GMsgBodyView::PageUp() {
if(msg->lines > height) {
can_pagedown = true;
if(upperline) {
upperline -= height - 1;
if(upperline < 0)
upperline = 0;
lowerline = upperline + height - 1;
Paint();
return true;
}
}
return false;
}
// ------------------------------------------------------------------
int GMsgBodyView::PageDown() {
if(msg->lines > height) {
if(can_pagedown) {
if(lowerline < msg->lines-1) {
lowerline += height - 1;
if(lowerline >= msg->lines-1)
can_pagedown = false;
upperline = lowerline - height + 1;
Paint();
return true;
}
}
}
return false;
}
// ------------------------------------------------------------------
int GMsgBodyView::LineUp() {
if(msg->lines > height) {
if(upperline) {
window.scroll_down();
upperline--;
lowerline--;
#ifdef GOLD_MOUSE
gmou.HideCursor();
#endif
PaintLine(0, msg->line[upperline]);
#ifdef GOLD_MOUSE
gmou.ShowCursor();
#endif
can_pagedown = lowerline < (msg->lines-1);
UpdateScrollbar();
return true;
}
}
return false;
}
// ------------------------------------------------------------------
int GMsgBodyView::LineDown() {
if(msg->lines > height) {
if(lowerline < (msg->lines-1)) {
window.scroll_up();
upperline++;
lowerline++;
#ifdef GOLD_MOUSE
gmou.HideCursor();
#endif
PaintLine(height-1, msg->line[lowerline]);
#ifdef GOLD_MOUSE
gmou.ShowCursor();
#endif
can_pagedown = lowerline < (msg->lines-1);
UpdateScrollbar();
return true;
}
}
return false;
}
// ------------------------------------------------------------------
int GMsgBodyView::Continue() {
if(can_pagedown)
return PageDown();
return false;
}
// ------------------------------------------------------------------
int GMsgBodyView::ThumbTrack(int pos) {
return ThumbPosition(pos);
}
// ------------------------------------------------------------------
int GMsgBodyView::ThumbPosition(int pos) {
upperline = pos;
lowerline = upperline + height - 1;
can_pagedown = lowerline < (msg->lines-1);
Paint();
return true;
}
// ------------------------------------------------------------------
void GMsgBodyView::UpdateScrollbar() {
if(CFG->switches.get(disppagebar) and scrollbar_visible)
window.vscrollbar(msg->lines, msg->lines-height, upperline);
}
// ------------------------------------------------------------------
void GMsgBodyView::prints(int wrow, int wcol, int atr, char* str) {
vputs(wrow, wcol, atr, str);
}
// ------------------------------------------------------------------

134
golded3/geview.h Normal file
View File

@ -0,0 +1,134 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Message viewer classes.
// ------------------------------------------------------------------
#include <gwindow.h>
// ------------------------------------------------------------------
class GMsgHeaderView {
int alive;
protected:
public:
Area *area;
GMsg *msg;
gwindow window;
GMsgHeaderView();
~GMsgHeaderView();
// Window setup
int at_row;
int at_column;
int width;
int height;
int border_type;
int border_color;
int window_color;
int title_color;
int highlight_color;
int from_color;
int to_color;
int subject_color;
void Use(Area *areaptr, GMsg *msgptr);
void Create();
void Destroy();
void Paint();
};
// ------------------------------------------------------------------
class GMsgBodyView : public Container {
int alive;
protected:
// View data
int visible_width;
int scrollbar_visible;
Line dummy_line;
int can_pagedown;
int upperline;
int lowerline;
void PaintLine(int row, Line *line);
void UpdateScrollbar();
void prints(int wrow, int wcol, int atr, char* str);
public:
Area *area;
GMsg *msg;
gwindow window;
GMsgBodyView();
~GMsgBodyView();
// Window setup
int at_row;
int at_column;
int width;
int height;
int border_type;
int border_color;
int window_color;
int scrollbar_color;
int highlight_color;
void Use(Area *areaptr, GMsg *msgptr, int startline=0);
int UpperLine() { return upperline; }
void Create();
void Destroy();
void Paint();
int Top(int redraw=false);
int Bottom();
int PageUp();
int PageDown();
int LineUp();
int LineDown();
int Continue();
int ThumbTrack(int pos);
int ThumbPosition(int pos);
};
// ------------------------------------------------------------------

351
golded3/gmarea.cpp Normal file
View File

@ -0,0 +1,351 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Area functions.
// ------------------------------------------------------------------
#include <golded.h>
// ------------------------------------------------------------------
int SearchTaglist(Echo* taglist, char* tag) {
int n = 0;
while(*taglist[n]) {
if(strieql(taglist[n], tag))
break;
n++;
}
return(n);
}
// ------------------------------------------------------------------
// Update exportlist scanning file
void WriteNoDupes(const char* file, const char* line) {
gfile fp;
Path buf;
bool found = false;
long tries = 0;
do {
fp.fopen(file, "at+", SH_DENYRW);
if(not fp.isopen()) {
if((errno != EACCES) or (PopupLocked(++tries, false, file) == false)) {
LOG.ErrOpen();
LOG.printf("! A semaphore file could not be opened.");
LOG.printf(": %s", file);
LOG.ErrOSInfo();
OpenErrorExit();
}
}
} while(not fp.isopen());
if(tries)
PopupLocked(0, 0, NULL);
fp.fseek(0, SEEK_SET);
while(fp.fgets(buf, sizeof(buf))) {
if(strieql(strtrim(buf), line)) {
found = true;
break;
}
}
if(not found) {
fp.fseek(0, SEEK_END);
fp.printf("%s\n", line);
}
fp.fclose();
}
// ------------------------------------------------------------------
void FreqWaZOO(const char* files, const Addr& dest, const Attr& attr) {
char* buf = throw_strdup(files);
Path filename, outbound, tmp;
StripBackslash(strcpy(outbound, CFG->outboundpath));
strcpy(filename, outbound);
if(dest.zone != CFG->aka[0].addr.zone) {
sprintf(tmp, ".%03X", dest.zone);
strcat(filename, tmp);
if(not is_dir(filename))
mkdir(filename, S_IWUSR);
}
AddBackslash(filename);
sprintf(tmp, "%04X%04X", dest.net, dest.node);
strcat(filename, tmp);
if(dest.point) {
strcat(filename, ".pnt");
if(not is_dir(filename))
mkdir(filename, S_IWUSR);
AddBackslash(filename);
sprintf(tmp, "%08X", dest.point);
strcat(filename, tmp);
}
strcpy(tmp, filename);
// filename now contains everything but the extension, and we are sure
// that the directory exists
strcat(tmp, ".req");
int i = 0;
while(buf[i]) {
if(buf[i] == ' ') {
if(buf[i+1] != '!' and buf[i+1] != '$')
buf[i] = '\n';
}
i++;
}
FILE* fcs = fopen(tmp, "at");
if(fcs) {
fprintf(fcs, "%s\n", buf);
fclose(fcs);
}
strcpy(tmp, filename);
char m;
if(attr.imm())
m = 'I';
else if(attr.cra())
m = 'C';
else if(attr.dir())
m = 'D';
else if(attr.hld())
m = 'H';
else
m = 'F';
char buf2[5];
sprintf(buf2, ".%clo", m);
strcat(tmp, buf2);
if(*tmp)
TouchFile(tmp);
throw_free(buf);
}
// ------------------------------------------------------------------
void RenumberArea() {
if(not AA->Renumber()) {
HandleGEvent(EVTT_JOBFAILED);
update_statusline(LNG->NoRenum);
waitkeyt(5000);
reader_keyok = YES;
}
else {
AA->Mark.ResetAll();
AA->Expo.ResetAll();
// Touch the netmail rescan semaphore
if(AA->isnet())
TouchFile(AddPath(CFG->areapath, CFG->semaphore.netscan));
// Tell user we are finished
update_statuslinef("%u %s", AA->Msgn.Count(), LNG->Renumbered);
waitkeyt(5000);
}
}
// ------------------------------------------------------------------
void Area::Open() {
if(not adat) {
adat = (AreaData*)throw_calloc(1, sizeof(AreaData));
InitData();
}
area->Msgn = &Msgn;
area->PMrk = &PMrk;
area->open();
isscanned = true;
UpdateAreadata();
}
// ------------------------------------------------------------------
void Area::Close() {
if(isreadpm) {
set_lastread(Msgn.ToReln(lastreadentry()));
isreadpm = false;
}
PMrk.ResetAll();
isreadmark = false;
area->close();
UpdateAreadata();
throw_release(adat);
}
// ------------------------------------------------------------------
void Area::Scan() {
if(cmdlinedebughg)
LOG.printf("- Scan: %s", echoid());
scan();
isscanned = true;
UpdateAreadata();
}
// ------------------------------------------------------------------
void Area::SaveMsg(int mode, GMsg* msg) {
if(CFG->switches.get(frqwazoo) and msg->attr.frq()) {
FreqWaZOO(msg->re, msg->dest, msg->attr);
if(CFG->frqoptions & FREQ_NOWAZOOMSG)
return;
msg->attr.frq0();
}
if(isinternet()) { // Adjust fields for compatibility
if(*msg->realby)
strcpy(msg->by, msg->realby);
if(*msg->realto)
strcpy(msg->to, msg->realto);
}
// Translate softcr to configured char
if(EDIT->SoftCrXlat()) {
strchg(msg->by, SOFTCR, EDIT->SoftCrXlat());
strchg(msg->to, SOFTCR, EDIT->SoftCrXlat());
strchg(msg->realby, SOFTCR, EDIT->SoftCrXlat());
strchg(msg->realto, SOFTCR, EDIT->SoftCrXlat());
if(not (msg->attr.frq() or msg->attr.att() or msg->attr.urq()))
strchg(msg->re, SOFTCR, EDIT->SoftCrXlat());
strchg(msg->txt, SOFTCR, EDIT->SoftCrXlat());
}
area->save_msg(mode, msg);
if(not (mode & GMSG_NOLSTUPD) or msg->attr.uns()) {
UpdateAreadata();
if(msg->attr.uns()) {
Path file, line;
if(islocal()) {
errorlevel |= EXIT_LOCAL;
locpost++;
}
else if(isnet()) {
errorlevel |= EXIT_NET;
netpost++;
}
else {
errorlevel |= EXIT_ECHO;
echopost++;
}
if(isjam() and (isecho() or isnet())) {
Path p;
sprintf(file, "%s%smail.jam", CFG->jampath, isecho() ? "echo" : "net");
sprintf(line, "%s %lu", ReMapPath(strcpy(p, path())), msg->msgno);
WriteNoDupes(file, line);
}
if(isqwk()) {
strcpy(file, AddPath(CFG->goldpath, "goldqwk.lst"));
sprintf(line, "%s %lu", echoid(), msg->msgno);
WriteNoDupes(file, line);
}
else if(isinternet()) {
strcpy(file, AddPath(CFG->goldpath, "goldsoup.lst"));
sprintf(line, "%s %lu", echoid(), msg->msgno);
WriteNoDupes(file, line);
}
else {
if(not strblank(CFG->semaphore.exportlist)) {
strcpy(file, AddPath(CFG->areapath, CFG->semaphore.exportlist));
sprintf(line, "%s", echoid());
WriteNoDupes(file, line);
}
}
}
}
}
// ------------------------------------------------------------------
void HudsSizewarn() {
whelpcat(H_EWarnMsgtxt);
call_help();
whelpcat(H_General);
}
// ------------------------------------------------------------------
void HGWarnRebuild() {
whelpcat(H_EQbaseRebuild);
call_help();
}
// ------------------------------------------------------------------
void FidoRenumberProgress(const char* s) {
update_statusline(s);
}
// ------------------------------------------------------------------

715
golded3/gmarea.h Normal file
View File

@ -0,0 +1,715 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Area structures and classes.
// ------------------------------------------------------------------
#ifndef __gmoarea_h
#define __gmoarea_h
// ------------------------------------------------------------------
#include <vector>
#include <gmoarea.h>
// ------------------------------------------------------------------
// Internal GoldED message header
class GMsg : public gmsg {
public:
IAdr iorig; // Internet "From:" header address
IAdr idest; // Internet "To:" header address
IAdr ireplyto; // Internet "Reply-To:" header address
IAdr iaddr; // Internet destination address (from ^aREPLYADDR)
IAdr igate; // Internet gate FTN-address and gatename (from ^aREPLYTO)
INam ifrom; // Internet "From:" header
char ito[512]; // Internet "To:" header
char icc[512]; // Internet "Cc:" header
char ibcc[512]; // Internet "Bcc:" header
INam organization; // Internet "Organization:" header
INam realby; // Real from-name
INam realto; // Real to-name
INam pseudoto; // Pseudo to-name
INam pseudofrom; // Pseudo from-name
uint you_and_I; // Mail was to/from me/you
INam fwdfrom; // FWDFROM kludge
ftn_addr fwdorig; // FWDORIG kludge
INam fwdto; // FWDTO kludge
ftn_addr fwddest; // FWDDEST kludge
Subj fwdsubj; // FWDSUBJ kludge
Echo fwdarea; // FWDAREA kludge
char fwdmsgid[201]; // FWDMSGID kludge
bool i51; // true if I51 kludge was found
char charset[100]; // Charset type
int charsetlevel; // Charset level
int charsetencoding; // Charset encoding format (GCHENC_*)
int tzutc; // TZUTC kludge
char tagline[80]; // Tagline for msg
char tearline[80]; // Tearline for msg
char origin[160]; // Origin for msg
Line* lin; // Index of the lines
Line** line; // Index of the viewable lines
int lines; // Total number of lines
int quotepct; // Quote/text percentage
uint foundwhere; // Where searched string was found (GFIND_*)
int foundtopline; // First line where a searched string was found
uint orig_timesread;
char* messageid; // Internet Message-ID (allocated)
char* inreplyto; // Internet In-Reply-To (allocated)
char* references; // Internet References (allocated)
int line_width; // Line width used
const char* areakludgeid; // Echoid from AREA: kludge or NULL
char* By() { return *realby ? realby : by; }
char* To() { return *realto ? realto : to; }
bool to_me() { return (you_and_I & TO_ME); }
bool to_all() { return (you_and_I & TO_ALL); }
bool by_me() { return (you_and_I & BY_ME); }
bool to_you() { return (you_and_I & TO_YOU); }
bool by_you() { return (you_and_I & BY_YOU); }
void TextToLines(int __line_width, bool header_recode = true);
void LinesToText();
};
// ------------------------------------------------------------------
class GAreaListScan {
private:
vector< pair<string, string> > container;
vector< pair<string, string> >::iterator currposn;
public:
inline GAreaListScan() { currposn = container.end(); }
inline ~GAreaListScan() {}
inline void Add(pair<string, string> p) { container.push_back(p); currposn = container.end(); }
inline void Reset() { container.clear(); currposn = container.end(); }
inline bool First() { currposn = container.begin(); return currposn != container.end(); }
inline bool Next() { currposn++; return currposn != container.end(); }
inline void CurrNo(int posn) { First(); while(posn--) if(not Next()) break; }
inline const char* MenuText() { return currposn != container.end() ? currposn->first.c_str() : ""; }
inline const char* File() { return currposn != container.end() ? currposn->second.c_str() : ""; }
inline const char* MenuText(int i) { return i < container.size() ? container[i].first.c_str() : ""; }
inline const char* File(int i) { return i < container.size() ? container[i].second.c_str() : ""; }
};
// ------------------------------------------------------------------
const word CUR_GOLDLAST_VER = 0x1A02;
#if defined(GOLD_CANPACK)
#pragma pack(1)
#endif
struct ggoldlast {
dword crcechoid;
dword lastread;
dword msgncount;
dword unread;
word marks;
byte flags;
};
#if defined(GOLD_CANPACK)
#pragma pack()
#endif
// ------------------------------------------------------------------
// Arealist class
class Area;
typedef vector<Area *>::iterator area_iterator;
class AreaList {
private:
Desc alistselections[16];
byte mask;
friend class Area;
friend class SelMaskPick;
public:
// Index of areas in the list
vector<Area *> idx;
// Area pointer
area_iterator item;
// Sort specs (for external compare func)
char sortspec[20];
// Active msgbases (bitmap of MT_* contants)
uint msgbases;
// Additional items to the area scan menu
GAreaListScan ListScan;
void Set_Mask(word value = 1) { mask = value; }
void Select_Mask(void);
// Con/destructor
AreaList();
~AreaList();
// Subscript operator, returns pointer to area
inline Area* operator[](size_t n) { return (n < idx.size()) ? idx[n] : (Area*)NULL; }
inline size_t size() { return idx.size(); }
// Allocate and initialize data
void Init();
// Deallocate and reset data
void Reset();
// Return pointer to a new'd area of the specified format
Area* NewArea(int msgbase);
// Sort areas
void Sort(const char* specs=NULL, int first=0, int last=-1);
// Default marks names
void SetDefaultMarks();
// Read/write GOLDLAST.LST
void ReadGoldLast();
void WriteGoldLast();
// Miscellaneous
void AddNewArea(AreaCfg* aa);
int AreaIdToNo(int __areaid);
Area* AreaIdToPtr(int __areaid);
int AreaNoToId(int __areano);
Area* AreaNoToPtr(int __areano);
int AreaScan(int mode, uint currno, int pmscan, int& pmails, int& pmareas, const char* file=NULL);
int AreaEchoToNo(const char* echoid);
Area* AreaEchoToPtr(const char* echoid);
void GetAreafile(char* val);
void GetArea(char* val);
bool GetAreaFirstPart(AreaCfg& aa, char*& key, char*& val);
void GetAreaDef(char* val);
void GetAreaSep(char* val);
void GetAreaDesc(char* val);
void ReadEcholist(char* val);
int SetActiveAreaId(int __areaid);
int SetActiveAreaNo(int __areano);
void SetAreaDesc(char* echoid, char* desc);
void SortAreaGroup(const char* options, int beginarea, int endarea);
void WriteAreaDef(const char* file);
};
// ------------------------------------------------------------------
// Msgbase function prototypes
int AreaCmp(const Area** __a, const Area** __b);
// ------------------------------------------------------------------
// Area data (collected from global/Random System)
struct AreaData {
// Area
gaka aka;
bool akamatching;
Attr attributes;
bool areacopyaddid;
bool areacopydirect;
Echo areacopyto;
bool areaforwarddirect;
bool areafreqdirect;
Echo areafreqto;
bool areareplydirect;
Echo areareplyto;
Echo areayouwroteto;
int ctrlinfo;
bool edithardterm;
bool editmixcase;
bool forcetemplate;
IAdr internetaddress;
Node internetgate;
bool internetmsgid;
bool internetrfcbody;
Path loadlanguage;
int msglistdate;
bool msglistfast;
bool msglistfirst;
bool msglistheader;
bool msglistwidesubj;
Name nickname;
INam organization;
char origin[160];
Path quotebuffile;
char quotechars[11];
int quotectrl;
char quotestring[10];
bool quotewraphard;
GPlay play;
int replyre;
char tagline[76];
char taglinechar;
bool taglinesupport;
Tear tearline;
Path tpl;
bool templatematch;
int usefwd;
Node username;
bool usetzutc;
IAdr whoto;
XlatName xlatexport;
XlatName xlatimport;
// Reader
Path inputfile;
Path outputfile;
INam searchfor;
int twitmode;
bool viewhidden;
bool viewkludge;
bool viewquote;
};
// ------------------------------------------------------------------
extern AreaList AL;
// ------------------------------------------------------------------
// Area information structures
class Area {
private:
word marks; // storing 16 different marks
friend class AreaList;
public:
// ----------------------------------------------------------------
// Config data
gmo_area* area;
AreaData* adat;
// ----------------------------------------------------------------
// Constructor and destructor
Area(gmo_area* a);
virtual ~Area();
// ----------------------------------------------------------------
// Data members
GTag Msgn; // Message numbers
GTag Mark; // Message marks
GTag PMrk; // Personal mail marks
GTag Expo; // Messages to be exported
ulong bookmark; // Current bookmark message number
uint unread; // Number of unread messages at last scan
uint lastread() const; // Number of last message read
ulong lastreadentry() const; // Lastread message number at entry to area
void set_lastread(uint lr);
bool isopen() { return area->isopen; }
bool isunreadchg : 1; // TRUE if unread was changed since last scan
bool isreadmark : 1; // TRUE if in read marked mode
bool isreadpm : 1; // TRUE if in read personal mail mode
bool isvalidchg : 1; // TRUE if isunreadchg is valid
bool isscanned : 1; // TRUE if scanned
bool ispmscanned : 1; // TRUE if pmscanned
bool istossed : 1; // TRUE if msgs were tossed to this area
// ----------------------------------------------------------------
// Access config data
int areaid() const { return area->areaid(); }
int groupid() const { return area->groupid(); }
uint type() const { return area->type(); }
uint msgbase() const { return area->msgbase(); }
uint board() const { return area->board(); }
const ftn_addr& aka() const { return area->aka(); }
int originno() const { return area->originno(); }
Attr& attr() { return area->attr(); }
bool scan() { return area->ascan(); }
bool scanexcl() { return area->ascanexcl(); }
bool scanincl() { return area->ascanincl(); }
bool pmscan() { return area->pmscan(); }
bool pmscanexcl() { return area->pmscanexcl(); }
bool pmscanincl() { return area->pmscanincl(); }
bool ismarked() const { return (marks & (1<<AL.mask)) ? true : false; }
const char* echoid() const { return area->echoid(); }
const char* desc() const { return area->desc(); }
const char* path() const { return area->path(); }
void set_marked(bool value) { if(value) marks |= (word)(1<<AL.mask); else marks &= (word)(~(1<<AL.mask)); }
void set_areaid(int a) { area->set_areaid(a); }
void set_groupid(int g) { area->set_groupid(g); }
void set_type(uint t) { area->set_type(t); }
void set_msgbase(uint m) { area->set_msgbase(m); }
void set_board(uint b) { area->set_board(b); }
void set_aka(ftn_addr& a) { area->set_aka(a); }
void set_originno(int o) { area->set_originno(o); }
void set_attr(Attr& a) { area->set_attr(a); }
void set_origin(char* o) { area->set_origin(o); }
void set_scan(bool s) { area->set_scan(s); }
void set_scanexcl(bool s) { area->set_scanexcl(s); }
void set_scanincl(bool s) { area->set_scanincl(s); }
void set_pmscan(bool s) { area->set_pmscan(s); }
void set_pmscanexcl(bool s) { area->set_pmscanexcl(s); }
void set_pmscanincl(bool s) { area->set_pmscanincl(s); }
void set_echoid(const char* s) { area->set_echoid(s); }
void set_desc(const char* s) { area->set_desc(s); }
void set_path(const char* s) { area->set_path(s); }
// ----------------------------------------------------------------
// Determine msgbase format
int isfts1() const;
int isopus() const;
int isezycom() const;
int isfido() const;
int isgoldbase() const;
int ishudson() const;
int isjam() const;
int ispcboard() const;
int issquish() const;
int iswildcat() const;
int isadeptxbbs() const;
int isseparator() const;
// ----------------------------------------------------------------
// Determine area type
int isnet() const;
int isecho() const;
int islocal() const;
int isemail() const;
int isnewsgroup() const;
int isinternet() const;
int isqwk() const;
int issoup() const;
// ----------------------------------------------------------------
// Miscellaneous
void SetBookmark(uint __relno);
void DeleteMsg(GMsg* msg, int direction);
void DelMsg();
void DelMsgs(GMsg* msg);
void SigExportlistUpdate();
void UpdateAreadata();
void SetHighwaterMark();
void ResetHighwaterMark();
// ----------------------------------------------------------------
// High-level messagebase member functions
void Open();
void Close();
void Suspend();
void Resume();
void Lock();
void Unlock();
void Scan();
void ScanArea();
void ScanAreaPM();
int LoadHdr(GMsg* msg, ulong msgno);
int LoadMsg(GMsg* msg, ulong msgno, int margin, int mode=0);
void SaveHdr(int mode, GMsg* msg);
void SaveMsg(int mode, GMsg* msg);
void DelMsg(GMsg* msg);
void NewMsgno(GMsg* msg);
char* UserLookup(char* lookfor);
int Renumber();
Line* MakeDumpMsg(GMsg* msg, char* lng_head);
void UpdateTimesread(GMsg* msg);
// ----------------------------------------------------------------
// Random System access functions
void InitData();
void RandomizeData(int mode=0);
const ftn_aka& Aka() const { return adat->aka; }
bool Akamatching() const { return adat->akamatching; }
const Attr& Attributes() const { return adat->attributes; }
bool Areacopyaddid() const { return adat->areacopyaddid; }
bool Areacopydirect() const { return adat->areacopydirect; }
const char* Areacopyto() const { return adat->areacopyto; }
bool Areaforwarddirect() const{ return adat->areaforwarddirect; }
bool Areafreqdirect() const { return adat->areafreqdirect; }
const char* Areafreqto() const { return adat->areafreqto; }
bool Areareplydirect() const { return adat->areareplydirect; }
const char* Areareplyto() const { return adat->areareplyto; }
const char* Areayouwroteto() const { return adat->areayouwroteto; }
int Ctrlinfo() const { return adat->ctrlinfo; }
bool Edithardterm() const { return adat->edithardterm; }
bool Editmixcase() const { return adat->editmixcase; }
bool Forcetemplate() const { return adat->forcetemplate; }
const char* Inputfile() const { return adat->inputfile; }
const char* Internetaddress() const { return adat->internetaddress; }
const Node& Internetgate() const { return adat->internetgate; }
bool Internetmsgid() const { return adat->internetmsgid; }
bool Internetrfcbody() const { return adat->internetrfcbody; }
const char* Loadlanguage() const { return adat->loadlanguage; }
int Msglistdate() const { return adat->msglistdate; }
bool Msglistfast() const { return adat->msglistfast; }
bool Msglistfirst() const { return adat->msglistfirst; }
bool Msglistheader() const { return adat->msglistheader; }
bool Msglistwidesubj() const { return adat->msglistwidesubj; }
const char* Nickname() const { return adat->nickname; }
const char* Organization() const { return adat->organization; }
const char* Origin() const { return adat->origin; }
const char* Outputfile() const { return adat->outputfile; }
const char* Quotebuffile() const { return adat->quotebuffile; }
const char* Quotechars() const { return adat->quotechars; }
int Quotectrl() const { return adat->quotectrl; }
const char* Quotestring() const { return adat->quotestring; }
bool Quotewraphard() const { return adat->quotewraphard; }
const GPlay& Play() const { return adat->play; }
const int Replyre() const { return adat->replyre; }
const char* Searchfor() const { return adat->searchfor; }
const char* Tagline() const { return adat->tagline; }
char Taglinechar() const { return adat->taglinechar; }
bool Taglinesupport() const { return adat->taglinesupport; }
const char* Tearline() const { return adat->tearline; }
const char* Tpl() const { return adat->tpl; }
bool Templatematch() const { return adat->templatematch; }
int Twitmode() const { return adat->twitmode; }
int Usefwd() const { return adat->usefwd; }
const Node& Username() const { return adat->username; }
bool Usetzutc() const { return adat->usetzutc; }
bool Viewhidden() const { return adat->viewhidden; }
bool Viewkludge() const { return adat->viewkludge; }
bool Viewquote() const { return adat->viewquote; }
const char* Whoto() const { return adat->whoto; }
const char* Xlatexport() const { return adat->xlatexport; }
const char* Xlatimport() const { return adat->xlatimport; }
int NextMsglistdate() { adat->msglistdate++; if(adat->msglistdate > MSGLISTDATE_RECEIVED) adat->msglistdate = MSGLISTDATE_NONE; return adat->msglistdate; }
const ftn_aka& SetAka(const ftn_addr& a) { adat->aka.addr = a; return adat->aka; }
const char* SetInputfile(const char* i) { return strcpy(adat->inputfile, i); }
int SetMsglistdate(int m) { adat->msglistdate = m; return adat->msglistdate; }
const char* SetOrigin(const char* o) { return strxcpy(adat->origin, o, sizeof(adat->origin)); }
const char* SetOutputfile(const char* o) { return strxcpy(adat->outputfile, o, sizeof(adat->outputfile)); }
const char* SetSearchfor(const char* s) { return strxcpy(adat->searchfor, s, sizeof(adat->searchfor)); }
const char* SetTagline(const char* t) { return strxcpy(adat->tagline, t, sizeof(adat->tagline)); }
const char* SetTpl(const char* t) { return strxcpy(adat->tpl, t, sizeof(adat->tpl)); }
int SetTwitmode(int m) { adat->twitmode = m; return adat->twitmode; }
const Node& SetUsername(const Node& n) { adat->username = n; return adat->username; }
const char* SetXlatexport(const char* x) { return strcpy(adat->xlatexport, x); }
const char* SetXlatimport(const char* x) { return strcpy(adat->xlatimport, x); }
int ToggleMsglistwidesubj() { adat->msglistwidesubj = not adat->msglistwidesubj; return adat->msglistwidesubj; }
int ToggleViewhidden() { adat->viewhidden = not adat->viewhidden; return adat->viewhidden; }
int ToggleViewkludge() { adat->viewkludge = not adat->viewkludge; return adat->viewkludge; }
int ToggleViewquote() { adat->viewquote = not adat->viewquote; return adat->viewquote; }
};
// ------------------------------------------------------------------
// Inline implementations
inline int Area::isfts1() const { return area->isfts1(); }
inline int Area::isopus() const { return area->isopus(); }
inline int Area::isezycom() const { return area->isezycom(); }
inline int Area::isfido() const { return area->isfido(); }
inline int Area::isgoldbase() const { return area->isgoldbase(); }
inline int Area::ishudson() const { return area->ishudson(); }
inline int Area::isjam() const { return area->isjam(); }
inline int Area::ispcboard() const { return area->ispcboard(); }
inline int Area::issquish() const { return area->issquish(); }
inline int Area::iswildcat() const { return area->iswildcat(); }
inline int Area::isadeptxbbs() const { return area->isadeptxbbs(); }
inline int Area::isseparator() const { return area->isseparator(); }
inline int Area::isnet() const { return area->isnet(); }
inline int Area::isecho() const { return area->isecho(); }
inline int Area::islocal() const { return area->islocal(); }
inline int Area::isemail() const { return area->isemail(); }
inline int Area::isnewsgroup() const { return area->isnewsgroup(); }
inline int Area::isinternet() const { return area->isinternet(); }
inline int Area::isqwk() const { return area->isqwk(); }
inline int Area::issoup() const { return area->issoup(); }
inline uint Area::lastread() const { return area->lastread; }
inline ulong Area::lastreadentry() const { return area->lastreadentry; }
inline void Area::set_lastread(uint lr) { area->lastread = lr; }
inline void Area::SetBookmark(uint __relno) { bookmark = Msgn.CvtReln(__relno); /*Book.Add(bookmark);*/ }
inline void Area::Suspend() { area->suspend(); }
inline void Area::Resume() { area->resume(); }
inline void Area::Lock() { area->lock(); }
inline void Area::Unlock() { area->unlock(); }
inline void Area::DelMsg(GMsg* msg) { area->del_msg(msg); }
inline void Area::NewMsgno(GMsg* msg) { area->new_msgno(msg); }
inline char* Area::UserLookup(char* lookfor) { return area->user_lookup(lookfor); }
inline int Area::Renumber() { return area->renumber(); }
inline Line* Area::MakeDumpMsg(GMsg* msg, char* lng_head) { return area->make_dump_msg(msg->lin, msg, lng_head); }
inline void Area::SetHighwaterMark() { area->set_highwater_mark(); }
inline void Area::ResetHighwaterMark() { area->reset_highwater_mark(); }
inline void Area::UpdateTimesread(GMsg* msg) { area->update_timesread(msg); }
// ------------------------------------------------------------------
class MsgbaseManager {
public:
void Init();
void Exit();
void WideScanBegin();
void WideScanEnd();
};
// ------------------------------------------------------------------
// Arealist picker class
class GPickArealist : public gwinpick {
private:
int areawin;
int tempwin;
int tempwin1;
int areawin1;
int areawin2;
int tempwin2;
uint area_fuzidx;
int pmails;
int pmareas;
bool pmscan;
void jump_to();
void jumpmatch();
void center();
void AreasRenumber();
void AreaCatchUp(uint n);
void AreaDropMsgMarks(uint n);
void dispbuf(char* buf, int areano);
protected:
public:
uint area_maxfuz;
bool esc_abort;
void open(); // Called after window is opened
void close(); // Called after window is closed
void precursor(); // Called before any cursor movement
void do_delayed(); // Called after a delay
void print_line(uint idx, uint pos, bool isbar);
bool handle_key(); // Handles keypress
bool is_selectable(uint idx); // is not separator ?
void close_all();
void update() { display_page(); display_bar(); }
int Run(const char* _title, int wpos, int& idx);
GPickArealist();
};
// ------------------------------------------------------------------
#endif // __gmoarea_h

100
golded3/golded.h Normal file
View File

@ -0,0 +1,100 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Main include file. (For precompiled headers)
// ------------------------------------------------------------------
#ifndef __GOLDED_H
#define __GOLDED_H
// ------------------------------------------------------------------
// Compiler dependencies
#include <gcmpall.h>
// ------------------------------------------------------------------
// Standard library headers
#include <gstrall.h>
#include <csignal>
#include <iostream>
#include <iomanip>
// Wrappers for certain mostly DOS/Borland headers
#include <gshare.h>
// ------------------------------------------------------------------
// Goldware Library headers
#include <gdefs.h>
#include <gcrcall.h>
#include <gdbgerr.h>
#include <gmemdbg.h>
#include <gdbgtrk.h>
#include <gfile.h>
#include <gfilutil.h>
#include <gftnall.h>
#include <gkbdbase.h>
#include <gkbdcode.h>
#include <glog.h>
#include <gmemall.h>
#include <gmoubase.h>
#include <gmsgattr.h>
#include <gprnall.h>
#include <gsearch.h>
#include <gstrbags.h>
#include <gstrarr.h>
#include <gtimall.h>
#include <gtxtpara.h>
#include <gutlgrp.h>
#include <gutlmisc.h>
#include <gutlmtsk.h>
#include <gutltag.h>
#include <gvidall.h>
#include <gwildmat.h>
#include <gwinall.h>
#include <gwinhelp.h>
#include <gwinpick.h>
#include <gedacfg.h>
// ------------------------------------------------------------------
// GoldED specific headers
#include <geall.h>
#include <geqwks.h>
#include <gectnr.h>
#include <geview.h>
#include <geglob.h>
#include <geprot.h>
#include <gemnus.h>
#include <gefn.h>
// ------------------------------------------------------------------
#endif
// ------------------------------------------------------------------

87
golded3/golded3.all Normal file
View File

@ -0,0 +1,87 @@
## ------------------------------------------------------------------
## 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$
## ------------------------------------------------------------------
## Master build file.
## ------------------------------------------------------------------
gcalst cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gcarea cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gccfgg cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gccfgg0 cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gccfgg1 cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gccfgg2 cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gccfgg3 cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gccfgg4 cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gccfgg5 cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gccfgg6 cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gccfgg7 cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gccfgg8 cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gckeys cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gclang cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gcmisc cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gealst cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gearea cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gecarb cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gecmfd cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gectnr cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gectrl cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gedoit cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gedoss cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
geedit cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
geedit2 cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
geedit3 cpp all nov bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gefile cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gefind cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
geglob cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gehdre cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gehdrs cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
geinit cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
geline cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gelmsg cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gemain cpp all nov bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gemenu cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gemlst cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gemnus cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gemrks cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gemsgs cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
genode cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
geplay cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gepost cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
geqwks cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gerand cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
geread cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
geread2 cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gescan cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gesrch cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gesoup cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
getpls cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
geusrbse cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
geutil cpp all nov bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
geutil2 cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
geview cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gmarea cpp all ovl bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
golded3 cpp all nov bcd bco bcx djg emx lnx rsx wcn wco wcx cyg
gedcyg rc cyg
gedemx rc emx
## ------------------------------------------------------------------

152
golded3/golded3.cpp Normal file
View File

@ -0,0 +1,152 @@
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Product name and version stuff.
// ------------------------------------------------------------------
#include <golded.h>
// ------------------------------------------------------------------
#define __GVER_PID__(A,B,C,SIZE) __GVER_PRE##SIZE##NAME__ __GVER_##SIZE##NAME__ __GVER_POST##SIZE##NAME__ __GVER_##SIZE##PLATFORM__ " " \
__GVER_PREVERSION__ #A "." #B "." #C __GVER_POSTVERSION__
#define __GVER__(__GVER_MAJOR__,__GVER_MINOR__,__GVER_RELEASE__) \
int __gver_major__ = __GVER_MAJOR__; \
int __gver_minor__ = __GVER_MINOR__; \
int __gver_release__ = __GVER_RELEASE__; \
const char* __gver_longpid__ = __GVER_PID__(__GVER_MAJOR__,__GVER_MINOR__,__GVER_RELEASE__,); \
const char* __gver_shortpid__ = __GVER_PID__(__GVER_MAJOR__,__GVER_MINOR__,__GVER_RELEASE__,SHORT);
// ------------------------------------------------------------------
// Product name.
#define __GVER_NAME__ "GoldED"
#define __GVER_SHORTNAME__ "GED"
// ------------------------------------------------------------------
// Vendor data displayed on the startup screen.
// Define in "mygolded.h" if you want.
#define __GVER_VENDOR_NAME__ "Anonymous"
#define __GVER_VENDOR_FIDO__ ""
#define __GVER_VENDOR_EMAIL__ ""
#define __GVER_RELEASENAME__ ""
// ------------------------------------------------------------------
// Strings prepended and appended to the product name.
// Define in "mygolded.h" if you want.
#define __GVER_PRENAME__ ""
#define __GVER_POSTNAME__ ""
#define __GVER_PRESHORTNAME__ ""
#define __GVER_POSTSHORTNAME__ ""
// ------------------------------------------------------------------
// Strings prepended and appened to the version numbers.
// Define in "mygolded.h" if you want.
#define __GVER_PREVERSION__ ""
#define __GVER_POSTVERSION__ ""
// ------------------------------------------------------------------
// Platform specific strings.
#if defined(__MSDOS__)
#define __GVER_PLATFORM__ "/386"
#define __GVER_SHORTPLATFORM__ "386"
#define __GVER_SHORTLOGNAME__ "X"
#define __GVER_CFGEXT__ ".gex"
#elif defined(__EMX__)
#define __GVER_PLATFORM__ "/EMX"
#define __GVER_SHORTPLATFORM__ "2"
#define __GVER_SHORTLOGNAME__ "2"
#define __GVER_CFGEXT__ ".geo"
#elif defined(__OS2__)
#define __GVER_PLATFORM__ "/2"
#define __GVER_SHORTPLATFORM__ "2"
#define __GVER_SHORTLOGNAME__ "2"
#define __GVER_CFGEXT__ ".geo"
#elif defined(__WIN32__)
#define __GVER_PLATFORM__ "/W32"
#define __GVER_SHORTPLATFORM__ "W32"
#define __GVER_SHORTLOGNAME__ "W"
#define __GVER_CFGEXT__ ".gew"
#elif defined(__linux__)
#define __GVER_PLATFORM__ "/LNX"
#define __GVER_SHORTPLATFORM__ "LNX"
#define __GVER_SHORTLOGNAME__ "L"
#define __GVER_CFGEXT__ ".gel"
#elif defined(__FreeBSD__) or defined(__OpenBSD__)
#define __GVER_PLATFORM__ "/BSD"
#define __GVER_SHORTPLATFORM__ "BSD"
#define __GVER_SHORTLOGNAME__ "B"
#define __GVER_CFGEXT__ ".geb"
#elif defined(__UNIX__)
#define __GVER_PLATFORM__ "/UNX"
#define __GVER_SHORTPLATFORM__ "UNX"
#define __GVER_SHORTLOGNAME__ "U"
#define __GVER_CFGEXT__ ".geu"
#else
#define __GVER_PLATFORM__ ""
#define __GVER_SHORTPLATFORM__ ""
#define __GVER_SHORTLOGNAME__ "D"
#define __GVER_CFGEXT__ ".ged"
#endif
// ------------------------------------------------------------------
// Include your personalized strings here:
#include <mygolded.h>
// ------------------------------------------------------------------
// Global variables
const char* __gver_vendor_name__ = __GVER_VENDOR_NAME__;
const char* __gver_vendor_fido__ = __GVER_VENDOR_FIDO__;
const char* __gver_vendor_email__ = __GVER_VENDOR_EMAIL__;
const char* __gver_prename__ = __GVER_PRENAME__;
const char* __gver_preshortname__ = __GVER_PRESHORTNAME__;
const char* __gver_name__ = __GVER_NAME__;
const char* __gver_shortname__ = __GVER_SHORTNAME__;
const char* __gver_shortlogname__ = __GVER_SHORTNAME__ __GVER_SHORTLOGNAME__;
const char* __gver_postshortname__ = __GVER_POSTSHORTNAME__;
const char* __gver_postname__ = __GVER_POSTNAME__;
const char* __gver_platform__ = __GVER_PLATFORM__;
const char* __gver_shortplatform__ = __GVER_SHORTPLATFORM__;
const char* __gver_cfgext__ = __GVER_CFGEXT__;
const char* __gver_preversion__ = __GVER_PREVERSION__;
const char* __gver_postversion__ = __GVER_POSTVERSION__;
const char* __gver_releasename__ = __GVER_RELEASENAME__;
const char* __gver_date__ = __DATE__;
const char* __gver_time__ = __TIME__;
// ------------------------------------------------------------------

53
golded3/mygolded.__h Normal file
View File

@ -0,0 +1,53 @@
// ------------------------------------------------------------------
// GoldED+
// Personalized strings.
// ------------------------------------------------------------------
// $Id$
// ------------------------------------------------------------------
// Please do not modify this file. It's just a template for your
// local "mygolded.h" settings file. So please change your copy only.
// ------------------------------------------------------------------
// Please edit these fields to match your real name
#undef __GVER_VENDOR_NAME__
#define __GVER_VENDOR_NAME__ "Put in your full name here"
#undef __GVER_VENDOR_FIDO__
#define __GVER_VENDOR_FIDO__ "your Fidonet-AKA"
#undef __GVER_VENDOR_EMAIL__
#define __GVER_VENDOR_EMAIL__ "your email@address"
// ------------------------------------------------------------------
// If you have an important message every user should read, put it
// here in. If you don't, leave it as default. ;-)
#undef __GVER_RELEASENAME__
#define __GVER_RELEASENAME__ __GVER_VENDOR_NAME__"\'s personal edition"
// ------------------------------------------------------------------
// It is highly recommended to leave these fields unchanged.
// They are reserved for future use.
#undef __GVER_PRENAME__
#define __GVER_PRENAME__ ""
#undef __GVER_POSTNAME__
#define __GVER_POSTNAME__ "+"
#undef __GVER_PRESHORTNAME__
#define __GVER_PRESHORTNAME__ ""
#undef __GVER_POSTSHORTNAME__
#define __GVER_POSTSHORTNAME__ "+"
// ------------------------------------------------------------------
// Version numbers.
#undef __GVER_PREVERSION__
#define __GVER_PREVERSION__ ""
#undef __GVER_POSTVERSION__
#define __GVER_POSTVERSION__ ".3"
__GVER__(1,1,4)
// ------------------------------------------------------------------