IRC


IRC Primer

Internet Relay Chat (IRC) is an open protocol that uses TCP and optionally TLS. IRC was born in August 1988, by Jarkko Oikarinen at the University of Oulu in Finland. Years later, in 1993, was standardised as RFC 1459. Assigned port 194/TCP by IANA, however in practice most use 6667/TCP, and nearby ports (6660-6669, 7000).

Each client session is assigned a unique identifier called a hostmask, which takes the form nick!user@host. Some networks (such as freenode) offer cloaks to show affiliation with a project, by altering the hostmask. For example alex@123.45.67.89 could become alex@gnu.org/AlexZ. They’re basically a badge of pride and legimaticy of who you say you are.

  1. Install a client (e.g. weechat).
  2. Register a server (e.g. freenode) /server add freenode chat.freenode.net/6697 -ssl -autoconnect or /server add oftc irc.oftc.net/6697 -ssl -autoconnect
  3. Set your nick /nick snazzybeard
  4. Register nick with NickServ /msg NickServ REGISTER password user@domain.com
  5. You’ll receive an email from NickServ, with a one off verification code.
  6. Verify with NickServ /msg NickServ VERIFY REGISTER vimjock abcdefg
  7. Group other nicks you want to the same account. /nick myothercoolnick then /msg NickServ IDENTIFY vimjock password then /msg NickServ GROUP
  8. In the future, once registered, you can login with the IDENTIFY command /msg NickServ IDENTIFY vimjock password
  9. Join a channel /join ##C or /join #cjeopardy

Channels

The means of communicating with a group of users. Basic channel operations include joining /join #channel, leaving /part #channel, and listing /list. Channel prefixes encode the following meanings:

  • # channel that is available across the entire IRC net
  • ## or more hashes, indicates its off topic
  • & channel local to a server
  • + modeless
  • ! timestamped channel

The most effective way to find a channel is by asking alis. Alis supports these options:

  • min <n>: show only channels with at least users
  • max <n>: show only channels with at most users
  • skip <n>: skip first matches
  • show [m][t]: show modes/topicsetter
  • mode <+|-|=><modes>: modes set/unset/equal
  • topic <pattern>: topic matches pattern
  • showsecret: show secret channels (requires chan:auspex)

Examples:

/msg alis LIST searchterm
/msg alis LIST * -topic multiple*ordered*search*terms
/msg alis LIST * -min 50
/msg alis LIST #foo*
/msg alis LIST #foo* -mode =n
/msg alis LIST *freetopic* -mode -t -show mt
/msg alis LIST ##nocolors* -mode +c -show t

ChanServ is the bot responsible for channel management, and doesn’t mind when you ask for help /msg ChanServ help:

***** ChanServ Help *****
ChanServ gives normal users the ability to maintain control
of a channel, without the need of a bot. Channel takeovers are
virtually impossible when a channel is registered with ChanServ.
Registration is a quick and painless process. Once registered,
the founder can maintain complete and total control over the channel.
Please note that channels will expire if there are no eligible channel successors.
   
For more information on a command, type:
/msg ChanServ help <command>
For a verbose listing of all commands, type:
/msg ChanServ help commands

The following commands are available:
FLAGS           Manipulates specific permissions on a channel.
INVITE          Invites you to a channel.
OP              Gives channel ops to a user.
RECOVER         Regain control of your channel.
REGISTER        Registers a channel.
SET             Sets various control flags.
UNBAN           Unbans you on a channel.

Other commands: ACCESS, AKICK, CLEAR, COUNT, DEOP, DEVOICE,
                DROP, GETKEY, HELP, INFO, QUIET, STATUS,
                SYNC, TAXONOMY, TEMPLATE, TOPIC, TOPICAPPEND,
                TOPICPREPEND, TOPICSWAP, UNQUIET, VOICE,
                WHY

Channel Modes

Mode Name Description
b channel ban +b nick!user@host (wildcards * and ? supported)
c colour filter Strip colour and formatting codes from channel messages.
C block CTCPs Blocks client-to-client protocol commands.
e ban exemption Overrides +b and +q bans. Example: /mode #channel +bee *!*@*.example.com *!*someuser@host3.example.com $a:JohnDoe would block all users from example.com, while still allowing someuser from host3 and JohnDoe to join.
f forward Users who cannot join the channel (because of +i, +j, +r, see below) are instead sent to the given channel.
F enable forwarding Allow operators in other channels to forward clients to this channel, without requiring ops.
g free invite Anybody in the channel may invite others.
i invite only Users are unable to join invite-only channels unless they are invited or match a +I entry.
I invite exemption Takes a ban parameter.
j join throttle Takes one parameter of the form n:t. Only n users may join in each period of t seconds, so with e.g. 3:10 only 3 users could join within 10 seconds. Invited users can join regardless of +j, but are counted as normal. You can use this mode to prevent bot attacks. This mode can be combined with +f to forward throttled users to an overflow channel.
k password To enter the channel, you must specify the password on your /join command.
l join limit Limits the number of users who can be in the channel at the same time.
m moderated Only opped and voiced users can send to the channel.
n prevent external send Users outside the channel may not send messages to it. Keep in mind that bans and quiets will not apply to external users.
p private The KNOCK command cannot be used on the channel, and users will not be shown the channel in whois output unless they share the channel with the requestor. The channel will still appear in channel lists and WHO output (set channel mode +s if this is not desired).
q quiet Works like +b (ban user), but allows matching users to join the channel.
Q block forwarded users Users cannot be forwarded (see +f above) to a channel with +Q.
r block unidentified Prevents users who are not identified to services from joining the channel.
s secret This channel will not appear on channel lists or WHO or WHOIS output unless you are on it.
S SSL-only Only users connected via SSL may join the channel while this mode is set. Users already in the channel are not affected. Keep in mind that this also blocks all webchat users, as they are not marked as connected via SSL.
t ops topic Only channel operators may set the channel topic.
z reduced moderation The effects of +b, +q, and +m are relaxed. For each message, if that message would normally be blocked by one of these modes, it is instead sent to channel operators (+o).

Channel Flags

FLAGS are how channel privileges are granted and removed, /msg ChanServ help flags:

***** ChanServ Help *****
Help for FLAGS:

The FLAGS command allows for the granting/removal of channel
privileges on a more specific, non-generalized level. It
supports nicknames, groups and hostmasks as targets.

When only the channel argument is given, a listing of
permissions granted to users will be displayed.

Syntax: FLAGS <#channel>

Otherwise, an access entry is modified. A modification may be
specified by a template name (changes the access to the
template) or a flags change (starts with + or -). See the
TEMPLATE help entry for more information about templates.

Syntax: FLAGS <#channel> [nickname|hostmask|group template]
Syntax: FLAGS <#channel> [nickname|hostmask|group flag_changes]

Permissions:
    +v - Enables use of the voice/devoice commands.
    +V - Enables automatic voice.
    +o - Enables use of the op/deop commands.
    +O - Enables automatic op.
    +s - Enables use of the set command.
    +i - Enables use of the invite and getkey commands.
    +r - Enables use of the unban command.
    +R - Enables use of the recover, sync and clear commands.
    +f - Enables modification of channel access lists.
    +t - Enables use of the topic and topicappend commands.
    +A - Enables viewing of channel access lists.
    +S - Marks the user as a successor.
    +F - Grants full founder access.
    +b - Enables automatic kickban.
    +e - Exempts from +b and enables unbanning self.

The special permission +* adds all permissions except +b, +S, and +F.
The special permission -* removes all permissions including +b and +F.

Examples:
    /msg ChanServ FLAGS #foo
    /msg ChanServ FLAGS #foo foo!*@bar.com VOP
    /msg ChanServ FLAGS #foo foo!*@bar.com -V+oO
    /msg ChanServ FLAGS #foo foo!*@bar.com -*
    /msg ChanServ FLAGS #foo foo +oOtsi
    /msg ChanServ FLAGS #foo TroubleUser!*@*.troubleisp.net +b
    /msg ChanServ FLAGS #foo !baz +*

Buffer Management

On the client is how a channel, private message, or service notification, is presented. As you will typically have multple of these at once, some useful commands to juggle them:

/win # /buf # alt + # /b name will match a buffer by partial name /join #channel /window move

WeeChat key bindings:

F5/F6 switch to previous/next buffer F7/F8 swtich to previous/next window F9/F10 scroll title bar F11/F12 scroll nicklist

Windows

/window splith split horizontal /window splitv split vertical /window zoom zoom current window /window merge

Buffers can be merged. For example you might want particular messages to go to a specific buffer.

Logging

WeeChat ships with the logger plugin. By default buffers are logged to ~/.weechat/logs, very handy for scanning for historic conversations and topics.

The /logger command will dump out current logs, example output:

Logging on buffers:
  [1] (core) weechat: logging (level: 9) (/home/ben/.weechat/logs/core.weechat.weechatlog)
  [1] (irc) server.freenode: logging (level: 9) (/home/ben/.weechat/logs/irc.server.freenode.weechatlog)
  [2] (irc) freenode.##C: logging (level: 9) (/home/ben/.weechat/logs/irc.freenode.##c.weechatlog)
  [3] (irc) freenode.#cjeopardy: logging (level: 9) (/home/ben/.weechat/logs/irc.freenode.#cjeopardy.weechatlog)

Set one directory by IRC server and a file by channel inside

/set logger.mask.irc irc/$server/$channel.weechatlog

Will make the following tree:

~/.weechat/
    |- logs/
        |- irc/
            |--- freenode/
            |       freenode.weechatlog
            |       #weechat.weechatlog
            |       #mychan.weechatlog
            |--- oftc/
            |       oftc.weechatlog
            |       #chan1.weechatlog
            |       #chan2.weechatlog

Log all messages on IRC buffers but not join/part/quit messages

For all IRC buffers:

/set logger.level.irc 3

For a server and its channels:

/set logger.level.irc.freenode 3

For a specific channel:

/set logger.level.irc.freenode.#weechat 3

Useful Features

highlight

TODO

ctrl+n, ctrl+p vs alt+n, alt+p

For quickly cycling buffers.

usermode +g == callerid

TODO

moving windows

/window move # or /buffer move #

  • autolog
  • searching ^r to search, and enter to stop

Peace and Quiet

/ignore a client side filter (e.g. user@host) /silence a server side filter which given a regex, will prevent spamming of the client. /mode <username> +g (callerid)

smartfilter or /filter to filter out pollution

With smart filter (keep join/part/quit from users who spoke recently):

/set irc.look.smart_filter on
/filter add irc_smart * irc_smart_filter *

With a global filter (hide all join/part/quit):

/filter add joinquit * irc_join,irc_part,irc_quit *

For more help /help filter and /help irc.look.smart_filter

Connections

/connect -ssl run over SSL (usually port 6697, versus cleartext on 6667). sasl (cap_sasl.pl) if disconnected, do the nickserv tango, put on any cloaks, before auto re-adding to channels.

WeeChat

The official user guide is excellent. Some features I’ve started exploring:

  • Bars
  • Highlights
  • Filters
  • Secured data

Plugins:

  • Alias
  • Aspell
  • Buflist
  • IRC: SSL support, SASL, TOR, smart filters
  • Logger
  • Relay
  • Triggers

Aspell

Aspell plugin lets you check spelling in command line. Disabled by default, can be toggled with Alt + s

/set aspell.check.default_dict en
/set aspell.check.suggestions 3
/set aspell.color.suggestion *green
/aspell enable

We’ll add the aspell_suggest bar to the bottom status bar, in the bars setup below.

Bars

Title Bar (active windows)

Note the condition restricts this bar to active windows.

/bar add activetitle window top 1 0 buffer_title
/set weechat.bar.activetitle.priority 500
/set weechat.bar.activetitle.conditions "${active}"
/set weechat.bar.activetitle.color_fg white
/set weechat.bar.activetitle.color_bg 31
/set weechat.bar.activetitle.separator on

Title Bar (inactive windows)

/set weechat.bar.title.conditions "${inactive}"
/set weechat.bar.title.color_fg black
/set weechat.bar.title.color_bg 31

Status Bar

/bar add rootstatus root bottom 1 0 [time],[buffer_count],[buffer_plugin],buffer_number+:+buffer_name+(buffer_modes)+{buffer_nicklist_count}+buffer_filter,[bitlbee_typing_notice],[lag],[aspell_dict],[aspell_suggest],completion,scroll /set weechat.bar.rootstatus.color_fg 31 /set weechat.bar.rootstatus.color_bg 234 /set weechat.bar.rootstatus.separator on /set weechat.bar.rootstatus.priority 500 /bar del status /bar set rootstatus name status

Key Bindings

Some of the more useful default bindings. If using GNOME Terminal, you may choose to disable the F11, and Alt + 0..9 shortcuts, to prevent clashes.

Key Does Command
^r Search for text in buffer history /input search_text_here
Alt s Toggle aspell /mute aspell toggle
PgUp Scroll up one page in buffer /window page_up
PgDown Scroll down one page in buffer /window page_down
Alt PgUp Scroll up a few lines /window scroll_up
Alt PgDown Scroll down a few lines /window scroll_down
Alt Home Scroll to top /window scroll_top
Alt End Scroll to bottom /window scroll_bottom
Alt ← or ^p or F5 previous buffer /buffer -1
Alt → or ^n or F6 Next buffer /buffer +1
F7 Previous window /window -1
F8 Next window /window +1
F9 Scroll buffers title on left /bar scroll title * -30%
F10 Scroll buffers title on right /bar scroll title * +30%
F11 Scroll down nicklist /bar scroll nicklist * -100%
F12 Scroll up nicklist /bar scroll nicklist * +100%
Alt F11 Start of nicklist /bar scroll nicklist * b
Alt F12 End of nicklist /bar scroll nicklist * e
Alt m Toggle mouse /mouse toggle
Alt n or Alt p Scroll to next/previous highlight /window scroll_next_highlight
Alt u Scroll to first unread line /window scroll_unread
Alt w, Alt ↑ Switch to window above (below, left or right) /window up
Alt w, Alt b Balance sizes of all windows /window balance
Alt w, Alt w Swap buffers of two windows /window swap
Alt / Switch to last buffer /input jump_last_buffer_displayed
Alt = Toggle filters /filter toggle
Alt - Toggle filters in current buffer /filter toggle @

Resources