Projects : yrc : yrc_completion

yrc/manual.txt

Dir - Raw

1The yrc manual
2
3Version 97 Kelvin
4Jacob Welsh
5
6Table of Contents
7 1 About yrc
8 2 Display
9 3 Commands
10 3.1 Slash commands
11 3.2 Keyboard commands
12 3.2.1 Anywhere
13 3.2.2 In the window list
14 3.2.3 At the prompt
15 3.2.4 In the scrollback window
16 4 Configuration
17 4.1 Keys
18 4.2 Logging
19 4.3 Example
20 5 Roadmap
21 6 News and contact
22 Footnotes
23
241. About yrc
25
26yrc is a text-based, screen-oriented Internet Relay Chat (IRC) client providing a vital dose of simplicity in a computing world drowning in complexity. There are certain things that just shouldn't have bugs, and in the author's opinion, chat programs are among them.
27
28Simple does not necessarily mean "user-friendly" in the sense that you can expect to operate it without reading this manual. It does mean the literate operator should be able to read and comprehend the manual in an hour or two, and on this basis to fully grasp the workings of the program with a little practice.
29
30For yrc to achieve its goals, the following decisions were made:
31
32 1. High-level language implementation. In a network-exposed, not performance-critical application, there's just no excuse for the possibility of invoking Undefined Behavior and the ensuing vulnerabilities.
33
34 2. Simple configuration mechanism employing the filesystem as a hierarchical key-value database; no structured format to parse. [1]
35
36 3. Support exclusively VT100-compatible terminals on Unix-like systems.
37
38 4. No dependencies besides POSIX. [2]
39
40 5. No superfluous features such as mIRC colors, DCC or CTCP. [3]
41
42 6. No Unicode or any other flavor of hieroglyphs. Control and 8-bit characters in any IRC string are sanitized on display, both to protect the terminal and show the operator exactly what he is receiving. [4]
43
44 7. No SSL/TLS/TLS_1.3/whatever-they're-calling-it-today. [5]
45
46It does support several niceties:
47
48 1. Multiple message windows (separated channels/conversations)
49
50 2. Maintenance of connections to multiple networks, defined either by configuration or on the fly
51
52 3. Round-robin server balancing independent of DNS
53
54 4. Unlimited scrollback [6]
55
56 5. Basic authentication (the PASS command)
57
58 6. Sending raw commands to the IRC server for unsupported features
59
60 7. Communication of internal state to the operator: unread messages, connection state
61
62 8. Chat logging
63
64It is written in Python 2.6 (though this is an implementation detail and subject to change). Some of its more reusable terminal interface code is included as a separate "yterm" module. The yrc+yterm code weighs in around 2390 raw lines, compressing to 19KB.
65
66yrc is written, published and maintained by JWRD Computing ( http://jwrd.net/ ).
67
682. Display
69
70The yrc display is designed to maximize information and context available on a single screen, because eyes move faster than fingers. It has five parts:
71
72 Title bar: shows a description of the current window, or the channel topic.
73
74 Window list: an index of open windows (see below).
75
76 Scrollback window: shows message history for a particular channel or private conversation, or server messages for a network, or general messages.
77
78 Status bar: typically, shows the current nickname, network, and message target.
79
80 Prompt: messages and commands are typed here.
81
82The window list is kept in alphabetical order, grouped by network, after the general messages window "yrc". An asterisk (*) in the first column indicates the currently selected window and a hyphen (-) the previous. Unread messages are indicated by a +N after the window name, where N is the number unread. A network's connection state is indicated by a symbol in front of its name, as follows:
83
84 Blank: Not connected
85
86 Tilde (~): Connection down: awaiting TCP handshake completion, or connection lost and waiting to reconnect
87
88 Hyphen (-): TCP connection established but not registered to the server
89
90 Equals (=): Fully registered; clear to send messages
91
923. Commands
93
94yrc is controlled using _slash commands_ and _keyboard commands_. Slash commands are entered at the prompt by starting the line with the forward "/" character. Most can be given as abbreviations, as indicated below. Some take one or more space-delimited arguments. To send a line starting with a slash as a normal message, use two slashes. Keyboard commands are invoked by typing special keys or key combinations.
95
96For interactive use, the phrases "current network" or "current channel" mean the network or channel of the currently selected window. For scripts (not yet implemented), they mean the network or channel under which the script is configured.
97
983.1. Slash commands
99
100 [c]onnect NETWORK [HOST[:PORT] [NICK [PASS]]]
101
102Connect to NETWORK, either preconfigured or with the given parameters.
103
104 [d]isconnect [NETWORK]
105
106Disconnect from NETWORK or the current network, or cancel a reconnection attempt.
107
108 [j]oin CHANNEL [KEY]
109
110Join a channel on the current network.
111
112 [k]ick USER [MESSAGE]
113
114Kick a user from the current channel.
115
116 [l]ist [CHANNEL]
117
118Request a list of channels and topics, or the status of a given channel, on the current network.
119
120 me MESSAGE
121
122Send MESSAGE as a CTCP ACTION (rendered by many clients in an alternate style showing the nickname as the start of a sentence).
123
124 [m]ode MODE {[CHANNEL] | NICK [CHANNEL]}
125
126[TODO; uncertain...] Set a mode on CHANNEL or the current channel, or a user mode on NICK in CHANNEL or the current channel.
127
128 msg {CHANNEL | NICK} [MESSAGE]
129
130Switch to the window for CHANNEL or NICK on the current network, creating one if needed, and send the given MESSAGE, if any. (This does not join a channel; messages to an unjoined channel might be rejected by the server.)
131
132 [na]mes [CHANNEL]
133
134Request the list of names in the given channel, or all visible channels and users on the current network.
135
136 [n]ick NICK
137
138Temporarily change nickname on the current network (persists across reconnections but not new connections).
139
140 [p]art [PART_MESSAGE]
141
142Leave the current channel, keeping its window open.
143
144 [q]uit [QUIT_MESSAGE]
145
146Disconnect from all networks and quit yrc.
147
148 [s]end COMMAND
149
150Send a raw IRC command to the server for the current network.
151
152 [st] set-topic TOPIC
153
154Set the topic for the current channel to TOPIC.
155
156 [t]opic [CHANNEL]
157
158Get the topic for the current channel or the given channel on the current network.
159
160 [w]hois NICK
161
162Request information on a user on the current network.
163
164 [ww] whowas NICK
165
166Request cached information for a disconnected user on the current network.
167
168 [x] close
169
170Close the current window, parting with no message if it is a channel.
171
172 [xn] close-net (TODO)
173
174Disconnect and close all windows for the current network.
175
1763.2. Keyboard commands
177
178In the Emacs tradition, C- means to hold Ctrl, and M- means to hold Alt (Meta).
179
180Some commands are multi-key sequences beginning with C-x. For these, you can either continue holding Ctrl or not. That is, C-x n is equivalent to C-x C-n. If necessary, an Alt combination can be emulated by pressing (not holding) Esc followed by the letter. Key sequences in progress are indicated in the status bar and can be cancelled with C-g.
181
182Each keyboard command has an associated name (used internally for key mapping and perhaps a future scripting feature). The mapping of some keys to commands depends on which part of the interface is focused. Most commands have multiple keybindings, providing a choice of Emacs, vi, or dedicated key styles. To become a more productive Unix user, it can't hurt to learn them all!
183
1843.2.1. Anywhere
185
186 C-x n: buflist-switch-next
187
188Switches to the next scrollback window in the list.
189
190 C-x p: buflist-switch-prev
191
192Switches to the previous scrollback window in the list.
193
194 C-x l: buflist-last-selected
195
196Switches to the previously active scrollback window.
197
198 C-x w: buflist-enter
199
200Moves focus to the window list (see 3.2.2).
201
202 C-l: redraw
203
204Performs a full redraw of the screen, e.g. in case of corruption from the output of another program.
205
2063.2.2. In the window list
207
208 C-n, j, Down: buflist-next
209
210Moves the cursor to the next entry in the window list.
211
212 C-p, k, Up: buflist-prev
213
214Moves the cursor to the previous entry in the window list.
215
216 h, Left: buflist-shrink
217
218Reduces window list width.
219
220 l, Right: buflist-grow
221
222Increases window list width.
223
224 M-<, g, Home: buflist-top
225
226Moves the cursor to the top of the window list.
227
228 M->, G, End: buflist-bottom
229
230Moves the cursor to the bottom of the window list.
231
232 Return (C-m): buflist-submit
233
234Activates the selected scrollback window and returns focus to where it was.
235
2363.2.3. At the prompt
237
238 Return (C-m): prompt-submit
239
240Submits the message or command given at the prompt.
241
242 Ins: prompt-exit
243
244Moves focus to the scrollback window (see 3.2.4).
245
246 C-b, Left: prompt-back
247
248Moves the cursor backward by one character.
249
250 C-f, Right: prompt-forward
251
252Moves the cursor forward by one character.
253
254 C-a, Home: prompt-start
255
256Moves the cursor to the start of the line.
257
258 C-e, End: prompt-end
259
260Moves the cursor to the end of the line.
261
262 M-b, prompt-back-word
263
264Moves the cursor to the start of the current word, or preceeding word if not currently in one.
265
266 M-f, prompt-forward-word
267
268Moves the cursor past the end of the current word, or following word if not currently in one.
269
270 C-p, Up: history-prev
271
272Recalls a previous line from input history. (History size is currently fixed at 1024 most recent entries.)
273
274 C-n, Down: history-next
275
276Recalls a subsequent line from input history, discarding any unsubmitted edits to a previous line.
277
278 Backspace (C-h, C-?): prompt-backspace
279
280Deletes backward by one character.
281
282 C-d, Del: prompt-delete
283
284Deletes forward by one character.
285
286 Tab (C-i): prompt-complete
287
288Completes word at cursor. Possible completions are drawn from slash commands, currently joined channel names, and nicknames present in the current channel. When the prefix is ambiguous, completes up to the longest common prefix of the candidates (i.e. goes as far as it can based on what was given).
289
290 C-u: kill-start
291
292Deletes text from start of line to cursor, saving it to the kill ring. (Kill ring size is currently fixed at 8 entries.)
293
294 C-k: kill-end
295
296Deletes text from cursor to end of line, saving it to the kill ring.
297
298 M-Backspace: kill-back-word
299
300Deletes text from cursor to start of current or preceeding word, saving it to the kill ring. Multiple kills in a row accumulate into a single entry, allowing the span to be pasted as a whole.
301
302 M-d: kill-forward-word
303
304Deletes text from cursor to end of current or following word, saving it to the kill ring.
305
306 C-y: yank
307
308Inserts ("yanks" or "pastes") the most recent kill ring entry at cursor position.
309
310 M-y: yank-next
311
312Following a yank, replaces the just-inserted text with the next older entry in the kill ring.
313
314 C-v, PgDn: scroll-down-page
315 M-v, PgUp: scroll-up-page
316
317Scrolls the active scrollback window.
318
319 M-<: scroll-top
320 M->: scroll-bottom
321
322Scrolls the active scrollback window to the top or bottom.
323
3243.2.4. In the scrollback window
325
326If the window is scrolled to the bottom (the last available message is fully visible), it will autoscroll as new messages arrive.
327
328 i, Ins: prompt-enter
329
330Moves focus to the prompt (see 3.2.3).
331
332 C-v, C-f, f, PgDn, Space: scroll-down-page
333 M-v, C-b, b, PgUp: scroll-up-page
334
335Scrolls the window down or up by a page.
336
337 C-n, j, Down: scroll-down-line
338 C-p, k, Up: scroll-up-line
339
340Scrolls the window down or up by one wrapped line.
341
342 M-<, g, Home: scroll-top
343 M->, G, End: scroll-bottom
344
345Scrolls to the top or bottom.
346
3474. Configuration
348
349As mentioned above, yrc is configured using the filesystem as a key-value store. The config tree is rooted at ~/.yrc (the hidden directory ".yrc" under your home directory), known as the yrc home. Each config key is represented by a text file; trailing linefeeds are stripped.
350
351Under the yrc home may be a "nets" subdirectory. IRC networks are defined by creating further subdirectories under "nets" with names of your choice; these names are used for NETWORK in the yrc commands.
352
3534.1. Keys
354
355The following keys may be defined at top level (directly in the yrc home) or per network, with network level taking precedence.
356
357 addrs -- one or more server addresses (required)
358 nick -- initial IRC nickname (required)
359 pass -- plain-text password to send on connect
360
361Addresses are specified one per line as either hostname or IPv4 address optionally followed by ":" and port number. Lines starting with the "#" character are ignored. Per common practice, the default port is 6667. On initial connection to a network, a server is selected at random; subsequent reconnections by the same process rotate sequentially through the list.
362
3634.2. Logging
364
365A "logs" tree is created automatically under the yrc home with subdirectories for each network. Messages associated with chats are appended to log files under these, named by VENUE.log where VENUE is the channel name or correspondent nick, casefolded and %-encoded for problematic characters. [7] To suppress logging for a particular entity, you could symlink its log file to /dev/null.
366
367yrc behaves as if each log file is opened fresh on each write, in the sense that deleting, truncating, renaming or linking log files works immediately and as expected. [8] yrc attempts to write each message with a single system call, so concurrent processes should be safe, though not recommended.
368
369The log format, designed for a degree of human and machine readability, is one message per line with the following single-space-delimited fields:
370
371 timestamp -- decimal integer, centiseconds since the epoch
372 type -- mostly matching the IRC protocol but with some variation; consult the "message" variant type in yrc.py for details
373 sender -- quoted in <angle brackets> for aesthetics
374 content -- running to end of line
375
376Note that unlike in the UI, message content is not escaped; the only characters excluded by protocol are ASCII NUL, CR and LF. Thus printing a log directly to terminal (as opposed to using an editor or "less") can cause unexpected and possibly dangerous behavior.
377
3784.3. Example
379
380An example tree, including some planned keys not yet implemented:
381
382~/.yrc
383|-- nets
384| |-- net1
385| | |-- auto
386| | |-- addrs
387| | |-- nick
388| | |-- pass
389| | |-- chans
390| | | `-- #somechan
391| | | |-- auto
392| | | `-- key
393| | `-- contacts
394| | `-- buddy
395| `-- net2
396| `-- addrs
397|-- nick
398|-- realname
399|-- user
400`-- logs
401 |-- net1
402 | |-- buddy.log
403 | `-- #channel.log
404 `-- net2
405 `-- 1337%2Fhax0r%0A.log
406
4075. Roadmap
408
409High-priority missing features:
410
411 - Finish mode/op and close-net commands
412 - Scrolling in window list if it exceeds available screen rows
413 - More accurate derivation of message length limit to reduce overly-conservative wrapping
414
415Nice to have:
416
417 - Indication of nick mentions (ring bell + bold the window name?)
418 - Formatting for displayed messages (e.g. bold sender, highlight own nick)
419 - Filtering of inbound PMs (/ignore or similar)
420 - More efficient navigation of window list
421 - Search in scrollback
422 - Nickname fallback
423 - Online /help command
424 - Auto-connect/join or scripting
425 - Parse WHOIS/WHOWAS/LIST responses
426 - Bracketed paste [meh, not all it's cracked up to be]
427 - Date change messages
428 - Channel join status indicators
429 - Finish config fields [?]
430
4316. News and contact
432
433News can be found in the yrc category on the author's blog: http://fixpoint.welshcomputing.com/category/software/yrc/
434
435Questions/comments can be left on articles there or by visiting #fixpoint on Freenode.
436
437Footnotes
438
439[1] Inspired by DJB software, http://cr.yp.to/.
440
441[2] Not even "ncurses", a lesson learned from the first implementation. It's a mess.
442
443[3] With the possible exception of CTCP ACTION (the /me command) due to its popularity.
444
445[4] Contrary to presently popular opinion, this does not preclude non-English communication. It's simpler, and probably healthier, for people to learn "pinyin"/transliteration systems to a single alphabet, than to have every program pretend to support some Consortium's never-finished Babel of an infinite alphabet and all the related landmines. Double-width characters in fixed-width fonts; bidirectionality; combining ligatures, diacritics, and canonicalization thereof; surrogate escapes; multiple types of spaces; characters that look the same but aren't; non-standard private mappings; variable length encodings; byte orderings; decode error handling; glyph substitution because no single font designer can hope to provide complete coverage... are you scared yet?
446
447[5] Historically it's had more holes than Swiss cheese -- in design, in every major implementation -- and there's no cause to imagine that just one more patch release will fix everything. Use good cryptography if you need it, and stop deluding yourself otherwise.
448
449[6] Well, limited by your available memory. It would take a very busy channel indeed to make a serious dent in today's memory sizes, but in such a case, you can reclaim memory by closing its specific window from time to time.
450
451[7] Control and 8-bit characters plus ".", "/" and "%"; this does not include various shell metacharacters.
452
453[8] Currently this is in fact the implementation, which may result in interface lag e.g. on network filesystems. FD caching or a separate log thread are possible remedies if anyone cares.