@sockethub/platform-irc 4.0.0-beta.0 → 4.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,11 +10,17 @@ messages.
10
10
 
11
11
  ## Implemented Verbs (`type`)
12
12
 
13
+ * **connect** - Open the IRC connection after credentials are stored
13
14
  * **send** - Send messages to channels or users
14
15
  * **join** - Join IRC channels
15
16
  * **leave** - Leave IRC channels
16
- * **observe** - Monitor channel activity and user events
17
- * **update** - Update user information (nick, etc.)
17
+ * **update** - Change a nick (`address`) or a channel topic (`topic`)
18
+ * **query** - List who is in a channel, or list channels on the server
19
+ * **disconnect** - Close the IRC connection
20
+
21
+ Incoming chat, joins, presence, and nick changes arrive as messages. There is
22
+ no separate observe command. `/me` is a `send` whose `object.content` starts
23
+ with `/me`.
18
24
 
19
25
  ## Usage
20
26
 
@@ -137,7 +143,8 @@ name as it appears on IRC (for example `#general`).
137
143
  },
138
144
  "target": {
139
145
  "id": "newnick@irc.libera.chat",
140
- "type": "person"
146
+ "type": "person",
147
+ "name": "newnick"
141
148
  },
142
149
  "object": {
143
150
  "type": "address"
@@ -145,6 +152,40 @@ name as it appears on IRC (for example `#general`).
145
152
  }
146
153
  ```
147
154
 
155
+ ### Nick changes
156
+
157
+ `target.name` is the nick sent in `NICK`. `target.id` is that nick as a person
158
+ id, `newnick@server`. On success the connection is re-keyed to that actor.
159
+ Later commands must use the new `actor.id`.
160
+
161
+ The client library moves stored credentials, connect, and join entries when
162
+ the update is acknowledged without an error, and when the server reports a
163
+ rename of an actor this session holds. The credential object stays as
164
+ submitted (`nick`, `password`, `token`, and the rest). The live connection is
165
+ selected by a fingerprint of that original object, so a reconnect that also
166
+ rewrites `nick` misses it and opens another session. See the
167
+ [client guide](../../docs/client-guide.md#irc-nick-changes).
168
+
169
+ A callback or message that contains `error` means the nick did not change.
170
+ Keep the previous actor. That includes:
171
+
172
+ * Another account is already stored for the target actor, in this session or
173
+ in another session on the same connection. `NICK` is not sent. The error is
174
+ `cannot rename <old-actor> to <new-actor>: credentials already stored for <new-actor>`.
175
+ The same credential object already stored at the new actor is not a
176
+ collision.
177
+ * The IRC server rejects the nick. The callback `error` is the server's
178
+ reason text. These numeric replies fail the command instead of leaving it
179
+ waiting: 431 (no nickname), 432 (erroneous nickname), 433 (nickname in
180
+ use), 436 (collision), 437 (temporarily unavailable), and 438 (nick change
181
+ too fast; sent by solanum, ircu, and Unreal).
182
+
183
+ A server-forced rename of this connection arrives as an `update` with
184
+ `object.type` `address`, `actor` the previous identity and `target` the new
185
+ one. If Sockethub cannot re-key the worker, that message includes `error`
186
+ and the session stays on the previous actor. Other users' nick changes use
187
+ the same shape and are delivered as ordinary messages.
188
+
148
189
  ### Query Attendance Example
149
190
 
150
191
  ```json
@@ -386,6 +427,44 @@ distinction clear:
386
427
  }
387
428
  ```
388
429
 
430
+ ### Private addresses
431
+
432
+ The platform refuses to connect to loopback, private, link-local, and cloud
433
+ metadata addresses, using the same address rules as the
434
+ [outbound URL guard](../../docs/configuration.md#outbound-url-guard). To reach
435
+ an IRC server on a private network, set `allowPrivateAddresses` in this
436
+ platform's `packageConfig` entry:
437
+
438
+ ```json
439
+ {
440
+ "packageConfig": {
441
+ "@sockethub/platform-irc": {
442
+ "allowPrivateAddresses": true
443
+ }
444
+ }
445
+ }
446
+ ```
447
+
448
+ Do not enable it on a server that accepts untrusted clients. Any client could
449
+ then make Sockethub connect to internal services.
450
+
451
+ ## Messages and CTCP
452
+
453
+ A normal `send` is a channel or private `PRIVMSG`. The request schema only
454
+ accepts `object.type` `message`; the content decides the IRC command. Content
455
+ starting with `/me` is sent as a CTCP `ACTION` and content starting with
456
+ `/notice` is sent as a `NOTICE`, with the prefix stripped. An incoming
457
+ `ACTION` is delivered with `object.type` `me`. An incoming `NOTICE` is
458
+ delivered as a plain `message`.
459
+
460
+ Other incoming CTCP is not delivered to the application. The platform answers
461
+ `VERSION` with `Sockethub <platform version>` and `PING` by echoing the
462
+ argument. Other requests, and every CTCP reply, are ignored. Sending CTCP
463
+ other than `me` is not supported.
464
+
465
+ Channel and private `send` values, nicks, and topics must not contain CR or
466
+ LF. A value that does is rejected before anything is written to the socket.
467
+
389
468
  ## Features
390
469
 
391
470
  * **Channel communication**: Join and participate in IRC channels