Install Bitlbee

Bitlbee is a gateway from IRC clients to a variety of other protocols, by acting like a server for IRC clients and a client for those other networks. For example, you can use Bitlbee to connect your perfered IRC client to many popular protocols, such as Telegram, Discord, or Slack.

The core of bitlbee itself is written in C.

Installation and configuration

First, let's install the package:

$ doas pkg_add bitlbee-3.6p1-libpurple

Note: There are multiple versions of bitlbee:

bitlbee-libpurple is bitlbee compiled with libpurple support. This is what we want because it supports the most protocols.

bitlbee-otr is bitlbee compiled with Off The Record (OTR) encryption support. However, the developers suggest not installing OTR version of bitlbee if you plan to provide a public bitlbee instance. This is because the encryption provided by OTR (Off-the-Record) is undermined by the fact that the sysadmin can intercept the messages in plaintext. It gives a false sense of security. Moreover, OTR messaging is often fails when the same account is used with other XMPP clients besides bitlbee.

bitlbee-libpurple-otr is bitlbee with OTR and libpurple support. We avoid it for the same reason as above.

After installation edit /etc/bitlbee/bitlbee.conf:

RunMode = ForkDaemon
User = _bitlbee
# Bitlbee will only be bound to localhost on port 8171
DaemonInterface = 127.0.0.1
DaemonPort = 8171
OperPassword = password
AllowAccountAdd 1
HostName = example.com

Replace password with your own password. We set bitlbee to be bound to localhost on port 8171, which users of our bouncer will be able to connect to, because remote connections of bitlbee server can't support SSL (unlike ZNC).

To start bitlbee:

$ doas rcctl enable bitlbee
$ doas rcctl start bitlbee

Discord Support

Use sm00th's bitlbee-discord plugin. Here is a convenient port provided by namtsui:

$ cvs -d anoncvs@namtsui.com:/cvs checkout -P ports/net/bitlbee-discord/

Telegram Support

$ doas pkg_add telegram-purple

Matrix Support

From packages:

Note: packaged version of purple-matrix is not working with bitlbee, so we have to install it from source instead.

$ doas pkg_add purple-matrix

From source:

$ doas pkg_add olm glib json-glib
$ cd ~/
$ git clone https://github.com/matrix-org/purple-matrix.git
$ cd purple-matrix
$ gmake MATRIX_NO_E2E=1
$ doas gmake install

RocketChat support

$ doas pkg_add purple-rocketchat

Mastodon support

$ doas pkg_add bitlbee-mastodon

Adding accounts

connect with your IRC client to your bitlbee server, this usually will be localhost, then join &bitlbee (not #bitlbee), you can see your buddy list or generally your chats with people in there. by default only 'root' user exist in there. root can used as a configuration panel to bitlbee.

first let's register your account, this will helps to store your settings.

register <password>

then save it.

save

next time you connected into bitlbee, you can login via NickServ or write directly in &bitlbee

identify <password>

create your account using following command

account add <protocol> <username> [password] [server]

password and server are optional and depends on the protocol, for example, telegram does not require them by default. for protocol, there are two types of protocols, ones are supported by bitlbee and ones are supported by libpurple. for checking bitlbee built-in protocols:

help plugins

and for checking avaliable protocols supported by libpurple:

help purple

the add command by default gives a id to your account by the protocol name, for example if you add a matrix account it id will be 'matrix', if you had more than one matrix account, they will be named like matrix2, matrix3 and so on.

you can check your accounts using

account list

let's add a jabber account:

account add jabber myusername@ircnow.org MyVerySecurePassword

of course, replace myusername@ircnow.org with your JID and MyVerySecurePassword with your password (maybe YourVerySecurePassword? :] )

another example for telegram:

account add telegram +11234567

it will ask for login code later.

Note: telegram-purple is known to be buggy and can't connect to telegram sometimes. try to disconnect using following command:

account <id> off
account <id> on

chatting

after adding your accounts, you can start chating using msg or query command, for example

/query my_buddy

will open a query with my_buddy user. if you want to message your buddy in jabber, do following

/query JID