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