Download and decrypt encrypted files uploaded by the Conversations XMPP client
using the mechanism from XEP-0363: HTTP Upload:
(http://xmpp.org/extensions/xep-0363.html)

This is basically a translation in python of ImageDownlaoder:
https://github.com/iNPUTmice/ImageDownloader

However there are some differences:
  - The file is saved on local storage instead of being written on the
    standard output, this way xdg-open can be used to open it.
  - The wrapper script uses xdg-open, this is a more generic approach which
    works with different file types.
  - The wrapper script downloads the file to a temporary directory, this way
    it can be invoked multiple times without the risk of overwriting existing
    files.

Some snippets were taken from python-omemo:
https://github.com/omemo/python-omemo/blob/HEAD/src/omemo/aes_gcm_native.py

Example of use:

  ./conversations_http_downloader.py http://host.tld/path/to/file.jpg#theivandkey

The open_wrapper.sh script can be used in gajim as a browser command to
download, decrypt, and open the files automatically.

Here are some directions to set it up:

  cd $SOMEDIR
  git clone https://git.ao2.it/conversations_http_downloader.git/
  cd conversations_http_downloader
  make
  realpath open_wrapper.sh

and save the printed path in the clipboard.

Then in gajim:

  - go to the menu item "Edit -> Preferences",
  - In the "Preferences" dialog choose the "Advanced" tab,
  - in the "Applications" section choose "Custom",
  - paste the path from the clipboard in the "Browser" field.

Now encrypted files can be opened seamlessly by just clicking on them.