monochromatic

monochromatic blog: http://blog.z3bra.org
git clone git://z3bra.org/monochromatic
Log | Files | Refs

so-tox-me-maybe.txt (5810B)


      1 # [So tox me maybe](#)
      2 ## — 11 December, 2014
      3 
      4 Microsoft. I don't really like their policies, or softwares, or operating
      5 systems. But I must say that one of their (because they bough it) software was
      6 revolutionary for the instant messaging world: **Skype**.
      7 
      8 Skype brought many nice features to online chat. It allows free
      9 (not as in freedom) audio communications, and video calls. It is fairly easy to
     10 add friends on it, and chat with them around the world. The idea behind it is
     11 quite nice.
     12 But as for many softwares, the implementation sucks.
     13 
     14 ### The itch
     15 
     16 Skype relies on a centralised platform, which means that ALL your
     17 conversations go through a few servers around the world, and get re-routed to
     18 your friends.  
     19 
     20 The drawback is that you can experience consequent lags within
     21 your calls, because all the data have to go through the server instead of being
     22 sent directly to your friend.
     23 
     24 There is an advantage though: it makes your conversations easier to [record by other
     25 entities](http://www.zdnet.com/article/fbi-nsa-said-to-be-secretly-mining-data-from-nine-u-s-tech-giants/).
     26 
     27 ### The antidot
     28 
     29 I'm not putting forward the griefs I have against skype without providing a
     30 solution. Some people concerned about freedom and privacy decided to provide a
     31 free (as in freedom) replacement for the microsoft software.
     32 
     33 They ended up with [tox](https://tox.im/). Check their homepage at least, they
     34 will sell the product better than I'll do.
     35 
     36 Tox is a library allowing encrypted peer-to-peer communication between you and
     37 the world. It comes with a lot of clients, each of them having its set of
     38 features. If you want to try tox quickly, consider [utox](http://utox.org/),
     39 it is light, fast, featureful and easy-to use. Download it, launch it, and start
     40 toxing. It can't be simpler...
     41 
     42 Each user is assigned a tox ID (which is a randomly generated sequence of
     43 alphanumeric chars) that you can share with your friends to add them in your
     44 client of choice.
     45 
     46 [![an utox window](http://pub.z3bra.org/monochromatic/img/thumb/2014-12-11-utox.png)](http://pub.z3bra.org/monochromatic/img/2014-12-11-utox.png)
     47 
     48 <span class="caption">An [utox](http://utox.org) window. As you can see, the
     49 friend list is on the right, and the chat happens on the right pane. Fairly easy
     50 :)</span>
     51 
     52 ### The Unix way
     53 
     54 Now that you know what tox is, what about trying a client that will turn your
     55 whole system into an interface to the tox library ?
     56 
     57 [Ratox](http://ratox.2f30.org), a FIFO based tox client. A
     58 FIFO (First In First Out) is, in the Unix context, a file that can be used
     59 by two different programs to communicate. It works kinda like pipes on the
     60 shell, but using a physical file.
     61 
     62 When you start `ratox`, it will create the following tree in the current
     63 directory:
     64 
     65     $ tree
     66     .
     67     ├── id
     68     ├── name
     69     │   ├── err
     70     │   ├── in
     71     │   └── out
     72     ├── nospam
     73     │   ├── err
     74     │   ├── in
     75     │   └── out
     76     ├── request
     77     │   ├── err
     78     │   ├── in
     79     │   └── out
     80     ├── state
     81     │   ├── err
     82     │   ├── in
     83     │   └── out
     84     └── status
     85         ├── err
     86         ├── in
     87         └── out
     88 
     89 The `id` file contain your tox ID. Send it to your friends so they can add you !
     90 Then there are 3 other files: 
     91 
     92 * `in`  : A FIFO. Use it to set values
     93 * `out` : A Text file, or a directory. Use it to read values
     94 * `err` : A Text file. It will contain the last error generated
     95 
     96 They are fairly straighforward to use. Here is an example to set your nickname:
     97 
     98     $ echo $USER > name/in
     99     $ cat name/out
    100     z3bra
    101 
    102 I bet you already know how to set your status ;)
    103 
    104 Let's see how to add people to your friend list now ! All the magic happen in
    105 the `request` directory. To send a request, use the in file with your friends
    106 tox ID. On the other hand, friends request will be represented as FIFO in the
    107 `out` directory. To accept them, just write '1' into those files.
    108 
    109 When you accept or request, or someone accept your, a directory gets created,
    110 named after the tox ID (tox IDs are shortened here to improve readability).
    111 
    112     $ echo $TOXID > request/in
    113     $ echo 1 > request/out/E05A5[...]9F02064
    114 
    115     $ ls
    116     E05A50[...]CEAA6EB7E
    117     6B2197[...]966341980
    118     id
    119     name
    120     nospam
    121     request
    122     state
    123     status
    124 
    125     $ tree $TOXID
    126     6B2197[...]966341980
    127     ├── call_in
    128     ├── call_out
    129     ├── call_state
    130     ├── file_in
    131     ├── file_out
    132     ├── file_pending
    133     ├── name
    134     ├── online
    135     ├── remove
    136     ├── state
    137     ├── status
    138     ├── text_in
    139     └── text_out
    140 
    141 The files in there are pretty self-explanatory. Using the `*_in` FIFOs, you can
    142 send data to your friends. The `*_out` files are used to receive data.
    143 
    144 This simplicity allow many possibilities ! You can write a bot, that would read
    145 `text_out` and reply on `text_in`. You could record your desktopn and stream it to
    146 `file_in`, to share your screen. You could stream music to `call_in`, or maybe
    147 read `text_out`, and have a program like `espeak` read the text on `call_in`.
    148 
    149 Because of how it is designed, `ratox` is only limited by your imagination...
    150 Check out the [ratox-nuggets](http://git.2f30.org/ratox-nuggets) for a few neat
    151 scripts related to ratox.
    152 
    153 Oh, and by the way... Here is the mandatory screenshot ;)
    154 
    155 [![ratox in action](http://pub.z3bra.org/monochromatic/img/thumb/2014-12-11-ratox.png)](http://pub.z3bra.org/monochromatic/img/2014-12-11-ratox.png)
    156 
    157 <span class="caption">Ratox in action. A terminal multiplexer is of good help
    158 with it. It is also pretty easy to create an input bar for your `text_in`
    159 file</span>
    160 
    161 Be creative, and keep tweaking !
    162 
    163 <!-- vim: set ft=markdown ts=4 et tw=80: -->