-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdocumentation.lisp
306 lines (216 loc) · 7.62 KB
/
documentation.lisp
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
(in-package #:org.shirakumo.maiden.modules.client-entities)
;; clients.lisp
(docs:define-docs
(type user-client
"Superclass for clients that communicate with users of some form.
See FIND-USER
See USERS
See ENSURE-USER
See AUTHENTICATE
See USER
See USERNAME")
(function find-user
"Attempt to find the user object of the given name on the client.
Note that if the user cannot be found, it does not necessarily
mean that the user does not exist at all, or does not exist on
the server at this time. You can only find users that the system
has already learned about in some way.
For some clients this may also be an accessor that allows you to
register user objects with the client.
See USER
See USER-CLIENT")
(function users
"Return a list of all known user objects on the client.
See USER
See USER-CLIENT")
(function ensure-user
"Either return the existing user of that name, or create it new. Either way, ensure it exists.
See USER
See FIND-USER
See USER-CLIENT")
(function authenticate
"Return whether it is known that the given user object is really that particular user, or might also be someone else.
In other words, this returns whether the identity of the user can
be trusted or not. Note that the check is not cached, and may thus
take some time or be costly in some fashion, as outside
communication might be necessary to confirm the identity.
See AUTHENTICATED-P")
(type channel-client
"Superclass for clients that provide the concept of a channel over which users can communicate with each other in a group.
See FIND-CHANNEL
See CHANNELS
See ENSURE-CHANNEL
See CHANNEL")
(function find-channel
"Attempt to find the channel object of the given name on the client.
Note that if the channel cannot be found, it does not necessarily
mean that the channel does not exist at all, or does not exist on
the server at this time. You can only find channels that the
system has already learned about in some way.
For some clients this may also be an accessor that allows you to
register channel objects with the client.
See CHANNEL
See CHANNEL-CLIENT")
(function channels
"Return a list of all known channel objects on the client.
See CHANNEL
See CHANNEL-CLIENT")
(function ensure-channel
"Either return the existing channel of that name, or create it new. Either way, ensure it exists.
See CHANNEL
See FIND-CHANNEL
See CHANNEL-CLIENT")
(type user-container
"Mixin for objects that can contain users in some way.
The standard implementation this offers uses an equalp hash-table
for the user storage, mapping user names to user objects.
See USER
See USER-MAP
See USERS
See FIND-USER
See REMOVE-USER
See ENSURE-USER")
(function user-map
"Accessor to the hash-table that maps user names to user objects on the user-container.
See USER-CONTAINER")
(function remove-user
"Remove the given user from the user-container.
See USER
See USER-CONTAINER")
(type channel-container
"Mixin for objects that contain channels in some way.
The standard implementation this offers uses an equalp hash-table
for the channel storage, mapping channel names to channel objects.
See CHANNEL
See CHANNEL-MAP
See CHANNELS
See FIND-CHANNEL
See REMOVE-CHANNEL
See ENSURE-CHANNEL")
(function channel-map
"Accessor to the hash-table that maps channel names to channel objects on the channel-container
See CHANNEL-CONTAINER")
(function remove-channel
"Remove the given channel from the channel-container.
See CHANNEL
See CHANNEL-CONTAINER")
(type simple-user-channel-client
"Superclass for a client that has both users and channels.
This class already handles the association/storage of user and
channel objects. User ENSURE-USER/CHANNEL to register users and
channels.
If you need to subclass USER or CHANNEL --which you probably
should anyway-- you should subclass SIMPLE-USER and SIMPLE-CHANNEL
instead, and override ENSURE-USER and ENSURE-CHANNEL to create
instances of the appropriate classes instead.
You will have to make sure that, when a user enters a channel, the
channel is registered to the user via FIND-CHANNEL on the user,
and the user is registered to the channel via FIND-USER on the
channel. The same goes when a user leaves a channel. However, you
do not need to do anything should a channel or a user be removed
from the client altogether, as in that case this generic system
can figure out what to do on its own and ensure consistency.
See USER-CLIENT
See CHANNEL-CLIENT
See USER-CONTAINER
See CHANNEL-CONTAINER
See SIMPLE-USER
See SIMPLE-CHANNEL")
(type simple-user
"Superclass for simple users.
Users can be in a number of channels.
See USER
See CHANNEL-CONTAINER")
(type simple-channel
"Superclass for simple channels.
Channels can contain a number of users.
See CHANNEL
See USER-CONTAINER"))
;; entities.lisp
(docs:define-docs
(type client-entity
"Superclass for all entities that are tied to a client instance somehow.
See NAMED-ENTITY
See CLIENT")
(type user
"Object representing a user on a remote system somewhere.
Users have a name and may be authenticated. Additional properties
are not guaranteed, but may be provided by a client.
See CLIENT-ENTITY
See AUTHENTICATE
See AUTHENTICATED-P
See USERNAME")
(function username
"Accessor to the entity's name on the client network.
This may or may not be distinct from the entity's NAME.
Especially clients may often want to keep a separate NAME
and USERNAME, as the name should stay the same on the local
core, but the username may possibly change or be different
depending on the network.
See USER
See USER-CLIENT")
(function authenticated-p
"Returns whether the user is authenticated or not.
This value is cached. The first time this is called on a user, it
may take a while.
See USER
See AUTHENTICATE")
(type channel
"Object representing a channel on a remote system somewhere.
Channels are virtual \"rooms\" over which one or more users may
communicate with each other.
Channels have a name and a number of users that inhabit it.
Additional properties are not guaranteed, but may be provided by a
client.
See CLIENT-ENTITY
See USERS"))
;; events.lisp
(docs:define-docs
(type user-event
"Superclass for all events relating to a user.
See CLIENT-EVENT
See USER")
(function user
"Reader for the user object the event relates to.
See USER-EVENT")
(type user-removed
"Event issued when a user can no longer be tracked by the client.
This does not necessarily mean that the user has left the remote
server.
See USER-EVENT")
(type user-added
"Event issued when a user is now tracked by the client.
See USER-EVENT")
(type user-name-changed
"Event issued when the name of a user has changed for some reason.
If you track users by name rather than by their object, you should
use this to update your records. The old name is kept in the OLD-
NAME slot.
See USER-EVENT
See OLD-NAME")
(function old-name
"Reader for the old name the user used to have. The user object should already have the new name.
See USER-NAME-CHANGED")
(type message-event
"Event issued when a textual message of some kind is sent.
Note that not all message-events are channel-events.
See MESSAGE
See USER-EVENT")
(function message
"Accessor to the message string carried by the event.
See MESSAGE-EVENT")
(type channel-event
"Superclass for all events relating to a channel.
See CHANNEL
See CLIENT-EVENT")
(function channel
"Reader for the channel object the event relates to
See CHANNEL-EVENT")
(type user-entered
"Event issued when a user entered a channel.
See USER-EVENT
See CHANNEL-EVENT")
(type user-left
"Event issued when a user left a channel.
See USER-EVENT
See CHANNEL-EVENT"))