Irssi

From Redbrick Wiki
Revision as of 08:46, 14 October 2009 by Maiden (talk | contribs)

In the chat tutorial we went through all the basics of using chat on Redbrick. This tutorial goes through some of the more advanced features specific to the default chat client irssi.

Moving windows

When you start chat you'll have two windows, #lobby and the status window, but of course you're going to want to open more windows. The more windows you have open the harder it is to keep track of them so most people like to keep their different channels & private messages in the same place all the time.

Windows can be moved either left/right by typing

/window move left
/window move right

Or, you can move a window straight to a certain number. For example, if you join the #gamessoc channel and want it in window 3 next to #lobby you can use the command

/window move 3


Irssi Scripts

Scripts allow you to add functionality to irssi that wasnt originally part of the program, like extensions in firefox. Some members have scripts that allow you to set yourself to set yourself away automatically after you have been idle for a set period of time, and others to list the current windows you have open.

So, undone has given you a cool autoaway script, but how do you use it. The first thing you have to do is move it to the proper scripts directory which is ~/.irssi/scripts. You can do this using winscp. Once you've done that you need to load it, just type

 /run <script-name>

from irssi to start it. If you want to search for your own cool scripts there's loads at the irssi homepage

Irssi Themes

Just as scripts can add functionality to irssi themes can be added that change the look of it. Adding themes is just like addming scripts, just copy them into the ~/.irssi folder. To use your new theme type

/set theme <theme-name>

There are lots of themes on the irssi homepage, some better than others. The themes are written in plain text, so if you find a well written example they're pretty easy to change around slightly.


Configuration file

The easy way to enter chat is with the alias "chat" - this runs irssi with a default Redbrick config.

This is fine for a while, but it's nice to personalise things a little and to do this you can edit your ~/.irssi/config file.

Every time you type "irssi" it will start with this configuration file by default.

Here's an basic file to get you started:

servers = (
  {
   address = "irc.redbrick.dcu.ie";
   chatnet = "RedBrick";
   port = "6667";
   autoconnect = "yes"; },
); 
chatnets = {
  RedBrick =
  {
   type = "IRC";
        autosendcmd = "/msg chanserv identify <password>";
  };
}; 
channels = (
  { name = "#lobby"; chatnet = "RedBrick"; autojoin = "yes"; },
  { name = "#mychannel"; chatnet = "RedBrick"; autojoin = "yes"; },
);
aliases = {
  J = "join";
  WJOIN = "join -window";
  WQUERY = "query -window";
  LEAVE = "part";
  BYE = "quit";
  EXIT = "quit";
  SIGNOFF = "quit";
  DESCRIBE = "action";
  DATE = "time";
  HOST = "userhost";
  LAST = "lastlog";
  SAY = "msg *";
  WI = "whois";
  WII = "whois $0 $0";
  WW = "whowas";
  W = "who";
  N = "names";
  M = "msg";
  T = "topic";
  C = "clear";
  CL = "clear";
  K = "kick";
  KB = "kickban";
  KN = "knockout";
  BANS = "ban";
  B = "ban";
  MUB = "unban *";
  UB = "unban";
  IG = "ignore";
  UNIG = "unignore";
  SB = "scrollback";
  UMODE = "mode $N";
  WC = "window close";
  WN = "window new hide";
  SV = "say Irssi $J ($V) - http://irssi.org/";
  GOTO = "sb goto";
  CHAT = "dcc chat";
  RUN = "SCRIPT LOAD";
  UPTIME = "eval exec - expr `date +%s` - \\$F | awk '{print \"Irssi uptime: \"int(\\\\\\$1/3600/24)\"d \"int (\\\\\\$1/3600%24)\"h \"int(\\\\\\$1/60%60)\"m \"int(\\\\\\$1%60)\"s\" }'";
  CALC = "exec - if which bc &>/dev/null\\; then echo '$*' | bc | awk '{print \"$*=\"$$1}'\\; else echo bc was not  found\\; fi";
  SBAR = "STATUSBAR";
  INVITELIST = "mode $C +I";
};
statusbar = {
  # formats:
  # when using {templates}, the template is shown only if it's argument isn't
  # empty unless no argument is given. for example {sb} is printed always,
  # but {sb $T} is printed only if $T isn't empty.
  items = {
    # start/end text in statusbars
    barstart = "{sbstart}";
    barend = "{sbend}";
    # treated "normally", you could change the time/user name to whatever
    time = "{sb $Z}";
    user = "{sb $cumode$N{sbmode $usermode}{sbaway $A}}";
    # treated specially .. window is printed with non-empty windows,
    # window_empty is printed with empty windows
    window = "{sb $winref:$T{sbmode $M}}";
    window_empty = "{sb $winref{sbservertag $tag}}";
    prompt = "{prompt $[.15]T}";
    prompt_empty = "{prompt $winname}";
    topic = " $topic";
    topic_empty = " Irssi v$J - http://irssi.org/help/";
    # all of these treated specially, they're only displayed when needed
    lag = "{sb Lag: $0-}";
    act = "{sb Act: $0-}";
    more = "-- more --";
  };
  # there's two type of statusbars. root statusbars are either at the top
  # of the screen or at the bottom of the screen. window statusbars are at
  # the top/bottom of each split window in screen.
  default = {
    # the "default statusbar" to be displayed at the bottom of the window.
    # contains all the normal items.
    window = {
      disabled = "no";
      # window, root
      type = "window";
      # top, bottom
      placement = "bottom";
      # number
      position = "1";
      # active, inactive, always
      visible = "active";
      # list of items in statusbar in the display order
      items = {
        barstart = { priority = "100"; };
        time = { };
        user = { };
        window = { };
        window_empty = { };
        lag = { priority = "-1"; };
        act = { priority = "10"; };
        more = { priority = "-1"; alignment = "right"; };
        barend = { priority = "100"; alignment = "right"; };
      };
    };
    # statusbar to use in inactive split windows
    window_inact = {
      type = "window";
      placement = "bottom";
      position = "1";
      visible = "inactive";
      items = {
        barstart = { priority = "100"; };
        window = { };
        window_empty = { };
        more = { priority = "-1"; alignment = "right"; };
        barend = { priority = "100"; alignment = "right"; };
      };
    };
    # we treat input line as yet another statusbar :) It's possible to
    # add other items before or after the input line item.
    prompt = {
      type = "root";
      placement = "bottom";
      # we want to be at the bottom always
      position = "100";
      visible = "always";
      items = {
        prompt = { priority = "-1"; };
        prompt_empty = { priority = "-1"; };
        # treated specially, this is the real input line.
        input = { priority = "10"; };
      };
    };
    # topicbar
    topic = {
      type = "root";
      placement = "top";
      position = "1";
      visible = "always";
      items = {
        barstart = { priority = "100"; };
        topic = { };
        topic_empty = { };
        barend = { priority = "100"; alignment = "right"; };
      };
    };
  };
};
#THIS SECTION DEALS WITH SETTINGS SUCH AS YOUR NAME AND TIMESTAMP FORMAT
settings = {
  core = {
    real_name = "Newb McNewberton";
    user_name = "newb";
    nick = "newb";
    timestamp_format = "%H:%M:%S";
  };
  "fe-text" = { scrollback_time = "24h"; };
  "fe-common/core" = { autolog = "yes"; };
};
#THIS SECTION DEALS WITH YOUR HILIGHTS
hilights = (
  { text = "newb"; nick = "yes"; word = "no"; },
);
settings = {
        core = {
                settings_autosave = "no";
        }
};


Now, you don't need to worry about most of this as it's just setting a lot of default things that won't need to be changed.

However there are a few sections you will/may want to change:

chatnets = {
  RedBrick =
  {
   type = "IRC";
        autosendcmd = "/msg chanserv identify <password>"; # put in your identify password here.
  };
}; 
channels = (
  { name = "#lobby"; chatnet = "RedBrick"; autojoin = "yes"; },
  { name = "#mychannel"; chatnet = "RedBrick"; autojoin = "yes"; },
);

What this part does is when you start irssi, it sends a priavte message to chanserv identifying you as you (if you've registered your nickname) and the bit underneath will automatically join you to the channels listed, namely #lobby and #mychannel. You can add as many channels as you want to this list, just copy and paste the same lines and edit the "#channel" bit. Simple really. This saves time and hassle if Redbrick ever restarts or you lose your connection for whatever reason as you don't have to remember all the channels you want to join.

#THIS SECTION DEALS WITH SETTINGS SUCH AS YOUR NAME AND TIMESTAMP FORMAT
settings = {
  core = {
    real_name = "Newb McNewberton";
    user_name = "newb";
    nick = "newb";
    timestamp_format = "%H:%M:%S";
  };
  "fe-text" = { scrollback_time = "24h"; };
  "fe-common/core" = { autolog = "yes"; };
};
#THIS SECTION DEALS WITH YOUR HILIGHTS
hilights = (
  { text = "newb"; nick = "yes"; word = "no"; },
);

Here you'll want to set your own name/nickname into the appropriate places. You may also want to change the timestamp_format = "%H:%H"; if you don't like having seconds displayed as well.

You may also want to delete the "autolog = "yes";" line too, if you do not want all you chat logged. Some users find this usual for checking back over past conversations. (It will save all chat in all the channels you're joined to, even if you haven't read it to ~/irclogs/RedBrick/)

The hilights section well, hilights specific words, commonly people will put their nickname in here, or other key words that they may be interested in.


Configuration Options

Irssi comes with loads of options, so i've just included the ones I think are useful (These are to be used in chat)

/set window_history off

Irssi remembers the last few lines of text you've typed into it, just press up to view them. With this you have a seprate buffer of commands for each window, so you cant accidentally send the last line of a private message into #lobby for all to read

/set autolog on
/set autolog_path ~/irclogs/$tag/$0.log

This turns on irssi logging, and setting the paths like this with the variables means that the irssi will save all the logs for a certain channel/pm in a different file each day.

/set autoclose_query 86400

This sets a time in seconds after which idle windows will be closed automatically, so your private message windows will be closed if you don't use them for a whole day (86400 seconds)

/set show_quit_once on

Say you and undone are in three of the same channels, with this set on if he quits for the night his quit message will only appear to you in one of your open windows, not all of them.

/set quit_message <my personal quit message>

Change the default quit message to your own personal one.

/last receive 10

Say i've just come back from a lecture, and i want to see was anyone talking about me while i was gone this shows me the last 10 lines in the current channel that contain my username.

/set real_name Andrew

This sets my real name to Andrew, so people know who i am if they use the /whois command on me.

Ignoring

In a channel with lots of people coming and going, you may want to ignore certain messages, such as joins. You can do this (in lobby for example) by typing

/ignore #lobby JOINS

Here's a list of the different message catagories you could set to ignore

NOTICES       - Match NOTICE messages.
SNOTES        - Match server notices.
CTCPS         - Match CTCP messages.
ACTIONS       - Match CTCP actions.
JOINS         - Match join messages.
PARTS         - Match part messages.
QUITS         - Match quit messages.
KICKS         - Match kick messages.
MODES         - Match mode changes.
TOPICS        - Match topic changes.
WALLOPS       - Match wallops.
INVITES       - Match invite requests.
NICKS         - Match nickname changes. 
DCC           - DCC related messages.
DCCMSGS       - Match DCC chat messages.
CLIENTNOTICE  - Irssi's notices.
CLIENTCRAP    - Miscellaneous irssi messages.
CLIENTERROR   - Irssi's error messages.

Taskbar Flashing

You can get your taskbar to flash on receiving a new msg or hilight.

 

Configure PuTTY with these options, you may want to save the session so you don't have to do this all the time.

Next pass these options to irssi

/set beep_msg_level MSG HILIGHT
/set beep_when_away ON
/set beep_when_window_active ON
/set bell_beeps ON

If you are using screen you will need to make sure you are set to an audible bell rather than a visual bell, to do this hit the following until you see 'switched to audible bell.'.

CTRL + A, CTRL + G

Saving Your Config

When you type chat at your prompt this loads irssi with all the default Redbrick settings. This is useful, because if you've broken something with your changes you can just restart and irssi will be just as it was before, but you'll want to save your personal configuration so you don't have to set up irssi the way you like it everytime you start.

To save all the current options and theme to a file type

/save my-irssi.conf

To use this configuration rather than the default to start chat type

receive@murphy (~) % irssi --CONFIG=my-irssi.conf

Some Other Handy Commands

To join the channel, #intersocs, type

/j #intersocs

To leave the channel, #intersocs, without entirely quitting chat, type

/part #intersocs

To close a window you're not using anymore, type

/wc

To find out who someone is, for example, haus, type

/whois haus

To see the list of all the channels on the network, type

/list

Or if you're looking for a channel but can't remember the exact name, but you know it contains "inter", type

/list *inter*

Wanna see if someone mentions you (or something you're interested in, eg: helpdesk), type

/hilight helpdesk

Now whenever helpdesk is mentioned it'll highlight you

Say you're going to a lecture, but you don't want to have to scroll back up and see if someone hilighted you when you weren't looking, you set irssi to /away with a message, to do this type

/away gone to my lecture, back soon.

When you come back type just /away and you'll see any hilights you might've picked up between you going and coming back.

If you're lazy (like me), you can find loads of uses for the /alias command. Example: I like having the same away message all the time, and it's a bit long, so I made it into an /alias command by typing

/alias awaymsg /away haus is off in the real world if you need to talk to him you can reach him on <phone_num>

Now instead of typing the away message out everytime I can just type /awaymsg instead. It's also really handy for typos, like when I'm typing /me sometimes i end up typing /mw and then irssi tells me it's not a command, which can get really annoying. To fix it just type:

/alias mw /me

Now when you typo it doesn't matter \o/


Further Configuration

This tutorial was just to get you started on some of the things you can do with irssi, for more have a look at the irssi documentation.

To give you an idea of what you can do, here's a screenshot of how i have irssi set up. Happy Configuring!

File:Irssi custom.gif


If you need any more help with irssi, please feel free to hey a helpdesk member or mail at helpdesk@redbrick.dcu.ie