z3bra, the stripes apart

So tox me maybe

— 11 December, 2014

Microsoft. I don't really like their policies, or softwares, or operating systems. But I must say that one of their (because they bough it) software was revolutionary for the instant messaging world: Skype.

Skype brought many nice features to online chat. It allows free (not as in freedom) audio communications, and video calls. It is fairly easy to add friends on it, and chat with them around the world. The idea behind it is quite nice. But as for many softwares, the implementation sucks.

The itch

Skype relies on a centralised platform, which means that ALL your conversations go through a few servers around the world, and get re-routed to your friends.

The drawback is that you can experience consequent lags within your calls, because all the data have to go through the server instead of being sent directly to your friend.

There is an advantage though: it makes your conversations easier to record by other entities.

The antidot

I'm not putting forward the griefs I have against skype without providing a solution. Some people concerned about freedom and privacy decided to provide a free (as in freedom) replacement for the microsoft software.

They ended up with tox. Check their homepage at least, they will sell the product better than I'll do.

Tox is a library allowing encrypted peer-to-peer communication between you and the world. It comes with a lot of clients, each of them having its set of features. If you want to try tox quickly, consider utox, it is light, fast, featureful and easy-to use. Download it, launch it, and start toxing. It can't be simpler...

Each user is assigned a tox ID (which is a randomly generated sequence of alphanumeric chars) that you can share with your friends to add them in your client of choice.

an utox window

An utox window. As you can see, the friend list is on the right, and the chat happens on the right pane. Fairly easy :)

The Unix way

Now that you know what tox is, what about trying a client that will turn your whole system into an interface to the tox library ?

Ratox, a FIFO based tox client. A FIFO (First In First Out) is, in the Unix context, a file that can be used by two different programs to communicate. It works kinda like pipes on the shell, but using a physical file.

When you start ratox, it will create the following tree in the current directory:

$ tree
├── id
├── name
│   ├── err
│   ├── in
│   └── out
├── nospam
│   ├── err
│   ├── in
│   └── out
├── request
│   ├── err
│   ├── in
│   └── out
├── state
│   ├── err
│   ├── in
│   └── out
└── status
    ├── err
    ├── in
    └── out

The id file contain your tox ID. Send it to your friends so they can add you ! Then there are 3 other files:

They are fairly straighforward to use. Here is an example to set your nickname:

$ echo $USER > name/in
$ cat name/out

I bet you already know how to set your status ;)

Let's see how to add people to your friend list now ! All the magic happen in the request directory. To send a request, use the in file with your friends tox ID. On the other hand, friends request will be represented as FIFO in the out directory. To accept them, just write '1' into those files.

When you accept or request, or someone accept your, a directory gets created, named after the tox ID (tox IDs are shortened here to improve readability).

$ echo $TOXID > request/in
$ echo 1 > request/out/E05A5[...]9F02064

$ ls

$ tree $TOXID
├── call_in
├── call_out
├── call_state
├── file_in
├── file_out
├── file_pending
├── name
├── online
├── remove
├── state
├── status
├── text_in
└── text_out

The files in there are pretty self-explanatory. Using the *_in FIFOs, you can send data to your friends. The *_out files are used to receive data.

This simplicity allow many possibilities ! You can write a bot, that would read text_out and reply on text_in. You could record your desktopn and stream it to file_in, to share your screen. You could stream music to call_in, or maybe read text_out, and have a program like espeak read the text on call_in.

Because of how it is designed, ratox is only limited by your imagination... Check out the ratox-nuggets for a few neat scripts related to ratox.

Oh, and by the way... Here is the mandatory screenshot ;)

ratox in action

Ratox in action. A terminal multiplexer is of good help with it. It is also pretty easy to create an input bar for your text_in file

Be creative, and keep tweaking !