1 // This may look like C code, but it is really -*- C++ -*-
2
3 // ------------------------------------------------------------------
4 // The Goldware Library
5 // Copyright (C) 1990-1999 Odinn Sorensen
6 // ------------------------------------------------------------------
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Library General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Library General Public License for more details.
16 //
17 // You should have received a copy of the GNU Library General Public
18 // License along with this program; if not, write to the Free
19 // Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 // MA 02111-1307, USA
21 // ------------------------------------------------------------------
22 // $Id: gxfm100.cpp,v 1.6 2006/05/13 16:13:48 ssianky Exp $
23 // ------------------------------------------------------------------
24 // Read areas from FMail
25 // ------------------------------------------------------------------
26
27 #include <cstdlib>
28 #include <gmemdbg.h>
29 #include <gstrall.h>
30 #undef GCFG_NOFMAIL
31 #include <gedacfg.h>
32 #include <gs_fm10g.h>
33
34
35 // ------------------------------------------------------------------
36
ReadFMail098(gfile & fp,char * path,char * file,char * options)37 void gareafile::ReadFMail098(gfile &fp, char* path, char* file, char* options)
38 {
39 AreaCfg aa;
40
41 configType* cfg = new configType; throw_new(cfg);
42
43 fp.Fread(cfg, sizeof(configType));
44 fp.Fclose();
45
46 // Get Hudson msgbase path
47 CfgHudsonpath(cfg->bbsPath);
48
49 // .MSG style netmail
50 if(not strblank(cfg->netPath)) {
51 aa.reset();
52 aa.aka = cfg->akaList[0].nodeNum;
53 aa.basetype = fidomsgtype;
54 aa.type = GMB_NET;
55 aa.attr = attribsnet;
56 aa.setpath(cfg->netPath);
57 aa.setdesc("FMail Netmail");
58 aa.setautoid("NETMAIL");
59 AddNewArea(aa);
60 }
61
62 // .MSG style netmail sent
63 if(not strblank(cfg->sentPath)) {
64 aa.reset();
65 aa.aka = cfg->akaList[0].nodeNum;
66 aa.basetype = fidomsgtype;
67 aa.type = GMB_NET;
68 aa.attr = attribsnet;
69 aa.setpath(cfg->sentPath);
70 aa.setdesc("FMail Netmail Sent");
71 aa.setautoid("NET_SENT");
72 AddNewArea(aa);
73 }
74
75 // .MSG style netmail rcvd
76 if(not strblank(cfg->rcvdPath)) {
77 aa.reset();
78 aa.aka = cfg->akaList[0].nodeNum;
79 aa.basetype = fidomsgtype;
80 aa.type = GMB_NET;
81 aa.attr = attribsnet;
82 aa.setpath(cfg->rcvdPath);
83 aa.setdesc("FMail Netmail Received");
84 aa.setautoid("NET_RECEIVED");
85 AddNewArea(aa);
86 }
87
88 // Hudson netmail
89 for(int x=0; x<MAX_NETAKAS; x++) {
90 if(cfg->netmailBoard[x] and cfg->netmailBoard[x] < 201) {
91 aa.reset();
92 aa.basetype = "HUDSON";
93 aa.type = GMB_NET;
94 aa.attr = attribsnet;
95 aa.board = cfg->netmailBoard[x];
96 aa.aka = cfg->akaList[x].nodeNum;
97 Desc desc;
98 sprintf(desc, "%s", cfg->descrAKA[x]);
99 aa.setdesc(desc);
100 sprintf(desc, "NET_AKA%u", x);
101 aa.setautoid(desc);
102 AddNewArea(aa);
103 }
104 }
105
106 // Hudson recovery board
107 if(cfg->recBoard and cfg->recBoard < 201) {
108 aa.reset();
109 aa.aka = cfg->akaList[0].nodeNum;
110 aa.basetype = "HUDSON";
111 aa.type = GMB_ECHO;
112 aa.attr = attribsecho;
113 aa.board = cfg->recBoard;
114 aa.setdesc("FMail Recovery Board");
115 aa.setautoid("ECHO_RECOVERY");
116 AddNewArea(aa);
117 }
118
119 // Hudson badmsgs
120 if(cfg->badBoard and cfg->badBoard < 201) {
121 aa.reset();
122 aa.aka = cfg->akaList[0].nodeNum;
123 aa.basetype = "HUDSON";
124 aa.type = GMB_ECHO;
125 aa.attr = attribsecho;
126 aa.board = cfg->badBoard;
127 aa.setdesc("FMail Bad Echomail Board");
128 aa.setautoid("ECHO_BAD");
129 AddNewArea(aa);
130 }
131
132 // Hudson dupmsgs
133 if(cfg->dupBoard and cfg->dupBoard < 201) {
134 aa.reset();
135 aa.aka = cfg->akaList[0].nodeNum;
136 aa.basetype = "HUDSON";
137 aa.type = GMB_ECHO;
138 aa.attr = attribsecho;
139 aa.board = cfg->dupBoard;
140 aa.setdesc("FMail Duplicates Board");
141 aa.setautoid("ECHO_DUPES");
142 AddNewArea(aa);
143 }
144
145 // Personal mail
146 if(not strblank(cfg->pmailPath)) {
147 aa.reset();
148 aa.aka = cfg->akaList[0].nodeNum;
149 aa.basetype = fidomsgtype;
150 aa.type = GMB_ECHO;
151 aa.attr = attribsecho;
152 aa.setpath(cfg->pmailPath);
153 aa.setdesc("FMail Personal Mail");
154 aa.setautoid("ECHO_PERSONAL");
155 AddNewArea(aa);
156 }
157
158 headerType hdr;
159
160 rawEchoType* ar;
161
162 MakePathname(file, path, "fmail.ar");
163
164 fp.Fopen(file, "rb", sharemode);
165 if (fp.isopen())
166 {
167 fp.Fread(&hdr, sizeof(headerType));
168 fp.FseekSet(hdr.headerSize);
169
170 ar = (rawEchoType*)throw_calloc(1, hdr.recordSize);
171 if (ar)
172 {
173 while (fp.Fread(ar, hdr.recordSize))
174 {
175 if(ar->options.active) {
176
177 aa.reset();
178
179 aa.groupid = 'A';
180 dword grp = ar->group;
181 while((grp & 1L) == 0) {
182 if((++aa.groupid) == 'Z')
183 break;
184 grp >>= 1;
185 }
186
187 //aa.groupid = (char)g_toupper((char)ar->group);
188 aa.aka = cfg->akaList[ar->address].nodeNum;
189 if(ar->options.local) {
190 aa.type = GMB_LOCAL;
191 aa.attr = attribslocal;
192 }
193 else {
194 aa.type = GMB_ECHO;
195 aa.attr = attribsecho;
196 }
197 switch(ar->msgKindsRA) {
198 case 1:
199 aa.attr.pvt1();
200 break;
201 case 0:
202 case 2:
203 aa.attr.pvt0();
204 break;
205 case 3:
206 aa.attr.r_o1();
207 break;
208 }
209 if(ar->board) {
210 aa.board = ar->board;
211 aa.basetype = "HUDSON";
212 }
213 else if(*ar->msgBasePath) {
214 aa.setpath(ar->msgBasePath);
215 aa.basetype = "JAM";
216 }
217
218 aa.setdesc(ar->comment);
219 aa.setechoid(ar->areaName);
220 aa.setorigin(ar->originLine);
221 AddNewArea(aa);
222 }
223 }
224 }
225
226 throw_free(ar);
227
228 fp.Fclose();
229 }
230
231 throw_delete(cfg);
232 }
233
234
235 // ------------------------------------------------------------------
236