Refactoring!

This commit is contained in:
Ianos Gnatiuc
2006-05-13 16:15:35 +00:00
parent 48908d77d9
commit 40cd10db65
89 changed files with 7944 additions and 28800 deletions

View File

@@ -821,7 +821,7 @@ void CookieIndex(char* textfile, char* indexfile)
{
ifp.SetvBuf(NULL, _IOFBF, 32000);
gfile ofp(indexfile, "wb", CFG->sharemode);
if (ofp)
if (ofp.isopen())
{
ofp.SetvBuf(NULL, _IOFBF, 16000);
char buf[256];

File diff suppressed because it is too large Load Diff

View File

@@ -23,8 +23,12 @@
// ------------------------------------------------------------------
// The main GoldED configuration structure.
// ------------------------------------------------------------------
#ifndef __GECFGG__H
#define __GECFGG__H
#include <list>
#include <gmo_msg.h>
#include <geall.h>
// ------------------------------------------------------------------
@@ -109,6 +113,88 @@ private:
};
// ------------------------------------------------------------------
struct Win {
int btype; // Border type
vattr c[16]; // Colors
int w; // Window handle
};
// ------------------------------------------------------------------
// Combined name/address structure
struct Node
{
Name name;
Addr addr;
Node &operator=(const Node &a) { strxcpy(name, a.name, ARRAYSIZE(name)); addr=a.addr; return *this; }
};
// ------------------------------------------------------------------
// Filename aliases
struct FileAlias {
char alias[9];
Path file;
FileAlias& operator=(const FileAlias& a) {
strxcpy(alias, a.alias, sizeof(alias));
strxcpy(file, a.file, sizeof(Path));
return *this;
}
};
// ------------------------------------------------------------------
// Template typedefs
struct Tpl {
Path file;
Desc name;
Addr match;
};
// ------------------------------------------------------------------
// Address macro record
struct AddrMacro {
char macro[20];
IAdr name;
Addr addr;
Subj subj;
Attr attr;
};
// ------------------------------------------------------------------
struct AkaMatchG {
Addr mask;
Addr aka;
};
// ------------------------------------------------------------------
struct MailList {
Echo echoid;
IAdr sender;
IAdr contribution;
bool sender_is_pattern;
};
// ------------------------------------------------------------------
struct FrqNodeMap {
Addr from;
Addr to;
};
// ------------------------------------------------------------------
class CfgGed {
@@ -559,3 +645,4 @@ public:
// ------------------------------------------------------------------
#endif

View File

@@ -232,8 +232,9 @@ static void WriteMsgs(GMsg* msg) {
update_statuslinef(LNG->WritingMsg, "ST_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)
if (target & WRITE_PRINTER)
{
if (prnfp.isopen())
SaveLines(MODE_WRITE, "\001PRN", msg, prnmargin);
}
else {

View File

@@ -2013,7 +2013,7 @@ void IEclass::savefile(int __status) {
const char* editorfile = AddPath(CFG->goldpath, EDIT->File());
remove(editorfile);
gfile _fp(editorfile, "wb", CFG->sharemode);
if (_fp)
if (_fp.isopen())
{
// Find the first line
Line* _saveline = findfirstline();
@@ -2863,7 +2863,7 @@ int IEclass::Start(int __mode, uint* __position, GMsg* __msg) {
// Check if there is an unfinished backup message
gfile _fp(AddPath(CFG->goldpath, EDIT->File()), "rt", CFG->sharemode);
if (_fp)
if (_fp.isopen())
{
char _buf[EDIT_BUFLEN];
_fp.Fgets(_buf, sizeof(_buf));

View File

@@ -799,7 +799,7 @@ void IEclass::LoadFile() {
// Open the file to load
gfile _fp(AddPath(CFG->goldpath, EDIT->File()), "rb", CFG->sharemode);
if (_fp)
if (_fp.isopen())
{
XlatName __oldxlatimport;

View File

@@ -395,7 +395,7 @@ static void w_brag() {
wprints(5, 12, C_BRAGW, "http://golded-plus.sourceforge.net");
wprints(0, 48, C_BRAGW, " GoldED+ Message Editor ");
sprintf(buf, " Copyright (C) 1990-%s ",__gver_date__+7);
gsprintf(PRINTF_DECLARE_BUFFER(buf), " Copyright (C) 1990-%s ",__gver_date__+7);
wprints(1, 48, C_BRAGW, buf);
wprints(2, 48, C_BRAGW, " by Odinn Sorensen, ");
wprints(3, 48, C_BRAGW, " Alexander Aganichev, ");

View File

@@ -2986,7 +2986,7 @@ static bool CheckLevel(const char* imp, const char* imp2, int n, int &current_ta
if (!CharTable) CharTable = (Chs*)throw_calloc(1, sizeof(Chs));
fp.FseekSet(n, sizeof(Chs));
fp.Fread(CharTable, sizeof(Chs));
ChsTP = CharTable->t;
current_table = n;

View File

@@ -74,7 +74,24 @@ inline void mlst_with_date(int with_date) {
// ------------------------------------------------------------------
class GMsgList : public gwinpick {
class GMsgList : public gwinpick
{
struct MLst
{
uint32_t msgno;
byte high;
char num[8];
char marks[3];
char by[sizeof(Name)+20];
char to[sizeof(Name)+20];
Subj re;
time32_t written;
time32_t arrived;
time32_t received;
char goldmark;
vattr colorby;
vattr colorto;
};
gwindow window;
GMsg msg;

View File

@@ -1,57 +0,0 @@
// ------------------------------------------------------------------
// GoldED+
// Copyright (C) 2003 Alexander Reznikov, 2:4600/220@fidonet,
// <homebrewer@yandex.ru>
// ------------------------------------------------------------------
// 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$
// ------------------------------------------------------------------
// Generate MSGID.
// ------------------------------------------------------------------
#include <golded.h>
#include <genmsgid.h>
// ------------------------------------------------------------------
static uint32_t msgcount = 0;
// ------------------------------------------------------------------
uint32_t getClassicMsgId() {
return gtime(NULL)+(msgcount++);
}
// ------------------------------------------------------------------
uint32_t getMsgId() {
uint32_t id;
char *err;
if((CFG->seqmsgid == YES) or ((CFG->seqmsgid == MAYBE) and (*CFG->seqdir != NUL))) {
id = GenMsgIdEx(CFG->seqdir, CFG->seqoutrun, getClassicMsgId, &err);
if(err) {
LOG.printf("* Warning, SeqMsgId failed: %s, fall to classic algorythm!", err);
}
return id;
}
return getClassicMsgId();
}
// ------------------------------------------------------------------

View File

@@ -1248,7 +1248,7 @@ void CheckNodelists() {
update_statusline(LNG->CheckingNodelists);
gfile fp(file, "rt", CFG->sharemode);
if (fp)
if (fp.isopen())
{
// Read the list index
char buf[256];

View File

@@ -31,6 +31,7 @@
// ------------------------------------------------------------------
#include <vector>
#include <gecfgg.h>
#include <gmoarea.h>