|
@@ -415,8 +415,8 @@ functions:
|
415
|
415
|
|
416
|
416
|
[source,kotlin]
|
417
|
417
|
----
|
418
|
|
-'o' == getMode('@')
|
419
|
|
-"ov" == getModes("@+")
|
|
418
|
+getMode('@') == 'o'
|
|
419
|
+getModes("@+") == "ov"
|
420
|
420
|
----
|
421
|
421
|
|
422
|
422
|
.serverState.channelTypes (String)
|
|
@@ -473,15 +473,108 @@ the server.
|
473
|
473
|
|
474
|
474
|
===== Features
|
475
|
475
|
|
476
|
|
-TODO
|
|
476
|
+Features are KtIrc's way of exposing the information the server declares in
|
|
477
|
+its ISUPPORT messages. These describe how the server is configured, and what
|
|
478
|
+limits are placed on clients. You access features using the `features` map
|
|
479
|
+in the server state:
|
|
480
|
+
|
|
481
|
+[source,kotlin]
|
|
482
|
+----
|
|
483
|
+ircClient.serverState.features[ServerFeature.Network]
|
|
484
|
+----
|
|
485
|
+
|
|
486
|
+The following features are available:
|
|
487
|
+
|
|
488
|
+* `Network` - the name of the network the server belongs to __(String?)__
|
|
489
|
+* `ServerCaseMapping` - the current case mapping of the server __(CaseMapping!)__
|
|
490
|
+* `Modeprefixes` - the user mode prefix mapping (e.g. ov to @+) __(ModePrefixMapping!)__
|
|
491
|
+* `MaximumChannels` - the maximum number of channels a user can join __(Int?)__
|
|
492
|
+* `ChannelModes` - the modes supported in channels __(Array<String>?)__
|
|
493
|
+* `ChannelTypes` - the types of channel supported (e.g. "#&") __(String!)__
|
|
494
|
+* `MaximumChannelNameLength` - how long channel names may be __(Int!)__
|
|
495
|
+* `WhoxSupport` - whether the server supports extended whos ("WHOX") __(Boolean!)__
|
|
496
|
+
|
|
497
|
+[NOTE]
|
|
498
|
+====
|
|
499
|
+If the server does not define a feature, KtIrc will either fall back to a
|
|
500
|
+default value based on the IRC RFCs or common practice (for those features
|
|
501
|
+identified with a non-null type such as `Int!` or `String!`); otherwise
|
|
502
|
+the value of the feature will be `null` (such as for those identified as
|
|
503
|
+`Int?` or `String?` types).
|
|
504
|
+====
|
477
|
505
|
|
478
|
506
|
==== UserState
|
479
|
507
|
|
480
|
|
-TODO
|
|
508
|
+The client's UserState object tracks the details of all users in common
|
|
509
|
+channels. It can be used to find the most up-to-date and comprehensive
|
|
510
|
+information for those users, as well as the set of channels that we share
|
|
511
|
+with them.
|
|
512
|
+
|
|
513
|
+The UserState is accessed via the `userState` property of IrcClient and
|
|
514
|
+acts as a map, accessible using either a nickname or a `User` object:
|
|
515
|
+
|
|
516
|
+[source,kotlin]
|
|
517
|
+----
|
|
518
|
+ircClient.userState["acidBurn"]
|
|
519
|
+
|
|
520
|
+val user: User = myIrcEvent.user
|
|
521
|
+ircClient.userState[user]
|
|
522
|
+----
|
|
523
|
+
|
|
524
|
+The UserState returns a `KnownUser` object which exposes a `details`
|
|
525
|
+property containing the user details, and a `channels` property
|
|
526
|
+containing the common channel names. You can also use the `in`
|
|
527
|
+operator to check if the user is in a channel:
|
|
528
|
+
|
|
529
|
+[source,kotlin]
|
|
530
|
+----
|
|
531
|
+ircClient.userState["acidBurn"]?.let { knownUser ->
|
|
532
|
+ val accountName = knownUser.account
|
|
533
|
+ val inChannel = "#channel" in knownUser
|
|
534
|
+ val allChannels = knownUser.channels
|
|
535
|
+}
|
|
536
|
+----
|
481
|
537
|
|
482
|
538
|
==== ChannelState
|
483
|
539
|
|
484
|
|
-TODO
|
|
540
|
+The ChannelState keeps track of the state for all channels that the client
|
|
541
|
+is joined to. It is indexed by channel name:
|
|
542
|
+
|
|
543
|
+[source,kotlin]
|
|
544
|
+----
|
|
545
|
+ircClient.channelState["#ktirc"]
|
|
546
|
+----
|
|
547
|
+
|
|
548
|
+Each channel's state contains the following properties:
|
|
549
|
+
|
|
550
|
+* `receivingUserList` - boolean value indicating whether we are in the process
|
|
551
|
+ of receiving the list of users for the channel. If we are, the `users`
|
|
552
|
+ property will be incomplete.
|
|
553
|
+* `modesDiscovered` - boolean value indicating whether we have received the
|
|
554
|
+ full set of modes set on the channel. The `requestModesOnJoin` <<Behaviour>>
|
|
555
|
+ allows you to make KtIrc request these automatically.
|
|
556
|
+* `topic` - a ChannelTopic object representing the current channel topic.
|
|
557
|
+ If no topic is set, then a ChannelTopic with `null` properties will be
|
|
558
|
+ provided.
|
|
559
|
+* `users` - a map of all known users in the channel, see <<Channel users>>
|
|
560
|
+ for more information
|
|
561
|
+* `modes` - A map of the current channel modes and their values. Only
|
|
562
|
+ complete if `modesDiscovered` is true.
|
|
563
|
+
|
|
564
|
+===== Channel users
|
|
565
|
+
|
|
566
|
+Channel users are accessed using the `users` property, which provides an
|
|
567
|
+iterable map of nickname to `ChannelUser`. Each `ChannelUser` contains
|
|
568
|
+the nickname and current modes for that user. To get further details about
|
|
569
|
+a user, such as their hostmask or real name, you should query the <<UserState>>
|
|
570
|
+with the given nickname.
|
|
571
|
+
|
|
572
|
+[source,kotlin]
|
|
573
|
+----
|
|
574
|
+ircClient.channelState["#ktirc"]?.users?.forEach { user ->
|
|
575
|
+ println("${user.nickname} has modes ${user.modes}")
|
|
576
|
+}
|
|
577
|
+----
|
485
|
578
|
|
486
|
579
|
=== Events
|
487
|
580
|
|