imsd: the Messaging GetStatus carries the subscriber's own number

The subscriber's own number was in the frozen interface's GetStatus and
not in the Messaging one, so a consumer that wanted it beside the
Messaging status needed a second call, and two calls can disagree: the
second can fail alone, and the status can change between them. Both
GetStatus methods take the number from the daemon's one status snapshot
as it then is, and within a run the number is never cleared. So one
answer can carry it: the Messaging GetStatus gives `ppi` beside `smsc`
and `registered`, as the frozen interface gives it but made valid UTF-8
as `to` is, so a consumer reads the status in one call and never lacks a
number the frozen status gives.

Tested: the suites as before (the key is a line in the method's reply;
the frozen interface's `ppi` is unchanged).
This commit is contained in:
Jorijn van der Graaf 2026-11-02 22:26:52 +01:00
commit c434c8e84d
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
3 changed files with 3 additions and 2 deletions

View file

@ -1871,7 +1871,7 @@ when it does not know it.
| Member | Signature | | Member | Signature |
|---|---| |---|---|
| `Send(number, text, options)` | `ssa{sv} → s` (the message's id, `ims-sms-<run>-<start>-<N>`: this run's token — eight hex digits drawn at the daemon's start —, its start second and a counter; a later run gives the same id only if it draws the same token and starts in the same second, and a received id (`ims-sms-in-<run>-<epoch>-<N>`) only with the same token, arrival second and counter; a client keys `StateChanged` by id); options: `status-report` (b). `org.freedesktop.DBus.Error.NotSupported` while `SMS_OVER_IMS` is off | | `Send(number, text, options)` | `ssa{sv} → s` (the message's id, `ims-sms-<run>-<start>-<N>`: this run's token — eight hex digits drawn at the daemon's start —, its start second and a counter; a later run gives the same id only if it draws the same token and starts in the same second, and a received id (`ims-sms-in-<run>-<epoch>-<N>`) only with the same token, arrival second and counter; a client keys `StateChanged` by id); options: `status-report` (b). `org.freedesktop.DBus.Error.NotSupported` while `SMS_OVER_IMS` is off |
| `GetStatus()` | `→ a{sv}`: `enabled` (b, the daemon's configuration — answered before the first registration too), `smsc` (s, the service centre as of the daemon's last status snapshot, the one the frozen `GetStatus` answers from — so empty before a run's first, and when none is known), `registered` (b), `subscribers` (u). No count of the store: `GetStatus` is the open read, and a count would tell any local account when a text arrived; `List`'s length is behind the gate | | `GetStatus()` | `→ a{sv}`: `enabled` (b, the daemon's configuration — answered before the first registration too), `smsc` (s, the service centre as of the daemon's last status snapshot, the one the frozen `GetStatus` answers from — so empty before a run's first, and when none is known), `ppi` (s, the own number in that snapshot — the frozen interface's `ppi`, made valid UTF-8 as `to` is, so a consumer needs no second call — empty while the snapshot holds none), `registered` (b), `subscribers` (u). No count of the store: `GetStatus` is the open read, and a count would tell any local account when a text arrived; `List`'s length is behind the gate |
| `Subscribe()` | `→` nothing: the caller's connection receives the two signals below from now on, until it closes. It succeeds while SMS over IP is off too (only `Send` is refused then); a consumer reads `enabled` for that state | | `Subscribe()` | `→` nothing: the caller's connection receives the two signals below from now on, until it closes. It succeeds while SMS over IP is off too (only `Send` is refused then); a consumer reads `enabled` for that state |
| `List()` | `→ a(sa{sv})`: the stored messages it can read, by the arrival second on the phone's wall clock, then within a run the sequence number — oldest first on a synced clock (a 1970 second before the first time sync sorts first; the SC's `timestamp` is the chronology, §7.9) — each the id and the same dictionary `Received` carries (its `received` the arrival time) | | `List()` | `→ a(sa{sv})`: the stored messages it can read, by the arrival second on the phone's wall clock, then within a run the sequence number — oldest first on a synced clock (a 1970 second before the first time sync sorts first; the SC's `timestamp` is the chronology, §7.9) — each the id and the same dictionary `Received` carries (its `received` the arrival time) |
| `Delete(id)` | `s`: removes a stored message; `org.freedesktop.DBus.Error.InvalidArgs` for an empty string, one over 64 bytes or one with a character other than an ASCII letter, an ASCII digit or `-`; `org.freedesktop.DBus.Error.FileNotFound` for any other string when the removal found no file; `org.freedesktop.DBus.Error.IOError`, with the system's reason, when the removal failed — a record that is there is kept | | `Delete(id)` | `s`: removes a stored message; `org.freedesktop.DBus.Error.InvalidArgs` for an empty string, one over 64 bytes or one with a character other than an ASCII letter, an ASCII digit or `-`; `org.freedesktop.DBus.Error.FileNotFound` for any other string when the removal found no file; `org.freedesktop.DBus.Error.IOError`, with the system's reason, when the removal failed — a record that is there is kept |

View file

@ -153,7 +153,7 @@ gain a key.
| Member | Signature | | Member | Signature |
|---|---| |---|---|
| `Send(number, text, options)` | `ssa{sv} → s` (id); options: `status-report` (b, ask the SC to report delivery). Refused with `NotSupported` while SMS over IMS is off | | `Send(number, text, options)` | `ssa{sv} → s` (id); options: `status-report` (b, ask the SC to report delivery). Refused with `NotSupported` while SMS over IMS is off |
| `GetStatus()` | `→ a{sv}`: `enabled` (b), `smsc` (s), `registered` (b), `subscribers` (u) | | `GetStatus()` | `→ a{sv}`: `enabled` (b), `smsc` (s), `ppi` (s, the own number in the daemon's last status, e.g. `tel:+31612345678`), `registered` (b), `subscribers` (u) |
| `Subscribe()` | `→` nothing: the calling connection receives `Received` and `StateChanged` from now on (unicast, never broadcast: to subscribers, and a submission's `sent` / `failed` also to its `Send` caller); subscribe again when imsd's name reappears on the bus | | `Subscribe()` | `→` nothing: the calling connection receives `Received` and `StateChanged` from now on (unicast, never broadcast: to subscribers, and a submission's `sent` / `failed` also to its `Send` caller); subscribe again when imsd's name reappears on the bus |
| `List()` | `→ a(sa{sv})`: the stored messages it can read, by the arrival second on the phone's wall clock, then within a run the sequence number (a 1970 clock before the first time sync sorts first; the SC's `timestamp` is the real chronology), each the id and the dictionary `Received` carries | | `List()` | `→ a(sa{sv})`: the stored messages it can read, by the arrival second on the phone's wall clock, then within a run the sequence number (a 1970 clock before the first time sync sorts first; the SC's `timestamp` is the real chronology), each the id and the dictionary `Received` carries |
| `Delete(id)` | `s`: removes a stored message | | `Delete(id)` | `s`: removes a stored message |

View file

@ -3304,6 +3304,7 @@ void HandleMessagingMethod(GDBusConnection* conn, const gchar*, const gchar*, co
// the truth // the truth
g_variant_builder_add(&b, "{sv}", "enabled", g_variant_new_boolean(TheEngine->SmsEnabled() ? TRUE : FALSE)); g_variant_builder_add(&b, "{sv}", "enabled", g_variant_new_boolean(TheEngine->SmsEnabled() ? TRUE : FALSE));
g_variant_builder_add(&b, "{sv}", "smsc", g_variant_new_string(StatusSnap.smsc.c_str())); g_variant_builder_add(&b, "{sv}", "smsc", g_variant_new_string(StatusSnap.smsc.c_str()));
g_variant_builder_add(&b, "{sv}", "ppi", g_variant_new_take_string(g_utf8_make_valid(StatusSnap.ppi.c_str(), -1))); // from a header, as `to`
g_variant_builder_add(&b, "{sv}", "registered", g_variant_new_boolean(StatusSnap.registered ? TRUE : FALSE)); g_variant_builder_add(&b, "{sv}", "registered", g_variant_new_boolean(StatusSnap.registered ? TRUE : FALSE));
g_variant_builder_add(&b, "{sv}", "subscribers", g_variant_new_uint32(static_cast<guint32>(Subscribers.size()))); g_variant_builder_add(&b, "{sv}", "subscribers", g_variant_new_uint32(static_cast<guint32>(Subscribers.size())));
g_dbus_method_invocation_return_value(inv, g_variant_new("(a{sv})", &b)); g_dbus_method_invocation_return_value(inv, g_variant_new("(a{sv})", &b));