-
Notifications
You must be signed in to change notification settings - Fork 0
/
MSGBASE.CPP
82 lines (64 loc) · 1.2 KB
/
MSGBASE.CPP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#define Use_MsgBase
#include "proboard.hpp"
MsgBaseList::MsgBaseList()
{
mblist[0] = NULL;
}
void
MsgBaseList::add(MsgBase *mb)
{
for(int i=0; mblist[i] ; i++) {}
mblist[i] = mb;
mblist[i+1] = NULL;
}
MsgBaseList::~MsgBaseList()
{
for(int i=0; mblist[i] ; i++) delete mblist[i];
}
void
MsgBaseList::open()
{
for(int i=0 ; mblist[i] ; i++) mblist[i]->open();
}
void
MsgBaseList::close()
{
for(int i=0 ; mblist[i] ; i++) mblist[i]->close();
MsgArea::close();
}
bool
MsgBaseList::lock()
{
for(int i=0 ; mblist[i] ; i++)
if(!mblist[i]->lock())
return FALSE;
return TRUE;
}
bool
MsgBaseList::unlock()
{
for(int i=0 ; mblist[i] ; i++)
if(!mblist[i]->unlock())
return FALSE;
return TRUE;
}
word
MsgBaseList::scanMail(MessageIndex *mi,word maxmsgs)
{
word left = maxmsgs;
for(int i=0; mblist[i] ; i++)
{
if(left>0) left -= mblist[i]->scanMail(&mi[maxmsgs-left],left);
}
return maxmsgs-left;
}
long
MsgBaseList::totalMsgs()
{
long total = 0;
for(int i=0; mblist[i] ; i++)
{
total += mblist[i]->totalMsgs();
}
return total;
}