Deltachat connection manager for Telepathy
Go to file
Nick Thomas 7707242d10 Merge branch 'async' 2020-05-28 09:38:48 +01:00
scripts Rework automatic code generation 2020-05-17 23:23:45 +01:00
share Add and set the "Bcc self" option. 2020-05-23 23:52:42 +01:00
src Upgrade to Delta v1.33.0 2020-05-28 09:37:50 +01:00
telepathy-spec@65c5d483f3 Add telepathy-spec submodule 2020-05-08 17:22:53 +01:00
.gitignore Initial checkin 2020-05-09 01:48:14 +01:00
.gitmodules Use telepathy-spec v0.27.4 2020-05-08 19:22:47 +01:00
.rustfmt.toml Initial checkin 2020-05-09 01:48:14 +01:00
Cargo.lock Upgrade to Delta v1.33.0 2020-05-28 09:37:50 +01:00
Cargo.toml Upgrade to Delta v1.33.0 2020-05-28 09:37:50 +01:00
LICENSE Initial checkin 2020-05-09 01:48:14 +01:00 Add and set the "Bcc self" option. 2020-05-23 23:52:42 +01:00
about.hbs cargo-about output 2020-05-23 17:48:13 +01:00
about.toml cargo-about output 2020-05-23 17:48:13 +01:00
license.html cargo-about output 2020-05-23 17:48:13 +01:00
rust-toolchain Pin to the same version of rust nightly as delta 2020-05-19 00:16:01 +01:00
telepathy-padfoot.service Add an (untested) service file 2020-05-23 17:57:37 +01:00

Telepathy for Delta Chat


Authored by Nick Thomas under the MIT License.


Delta Chat is IM over email. Telepathy is a framework for abstracting over multiple IM protocols. This project glues the two together, allowing Telepathy clients to send/receive Delta messages.

Telepathy CMs should have a name that is not the same as their protocol; so this CM is hereby named "padfoot".

My first attempt was purple-plugin-delta. This has some licensing issues (linking libpurple with OpenSSL) that will be resolved with OpenSSL v3.0.0. At least until then, I've lost interest in it; my efforts are going into this version instead.


When it's ready.


Here's where we're at right now:

  • Connect to DBUS
  • Advertise enough properties / interfaces to become visible in Empathy
  • Connect to deltachat-core-rust
  • Set up an account via autoconfiguration
  • Appear as online in Empathy
  • Disconnect!
  • Set up an account manually
  • [~] Contacts handling
  • Text messages
  • Multimedia messages
  • [~] Setup messages
  • Import/Export
  • Group chats
  • Geolocation messages


Mobile IM, mostly. Desktop IM, also. It's ideal for my pinephone, and lighter than the electron desktop client.

At this point, I don't know Rust, I don't know DBUS, I don't know Telepathy, and I don't know Deltachat particularly well either. So this also functions as a learning exercise!



This project is written in Rust, so you'll need a rust compiler to build it. Rustup comes highly recommended.

There is a rust-toolchain file that I try to keep synced with the version of rust that deltachat-core-rust uses.

Once you have a working rust compiler, just:

$ cargo build --release

to get a `telepathy-padfoot binary. Drop the release flag to make it build fast.

Cross-compiling amd64 -> i386

If you need a 32-bit binary and you're on an am64 bit system, this seems to work, as long as you have 32-bit versions of libdbus-1 and libssl installed.

On Debian, the full sequence looks like:

$ dpkg --print-architecture
# dpkg --add-architecture i386
$ dpkg --print-foreign-architectures
# apt update
# apt install libdbus-1-dev:i386 libssl-dev:i386
$ rustup target install i686-unknown-linux-gnu
$ PKG_CONFIG_ALLOW_CROSS=1 cargo build --target=i686-unknown-linux-gnu --release

This creates a 32-bit executable at target/i686-unknown-linux-gnu/release/telepathy-padfoot

I don't have a 32-bit machine to test this on, but happy to take fixes for it.

Cross-compiling amd64 -> aarch64

This is a handy thing to do for linux phones, most of which use telepathy. Rust is quite heavy to compile - it's a pain even on a pinebook pro, which is the same architecture. Setup on a Debian machine is quite simple:

$ dpkg --print-architecture
# dpkg --add-architecture arm64
$ dpkg --print-foreign-architectures
# apt update
# apt install libdbus-1-dev:arm64 libssl-dev:arm64 gcc-aarch64-linux-gnu
$ rustup target install aarch64-unknown-linux-gnu
$ RUSTFLAGS="-C linker=aarch64-linux-gnu-gcc" PKG_CONFIG_ALLOW_CROSS=1 cargo build --target=aarch64-unknown-linux-gnu --release

We have to specify the linker because of this bug.

Note that this doesn't create a static binary, so you'll need to match versions for the shared libraries that are on the phone. In theory we can create static binaries with musl, but openssl makes it hard. If you get it working, tell me how!

UBTouch uses an ancient version of OpenSSL: 1.0.2g. KDE Neon does much better with 1.1.1, so is easier to compile against.

An alternative approach to using multiarch (as above) is to use debootstrap (or a similar tool) to get a sysroot containing libraries of all the right versions. E.g. You can then add -C link-args=--sysroot=/path/to/sysroot to RUSTFLAGS to use those libraries. Ufff. I've not got this working yet either.

...I'm compiling it directly on the phone. Not ideal. Add swap.

Compiling directly on the phone, using KDE Neon, I can get Padfoot running at the same time as Spacebar, which is a Telepathy client. I can see that Padfoot is checked for protocols, but I don't see a way to start a connection with it yet. Next step for this is to get Spacebar built and running locally, for a better debugging experience.

postmarketOS is more difficult. It's an aarch64...musl target. Rustup doesn't support this, and the rustc included in the repositories is stable, not nightly, so compiling directly on the phone is very difficult. Cross-compile is likely the way to go here, in the end, but I need to get one of the two tries above working first. Spacebar is available, but Empathy is not.

Phosh uses Chatty, which is based on libpurple, so doesn't work with Padfoot.

In the end, I tried Mobian. This is regular ordinary Debian Bullseye, plus a few Phosh packages. Installing Empathy and Padfoot together (Chatty is bundled but doesn't work), I have a working setup \o/ - although there are many warts, I can use Deltachat on Linux Mobile in at least one configuration.

I'll probably keep Mobian for a while though, it's exactly what I want in a mobile phone. Yes, I am peculiar.


There is a share/ directory in this project that contains a bunch of files. They should be placed into /usr/share, following the same layout. Then put the binary into /usr/lib/telepathy/telepathy-padfoot.

I should probably put this into the makefile.


D-Bus activation is not enabled yet, since it gets in the way of disaster-driven development. Just run the telepathy-padfoot binary as the same user that your chat client will be running as. It registers to the DBUS session bus, and will be picked up next time your chat client scans (which may need a restart).

Setup messages

If you send an autocrypt setup message while a padfoot connection is up, it will notice it and open a channel asking you to reply with a message like:

IMEX: <id> nnnn-nnnn-nnnn-nnnn-nnnn-nnnn-nnnn-nnnn-nnnn

The ID is the delta-generated message ID, while the rest is the setup code. No whitespace!

This bit is still extremely janky; it should instead be a magic channel type or action button of some kind. It is, however, functional.

Delta wants us to enable the "Send copy to self" option in settings. That's exposed as "Bcc self" in the advanced options in Empathy. Once enabled, messages you send via Padfoot will appear in other clients. However, messages you send from other clients don't appear in Padfoot yet because it mostly ignores self messages as a dirty hack to avoid double-showing messages. Progess though.

Autogenerated telepathy DBUS bindings

It makes use of the dbus-codegen-rust crate to convert the telepathy interface specs into the executable code in src/telepathy. This is checked in, but can be regenerated like so:

$ git submodule init telepathy-spec
$ git submodule update telepathy-spec
$ cargo install dbus-codegen
$ ./scripts/dbus-codegen

dbus-codegen-rust doesn't seem to handle namespaced attributes properly, so we modify the XML files in telepathy-spec... with sed. The tp:type attribute is renamed to tp:typehint. This will be fixed in the next release.