1 //  This may look like C code, but it is really -*- C++ -*-
2 
3 //  ------------------------------------------------------------------
4 //  The Goldware Library
5 //  Copyright (C) 2000 Alexander S. Aganichev
6 //  ------------------------------------------------------------------
7 //  This program is free software; you can redistribute it and/or
8 //  modify it under the terms of the GNU General Public License as
9 //  published by the Free Software Foundation; either version 2 of the
10 //  License, or (at your option) any later version.
11 //
12 //  This program 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 //  General Public License for more details.
16 //
17 //  You should have received a copy of the GNU General Public License
18 //  along with this program; if not, write to the Free Software
19 //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 //  ------------------------------------------------------------------
21 //  $Id: gmosmb.h,v 1.3 2003/12/10 08:35:16 asa Exp $
22 //  ------------------------------------------------------------------
23 //  Based on freeware sources from Digital Dynamics
24 //  ------------------------------------------------------------------
25 //  Synchronet message base
26 //  ------------------------------------------------------------------
27 
28 #ifndef __GMOSMB_H
29 #define __GMOSMB_H
30 
31 
32 //  ------------------------------------------------------------------
33 
34 #include <smblib.h>
35 #include <gmoarea.h>
36 
37 
38 //  ------------------------------------------------------------------
39 
40 class SMBArea : public gmo_area {
41 
42 protected:
43 
44   smb_t *data;
45 
46   void  data_open();
47   void  data_close();
48 
49   void  raw_scan(bool keep_index=false, bool scanpm=false);
50   int   load_hdr(gmsg* __msg, smbmsg_t *msg);
51 
52 public:
53 
SMBArea()54   SMBArea() { data = NULL; }
~SMBArea()55   virtual ~SMBArea() {}
56 
issoftdelete()57   virtual bool issoftdelete() const { return true; }
58 
59   //  ----------------------------------------------------------------
60   //  Messagebase member functions
61 
62   void open();
63   void close();
64 
65   void suspend();
66   void resume();
67 
68   void lock();
69   void unlock();
70 
71   void scan();
72   void scan_area();
73   void scan_area_pm();
74 
load_hdr(gmsg * msg)75   int load_hdr(gmsg* msg) { return load_hdr(msg, NULL); }
76   int load_msg(gmsg* msg);
77 
78   void save_hdr(int mode, gmsg* msg);
79   void save_msg(int mode, gmsg* msg);
80 
81   void del_msg(gmsg* msg);
82 
83   void new_msgno(gmsg* msg);
84   char* user_lookup(char* lookfor);
85   int renumber();
86 
87   void update_timesread(gmsg* msg);
88 
89   Line* make_dump_msg(Line*& lin, gmsg* msg, char* lng_head);
90 };
91 
92 
93 //  ------------------------------------------------------------------
94 
95 extern smb_t *smbdata;
96 extern int smbdatano;
97 
98 
99 //  ------------------------------------------------------------------
100 
101 #endif
102 
103 //  ------------------------------------------------------------------
104