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 // Copyright (C) 1999-2000 Alexander S. Aganichev 7 // ------------------------------------------------------------------ 8 // This library is free software; you can redistribute it and/or 9 // modify it under the terms of the GNU Library General Public 10 // License as published by the Free Software Foundation; either 11 // version 2 of the License, or (at your option) any later version. 12 // 13 // This library is distributed in the hope that it will be useful, 14 // but WITHOUT ANY WARRANTY; without even the implied warranty of 15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 // Library General Public License for more details. 17 // 18 // You should have received a copy of the GNU Library General Public 19 // License along with this program; if not, write to the Free 20 // Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21 // MA 02111-1307, USA 22 // ------------------------------------------------------------------ 23 // $Id: gmoezyc.h,v 1.3 2005/10/07 12:41:11 stas_degteff Exp $ 24 // ------------------------------------------------------------------ 25 // Ezycom msgbase. 26 // ------------------------------------------------------------------ 27 28 29 // ------------------------------------------------------------------ 30 // Only include once! 31 32 #ifndef __GMEZYC_H 33 #define __GMEZYC_H 34 35 36 // ------------------------------------------------------------------ 37 38 #include <gmoarea.h> 39 #include <gusrezyc.h> 40 41 #if defined(GOLD_CANPACK) 42 #pragma pack(1) 43 #endif 44 45 46 // ------------------------------------------------------------------ 47 // Ezycom constants 48 49 #define EZYC_MAXNAME 36 50 #define EZYC_MAXSUBJ 73 51 #define EZYC_MAXMESS102 1024 52 #define EZYC_MAXMESS110 1536 53 #define EZYC_USERSBUF 100 54 55 #define EZYC_USERDELETED 0x0001 56 57 58 // ------------------------------------------------------------------ 59 60 const byte EZYC_MSGATTR_DELETED = 0x01; 61 const byte EZYC_MSGATTR_NETPEND = 0x02; 62 const byte EZYC_MSGATTR_RESERVED = 0x04; 63 const byte EZYC_MSGATTR_PRIVATE = 0x08; 64 const byte EZYC_MSGATTR_RECEIVED = 0x10; 65 const byte EZYC_MSGATTR_ECHOPEND = 0x20; 66 const byte EZYC_MSGATTR_LOCAL = 0x40; 67 const byte EZYC_MSGATTR_NOKILL = 0x80; 68 69 const byte EZYC_NETATTR_KILLSENT = 0x01; 70 const byte EZYC_NETATTR_SENT = 0x02; 71 const byte EZYC_NETATTR_ATTACH = 0x04; 72 const byte EZYC_NETATTR_CRASH = 0x08; 73 const byte EZYC_NETATTR_FREQ = 0x10; 74 const byte EZYC_NETATTR_RREQ = 0x20; 75 const byte EZYC_NETATTR_AREQ = 0x40; 76 const byte EZYC_NETATTR_RREC = 0x80; 77 78 const byte EZYC_EXTATTR_RSVD1 = 0x01; 79 const byte EZYC_EXTATTR_RSVD2 = 0x02; 80 const byte EZYC_EXTATTR_RSVD3 = 0x04; 81 const byte EZYC_EXTATTR_RSVD4 = 0x08; 82 const byte EZYC_EXTATTR_RSVD5 = 0x10; 83 const byte EZYC_EXTATTR_RSVD6 = 0x20; 84 const byte EZYC_EXTATTR_RSVD7 = 0x40; 85 const byte EZYC_EXTATTR_SEEN = 0x80; 86 87 88 // ------------------------------------------------------------------ 89 // Ezycom message header 90 91 struct EzycHdr { 92 93 word replyto; 94 word reply1st; 95 96 uint32_t startposition; 97 uint32_t messagelength; 98 99 Addr destnet; 100 Addr orignet; 101 102 word cost; // redefine to replynext? 103 104 byte msgattr; 105 byte netattr; 106 byte extattr; 107 108 FTime posttimedate; 109 FTime recvtimedate; 110 111 char whoto[EZYC_MAXNAME]; 112 char whofrom[EZYC_MAXNAME]; 113 char subject[EZYC_MAXSUBJ]; 114 }; 115 116 117 // ------------------------------------------------------------------ 118 // Ezycom LASTCOMB.BBS record structure 119 120 struct EzycLast { 121 word combinedinfo; 122 word lastreadinfo[16]; 123 }; 124 125 126 // ------------------------------------------------------------------ 127 // Ezycom MSGFAST.BBS record structure 128 129 struct EzycFast { 130 dword whoto; // 32 bit CRC on WhoTo in MSGHxxx.BBS 131 word msgboard; 132 word msgnumber; 133 }; 134 135 136 // ------------------------------------------------------------------ 137 // Ezycom MSGDLTD.BBS record 138 139 struct EzycDeleted { 140 word msgboard; 141 word msgnumber; 142 }; 143 144 145 // ------------------------------------------------------------------ 146 147 #if defined(GOLD_CANPACK) 148 #pragma pack() 149 #endif 150 151 152 // ------------------------------------------------------------------ 153 154 struct EzycData { 155 int fhhdr; 156 int fhtxt; 157 int fhnow; 158 int omode; 159 int smode; 160 int timesposted; 161 int islocked; 162 Path ezyfile; 163 }; 164 165 166 // ------------------------------------------------------------------ 167 168 struct EzycWide { 169 int ver; 170 EzycomUser* user; 171 int userno; 172 int maxmess; 173 const char* msgbasepath; 174 const char* userbasepath; 175 }; 176 177 178 // ------------------------------------------------------------------ 179 180 class EzycomArea : public gmo_area { 181 182 protected: 183 184 EzycWide* wide; 185 EzycData* data; 186 187 void data_open(); 188 void data_close(); 189 190 char* ret_mess_xxx(char* __path, byte __type); 191 char* ret_mess_area(char* __path); 192 193 int raw_open(); 194 195 void test_raw_open(int __fileline); 196 void raw_close(); 197 int test_open(const char* __file, int __mode, int __share); 198 199 void save_lastread(); 200 201 void raw_scan(int __keep_index); 202 203 int load_message(int __mode, gmsg* __msg, EzycHdr& __hdr); 204 void save_message(int __mode, gmsg* __msg, EzycHdr& __hdr); 205 206 207 public: 208 EzycomArea()209 EzycomArea() { wide = NULL; data = NULL; } ~EzycomArea()210 virtual ~EzycomArea() {} 211 havereceivedstamp()212 virtual bool havereceivedstamp() const { return false; } requiresoftterm()213 virtual bool requiresoftterm() const { return true; } 214 215 // ---------------------------------------------------------------- 216 // Messagebase member functions 217 218 void open(); 219 void close(); 220 221 void suspend(); 222 void resume(); 223 224 void lock(); 225 void unlock(); 226 227 void scan(); 228 void scan_area(); 229 void scan_area_pm(); 230 231 int load_hdr(gmsg* msg); 232 int load_msg(gmsg* msg); 233 234 void save_hdr(int mode, gmsg* msg); 235 void save_msg(int mode, gmsg* msg); 236 237 void del_msg(gmsg* msg); 238 239 void new_msgno(gmsg* msg); 240 char* user_lookup(char* lookfor); 241 int renumber(); 242 243 void update_timesread(gmsg* msg); 244 245 Line* make_dump_msg(Line*& lin, gmsg* msg, char* lng_head); 246 }; 247 248 249 // ------------------------------------------------------------------ 250 251 extern EzycWide* ezycomwide; 252 extern EzycData* ezycomdata; 253 extern int ezycomdatano; 254 255 256 // ------------------------------------------------------------------ 257 258 #endif 259 260 // ------------------------------------------------------------------ 261 262