-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmkopen.pas
104 lines (85 loc) · 2.45 KB
/
mkopen.pas
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
{ $O+,F+,I-,S-,R-,V-}
Unit MKOpen; {Open a message area using an MsgAreaId}
{ $I AQUAED.INC}
Interface
Uses MKMsgAbs;
Function OpenMsgArea(Var Msg: AbsMsgPtr; MsgAreaId: String): Boolean;
Function OpenOrCreateMsgArea(Var Msg: AbsMsgPtr; MsgAreaId: String): Boolean;
Function CloseMsgArea(Var Msg: AbsMsgPtr): Boolean;
Function InitMsgPtr(Var Msg: AbsMsgPtr; MsgAreaId: String): Boolean;
Function DoneMsgPtr(Var Msg: AbsMsgPtr): Boolean;
Implementation
Uses MKMsgHud, MKMsgFid, MKMsgSqu, MKMsgEzy, MKMsgJam;
{ Area ids begin with identifier for msg base type }
{ The following characters are already reserved }
{ B = PC-Board }
{ E = Ezycomm }
{ F = Fido *.Msg }
{ H = Hudson }
{ I = ISR - msg fossil }
{ J = JAM }
{ M = MK-Merlin }
{ P = *.PKT }
{ Q = QWK/REP }
{ R = Renegade }
{ S = Squish }
{ W = Wildcat }
Function OpenMsgArea(Var Msg: AbsMsgPtr; MsgAreaId: String): Boolean;
Begin
If InitMsgPtr(Msg, MsgAreaId) Then
Begin
OpenMsgArea := True;
If Msg^.OpenMsgBase <> 0 Then
Begin
OpenMsgArea := False;
If DoneMsgPtr(Msg) Then;
End;
End
Else
OpenMsgArea := False;
End;
Function OpenOrCreateMsgArea(Var Msg: AbsMsgPtr; MsgAreaId: String): Boolean;
Begin
If InitMsgPtr(Msg, MsgAreaId) Then
Begin
OpenOrCreateMsgArea := True;
If Not Msg^.MsgBaseExists Then
If Not Msg^.CreateMsgBase(200, 10) = 0 Then
OpenOrCreateMsgArea := False;
If Msg^.OpenMsgBase <> 0 Then
Begin
OpenOrCreateMsgArea := False;
If DoneMsgPtr(Msg) Then;
End;
End;
End;
Function CloseMsgArea(Var Msg: AbsMsgPtr): Boolean;
Begin
If Msg <> Nil Then Begin
CloseMsgArea := (Msg^.CloseMsgBase = 0);
DoneMsgPtr(Msg);
End Else
CloseMsgArea := False;
End;
Function InitMsgPtr(Var Msg: AbsMsgPtr; MsgAreaId: String): Boolean;
Begin
Msg := Nil;
InitMsgPtr := True;
Case UpCase(MsgAreaId[1]) of
'H': Msg := New(HudsonMsgPtr, Init);
'S': Msg := New(SqMsgPtr, Init);
'F': Msg := New(FidoMsgPtr, Init);
'E': Msg := New(EzyMsgPtr, Init);
'J': Msg := New(JamMsgPtr, Init);
Else
InitMsgPtr := False;
End;
If Msg <> Nil Then
Msg^.SetMsgPath(Copy(MsgAreaId, 2, 128));
End;
Function DoneMsgPtr(Var Msg: AbsMsgPtr): Boolean;
Begin
If Msg <> Nil Then Dispose(Msg, Done);
Msg := Nil;
End;
End.