imsd, engine: the Messaging status and a received text carry the SIM's operator
A consumer that keeps a number in the form it was written in — a national number, an operator's short code — has to know where it was written before it dials it again: a national number's country, a short code's operator. The own number's country code is not enough for either: countries share a code, and the operators of one country share theirs. The daemon reads the SIM's operator id at bring-up (ModemManager's: MCC then MNC), which names the subscription's country and operator. The Messaging GetStatus gives it as `operator`, from the snapshot `ppi` comes from, and a received text's record and its Received and List dictionaries carry the one the daemon held at receipt, beside `to` — additive keys, as `to` and `ppi` are, and the operator id only, never the IMSI. Tested: tests/Engine, the record round trip with `operator` and a record without it.
This commit is contained in:
parent
c434c8e84d
commit
e39f7e39d6
5 changed files with 30 additions and 18 deletions
|
|
@ -1309,8 +1309,8 @@ export namespace imsd::engine {
|
|||
|
||||
// A received message as the daemon keeps it until an app takes it
|
||||
// (`List`/`Delete` on the Messaging interface, §8.4): its id, when it
|
||||
// arrived (epoch seconds), the message and the subscriber it arrived
|
||||
// for. One record per file,
|
||||
// arrived (epoch seconds), the message, the subscriber it arrived
|
||||
// for and the SIM's operator then. One record per file,
|
||||
// key=value lines; the sender, the text, the data and the PDU as hex
|
||||
// (a sender or a text may hold any character). Absent keys read as
|
||||
// their defaults; a record without an id, or with a number or hex
|
||||
|
|
@ -1320,6 +1320,7 @@ export namespace imsd::engine {
|
|||
std::int64_t receivedAt = 0;
|
||||
SmsReceived sms;
|
||||
std::string to; // the own number the daemon held at receipt (from a tel: P-Associated-URI); "" while it held none
|
||||
std::string simOperator; // the SIM's operator id at receipt (MCC then MNC); "" when none was read
|
||||
};
|
||||
|
||||
std::string FormatStoredSms(const StoredSms& r) {
|
||||
|
|
@ -1328,6 +1329,7 @@ export namespace imsd::engine {
|
|||
out += std::format("id={}\n", r.id);
|
||||
out += std::format("received={}\n", r.receivedAt);
|
||||
if (!r.to.empty()) out += std::format("to={}\n", r.to);
|
||||
if (!r.simOperator.empty()) out += std::format("operator={}\n", r.simOperator);
|
||||
out += std::format("from={}\n", hex(r.sms.from));
|
||||
out += std::format("sc={}\n", r.sms.sc);
|
||||
out += std::format("timestamp={}\n", r.sms.scts);
|
||||
|
|
@ -1381,6 +1383,7 @@ export namespace imsd::engine {
|
|||
if (k == "id") r.id = std::string(v);
|
||||
else if (k == "received") r.receivedAt = intOf(v);
|
||||
else if (k == "to") r.to = std::string(v);
|
||||
else if (k == "operator") r.simOperator = std::string(v);
|
||||
else if (k == "from") r.sms.from = stringOf(v);
|
||||
else if (k == "sc") r.sms.sc = std::string(v);
|
||||
else if (k == "timestamp") r.sms.scts = std::string(v);
|
||||
|
|
|
|||
Loading…
Reference in a new issue