Welcome to mirror list, hosted at ThFree Co, Russian Federation.

MKServerModel.h « MumbleKit « src - github.com/mumble-voip/mumblekit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 476114a53a312e0db7280c7e31b13be5a6ffeb45 (plain)
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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
// Copyright 2010-2012 The MumbleKit Developers. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#import <MumbleKit/MKUser.h>
#import <MumbleKit/MKChannel.h>
#import <MumbleKit/MKConnection.h>
#import <MumbleKit/MKTextMessage.h>
#import <MumbleKit/MKPermission.h>
#import <MumbleKit/MKAccessControl.h>

@class MulticastDelegate;
@class MKServerModel;

/**
 * MKServerModelDelegate is the delegate of MKServerModel.
 * It is called to notify any registered delegates of events happening on the server, or
 * of replies to previously sent messages.
 */
@protocol MKServerModelDelegate

// All members are currently optional.
@optional

///------------------------------------------
/// @name Connection and disconnection events
///------------------------------------------

/**
 * Called upon successfully authenticating with a server.
 * This method is deprecated, see serverModel:joinedServerAsUser:withWelcomeMessage:.
 *
 * @param model  The MKServerModel object in which this event originated.
 * @param user   The MKUser object representing the local user.
 */
- (void) serverModel:(MKServerModel *)model joinedServerAsUser:(MKUser *)user;

/**
 * Called upon successfully authenticating with a server.
 *
 * @param model  The MKServerModel object in which this event originated.
 * @param user   The MKUser object representing the local user.
 * @param msg    The welcome message presented by the server.
 */
- (void) serverModel:(MKServerModel *)model joinedServerAsUser:(MKUser *)user withWelcomeMessage:(MKTextMessage *)msg;

/**
 * Called when disconnected from the server (forcefully or not).
 *
 * @param model  The MKServerModel object in which this event originated.
 */
- (void) serverModelDisconnected:(MKServerModel *)model;

///-------------------
/// @name User changes
///-------------------

/**
 * Called when a new user joins the server.
 *
 * @param model  The MKServerModel object in which this event originated.
 * @param user   The user who joined the server.
 */
- (void) serverModel:(MKServerModel *)model userJoined:(MKUser *)user;

/**
 * Called when the talk state of a user changes.
 * This event is fired when the audio subsystem (MKAudio and its minions) notify
 * the MKServerModel that audio data from a user on the connection handled by the
 * server model is being played back.
 *
 * @param model  The MKServerModel object in which this event originated.
 * @param user   The user whose talk state changed.
 */
- (void) serverModel:(MKServerModel *)model userTalkStateChanged:(MKUser *)user;

/**
 * Called when a user is renamed.
 *
 * @param model  The MKServerModel object in which this event originated.
 * @param user   The user that was renamed.
 */
- (void) serverModel:(MKServerModel *)model userRenamed:(MKUser *)user;

/**
 * Called when a user is moved to another channel.
 * This is also called when a user changes the channel he resides in (in which
 * case user is equivalent to mover).
 *
 * In case the server initiated the move, the mover is nil.
 *
 * @param model  The MKServerModel object in which this event originated.
 * @param user   The user that was moved.
 * @param chan   The channel to which user was moved to.
 * @param mover  The user that performed the user move. If the move was
 *               performed by the server, mover is nil.
 *
 */
- (void) serverModel:(MKServerModel *)model userMoved:(MKUser *)user toChannel:(MKChannel *)chan byUser:(MKUser *)mover;

/**
 * Called when a user is moved to another channel.
 * This is also called when a user changes the channel he resides in (in which
 * case user is equivalent to mover).
 *
 * In case the server initiated the move, the mover is nil.
 *
 * @param model     The MKServerModel object in which this event originated.
 * @param user      The user that was moved.
 * @param chan      The channel to which user was moved to.
 * @param prevChan  The channel from which the user was moved. (May be nil)
 * @param mover     The user that performed the user move. If the move was
 *                  performed by the server, mover is nil.
 *
 */
- (void) serverModel:(MKServerModel *)model userMoved:(MKUser *)user toChannel:(MKChannel *)chan fromChannel:(MKChannel *)prevChan byUser:(MKUser *)mover;

/**
 * Called when a user's comment is changed.
 *
 * @param model  The MKServerModel in which this event originated.
 * @param user   The user whose comment was changed.
 */
- (void) serverModel:(MKServerModel *)model userCommentChanged:(MKUser *)user;

/**
 * Called when a user's texture is changed.
 *
 * @param model  The MKServerModel in which this event originated.
 * @param user   The user whose texture was changed.
 */
- (void) serverModel:(MKServerModel *)model userTextureChanged:(MKUser *)user;

///--------------------
/// @name Text messages
///--------------------

/**
 * Called whenever a text message is receieved.
 *
 * @param model  The MKServerModel in which this event originated.
 * @param msg    The MKTextMessage object representing the received text message.
 * @param user   The MKUser that sent the text message (nil if the message was sent by the server).
 */
- (void) serverModel:(MKServerModel *)model textMessageReceived:(MKTextMessage *)msg fromUser:(MKUser *)user;

///--------------------------------
/// @name Self-mute and self-deafen
///--------------------------------

/**
 * Called when a user self-mutes himself.
 *
 * @param model  The MKServerModel object in which this event originated.
 * @param user   The user who self-muted himself.
 */
- (void) serverModel:(MKServerModel *)model userSelfMuted:(MKUser *)user;

/**
 * Called when a user removes his self-mute status.
 *
 * @param model  The MKServerModel object in which this event originated.
 * @param user   The user who removed his self-mute status.
 */
- (void) serverModel:(MKServerModel *)model userRemovedSelfMute:(MKUser *)user;

/**
 * Called when a user self-mute-deafens himself.
 *
 * @param model  The MKServerModel in which this event originated.
 * @param user   The user who self-muted and self-deafened himself.
 */
- (void) serverModel:(MKServerModel *)model userSelfMutedAndDeafened:(MKUser *)user;

/**
 * Called when a user removes his self-mute-deafen status.
 *
 * @param model  The MKServerModel in which this event originated.
 * @param user   The user who removed his self-mute-deafen status.
 */
- (void) serverModel:(MKServerModel *)model userRemovedSelfMuteAndDeafen:(MKUser *)user;

/**
 * Called by the MKServerModel when a user's self-mute-deafen status changes.
 *
 * @param model  The MKServerModel in which this event originated.
 * @param user   The user whose self-mute-deafen status changed.
 */
- (void) serverModel:(MKServerModel *)model userSelfMuteDeafenStateChanged:(MKUser *)user;

///----------------------------------------
/// @name Muting, deafening and suppressing
///----------------------------------------

/**
 * Called when a user mutes-deafens another user.
 *
 * @param model  The MKServerModel in which this event originated.
 * @param user   The user who was mute-deafened.
 * @param actor  The user who initiated the mute-deafen action on the other user.
 *               May be nil if the server mute-deafened the user. 
 */
- (void) serverModel:(MKServerModel *)model userMutedAndDeafened:(MKUser *)user byUser:(MKUser *)actor;

/**
 * Called when a user removes mute-deafen status from another user.
 *
 * @param model  The MKServerModel in which this event originated.
 * @param user   The user whose mute-deafen status was removed.
 * @param actor  The user who iniated the removal of the other user's mute-deafen status.
 *               May be nil if the server removed the mute-deafen status.
 */
- (void) serverModel:(MKServerModel *)model userUnmutedAndUndeafened:(MKUser *)user byUser:(MKUser *)actor;

/**
 * Called when a user is muted by another user.
 *
 * @param model  The MKServerModel in which this event originated.
 * @param user   The user who was muted.
 * @param actor  The user who muted the other user. May be nil if the user was muted by
 *               the server.
 */
- (void) serverModel:(MKServerModel *)model userMuted:(MKUser *)user byUser:(MKUser *)actor;

/**
 * Called when a user is unmuted by another user.
 *
 * @param model  The MKServerModel in which this event originated.
 * @param user   The user who was unmuted.
 * @param actor  The user who unmuted the other user. May be nil if the user was unmuted by the
 *               server.
 */
- (void) serverModel:(MKServerModel *)model userUnmuted:(MKUser *)user byUser:(MKUser *)actor;

/**
 * Called when a user is deafened by another user.
 *
 * @param model  The MKServerModel in which this event originated.
 * @param user   The user who was deafened.
 * @param actor  The user who deafened the other user. May be nil if the user was deafened by
 *               the server.
 */
- (void) serverModel:(MKServerModel *)model userDeafened:(MKUser *)user byUser:(MKUser *)actor;

/**
 * Called when a user is undeafened by another user.
 *
 * @param model  The MKServerModel in which this event originated.
 * @param user   The user who was undeafened.
 * @param actor  The user who undeafened the other user. May be nil if the user was undeafened
 *               by the server.
 */
- (void) serverModel:(MKServerModel *)model userUndeafened:(MKUser *)user byUser:(MKUser *)actor;

/**
 * Called when a user is suppressed by another user.
 *
 * @param model  The MKServerModel in which this event originated.
 * @param user   The user who was suppressed.
 * @param actor  The user who suppressed the other user. May be nil if the user was
 *               suppressed by the server.
 */
- (void) serverModel:(MKServerModel *)model userSuppressed:(MKUser *)user byUser:(MKUser *)actor;

/**
 * Called when a user is unsuppressed by another user. 
 *
 * @param model  The MKServerModel in which this event originated.
 * @param user   The user who was unsuppressed.
 * @param actor  The user who unsuppresed the other user. May be nil if the user was
 *               unsupressed by the server.
 */
- (void) serverModel:(MKServerModel *)model userUnsuppressed:(MKUser *)user byUser:(MKUser *)actor;

/**
 * Called when a user's mute state changes.
 *
 * @param model  The MKServerModel in which this event originated.
 * @param user   The user whose mute state changed.
 */
- (void) serverModel:(MKServerModel *)model userMuteStateChanged:(MKUser *)user;

///------------------------------
/// @name Other user flag changes
///------------------------------

/**
 * Called when the user's authenticated flag changes.
 *
 * @param model  The MKServerModel in which this event originated.
 * @param user   The user whose authenticated flag changed. 
 */
- (void) serverModel:(MKServerModel *)model userAuthenticatedStateChanged:(MKUser *)user;

/**
 * Called when a user's priorty speaker flag changes.
 *
 * @param model  The MKServerModel in which this event originated.
 * @param user   The user whose priority speaker flag changed.
 */
- (void) serverModel:(MKServerModel *)model userPrioritySpeakerChanged:(MKUser *)user;

/**
 * Called when a user's recording flag changes.
 *
 * @param model   The MKServerModle in which this event originated.
 * @param user    The user whose recording flag changed.
 */
- (void) serverModel:(MKServerModel *)model userRecordingStateChanged:(MKUser *)user;

///--------------------
/// @name Leaving users
///--------------------

/**
 * Called when a user is banned by another user (or the server).
 * When a user is banned, he is also kicked from the server at the
 * same time.
 *
 * @param model   The MKServerModel in which this event originated.
 * @param user    The user that was banned.
 * @param actor   The user that banned the other user. May be nil if the
 *                ban was initiated by the server.
 * @param reason  The reason for the ban.
 */
- (void) serverModel:(MKServerModel *)model userBanned:(MKUser *)user byUser:(MKUser *)actor forReason:(NSString *)reason;

/**
 * Called when a user is kicked by another user (or the server).
 *
 * @param model   The MKServerModel in which this event originated.
 * @param user    The user that was kicked.
 * @param actor   The user that kicked the other user. May be nil if the
 *                server initiated the kick.
 * @param reason  The reason for kicking the user off the server.
 */
- (void) serverModel:(MKServerModel *)model userKicked:(MKUser *)user byUser:(MKUser *)actor forReason:(NSString *)reason;

/**
 * Called when a user disconnects from the server.
 *
 * @param model   The MKServerModel in which this event originated.
 * @param user    The user that disconnected.
 */
- (void) serverModel:(MKServerModel *)model userDisconnected:(MKUser *)user;

/**
 * Called when a user leaves the server.
 *
 * @param model   The MKServerModel in which this event originated.
 * @param user    The user that left the server.
 */
- (void) serverModel:(MKServerModel *)model userLeft:(MKUser *)user;

///-----------------------------
/// @name Channel-related events
///-----------------------------

/**
 * Called when a new channel is added.
 *
 * @param model    The MKserverModel in which this event originated.
 * @param channel  The channel that was added.
 */
- (void) serverModel:(MKServerModel *)model channelAdded:(MKChannel *)channel;

/**
 * Called when a channel is removed from the server.
 *
 * @param model    The MKServerModel in which this event originated.
 * @param channel  The channel that was removed.
 */
- (void) serverModel:(MKServerModel *)model channelRemoved:(MKChannel *)channel;

/**
 * Called when a channel is renamed.
 *
 * @param model    The MKServerModel in which this event originated.
 * @param channel  The channel that was renamed.
 */
- (void) serverModel:(MKServerModel *)model channelRenamed:(MKChannel *)channel;

/**
 * Called when a channel's position is changed.
 *
 * @param model    The MKServerModel in which this event originated.
 * @param channel  The channel whose position was changed.
 */
- (void) serverModel:(MKServerModel *)model channelPositionChanged:(MKChannel *)channel;

/**
 * Called when a channel (and all of its subchannels, and users) is re-parented.
 *
 * @param model    The MKServerModel in which this event originated.
 * @param channel  The channel that was moved.
 */
- (void) serverModel:(MKServerModel *)model channelMoved:(MKChannel *)channel;

/**
 * Called when a channel description is changed.
 *
 * @param model    The MKServerModel in which this event originated.
 * @param channel  The channel whose description was changed.
 */
- (void) serverModel:(MKServerModel *)model channelDescriptionChanged:(MKChannel *)channel;

/**
 * Called when a complete list of links for a channel is receieved. (This happens
 * mostly during initial connect).
 *
 * @param model     The MKServerModel in which this event originated.
 * @param newLinks  An array of channels whose links were changed.
 * @param channel   The channel for which newLinks were set for.
 */
- (void) serverModel:(MKServerModel *)model linksSet:(NSArray *)newLinks forChannel:(MKChannel *)channel;

/**
 * Called when new channels links are added to a channel.
 *
 * @param model     The MKServerModel in which this event originated.
 * @param newLinks  An array of channels that the channel was linked to.
 * @param channel   The channel that the links were added to.
 */
- (void) serverModel:(MKServerModel *)model linksAdded:(NSArray *)newLinks toChannel:(MKChannel *)channel;

/**
 * Called when channel links are removed from a channel.
 *
 * @param model         The MKServerModel in which this event originated.
 * @param removedLinks  An array of channels that were unlinked from the channel.
 * @param channel       The channel that the links were removed from.
 */
- (void) serverModel:(MKServerModel *)model linksRemoved:(NSArray *)removedLinks fromChannel:(MKChannel *)channel;

/**
 * Called when a channel's links change.
 *
 * @param model    The MKServerModel in which this event originated.
 * @param channel  The channel whose links changed.
 */
- (void) serverModel:(MKServerModel *)model linksChangedForChannel:(MKChannel *)channel;

///-------------------------------------
/// @name Errors and missing permissions
///-------------------------------------

/**
 * Called when a permission error occurred for a given channel for a given user.
 *
 * @param  model    The MKServerModel in which this permission error occurred.
 * @param  perm     The permission that was denied
 * @param  user     The user for whom the permission was denied.
 * @param  channel  The channel in which the permission was denied.
 */
- (void) serverModel:(MKServerModel *)model permissionDenied:(MKPermission)perm forUser:(MKUser *)user inChannel:(MKChannel *)channel;

/**
 * Called when a channel was attempted to be named or renamed to something
 * which was not allowed by the server.
 *
 * @param  model  The MKServerModel in which this error occured.
 */
- (void) serverModelInvalidChannelNameError:(MKServerModel *)model;

/**
 * Called when an attempt to modify the SuperUser failed.
 *
 * @param  model  The MKServerModel in which the error occurred.
 */
- (void) serverModelModifySuperUserError:(MKServerModel *)model;

/**
 * Called when the server received a text message that was too long.
 *
 * @param  model  The MKServerModel in which the error occurred.
 */
- (void) serverModelTextMessageTooLongError:(MKServerModel *)model;

/**
 * Called when an action could not be performed on a temporary channel.
 *
 * @param  model  The MKServerModel in which the error occurred.
 */
- (void) serverModelTemporaryChannelError:(MKServerModel *)model;

/**
 * Called when a certificate is needed, but not persent, for a given operation.
 *
 * @param  model  The MKServerModel in which the error occurred.
 * @param  user   The user who did not have a certificate.
 */
- (void) serverModel:(MKServerModel *)model missingCertificateErrorForUser:(MKUser *)user;

/**
 * Called when an action involving an invalid username occurs.
 *
 * @param  model  The MKServerModel in which this error occurred.
 * @param  name   The name that was deemed invalid by the server. May be nil.
 */
- (void) serverModel:(MKServerModel *)model invalidUsernameErrorForName:(NSString *)name;

/**
 * Called when a channel user move operation failed because the destination
 * channel was full. (Note: A joinChannel: also counts as a move operation.)
 *
 * @param  model  The MKServerModel in which this error occurred.
 */
- (void) serverModelChannelFullError:(MKServerModel *)model;

/**
 * Called when a channel create operation failed because the channel
 * name was invalid.
 *
 * @param  model  The MKServerModel in which this error occurred.
 */
- (void) serverModelChannelNameError:(MKServerModel *)model;

/**
 * Called when a simple 'Permission denied.' message is sufficient to show to the user.
 * Can include a reason. This kind of permission error is also used as a fallback, if
 * the server detects that a client is using a too old version of the Mumble protocol
 * to understand all error types.
 *
 * @param  model   The MKServerModel in which this error occurred.
 * @param  reason  The reason for the error. May be nil if no reason was given.
 */
- (void) serverModel:(MKServerModel *)model permissionDeniedForReason:(NSString *)reason;

/**
 * Called after an access control request
 *
 * @param  model            The MKServerModel in which this event originated.
 * @param  accessControl    The requested access control.
 * @param  channel          The channel to which access control refers.
 */
- (void) serverModel:(MKServerModel *)model didReceiveAccessControl:(MKAccessControl *)accessControl forChannel:(MKChannel *)channel;

@end

/**
 * MKServerModel wraps an MKConnection and acts as its message handler. It provides an
 * easy to use interface for interacting with a Mumble server.
 */
@interface MKServerModel : NSObject <MKMessageHandler>

///---------------------
/// @name Initialization
///---------------------

/**
 * Initialize a MKServerModel with the given connection.
 *
 * @param connection  The connection that the MKServerModel should handle.
 */
- (id) initWithConnection:(MKConnection *)connection;

///-------------------------
/// @name Handling delegates
///-------------------------

/**
 * Add a delegate. The delegate may only implement parts of the MKServerModelDelegate protocol.
 *
 * @param delegate  The delegate to add.
 */
- (void) addDelegate:(id)delegate;

/**
 * Remove a delegate from the MKServerModel.
 *
 * @param delegate  The delegate to remove.
 */
- (void) removeDelegate:(id)delegate;

///-------------------------
/// @name Server Information
///-------------------------

/**
 * Returns the hostname of the server that the MKServerModel is currently connected to.
 */
- (NSString *) hostname;

/**
 * Returns the port of the server that the MKServerModel is currently connected to.
 */
- (NSInteger) port;

///-----------------------
/// @name Users operations
///-----------------------

/**
 * Returns the connected user. The connected user is the user that 
 */
- (MKUser *) connectedUser;

/**
 * Look up a user by session ID.
 *
 * @param session  The session ID to look up.
 *
 * @returns  Returns the user with the given session ID. Returns nil
 *           if the user does not exist on the server.
 *
 */
- (MKUser *) userWithSession:(NSUInteger)session;

/**
 * Look up a user by hash. Most commonly, the hash of a user is the SHA1 digest
 * of their X.509 certificate.
 *
 * @param hash  The hash to look up. (Typically a hex-encoded SHA1 digest).
 *
 * @returns  Returns the user with the given hash. Returns nil if the user
 *           does not exist on the server.
 */
- (MKUser *) userWithHash:(NSString *)hash;

///-------------------------
/// @name Channel operations
///-------------------------

/**
 * Get the root channel of the server the underlying MKConnection is currently
 * connected to.
 *
 * @returns  Returns a MKChannel object pointing to the root channel.
 */
- (MKChannel *) rootChannel;

/**
 * Look up a channel by its channel ID.
 *
 * @param channelId  The channel ID to look up.
 */
- (MKChannel *) channelWithId:(NSUInteger)channelId;

/**
 * Ask the underlying connection to join the given channel.
 *
 * @param channel  The channel to join.
 */
- (void) joinChannel:(MKChannel *)channel;

/**
 * Create a new channel in the server the underlying MKConnection is currently
 * connected to.
 *
 * @param channelName   The name of the channel to create.
 * @param parent        The MKChannel that must contain the newly created one.
 * @param temp          Specify if the channel is temporary or not.
 */
- (void) createChannelWithName:(NSString *)channelName parent:(MKChannel *)parent temporary:(BOOL)temp;

/**
 * Ask the underlying connection to receive the access control for the given channel.
 *
 * @param channel  The channel for which you are requesting the access control.
 */
- (void) requestAccessControlForChannel:(MKChannel *)channel;

/**
 * Set access control for a channel.
 *
 * @param acl       The access control you want to set.
 * @param channel   The channel for which you are setting the access control.
 */
- (void) setAccessControl:(MKAccessControl *)accessControl forChannel:(MKChannel *)channel;

///------------------------------
/// @name Text message operations
///------------------------------

/**
 * Send a text message to the given destinations.
 *
 * One, or multiple of tree, channels and users must be passed to the method.
 *
 * Sending a message to a chnanel is the same as sending to all users in that channel;
 * receivers cannot distinguish between receiving a 'channel' message, and a message
 * specifically targetted at them.
 *
 * @param  txtMsg The text message to send.
 *
 * @param  trees  An NSArray of MKChannel objects (or nil). The message will be sent to
 *                all channels in this array, and recursively to their descendants
 *                (subchannels, children of subchannels, and so on).
 *
 * @param  channels  An NSArray of MKChannel objects (or nil). The message will be sent to all
 *                   channels in this array.
 *
 * @param  users  An NSArray of MKUser objects (or nil).
 *
 */
- (void) sendTextMessage:(MKTextMessage *)txtMsg toTreeChannels:(NSArray *)trees andChannels:(NSArray *)channels andUsers:(NSArray *)users;

/**
 * Send a message to all users in the channel chan and all of its descendants
 * (subchannels, children of subchannels, and so on).
 *
 * @param  txtMsg  The text message to send.
 * @param  chan    The destination channel.
 */
- (void) sendTextMessage:(MKTextMessage *)txtMsg toTree:(MKChannel *)chan;

/**
 * Send a message to all users in the the channel chan.
 *
 * @param  txtMsg  The text message to send.
 * @param  chan    The destination channel.
 */
- (void) sendTextMessage:(MKTextMessage *)txtMsg toChannel:(MKChannel *)chan;

/**
 * Send a message to the user user.
 *
 * @param  txtMsg  The text message to send.
 * @param  user    The user to send the message to.
 */
- (void) sendTextMessage:(MKTextMessage *)txtMsg toUser:(MKUser *)user;

///------------------------
/// @name Server operations
///------------------------

/**
 * Set the list of access tokens for the currently connected user.
 *
 * @param tokens  An NSArray of strings containing the tokens to use as access tokens for the
 *                connected user.
 */
- (void) setAccessTokens:(NSArray *)tokens;

/**
 * Get the server's certificate chain.
 */
- (NSArray *) serverCertificates;

/**
 * Get whether or not the certificate chain is verified by the system's root CAs.
 */
- (BOOL) serverCertificatesTrusted;

///-----------------------------
/// @name Mute/deafen operations
///-----------------------------

- (void) setSelfMuted:(BOOL)selfMuted andSelfDeafened:(BOOL)selfDeafened;

///------------------------
/// @name Self Registration
///------------------------

/**
 * Registers the currently connected user with the server.
 */
- (void) registerConnectedUser;

@end