-
Notifications
You must be signed in to change notification settings - Fork 0
/
output.h
274 lines (223 loc) · 6.61 KB
/
output.h
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
// -*- C++ -*-
//
// Output and derived classes, interfaces.
//
// Copyright 1992-2021 Deven T. Corzine <[email protected]>
//
// SPDX-License-Identifier: MIT
//
// Check if previously included.
#ifndef _OUTPUT_H
#define _OUTPUT_H 1
// Types of Output subclasses.
enum OutputType {
UnknownOutput, TextOutput, PublicMessage, PrivateMessage,
EntryOutput, ExitOutput, TransferOutput, AttachOutput,
DetachOutput, HereOutput, AwayOutput, BusyOutput,
GoneOutput, CreateOutput, DestroyOutput, JoinOutput,
QuitOutput, PublicOutput, PrivateOutput, PermitOutput,
DepermitOutput, AppointOutput, UnappointOutput, RenameOutput
};
// Classifications of Output subclasses.
enum OutputClass { UnknownClass, TextClass, MessageClass, NotificationClass };
class OutputObj: public Object {
public:
OutputType Type; // Output type.
OutputClass Class; // Output class.
Timestamp time; // Timestamp.
// constructor
OutputObj(OutputType t, OutputClass c, time_t when = 0): Type(t), Class(c),
time(when) { }
virtual ~OutputObj() { } // destructor
virtual void output(Telnet *telnet) { abort(); }
};
class Text: public OutputObj {
protected:
const char *text;
public:
Text(const char *buf): OutputObj(TextOutput, TextClass), text(buf) { }
~Text() { delete [] text; }
void output(Telnet *telnet);
};
class Message: public OutputObj {
protected:
friend class Session;
Pointer<Name> from;
Pointer<Sendlist> to;
String text;
public:
Message(OutputType type, Name *sender, Sendlist *dest, const char *msg):
OutputObj(type, MessageClass), from(sender), to(dest), text(msg) { }
void output(Telnet *telnet);
};
class EntryNotify: public OutputObj {
protected:
Pointer<Name> name;
public:
EntryNotify(Name *who, time_t when = 0):
OutputObj(EntryOutput, NotificationClass, when), name(who) { }
void output(Telnet *telnet);
};
class ExitNotify: public OutputObj {
protected:
Pointer<Name> name;
public:
ExitNotify(Name *who, time_t when = 0):
OutputObj(ExitOutput, NotificationClass, when), name(who) { }
void output(Telnet *telnet);
};
class TransferNotify: public OutputObj {
protected:
Pointer<Name> name;
public:
TransferNotify(Name *who, time_t when = 0):
OutputObj(TransferOutput, NotificationClass, when), name(who) { }
void output(Telnet *telnet);
};
class AttachNotify: public OutputObj {
protected:
Pointer<Name> name;
public:
AttachNotify(Name *who, time_t when = 0):
OutputObj(AttachOutput, NotificationClass, when), name(who) { }
void output(Telnet *telnet);
};
class DetachNotify: public OutputObj {
protected:
Pointer<Name> name;
boolean intentional;
public:
DetachNotify(Name *who, boolean i, time_t when = 0):
OutputObj(DetachOutput, NotificationClass, when), name(who),
intentional(i) { }
void output(Telnet *telnet);
};
class HereNotify: public OutputObj {
protected:
Pointer<Name> name;
public:
HereNotify(Name *who, time_t when = 0):
OutputObj(HereOutput, NotificationClass, when), name(who) { }
void output(Telnet *telnet);
};
class AwayNotify: public OutputObj {
protected:
Pointer<Name> name;
public:
AwayNotify(Name *who, time_t when = 0):
OutputObj(AwayOutput, NotificationClass, when), name(who) { }
void output(Telnet *telnet);
};
class BusyNotify: public OutputObj {
protected:
Pointer<Name> name;
public:
BusyNotify(Name *who, time_t when = 0):
OutputObj(BusyOutput, NotificationClass, when), name(who) { }
void output(Telnet *telnet);
};
class GoneNotify: public OutputObj {
protected:
Pointer<Name> name;
public:
GoneNotify(Name *who, time_t when = 0):
OutputObj(GoneOutput, NotificationClass, when), name(who) { }
void output(Telnet *telnet);
};
class CreateNotify: public OutputObj {
protected:
Pointer<Discussion> discussion;
public:
CreateNotify(Discussion *d, time_t when = 0):
OutputObj(CreateOutput, NotificationClass, when), discussion(d) { }
void output(Telnet *telnet);
};
class DestroyNotify: public OutputObj {
protected:
Pointer<Discussion> discussion;
Pointer<Name> name;
public:
DestroyNotify(Discussion *d, Session *s, time_t when = 0);
void output(Telnet *telnet);
};
class JoinNotify: public OutputObj {
protected:
Pointer<Discussion> discussion;
Pointer<Name> name;
public:
JoinNotify(Discussion *d, Session *s, time_t when = 0);
void output(Telnet *telnet);
};
class QuitNotify: public OutputObj {
protected:
Pointer<Discussion> discussion;
Pointer<Name> name;
public:
QuitNotify(Discussion *d, Session *s, time_t when = 0);
void output(Telnet *telnet);
};
class PublicNotify: public OutputObj {
protected:
Pointer<Discussion> discussion;
Pointer<Name> name;
public:
PublicNotify(Discussion *d, Session *s, time_t when = 0);
void output(Telnet *telnet);
};
class PrivateNotify: public OutputObj {
protected:
Pointer<Discussion> discussion;
Pointer<Name> name;
public:
PrivateNotify(Discussion *d, Session *s, time_t when = 0);
void output(Telnet *telnet);
};
class PermitNotify: public OutputObj {
protected:
Pointer<Discussion> discussion;
Pointer<Name> name;
boolean is_explicit;
public:
PermitNotify(Discussion *d, Session *s, boolean flag, time_t when = 0);
void output(Telnet *telnet);
};
class DepermitNotify: public OutputObj {
protected:
Pointer<Discussion> discussion;
Pointer<Name> name;
boolean is_explicit;
Pointer<Name> removed;
public:
DepermitNotify(Discussion *d, Session *s, boolean flag, Session *who,
time_t when = 0);
void output(Telnet *telnet);
};
class AppointNotify: public OutputObj {
protected:
Pointer<Discussion> discussion;
Pointer<Name> appointer;
Pointer<Name> appointee;
public:
AppointNotify(Discussion *d, Session *s1, Session *s2, time_t when = 0);
void output(Telnet *telnet);
};
class UnappointNotify: public OutputObj {
protected:
Pointer<Discussion> discussion;
Pointer<Name> unappointer;
Pointer<Name> unappointee;
public:
UnappointNotify(Discussion *d, Session *s1, Session *s2, time_t when = 0);
void output(Telnet *telnet);
};
class RenameNotify: public OutputObj {
protected:
String oldname;
String newname;
public:
RenameNotify(String oldstr, String newstr, time_t when = 0):
OutputObj(RenameOutput, NotificationClass, when), oldname(oldstr),
newname(newstr) { }
void output(Telnet *telnet);
};
#endif // output.h