Bus: the GDBus client, imsd's dictionaries, the notifier and the owned name

The GLib side of the app. Variant reads imsd's Received dictionary by
key and type as its SmsVariant writes it (`to`, the number the text
arrived for, a tel: URI read like the status's `ppi`; `operator`, the
SIM it arrived under), the GetStatus one with the subscriber's own
number and the SIM's operator in it (`ppi`, a tel: URI as the frozen
interface gives it; `operator`), and maps a GError to the core's error
kinds off GDBus's own mapping. Client is the Sync logic's transport:
asynchronous calls with their continuations as user data — every reply
guarded where it is delivered (OnCallDone), as are the signal handlers
and the name watch's callbacks: a throw is a fault the events hear, not
the end of the process — the calls behind imsd's polkit gate allow
interaction: Subscribe, List and Delete wait two minutes; Send has no
bound of the client's, since imsd sends the text once its prompt lets
the call through, however late, and a Send given up on would be failed
by Sync and be sent all the same; GetStatus ten seconds — (one call: the
Messaging status carries the own number, imsd reading both from one
snapshot; AGENTS.md §1 names both interfaces), the Messaging and
RegistrationChanged signals, and a watch on net.catcrafts.IMS1 whose
appeared callback is where Sync subscribes. Notifier shows one desktop
notification per conversation and replaces it as more texts arrive: one
Notify at a time per conversation, since the id to replace comes with
the answer; its default action asks the app for that conversation; the
body is escaped when the server renders markup (GetCapabilities, asked
once; Plasma and GNOME do), so a text's '<' or '&' shows as typed.
Instance owns net.catcrafts.ImsdMessages and serves
org.freedesktop.Application there, the Desktop Entry Specification's
interface of a running application: Activate, Open and ActivateAction,
each with its platform data — sent empty and not read: nothing in the
app can use an activation token yet — and one action, quit, any other
refused (the object registered before the name is asked for, so a launch
that forwards the moment the name is granted finds it; Own tells a name
another instance holds from a request that failed or was refused, and
keeps the error's words); it forwards a call to the owner. project.cpp
computes the gio flags once for the bus library, the executable and the
Decode test.

Tested: tests/Decode (every key of imsd's Received dictionary, one with
ten of them, GetStatus, the own number, the SIM's operator, the error
kinds, the markup escape, the parameters of the instance's three calls).
This commit is contained in:
Jorijn van der Graaf 2026-10-17 23:45:29 +02:00
commit dcf1aecafd
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
10 changed files with 930 additions and 31 deletions

View file

@ -11,12 +11,16 @@ right and this file has a bug — fix it in the same change.
## 1. What imsd-messages is
An SMS app for Linux phones (postmarketOS on the Fairphone 6 first; Plasma
Mobile and Phosh) whose only transport is imsd's D-Bus interface
`net.catcrafts.IMS1.Messaging` (system bus, object `/net/catcrafts/IMS1`).
imsd receives texts over IMS and keeps each one under `/var/lib/imsd/sms/`
until the app deletes it; the app subscribes to imsd's signals, imports the
stored messages into its own database and deletes imsd's copy. The interface
is documented in imsd's AGENTS.md §8.4 and §7.9.
Mobile and Phosh) whose transport is imsd's D-Bus object `/net/catcrafts/IMS1`
on the system bus: its `net.catcrafts.IMS1.Messaging` interface carries the
texts, the subscriber's own number and the SIM's operator (`GetStatus`'s
`ppi` and `operator`), and the frozen `net.catcrafts.IMS1` interface gives
the registration changes. imsd receives texts over IMS and keeps each one
it could store under `/var/lib/imsd/sms/` until the app deletes it; the app
subscribes to
imsd's signals, imports the stored messages into its own database and
deletes imsd's copy. The interfaces are documented in imsd's AGENTS.md §8.4
and §7.9 (Messaging) and §8.1 (the frozen one).
## 2. Repository layout