All Projects → dylanaraps → Birch

dylanaraps / Birch

Licence: mit
An IRC client written in bash

Programming Languages

shell
77523 projects
bash
514 projects

Projects that are alternatives of or similar to Birch

Irssi
The client of the future
Stars: ✭ 2,431 (+849.61%)
Mutual labels:  irc, irc-client
TwitchPy
This is a package you can use to connect with the Twitch API, manage a channel, create bots, etc
Stars: ✭ 22 (-91.41%)
Mutual labels:  irc, irc-client
Hexchat
GTK+ IRC client
Stars: ✭ 2,608 (+918.75%)
Mutual labels:  irc, irc-client
Kvirc
The KVIrc IRC Client
Stars: ✭ 179 (-30.08%)
Mutual labels:  irc, irc-client
irc.dart
Dart IRC Library
Stars: ✭ 45 (-82.42%)
Mutual labels:  irc, irc-client
Irc3
plugable irc client library based on python's asyncio with DCC and SASL support
Stars: ✭ 189 (-26.17%)
Mutual labels:  irc, irc-client
jj
An evolution of the suckless ii(1) file-based IRC client
Stars: ✭ 80 (-68.75%)
Mutual labels:  irc, irc-client
Irc Slack
IRC-to-Slack gateway
Stars: ✭ 123 (-51.95%)
Mutual labels:  irc, irc-client
erk
Ərk is an open source, cross-platform IRC client written in Python 3, Qt 5, and Twisted.
Stars: ✭ 21 (-91.8%)
Mutual labels:  irc, irc-client
swirc
Lightweight terminal based ICB and IRC client
Stars: ✭ 20 (-92.19%)
Mutual labels:  irc, irc-client
Xchataqua
An IRC client, OS X native front-end for XChat ( http://itunes.apple.com/app/id447521961 )
Stars: ✭ 157 (-38.67%)
Mutual labels:  irc, irc-client
IceChat
IceChat IRC Client
Stars: ✭ 68 (-73.44%)
Mutual labels:  irc, irc-client
Go Twitch Irc
go irc client for twitch.tv
Stars: ✭ 155 (-39.45%)
Mutual labels:  irc, irc-client
Srain
Modern IRC client written in GTK
Stars: ✭ 197 (-23.05%)
Mutual labels:  irc, irc-client
Irslackd
Self-hosted IRC gateway to Slack
Stars: ✭ 128 (-50%)
Mutual labels:  irc, irc-client
communi-sailfish
The first and foremost IRC client for Sailfish OS
Stars: ✭ 34 (-86.72%)
Mutual labels:  irc, irc-client
Rirc
A terminal IRC client in C
Stars: ✭ 115 (-55.08%)
Mutual labels:  irc, irc-client
Kittehircclientlib
An IRC client library in Java
Stars: ✭ 116 (-54.69%)
Mutual labels:  irc, irc-client
pesterchum-alt-servers
Instant messaging client copying the look and feel of clients from Andrew Hussie's webcomic Homestuck.
Stars: ✭ 37 (-85.55%)
Mutual labels:  irc, irc-client
yesbot
IRC Bot Written in Prolog
Stars: ✭ 19 (-92.58%)
Mutual labels:  irc, irc-client

m birch

An IRC client written in bash.

scrot

Features

* Full power of readline for input and keybindings. 

  This is thanks to bash's `read -e`. Birch will read a readline
  based configuration file from the environment variable 
  '$BIRCH_INPUTRC' which allows you to customize everything.

* Tab completion of nicks and channels. 
  
  Bash hardcodes `read -e` tab completion to the file based one. This 
  works fine for channel completion as each channel log is stored in 
  a file anyway. For nick completion, birch will create an empty file 
  for each nick in the channel. Hey, it works.

* Unique (or semi-unique) nick colors.

  All nicks are colored based on their length. The length is mapped
  to a color between 1 and 6 which is then used as input for 
  '\033[1;3<mapped_col>m'.

Caveats (or limitations)

* Nick column is fixed and truncated to 10 columns wide.
  
  This is something fixable down the line. It merely serves to
  simplify the alignment of messages into two columns (nick and
  messages).

* Lines are word-wrapped to a fixed 60 columns.

  This is also fixable down the line though a lot more painful
  than the nick column issue. POSIX fold is used to achieve the
  word wrapping but doesn't take into account non-printable
  characters and unicode.

  What this means is that wrapping will always be a little _off_
  as escape sequences, IRC formatting and unicode will throw
  out all attempts at calculating the "visible" line length.

  It's an interesting problem to solve. I've made a myriad of
  attempts at writing a suitable function in bash though they're
  all too slow (as expected!).

* No automatic server reconnect.

  This should be fairly easy to fix though I need to figure out
  the best way of doing so.

* No SSL (sadly).

  The network connection is through bash's builtin /dev/tcp
  feature which doesn't allow for SSL.

Interesting facts

* Connection to the IRC server happens without external
  utilities.

  Bash support network connections via two virtual device
  directories it "creates" in '/dev/'. 

  '/dev/tcp/host/port' and '/dev/udp/host/port'.

  I don't exactly know _why_ these were implemented as
  it's a crazy feature for a shell to have. I haven't seen
  them widely used either.

* The input loop and listener loop can't communicate.

  Birch utilizes two loops to work. One for the input and 
  an additional loop to listen to incoming IRC messages.

  When something is run asynchronously in bash with '&', it
  runs in a subshell (a second bash process).

  What this means is that the async code can't communicate
  with the blocking code. Any variables set in the input loop
  once both loops are running won't be visible in the async
  listener loop to give an example.

  To work around this birch utilizes files for IPC between the
  two. The current channel is communicated by maintaining a 
  symlink and checking its target where needed.

  Example: .c -> '#current_channel'

* This was HARD.

  Trying to make the input prompt and async listener (which
  spits out messages to the terminal) play nice took a lot
  of work.

  As birch implements a TUI _manually_ we're dealing with bare
  escape sequences to tie everything together.

  When a message needs to be printed, the cursor must move from
  the input prompt to the output area, print the message and
  finally return back to the input prompt.

  All of this must happen just right to ensure that this series
  of cursor movements doesn't end up mangling the display of 
  the interface.

  Birch has gone through a lot of rewrites to get this perfect.
  Fun fact: The older revisions read input char by char and
  implemented a lot of readline by hand.

Usage

birch <args>

-s <host>
-c <channel>
-u <nick>
-p <server_password>
-U <server_username>
-P <port>
-x <cmd>

-h (help)
-v (version)

Dependencies

  • bash 4+
  • POSIX compatible fold, rm

Keybindings

Ctrl+n - Next buffer.
Ctrl+p - Previous buffer.
Tab    - Completion of nicks and channels.

Further, all readline keybindings are available for use. See the
readline or bash manpages for a list of these. 

Keybindings to birch may also be set via a .inputrc file. Which
can be configured by setting `$BIRCH_INPUTRC`.

(BIRCH_INPUTRC=/path/to/birch-inputrc birch)

Commands

Channels:

/join <channel>       - Join a channel.
/part <channel>       - Leave a channel.
/quit                 - Quit out of birch.

Messages: 

/msg <nick> <message> - Message a user.
/me  <message>        - Send an action.

Navigation:

/next                 - Next buffer.
/prev                 - Previous buffer.
/<num>                - Buffer by number (0 indexed).

Other:

/nick <nick>          - Change nickname.
/names                - Display all nicks in channel.
/topic                - Display channel topic.
/away <message>       - Set afk message.
/raw <args>           - Send a raw IRC message.

Customization

(These are environment variables.)

# Set the formatting of the tab line's selected item.
# This defaults to reverse video.
BIRCH_STATUS='\e[7m'

# The path to a readline based .inputrc file to change
# birch's input settings. 
#
# See http://man7.org/linux/man-pages/man3/readline.3.html
BIRCH_INPUTRC=/path/to/file
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].