Irc.myr is a simple IRC client for IRC. It runs in a terminal, providing a curses-line interface. It is implemented as a single Myrddin file·
Irc.myr supports most basic functionality that one would expect in an IRC client, with multiple servers and channels, logging, and so on.
As usual, I'm continuing with my hubris. This tool is implemented
in pure Myrddin, from the system call layer
on up. The networking is implemented using the functions from
Terminal drawing is done using libtermdraw. There's no other code involved. All farm-fresh, free-range Myrddin.
To build irc.myr, I first had to finish up the dependencies. Most of what I needed was already in libstd, although I ran into a bug with my DNS resolver not recursing correctly on cname records.
The dependency that needed the most work was libtermdraw. I'd started libtermdraw seeing how far I could get with the standard ANSI escape code set, but quickly realized that ther was a lot of fairly basic functionality that wouldn't work quite right across many terminals. For example, page up and page down keys really did need terminfo. So, I wrote a terminfo parser, and hooked it in.
Terminfo format strings are crazy. They're stack machines, complete with branching and persistent registers. There's a good rant or two in there.
From there, it was all pretty smooth sailing. The subset of the IRC protocol I care about is simple, and it's easy to implement a client.
As of November 15, 2017, I have switched to using irc.myr as my only IRC client, replacing irssi fully.
Irc.myr runs ~/.ircrc when you start it. ~/.ircrc contains a list of commands, as would be typed in directly at the command line.
/connect irc.eigenstate.org /nick Ori /join #myrddin eigenstate /connect irc.freenode.org /nick Ori_B /msg NickServ -srv freenode identify my-pass0rd /join #proglangdesign freenode /join #cat-v freenode /join #more-channels
Irc.myr has them.
/help [cmd...]: Get help [on cmd...] /connect dialstr: Connect to server /quit: Exit irc.myr /join chan [srv]: Join channel on server /leave [chan]: Leave current channel /chan name: switch to channnel 'name' /win name: switch to channnel 'name' /names: List nicks in current channel /srv srv Set the focus to srv /msg [-srv srv] nick Send nick a message, optionally on server /nick name Set your nick name /user name Set your user name
ctrl+n Focus next channel ctrl+p Focus previous channel ctrl+l Refresh screen up arrow Scroll up one line down arrow Scroll down one line page up key Scroll up one page page down key Scroll down one page
ctrl+a Move cursor to start of line ctrl+e Move cursor to end of line ctrl+u Kill current line ctrl+y Paste last killed line ctrl+w Kill word before cursor Home Move to start of line End Move to end of line Backspace Same as everything else
Building and Installing
First, you will need a working myrddin installation. irc.myr is developed against the git version of myrddin, so will need to install that, as described here. For clarity, the instructions are repeated here:
git clone git://git.eigensatate.org/ori/mc.git cd mc make sudo make install
Build and install the terminal drawing library:
git clone git://git.eigenstate.org/npnth/libtermdraw.git cd libtermdraw mbld sudo mbld install
Then build and install irc.myr:
git clone git://git.eigenstate.org/ori/irc.myr.git cd irc.myr mbld sudo mbld install
Then, you run it:
- Connections happen in the foreground, which can cause UI jank.
- There are a number of commands that are not implemented (/me, etc)
- The chat history is an unbounded log. It should be replaced with a ringbuffer.
- Line wrapping is a bit rough, and doens't do word splits