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: gmopcbd.h,v 1.3 2005/10/07 12:41:11 stas_degteff Exp $ 24 // ------------------------------------------------------------------ 25 // PCBoard Structures. 26 // ------------------------------------------------------------------ 27 28 29 // ------------------------------------------------------------------ 30 // Only include once! 31 32 #ifndef __GMPCBD_H 33 #define __GMPCBD_H 34 35 36 // ------------------------------------------------------------------ 37 38 #include <gmoarea.h> 39 #include <gs_pcb.h> 40 #include <gusrpcb.h> 41 42 43 // ------------------------------------------------------------------ 44 45 #if defined(GOLD_CANPACK) 46 #pragma pack(1) 47 #endif 48 49 50 // ------------------------------------------------------------------ 51 52 typedef char PcbName[25+1]; 53 54 55 // ------------------------------------------------------------------ 56 // PCBoard Message Base Header (<msgbase>. file) 57 58 struct PcbBase { 59 60 int32_t highmsgno; // High Message Number (0 to 16,700,000) 61 int32_t lowmsgno; // Low Message Number (0 to 16,700,000) 62 int32_t active; // Number of Active Messages (0 to 32,767) 63 int32_t callers; // Number of System Callers (Main Message Base Only) 64 char locked[6]; // The "LOCKED" field for pre-14.2 systems (see note 1) 65 byte reserved[106]; // Reserved for future use 66 }; 67 68 69 // ------------------------------------------------------------------ 70 // PCBoard Individual Message Header (in <msgbase>. file) 71 72 struct PcbHdr { 73 74 char status; // Message Status Flag (see note 2) 75 int32_t msgno; // Message Number (0 to 16,700,000) 76 int32_t refno; // Reference Number (0 to 16,700,000) 77 byte blocks; // Number of 128 Byte Blocks in Message (see note 3) 78 char date[8]; // Date of Message Entry (in "mm-dd-yy" format) 79 char time[5]; // Time of Message Entry (in "hh:mm" format) 80 char destname[25]; // Name of the User to whom the Message is Addressed 81 int32_t replydate; // Date of the Reply Message (in yymmdd format) 82 char replytime[5]; // Time of the Reply Message (in "hh:mm" format) 83 char hasreply; // The Letter "R" if the Message has a Reply 84 char origname[25]; // Name of the User who wrote the Message 85 char subject[25]; // Subject of the Message 86 char password[12]; // Password Need to Read the Message (if any) 87 byte activestatus; // Active Status (225 = active, 226 = inactive) 88 char echoed; // The Letter "E" if the Message is to be Echoed 89 byte reserved[4]; // Reserved for future use 90 byte exthdrflags; // Extended Header Flags (version 15.0) 91 byte reserved2; // Reserved for future use 92 }; 93 94 95 // ------------------------------------------------------------------ 96 // PCBoard Extended Header (version 15.0) (in <msgbase>. file) 97 98 struct PcbExtHdr { 99 100 short id; // Extended Header ID = must be equal to 40FFh 101 char function[7]; // Extended Header Function 102 char colon; // A colon (:) character 103 char desc[60]; // Extended Header Description (subj, to, from, etc) 104 char status; // Status (N or R) 105 char separator; // Line Separator (E3h, or 0Dh for foreign systems) 106 }; 107 108 109 // ------------------------------------------------------------------ 110 // PCBoard Version 15.0 Style Index (<msgbase>.IDX file) 111 112 struct PcbIdx { 113 114 int32_t offset; // Offset (0 if none, >0 if active, <0 if killed) 115 int32_t num; // Message Number 116 char to[25]; // TO Name 117 char from[25]; // FROM Name 118 char status; // Status Character (from Message Header) 119 word date; // Date of Message (in julian date format) 120 char reserved[3]; // Reserved for future use 121 }; 122 123 124 // ------------------------------------------------------------------ 125 126 #if defined(GOLD_CANPACK) 127 #pragma pack() 128 #endif 129 130 131 // ------------------------------------------------------------------ 132 133 struct PcbData { 134 int fhmsg; 135 int fhidx; 136 int islocked; 137 PcbBase base; 138 }; 139 140 141 // ------------------------------------------------------------------ 142 143 struct PcbWide { 144 int isopen; 145 int fhusr; 146 int fhinf; 147 int userno; 148 PcbUser* user; 149 Path usersidxpath; 150 Path usersinf; 151 Path users; 152 int numareas; 153 PcbUsers usersrec; 154 PcbUsersInfHdr usershdr; 155 int32_t usershdrsize; 156 int32_t* lastread; 157 int32_t confbytelen; 158 int32_t extconflen; 159 int foreign; 160 const char* path; 161 }; 162 163 164 // ------------------------------------------------------------------ 165 166 class PcbArea : public gmo_area { 167 168 protected: 169 170 PcbWide* wide; 171 PcbData* data; 172 173 int just_scanning; 174 175 void data_open(); 176 void data_close(); 177 178 int test_open(const char* __file); 179 180 void raw_open(); 181 void raw_close(); 182 183 void save_lastread(); 184 void raw_scan(int __keep_index, int __scanpm=false); 185 int load_message(int __mode, gmsg* __msg, PcbHdr& __hdr); 186 void save_message(int __mode, gmsg* __msg, PcbHdr& __hdr); 187 188 public: 189 PcbArea()190 PcbArea() { wide = NULL; data = NULL; just_scanning = false; } ~PcbArea()191 virtual ~PcbArea() {} 192 havearrivedstamp()193 virtual bool havearrivedstamp() const { return false; } havereceivedstamp()194 virtual bool havereceivedstamp() const { return false; } requirehardterm()195 virtual bool requirehardterm() const { return true; } 196 197 // ---------------------------------------------------------------- 198 // Messagebase member functions 199 200 void open(); 201 void close(); 202 203 void suspend(); 204 void resume(); 205 206 void lock(); 207 void unlock(); 208 209 void scan(); 210 void scan_area(); 211 void scan_area_pm(); 212 213 int load_hdr(gmsg* msg); 214 int load_msg(gmsg* msg); 215 216 void save_hdr(int mode, gmsg* msg); 217 void save_msg(int mode, gmsg* msg); 218 219 void del_msg(gmsg* msg); 220 221 void new_msgno(gmsg* msg); 222 char* user_lookup(char* lookfor); 223 int renumber(); 224 225 void update_timesread(gmsg* msg); 226 227 Line* make_dump_msg(Line*& lin, gmsg* msg, char* lng_head); 228 }; 229 230 231 // ------------------------------------------------------------------ 232 233 extern PcbData* pcbdata; 234 extern PcbWide* pcbwide; 235 extern int pcbdatano; 236 237 238 // ------------------------------------------------------------------ 239 240 #endif 241 242 // ------------------------------------------------------------------ 243 244