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

@ -3304,6 +3304,7 @@ void HandleMessagingMethod(GDBusConnection* conn, const gchar*, const gchar*, co
// the truth
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}", "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}", "subscribers", g_variant_new_uint32(static_cast<guint32>(Subscribers.size())));
g_dbus_method_invocation_return_value(inv, g_variant_new("(a{sv})", &b));